2 * Widget group features module for Midnight Commander
6 * \brief Header: widget group features module
12 #include "lib/global.h"
14 /*** typedefs(not structures) and defined constants **********************************************/
16 #define GROUP(x) ((WGroup *)(x))
17 #define CONST_GROUP(x) ((const WGroup *)(x))
19 /*** enums ***************************************************************************************/
21 /*** typedefs(not structures) ********************************************************************/
23 /*** structures declarations (and typedefs of structures)*****************************************/
30 GList
*widgets
; /* widgets list */
31 GList
*current
; /* Currently active widget */
33 gboolean winch_pending
; /* SIGWINCH signal has been got. Resize group after rise */
34 int mouse_status
; /* For the autorepeat status of the mouse */
37 /*** global variables defined in .c file *********************************************************/
39 /*** declarations of public functions ************************************************************/
41 void group_init (WGroup
* g
, const WRect
* r
, widget_cb_fn callback
,
42 widget_mouse_cb_fn mouse_callback
);
43 /* Default callback for groups */
44 cb_ret_t
group_default_callback (Widget
* w
, Widget
* sender
, widget_msg_t msg
, int parm
,
46 cb_ret_t
group_default_set_state (Widget
* w
, widget_state_t state
, gboolean enable
);
47 int group_handle_mouse_event (Widget
* w
, Gpm_Event
* event
);
49 unsigned long group_add_widget_autopos (WGroup
* g
, void *w
, widget_pos_flags_t pos_flags
,
51 void group_remove_widget (void *w
);
53 void group_set_current_widget_next (WGroup
* g
);
54 void group_set_current_widget_prev (WGroup
* g
);
56 GList
*group_get_widget_next_of (GList
* w
);
57 GList
*group_get_widget_prev_of (GList
* w
);
59 void group_select_next_widget (WGroup
* g
);
60 void group_select_prev_widget (WGroup
* g
);
62 void group_select_widget_by_id (const WGroup
* g
, unsigned long id
);
64 void group_send_broadcast_msg (WGroup
* g
, widget_msg_t message
);
66 /* --------------------------------------------------------------------------------------------- */
67 /*** inline functions ****************************************************************************/
68 /* --------------------------------------------------------------------------------------------- */
71 * Add widget to group before current widget.
73 * @param g WGroup object
74 * @param w widget to be added
79 static inline unsigned long
80 group_add_widget (WGroup
*g
, void *w
)
82 return group_add_widget_autopos (g
, w
, WPOS_KEEP_DEFAULT
,
83 g
->current
!= NULL
? g
->current
->data
: NULL
);
86 /* --------------------------------------------------------------------------------------------- */
88 * Add widget to group before specified widget.
90 * @param g WGroup object
91 * @param w widget to be added
92 * @param before add @w before this widget
97 static inline unsigned long
98 group_add_widget_before (WGroup
*g
, void *w
, void *before
)
100 return group_add_widget_autopos (g
, w
, WPOS_KEEP_DEFAULT
, before
);
103 /* --------------------------------------------------------------------------------------------- */
105 * Select current widget in the Dialog.
107 * @param h WDialog object
111 group_select_current_widget (WGroup
*g
)
113 if (g
->current
!= NULL
)
114 widget_select (WIDGET (g
->current
->data
));
117 /* --------------------------------------------------------------------------------------------- */
119 static inline unsigned long
120 group_get_current_widget_id (const WGroup
*g
)
122 return WIDGET (g
->current
->data
)->id
;
125 #endif /* MC__GROUP_H */