root/lib/widget/button.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 
   2 /** \file button.h
   3  *  \brief Header: WButton widget
   4  */
   5 
   6 #ifndef MC__WIDGET_BUTTON_H
   7 #define MC__WIDGET_BUTTON_H
   8 
   9 /*** typedefs(not structures) and defined constants **********************************************/
  10 
  11 #define BUTTON(x) ((WButton *)(x))
  12 
  13 struct WButton;
  14 
  15 /* button callback */
  16 /* return 0 to continue work with dialog, non-zero to close */
  17 typedef int (*bcback_fn) (struct WButton * button, int action);
  18 
  19 /*** enums ***************************************************************************************/
  20 
  21 typedef enum
  22 {
  23     HIDDEN_BUTTON = 0,
  24     NARROW_BUTTON = 1,
  25     NORMAL_BUTTON = 2,
  26     DEFPUSH_BUTTON = 3
  27 } button_flags_t;
  28 
  29 /*** structures declarations (and typedefs of structures)*****************************************/
  30 
  31 typedef struct WButton
  32 {
  33     Widget widget;
  34     int action;                 /* what to do when pressed */
  35 
  36     button_flags_t flags;       /* button flags */
  37     hotkey_t text;              /* text of button, contain hotkey too */
  38     int hotpos;                 /* offset hot KEY char in text */
  39     bcback_fn callback;         /* callback function */
  40 } WButton;
  41 
  42 /*** global variables defined in .c file *********************************************************/
  43 
  44 /*** declarations of public functions ************************************************************/
  45 
  46 WButton *button_new (int y, int x, int action, button_flags_t flags, const char *text,
  47                      bcback_fn callback);
  48 char *button_get_text (const WButton * b);
  49 void button_set_text (WButton * b, const char *text);
  50 int button_get_len (const WButton * b);
  51 
  52 cb_ret_t button_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
  53                                   void *data);
  54 void button_mouse_default_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event);
  55 
  56 /*** inline functions ****************************************************************************/
  57 
  58 #endif /* MC__WIDGET_BUTTON_H */

/* [previous][next][first][last][top][bottom][index][help]  */