Other GUI Functions



int d_double_calc_edit_proc(int msg, DIALOG *d, int c);
Gui proc for an edit box accepting a mathematical expression whose result is a floating point number. The result is calculated and displayed on a separate gui object as the user types. The edit box has a 3d-ish look.
The dp2 field points to a `struct DIALOGF_EDIT_NUMBER *' which holds some information about the behavior of the edit box:

   typedef struct DIALOGF_EDIT_NUMBER
   {
      int is_signed;          /* Set for integer formats if it is signed. */
      int is_float;           /* Set if we only have float, not double. */
      double min_val, max_val;/* Range for numbers. */
      DIALOG *result_object;  /* DIALOG object to display result in. */
   } DIALOGF_EDIT_NUMBER;

The `result_object' will be used to display the result of the expression. There is an `d_calc_edit_result_proc' object type which is designed to be used as `result_object', but you may of course write your own object to take care of this. Whenever the user changes the text in the `d_double_calc_edit_proc', the result is printed to the `dp' field of `result_object'; hence you must have set the dp field of `result_object' to a text buffer with enough space (256 bytes is safe). The `result_object' will then be sent a `MSG_DRAW' message with the `c' parameter set to 2 if there is an error in the expression or 1 if it is ok.

int d_int_calc_edit_proc(int msg, DIALOG *d, int c);
Like `d_double_calc_edit_proc()', but displaying the result as an integer. If the user tries to enter a floating point value, it will be rounded.

int d_calc_edit_result_proc(int msg, DIALOG *d, int c);
Dialog proc for the result of a calculator edit box. The difference between this and Allegro's d_text_proc() is that it uses the c parameter to find the color to draw with (see d_double_calc_edit_proc()), and it also erases its whole area even if the text doesn't fill it.

int d_line_proc(int msg, DIALOG *d, int c);
A simple dialog object which draws a 3d-ish horizontal or vertical line (depending on whether its `w' field is greater or less than its `h' field).

int d_dime_check_proc(int msg, DIALOG *d, int c)
Like Allegro's d_check_box(), but with 3d-ish style.

int d_dime_text_list_proc(int msg, DIALOG *d, int c)
Like Allegro's d_text_list_proc(), but with 3d-ish style.

int d_dime_edit_proc(int msg, DIALOG *d, int c)
Like Allegro's d_edit_proc(), but with 3d-ish style.

int d_dime_button_proc(int msg, DIALOG *d, int c)
Like Allegro's d_button_proc(), but with 3d-ish style.

int d_multiline_text_proc(int msg, DIALOG *d, int c)
Like Allegro's d_text_proc(), but supports newlines ('\n') in the string.

void draw_empty_button(BITMAP *bmp, int x1, int y1, int x2, int y2, int face_color, int xlight, int light, int dark, int xdark)
Draws an empty button on the given position of the bitmap, using the given colors.

void draw_text_button(BITMAP *bmp, int x1, int y1, int x2, int y2, int face_color, int text_color, int xlight, int light, int dark, int xdark, FONT *f, char *text)
Draws a button with a text on it, at the given position of the bitmap and using the given colors and font.

void draw_text_button_down(BITMAP *bmp, int x1, int y1, int x2, int y2, int face_color, int text_color, int xlight, int light, int dark, int xdark, FONT *f, char *text)
Like `draw_text_button()', but draws the button pressed down.

void draw_picture_button(BITMAP *bmp, int x1, int y1, int x2, int y2, int face,int xlight, int light, int dark, int xdark, BITMAP *sprite)
Draws a button with a sprite on it at the given position of the bitmap and using the given colors and sprite.

void draw_picture_button_down(BITMAP *bmp, int x1, int y1, int x2, int y2, int face, int xlight, int light, int dark, int xdark, BITMAP *sprite)
Like `draw_picture_button()', but draws the button pressed down.

void fill_textout(BITMAP *bmp, FONT *f, char *text, int x, int y, int w, int fg, int bg)
Like `textout()', but erases the whole area of width `w' if the text doesn't cover it.




Back to Contents