author | KUDr |
Tue, 06 Mar 2007 13:06:38 +0000 | |
branch | cpp_gui |
changeset 6290 | 8078f7a3c8a0 |
parent 6289 | be3d8bd9fb02 |
child 6292 | 272c690043e3 |
permissions | -rw-r--r-- |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
1 |
/* $Id$ */ |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
2 |
|
6289 | 3 |
#ifndef WIDGET_TYPES_H |
4 |
#define WIDGET_TYPES_H |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
5 |
|
6289 | 6 |
#include "widget.h" |
7 |
#include "table/strings.h" |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
8 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
9 |
namespace gui { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
10 |
|
6286 | 11 |
struct Label : public Widget { |
12 |
typedef Widget super; |
|
13 |
||
14 |
protected: |
|
15 |
StringID m_text; |
|
16 |
||
17 |
public: |
|
18 |
Label() |
|
19 |
: Widget() |
|
20 |
{} |
|
21 |
||
22 |
Label(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, const Rect16 &rect, StringID text, StringID tooltip = 0, int color = COLOUR_NONE) |
|
23 |
: Widget(container, id, feature_flags, (byte)color, rect, tooltip) |
|
24 |
, m_text(text) |
|
25 |
{ |
|
26 |
/* make the label transparent (no background) if color not provided */ |
|
27 |
if (color == COLOUR_NONE) m_feature_flags |= FF_TRANSPARENT; |
|
28 |
} |
|
29 |
||
30 |
/*virtual*/ void DrawBackground(EvtPaint &ev); |
|
31 |
||
32 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
|
33 |
}; |
|
34 |
||
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
35 |
struct Button : public Widget { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
36 |
typedef Widget super; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
37 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
38 |
protected: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
39 |
bool m_pushed; |
6271
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
40 |
CaptureTicket m_ticket_pressed; |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
41 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
42 |
public: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
43 |
Button() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
44 |
: Widget() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
45 |
, m_pushed(false) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
46 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
47 |
|
6283
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
48 |
Button(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips) |
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
49 |
: Widget(container, id, feature_flags, color, rect, tooltips) |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
50 |
, m_pushed(false) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
51 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
52 |
|
6271
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
53 |
void OnCapturePressed(EvtMouseOver &e); |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
54 |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
55 |
/*virtual*/ void DrawBackground(EvtPaint &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
56 |
|
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
57 |
/*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev); |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
58 |
}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
59 |
|
6290
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
60 |
struct ImageButton : public Button { |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
61 |
typedef Button super; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
62 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
63 |
protected: |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
64 |
SpriteID m_sprite; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
65 |
Point16 m_sprite_offset; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
66 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
67 |
public: |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
68 |
ImageButton() |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
69 |
: Button() |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
70 |
, m_sprite(0) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
71 |
{} |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
72 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
73 |
ImageButton(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips, SpriteID sprite, Point16 sprite_offset) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
74 |
: Button(container, id, feature_flags, color, rect, tooltips) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
75 |
, m_sprite(sprite) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
76 |
, m_sprite_offset(sprite_offset) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
77 |
{} |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
78 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
79 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
80 |
}; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
81 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
82 |
struct ImageButton2 : public ImageButton { |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
83 |
typedef ImageButton super; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
84 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
85 |
protected: |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
86 |
SpriteID m_sprite_pushed; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
87 |
Point16 m_sprite_offset_pushed; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
88 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
89 |
public: |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
90 |
ImageButton2() |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
91 |
: ImageButton() |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
92 |
, m_sprite_pushed(0) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
93 |
{} |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
94 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
95 |
ImageButton2(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips, SpriteID sprite, Point16 sprite_offset, SpriteID sprite_pushed, Point16 sprite_offset_pushed) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
96 |
: ImageButton(container, id, feature_flags, color, rect, tooltips, sprite, sprite_offset) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
97 |
, m_sprite_pushed(sprite_pushed) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
98 |
, m_sprite_offset_pushed(sprite_offset_pushed) |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
99 |
{} |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
100 |
|
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
101 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
102 |
}; |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
103 |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
104 |
struct TextButton : public Button { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
105 |
typedef Button super; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
106 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
107 |
protected: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
108 |
StringID m_text; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
109 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
110 |
public: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
111 |
TextButton() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
112 |
: Button() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
113 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
114 |
|
6283
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
115 |
TextButton(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips, StringID text) |
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
116 |
: Button(container, id, feature_flags, color, rect, tooltips) |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
117 |
, m_text(text) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
118 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
119 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
120 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
121 |
}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
122 |
|
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
123 |
struct CloseBox : public Button { |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
124 |
typedef Button super; |
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
125 |
|
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
126 |
static const int16 DEFAULT_WIDTH = 11; |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
127 |
static const int16 DEFAULT_HEIGHT = 14; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
128 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
129 |
public: |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
130 |
CloseBox() |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
131 |
: Button() |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
132 |
{} |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
133 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
134 |
CloseBox(CompositeWidget *container) |
6289 | 135 |
: Button(container, -102, FF_NONE, container->m_color, Rect16(), STR_018B_CLOSE_WINDOW) |
136 |
{} |
|
137 |
||
138 |
/*virtual*/ void OnCreate(EvtCreate &ev); |
|
139 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
|
140 |
/*virtual*/ void OnLeftClick(EvtLeftClick &ev); |
|
141 |
}; |
|
142 |
||
6290
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
143 |
struct StickyBox : public ImageButton2 { |
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
144 |
typedef ImageButton2 super; |
6289 | 145 |
|
146 |
static const int16 DEFAULT_WIDTH = 12; |
|
147 |
static const int16 DEFAULT_HEIGHT = 14; |
|
148 |
||
149 |
public: |
|
150 |
StickyBox() |
|
6290
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
151 |
: ImageButton2() |
6289 | 152 |
{} |
153 |
||
154 |
StickyBox(CompositeWidget *container) |
|
6290
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
155 |
: ImageButton2(container, -103, FF_TOGGLE_BUTTON, container->m_color, Rect16(), STR_STICKY_BUTTON, SPR_PIN_DOWN, Point(0, 1), SPR_PIN_UP, Point(0, 1)) |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
156 |
{} |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
157 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
158 |
/*virtual*/ void OnCreate(EvtCreate &ev); |
6290
8078f7a3c8a0
(svn r9023) [cpp_gui] -Add: ImageButton and ImageButton2
KUDr
parents:
6289
diff
changeset
|
159 |
// /*virtual*/ void OnPaint(EvtPaint &ev); |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
160 |
/*virtual*/ void OnLeftClick(EvtLeftClick &ev); |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
161 |
}; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
162 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
163 |
struct Caption : public Widget { |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
164 |
typedef Widget super; |
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
165 |
|
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
166 |
protected: |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
167 |
Point16 m_moving_offset; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
168 |
CaptureTicket m_ticket_moving; |
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
169 |
|
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
170 |
public: |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
171 |
Caption() |
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
172 |
: Widget() |
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
173 |
{} |
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
174 |
|
6283
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
175 |
Caption(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 rect, byte text_color, StringID tooltips, StringID text) |
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
176 |
: Widget(container, id, feature_flags, color, rect, tooltips) |
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
177 |
{} |
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
178 |
|
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
179 |
/*virtual*/ void DrawBackground(EvtPaint &ev); |
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
180 |
|
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
181 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
182 |
/*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev); |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
183 |
void OnCaptureMoving(EvtMouseOver &e); |
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
184 |
}; |
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
185 |
|
6273 | 186 |
struct CaptionBar : public CompositeWidget { |
187 |
typedef CompositeWidget super; |
|
188 |
||
189 |
static const int16 DEFAULT_HEIGHT = 14; |
|
190 |
||
191 |
public: |
|
192 |
CaptionBar() |
|
193 |
: CompositeWidget() |
|
194 |
{} |
|
195 |
||
6283
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
196 |
CaptionBar(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color) |
7072ee68c676
(svn r8997) [cpp_gui] -Codechange: common window features are now controlled by FeatureFlags enum.
KUDr
parents:
6282
diff
changeset
|
197 |
: CompositeWidget(container, id, feature_flags, color, Rect16(0, 0, container->Right(), DEFAULT_HEIGHT - 1), 0) |
6273 | 198 |
{} |
199 |
||
6279
c75b2c7222ff
(svn r8991) [cpp_gui] -Codechange: composite widgets (incl. windows) now must implement CreateWidgets() method which is called from the default OnCreate() implementation
KUDr
parents:
6278
diff
changeset
|
200 |
/*virtual*/ void CreateWidgets(); |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
201 |
}; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
202 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
203 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
204 |
struct ResizeBox : public Widget { |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
205 |
typedef Widget super; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
206 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
207 |
static const int16 DEFAULT_WIDTH = 11; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
208 |
static const int16 DEFAULT_HEIGHT = 11; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
209 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
210 |
protected: |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
211 |
Point16 m_sizing_offset; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
212 |
CaptureTicket m_ticket_sizing; |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
213 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
214 |
public: |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
215 |
ResizeBox() |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
216 |
: Widget() |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
217 |
{} |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
218 |
|
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
219 |
ResizeBox(CompositeWidget *container) |
6289 | 220 |
: Widget(container, -101, FF_NONE, container->m_color, Rect16(), STR_RESIZE_BUTTON) |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
221 |
{} |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
222 |
|
6273 | 223 |
/*virtual*/ void DrawBackground(EvtPaint &ev); |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
224 |
void OnCaptureSizing(EvtMouseOver &e); |
6273 | 225 |
|
6278
c09f5e53af9b
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents:
6277
diff
changeset
|
226 |
/*virtual*/ void OnCreate(EvtCreate &ev); |
6273 | 227 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
6282
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
228 |
/*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev); |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
229 |
/*virtual*/ void OnResizeParent(EvtResizeParent &ev); |
c5b92f2d924f
(svn r8996) [cpp_gui] -Add: CloseBox added into CaptionBar
KUDr
parents:
6279
diff
changeset
|
230 |
|
6273 | 231 |
}; |
232 |
||
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
233 |
}; // namespace gui |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
234 |
|
6289 | 235 |
#endif /* WIDGET_TYPES_H */ |