Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         Changing Buffer Contents
         Moving Text Between Buffers
         Getting Text from a Buffer
         . . .
         Listing Buffers
      Display Primitives
         . . .
         Window Resizing Primitives
         Preserving Window Arrangements
         Pop-up Windows
         Pop-up Window Subroutines
         Window Attributes
         . . .
      File Primitives
         File Reading Primitives
         File Writing Primitives
         Line Translation Primitives
         . . .
         Tagging Internals
      . . .

Previous   Up    Next
Preserving Window Arrangements  Primitives and EEL Subroutines   Pop-up Window Subroutines


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Display Primitives >

Pop-up Windows

int add_popup(column, row, width, height, border, bnum)
   /* macros for defining a window's borders */
   /* BORD(BTOP, BSINGLE) puts single line on top */
#define BLEFT   0
#define BTOP    1
#define BRIGHT  2
#define BBOTTOM 3
#define BNONE   0
#define BBLANK  1
#define BSINGLE 2
#define BDOUBLE 3
#define BORD(side, val)         (((val) & 3) << ((side) * 2))
#define GET_BORD(side, bord)     ((bord >> (side * 2)) & 3)
#define LR_BORD(val)   (BORD(BLEFT, (val)) + BORD(BRIGHT, (val)))
#define TB_BORD(val)   (BORD(BTOP, (val)) + BORD(BBOTTOM, (val)))
#define ALL_BORD(val)  (LR_BORD(val) + TB_BORD(val))

The add_popup( ) primitive creates a new pop-up window. It accepts the column and row of the upper left corner of the new window, and the width and height of the window (including any borders). The border parameter contains a code saying what sort of borders the window should have, and the bnum parameter gives the buffer number of the buffer to display in the window. The primitive returns the handle of the new window, or -1 if the specified buffer did not exist, so Epsilon couldn't create the window. If the pop-up window is to become part of a dialog (see Windowed Dialogs), its size, position and border will be determined by the dialog, not the values passed to add_popup( ). The window created becomes the current window.

You can define the borders of a window using macros from codes.h. For each of the four sides, you can specify no border, a blank border, a border drawn with a single line, or a border drawn with a double line, using the codes BNONE, BBLANK, BSINGLE, or BDOUBLE, respectively. Specify the side to receive the border with the macros BLEFT, BTOP, BRIGHT, and BBOTTOM. You can make a specification for a given side using the BORD() macro, writing BORD(BBOTTOM, BDOUBLE) to put a double-line border at the bottom of the window. Add the specifications for each side to get the complete border code.

You can use other macros to simplify the border specification. Write LR_BORD(BSINGLE) + TB_BORD(BDOUBLE) to produce a window with single-line borders on the left and right, and double-line borders above and below. Write ALL_BORD(BNONE) for a window with no borders at all, and the most room for text.

You can use the GET_BORD() macro to extract (from a complete border code) the specification for one of its sides. For example, to find the border code for the left-side border of a window with a border value of bval, write GET_BORD(BLEFT, bval). If the window has a double-line border on that side, the macro would yield BDOUBLE.

int window_at_coords(int row, int col, ?int screen)

The window_at_coords( ) primitive provides the handle of the topmost window at a given set of screen coordinates. The primitive returns -1 if no window occupies that part of the screen. The screen number parameter can be zero or omitted to refer to the main screen, but it is usually a screen number from the mouse_screen primitive.

int window_to_screen(int win)

The window_to_screen( ) primitive takes a window handle and returns its screen number. Windows that are part of a dialog box have nonzero screen numbers; in this version other windows always have a screen number of zero.

int screen_to_window(int screen)

The screen_to_window( ) primitive takes a screen number, as returned in the variable mouse_screen, and returns the window handle associated with it. If the screen number is zero, there may be several windows associated with it; Epsilon will choose the first one. In this version of Epsilon, nonzero screen numbers uniquely specify a window. It returns -1 if no windows are associated with that screen number.

user window int window_left;
user window int window_top;

The window_left and window_top primitive variables provide screen coordinates for the current window. You can set the coordinates of a pop-up window to move the window around. Epsilon ignores attempts to set these variables in tiled windows.



Previous   Up    Next
Preserving Window Arrangements  Primitives and EEL Subroutines   Pop-up Window Subroutines


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.