2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
/** \file button.h
|
|
|
|
* \brief Header: WButton widget
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MC__WIDGET_BUTTON_H
|
|
|
|
#define MC__WIDGET_BUTTON_H
|
|
|
|
|
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
2012-10-11 12:25:07 +04:00
|
|
|
#define BUTTON(x) ((WButton *)(x))
|
2010-11-12 11:03:57 +03:00
|
|
|
|
|
|
|
struct WButton;
|
|
|
|
|
|
|
|
/* button callback */
|
2012-11-22 13:55:38 +04:00
|
|
|
/* return 0 to continue work with dialog, non-zero to close */
|
2010-11-12 11:03:57 +03:00
|
|
|
typedef int (*bcback_fn) (struct WButton * button, int action);
|
|
|
|
|
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2010-11-22 17:15:28 +03:00
|
|
|
HIDDEN_BUTTON = 0,
|
|
|
|
NARROW_BUTTON = 1,
|
|
|
|
NORMAL_BUTTON = 2,
|
2010-11-12 11:03:57 +03:00
|
|
|
DEFPUSH_BUTTON = 3
|
|
|
|
} button_flags_t;
|
|
|
|
|
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
|
|
|
typedef struct WButton
|
|
|
|
{
|
|
|
|
Widget widget;
|
|
|
|
int action; /* what to do when pressed */
|
|
|
|
|
|
|
|
button_flags_t flags; /* button flags */
|
|
|
|
hotkey_t text; /* text of button, contain hotkey too */
|
|
|
|
int hotpos; /* offset hot KEY char in text */
|
|
|
|
bcback_fn callback; /* callback function */
|
|
|
|
} WButton;
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
|
|
|
WButton *button_new (int y, int x, int action, button_flags_t flags, const char *text,
|
|
|
|
bcback_fn callback);
|
2015-11-13 17:11:29 +03:00
|
|
|
char *button_get_text (const WButton * b);
|
2010-11-12 11:03:57 +03:00
|
|
|
void button_set_text (WButton * b, const char *text);
|
|
|
|
int button_get_len (const WButton * b);
|
|
|
|
|
2017-08-31 16:10:47 +03:00
|
|
|
cb_ret_t button_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
|
|
|
void *data);
|
|
|
|
void button_mouse_default_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event);
|
|
|
|
|
2010-11-12 11:03:57 +03:00
|
|
|
/*** inline functions ****************************************************************************/
|
|
|
|
|
|
|
|
#endif /* MC__WIDGET_BUTTON_H */
|