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,
45 void *data);
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);
48
49 unsigned long group_add_widget_autopos (WGroup * g, void *w, widget_pos_flags_t pos_flags,
50 const void *before);
51 void group_remove_widget (void *w);
52
53 void group_set_current_widget_next (WGroup * g);
54 void group_set_current_widget_prev (WGroup * g);
55
56 GList *group_get_widget_next_of (GList * w);
57 GList *group_get_widget_prev_of (GList * w);
58
59 void group_select_next_widget (WGroup * g);
60 void group_select_prev_widget (WGroup * g);
61
62 void group_select_widget_by_id (const WGroup * g, unsigned long id);
63
64 void group_send_broadcast_msg (WGroup * g, widget_msg_t message);
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 static inline unsigned long
80 group_add_widget (WGroup *g, void *w)
81 {
82 return group_add_widget_autopos (g, w, WPOS_KEEP_DEFAULT,
83 g->current != NULL ? g->current->data : NULL);
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97 static inline unsigned long
98 group_add_widget_before (WGroup *g, void *w, void *before)
99 {
100 return group_add_widget_autopos (g, w, WPOS_KEEP_DEFAULT, before);
101 }
102
103
104
105
106
107
108
109
110 static inline void
111 group_select_current_widget (WGroup *g)
112 {
113 if (g->current != NULL)
114 widget_select (WIDGET (g->current->data));
115 }
116
117
118
119 static inline unsigned long
120 group_get_current_widget_id (const WGroup *g)
121 {
122 return WIDGET (g->current->data)->id;
123 }
124
125 #endif