This source file includes following definitions.
- group_add_widget
- group_add_widget_before
- group_select_current_widget
- group_get_current_widget_id
1
2
3
4
5
6
7
8
9 #ifndef MC__GROUP_H
10 #define MC__GROUP_H
11
12 #include "lib/global.h"
13
14
15
16 #define GROUP(x) ((WGroup *) (x))
17 #define CONST_GROUP(x) ((const WGroup *) (x))
18
19
20
21
22
23
24
25 struct WGroup
26 {
27 Widget widget;
28
29
30 GList *widgets;
31 GList *current;
32
33 gboolean winch_pending;
34 int mouse_status;
35 };
36
37
38
39
40
41 void group_init (WGroup *g, const WRect *r, widget_cb_fn callback,
42 widget_mouse_cb_fn mouse_callback);
43
44 cb_ret_t group_default_callback (Widget *w, Widget *sender, widget_msg_t msg, int parm, void *data);
45 cb_ret_t group_default_set_state (Widget *w, widget_state_t state, gboolean enable);
46 int group_handle_mouse_event (Widget *w, Gpm_Event *event);
47
48 unsigned long group_add_widget_autopos (WGroup *g, void *w, widget_pos_flags_t pos_flags,
49 const void *before);
50 void group_remove_widget (void *w);
51
52 void group_set_current_widget_next (WGroup *g);
53 void group_set_current_widget_prev (WGroup *g);
54
55 GList *group_get_widget_next_of (GList *w);
56 GList *group_get_widget_prev_of (GList *w);
57
58 void group_select_next_widget (WGroup *g);
59 void group_select_prev_widget (WGroup *g);
60
61 void group_select_widget_by_id (const WGroup *g, unsigned long id);
62
63 void group_send_broadcast_msg (WGroup *g, widget_msg_t message);
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 static inline unsigned long
79 group_add_widget (WGroup *g, void *w)
80 {
81 return group_add_widget_autopos (g, w, WPOS_KEEP_DEFAULT,
82 g->current != NULL ? g->current->data : NULL);
83 }
84
85
86
87
88
89
90
91
92
93
94
95
96 static inline unsigned long
97 group_add_widget_before (WGroup *g, void *w, void *before)
98 {
99 return group_add_widget_autopos (g, w, WPOS_KEEP_DEFAULT, before);
100 }
101
102
103
104
105
106
107
108
109 static inline void
110 group_select_current_widget (WGroup *g)
111 {
112 if (g->current != NULL)
113 widget_select (WIDGET (g->current->data));
114 }
115
116
117
118 static inline unsigned long
119 group_get_current_widget_id (const WGroup *g)
120 {
121 return WIDGET (g->current->data)->id;
122 }
123
124 #endif