GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
popup.c File Reference
#include <string.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/display.h>
Include dependency graph for popup.c:

Go to the source code of this file.

Macros

#define Y_BORDER   5
 
#define X_BORDER   5
 

Functions

int D_popup (int back_colr, int text_colr, int div_colr, int top, int left, int percent_per_line, char *options[])
 pop-up menu More...
 

Macro Definition Documentation

#define X_BORDER   5

Definition at line 34 of file popup.c.

Referenced by D_popup().

#define Y_BORDER   5

Definition at line 33 of file popup.c.

Referenced by D_popup().

Function Documentation

int D_popup ( int  back_colr,
int  text_colr,
int  div_colr,
int  top,
int  left,
int  percent_per_line,
char *  options[] 
)

pop-up menu

This routine provides a pop-up type menu on the graphics screen. The bcolor specifies the background color. The tcolor is the text color. The dcolor specifies the color of the line used to divide the menu items. The top and left specify the placement of the top left corner of the menu on the screen. 0,0 is at the bottom left of the screen, and 100,100 is at the top right. The size of the text is given as a percentage of the vertical size of the screen. The options array is a NULL terminated array of character strings. The first is a menu title and the rest are the menu options (i.e., options[0] is the menu title, and options[1], options[2], etc., are the menu options). The last option must be the NULL pointer. The coordinates of the bottom right of the menu are calculated based on the top left coordinates, the size, the number of options, and the longest option text length. If necessary, the menu coordinates are adjusted to make sure the menu is on the screen. D_popup(~) does the following:

  1. Current screen contents under the menu are saved.
  2. Area is blanked with the background color and fringed with the text color.
  3. Menu options are drawn using the current font.
  4. User uses the mouse to choose the desired option.
  5. Menu is erased and screen is restored with the original contents.
  6. Number of the selected option is returned to the calling module.
Parameters
bcolor
tcolor
dcolor
top
left
size
options[]
Returns
int

Definition at line 80 of file popup.c.

References b, G_fatal_error(), G_tempfile(), height, int, l, n, NULL, r, R_box_abs(), R_cont_abs(), R_cont_rel(), R_flush(), R_get_location_with_pointer(), R_move_abs(), R_panel_delete(), R_panel_restore(), R_panel_save(), R_screen_bot(), R_screen_left(), R_screen_rite(), R_screen_top(), R_set_window(), R_standard_color(), R_text(), R_text_size(), dialogs::width, point::x, X_BORDER, y, and Y_BORDER.