0
|
1 #ifndef __MENUITEM_H__
|
|
2 #define __MENUITEM_H__
|
|
3
|
|
4 #include"widget.h"
|
|
5
|
|
6 #define MenuItem WidMenuItem
|
|
7 #define MenuRadioButton WidMenuRadioButton
|
|
8 #define MenuScale WidMenuScale
|
|
9
|
|
10 // ɬ�פʤ�Ρ�
|
|
11 //
|
|
12 // ��٥롧surface��Ž�줿�����褤�����ޤ�������
|
|
13 // ��٥���֡��ܥ���ξ塢�⤷���ϱ�
|
|
14 // ���ξ�硧�������justify ����Τǡ���٥����Τ����ȱ��ޡ�����ɬ��
|
|
15 // ��ξ�硧������justify ����Τǡ����ޡ�����Ȳ��ޡ�����ɬ��
|
|
16
|
|
17 // ���ơ�x,y�Ŀ�����ꡢ�����������������
|
|
18
|
|
19 // ��٥���־���ʤ麸����justify, ���ʤ鱦�����justify
|
|
20 // �ʤΤǡ����ؤΥޡ�����Ⱦ�ؤΥޡ�����
|
|
21 // ��٥�ܻͳѥܥ���ʥ����å��ܥå�����
|
|
22 // �ܥ���������deactivate�����
|
|
23 //
|
|
24 // �饸���ܥ���
|
|
25 // �ƥ����ȥܥ���ν����Ρ�x,y �θĿ������
|
|
26 // ��������
|
|
27
|
|
28 struct MenuItem : PicWidget {
|
|
29 int x_size, y_size;
|
|
30 int menu_width, menu_height;
|
|
31 int lb_width, lb_right, lb_left, lb_bottom;
|
|
32 PicWidget* label;
|
|
33 int* value_ptr;
|
|
34 std::vector<PicWidget*> item;
|
|
35 typedef std::vector<PicWidget*>::iterator iterator;
|
|
36 MenuItem(PicContainer* parent, const Rect& r_orig, int x_size, int y_size, int* value_ptr);
|
|
37 void SetLabelLeft(PicWidget* lb, const Rect& min_rect, const Rect& min_margin);
|
|
38 void SetLabelTop(PicWidget* lb, const Rect& left_margin, const Rect& bottom_margin);
|
|
39 void pack(void);
|
|
40 void activate(void);
|
|
41 void deactivate(void);
|
|
42 // callback
|
|
43 typedef void (*SetFunc)(void* pointer, MenuItem* widget);
|
|
44 SetFunc set_func;
|
|
45 void* set_pointer;
|
|
46 void SetValue(int new_value);
|
|
47 virtual void SetValueImpl(int new_value) {};
|
|
48 };
|
|
49
|
|
50 struct RadioButton : MenuItem {
|
|
51 Event::Container& container;
|
|
52 PicContainer* parent;
|
|
53 int text_size;
|
|
54 Rect button_rect;
|
|
55 int buttons;
|
|
56 Color fore_color, pressed_color, back_color;
|
|
57 RadioButton(Event::Container& container, PicContainer* parent, const Rect& r_orig, int x_size, int y_size, int* value_ptr, const Rect& button_r, int text_size, const Color& fore, const Color& pressed, const Color& back);
|
|
58 void Add(const char* s, bool is_center = true);
|
|
59 void Add(const char* s, const Color& fore, const Color& pressed, const Color& back, bool is_center = true);
|
|
60 static void PressCallback(void* pointer, Button* from);
|
|
61 void SetValueImpl(int new_value);
|
|
62 };
|
|
63
|
|
64 #endif /* __MENUITEM_H__ */
|