author | KUDr |
Fri, 02 Mar 2007 22:31:08 +0000 | |
branch | cpp_gui |
changeset 6275 | bd57b30a8b81 |
parent 6273 | d8a2c6844650 |
child 6277 | 732cf765e2d7 |
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 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
3 |
#ifndef WIDGET_H |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
4 |
#define WIDGET_H |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
5 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
6 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
7 |
#include <list> |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
8 |
#include <map> |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
9 |
#include "../macros.h" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
10 |
#include "../string.h" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
11 |
#include "../order.h" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
12 |
#include "../rail.h" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
13 |
#include "../airport.h" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
14 |
#include "../misc/rect.hpp" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
15 |
#include "../misc/countedptr.hpp" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
16 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
17 |
#include "window_event_base.h" |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
18 |
|
6265
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
19 |
enum FrameFlags { |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
20 |
FR_NONE = 0x00, |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
21 |
FR_TRANSPARENT = 0x01, ///< Makes the background transparent if set |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
22 |
FR_BORDERONLY = 0x10, ///< Draw border only, no background |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
23 |
FR_LOWERED = 0x20, ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed) |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
24 |
FR_DARKENED = 0x40, ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes) |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
25 |
}; |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
26 |
|
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
27 |
DECLARE_ENUM_AS_BIT_SET(FrameFlags); |
7054c910251d
(svn r8932) [cpp_gui] -Fix(r8931): forward enum declaration doesn't work for g++
KUDr
parents:
6264
diff
changeset
|
28 |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
29 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
30 |
namespace gui { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
31 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
32 |
struct Widget; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
33 |
typedef CCountedPtr<Widget> WidgetPtr; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
34 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
35 |
struct CompositeWidget; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
36 |
typedef CCountedPtr<CompositeWidget> CompositeWidgetPtr; |
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 |
typedef int32 WidgetId; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
39 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
40 |
struct Widget : public SimpleCountedObject { |
6269
3b3bd4fe0736
(svn r8947) [cpp_gui] -Codechange: proprietary smart pointer adapter replaced by generic one
KUDr
parents:
6265
diff
changeset
|
41 |
typedef AdaptT<EventHandlerDelegatePtr> Handler; |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
42 |
typedef std::list<Handler> Handlers; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
43 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
44 |
CompositeWidget *m_container; ///< widget container (can be any panel or window) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
45 |
WidgetId m_id; ///< Widget id in its container |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
46 |
Rect16 m_rect; ///< The position offsets relative to the container |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
47 |
uint16 m_data; ///< The String/Image or special code (list-matrices) of a widget |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
48 |
byte m_display_flags; ///< Resize direction, alignment, etc. during resizing, see @ResizeFlags |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
49 |
byte m_color; ///< Widget color, see docs/ottd-colourtext-palette.png |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
50 |
bool m_is_closing : 1; ///< Widget was logically destroyed |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
51 |
bool m_dont_clip : 1; ///< should not be clipped by parent (container) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
52 |
StringID m_tooltips; ///< Tooltips that are shown when right clicking on a widget |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
53 |
Handlers m_handlers; ///< dynamically registered event handlers |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
54 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
55 |
Widget() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
56 |
: m_container(NULL), m_id(0), m_rect(), m_data(0), m_display_flags(0), m_color(0) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
57 |
, m_is_closing(false), m_tooltips(0) |
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 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
60 |
Widget(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
61 |
: m_container(container) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
62 |
, m_id(id) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
63 |
, m_rect(rect) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
64 |
, m_data(0) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
65 |
, m_display_flags(display_flags) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
66 |
, m_color(color) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
67 |
, m_is_closing(false) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
68 |
, m_dont_clip(false) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
69 |
, m_tooltips(tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
70 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
71 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
72 |
int16 Left() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
73 |
int16 Top() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
74 |
int16 Right() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
75 |
int16 Bottom() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
76 |
int16 Width() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
77 |
int16 Height() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
78 |
const Point16& TopLeft() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
79 |
const Point16& BottomRight() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
80 |
Point16 Size() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
81 |
Point16 CenterPt() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
82 |
const Rect16& GetRect() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
83 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
84 |
void SetLeft(int16 val); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
85 |
void SetTop(int16 val); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
86 |
void SetRight(int16 val); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
87 |
void SetBottom(int16 val); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
88 |
void SetWidth(int16 val); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
89 |
void SetHeight(int16 val); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
90 |
void SetTopLeft(const Point16 &pt); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
91 |
void SetBottomRight(const Point16 &pt); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
92 |
void SetSize(const Point16 &pt); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
93 |
void SetRect(const Rect16 &rect); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
94 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
95 |
WidgetId GetId() const; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
96 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
97 |
void AddHandler(EventHandlerDelegate *d); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
98 |
void CallHandlers(EventBase &e); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
99 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
100 |
void Invalidate() {}; ///< now we redraw gui all the time, so no processing is needed here |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
101 |
static /*static*/ void FillRect(const Rect16 &rc, int color); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
102 |
static void DrawFrameRect(int left, int top, int right, int bottom, int ctab, FrameFlags flags); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
103 |
void DrawFrameRect(int ctab, FrameFlags flags); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
104 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
105 |
virtual BaseWindow* GetWindow(); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
106 |
virtual Widget* WidgetFromPt(const Point16 &pt); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
107 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
108 |
virtual void Close(); |
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 |
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
|
111 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
112 |
/** |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
113 |
* OnCreate() handler called when window gets created. Override this method in your |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
114 |
* Window subclass and place widgets into your window from there. |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
115 |
*/ |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
116 |
virtual void OnCreate(EvtCreate &ev) {}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
117 |
virtual void OnDestroy(EvtDestroy &ev) {}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
118 |
virtual void OnPaint(EvtPaint &ev) = 0; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
119 |
virtual void OnKeyPress(EvtKeyPress &ev) {}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
120 |
virtual void OnLeftClick(EvtClick &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
121 |
virtual void OnRightClick(EvtRightClick &ev); |
6271
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
122 |
virtual void OnMouseOver(EvtMouseOver &ev) {}; |
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
123 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
124 |
/** |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
125 |
* Dispatch event by its type calling appropriate OnCreate(), OnDestroy(), etc. |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
126 |
*/ |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
127 |
virtual void DispatchEvent(EventBase &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
128 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
129 |
/** |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
130 |
* @function AddReflectHandlerT Registers reflected event handler. Use it from |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
131 |
* BaseWindow subclasses (Window implementations) to register custom event handler. |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
132 |
* For example if you are implementing 'MyWindow' class and want to handle OnLeftClick() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
133 |
* event for your button 'MyButton', define your handler method inside 'MyWindow' class |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
134 |
* like: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
135 |
* void MyWindow::MyButtonClickHandler(gui::EvtClick &e) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
136 |
* { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
137 |
* ... |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
138 |
* } |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
139 |
* then from inside OnCreate() handler, create your button 'my_button' and |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
140 |
* call: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
141 |
* my_button->AddReflectHandlerT(&MyWindow::MyButtonClickHandler); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
142 |
* and your MyButtonClickHandler will be called on every click on my_button. |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
143 |
*/ |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
144 |
template <class Twnd_cls, EventCode Tevt_code> void AddReflectHandlerT(void (Twnd_cls::*handler)(gui::EventT<Tevt_code>&)) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
145 |
{ |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
146 |
typedef ReflectHandlerDelegateT<Twnd_cls, Tevt_code> Delegate; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
147 |
AddHandler(new Delegate(handler)); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
148 |
} |
6271
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
149 |
|
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
150 |
/** add capture handler using default delegate type (CaptureHandlerDelegateT<>) */ |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
151 |
template <class Twd_cls, EventCode Tevt_code> CaptureTicket CaptureEventsT(Twd_cls *wd, void (Twd_cls::*handler)(EventT<Tevt_code>&)) |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
152 |
{ |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
153 |
CaptureTicket ticket = EventCaptureStack::AddHandler(new CaptureHandlerDelegateT<Twd_cls, Tevt_code>(wd, handler)); |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
154 |
return ticket; |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
155 |
} |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
156 |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
157 |
}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
158 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
159 |
struct CompositeWidget : public Widget { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
160 |
typedef Widget super; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
161 |
typedef std::map<WidgetId, WidgetPtr> Widgets; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
162 |
typedef Widgets::iterator WidgetIterator; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
163 |
typedef Widgets::reverse_iterator WidgetReverseIterator; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
164 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
165 |
protected: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
166 |
Widgets m_widgets; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
167 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
168 |
public: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
169 |
CompositeWidget() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
170 |
: Widget() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
171 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
172 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
173 |
CompositeWidget(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
174 |
: Widget(container, id, display_flags, color, rect, tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
175 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
176 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
177 |
void AddWidget(Widget *wd); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
178 |
Widget* GetWidget(WidgetId id); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
179 |
Widget* RemoveWidget(WidgetId id); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
180 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
181 |
/*virtual*/ Widget* WidgetFromPt(const Point16 &pt); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
182 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
183 |
virtual void Close(); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
184 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
185 |
/*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
|
186 |
/*virtual*/ void OnLeftClick(EvtClick &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
187 |
/*virtual*/ void OnRightClick(EvtRightClick &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
188 |
}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
189 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
190 |
struct Button : public Widget { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
191 |
typedef Widget super; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
192 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
193 |
protected: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
194 |
bool m_pushed; |
6271
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
195 |
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
|
196 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
197 |
public: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
198 |
Button() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
199 |
: Widget() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
200 |
, m_pushed(false) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
201 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
202 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
203 |
Button(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
204 |
: Widget(container, id, display_flags, color, rect, tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
205 |
, m_pushed(false) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
206 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
207 |
|
6271
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
208 |
void OnCapturePressed(EvtMouseOver &e); |
0ad100a98853
(svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents:
6269
diff
changeset
|
209 |
|
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
210 |
/*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
|
211 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
212 |
/*virtual*/ void OnLeftClick(EvtClick &ev); |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
213 |
}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
214 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
215 |
struct TextButton : public Button { |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
216 |
typedef Button super; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
217 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
218 |
protected: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
219 |
StringID m_text; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
220 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
221 |
public: |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
222 |
TextButton() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
223 |
: Button() |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
224 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
225 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
226 |
TextButton(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips, StringID text) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
227 |
: Button(container, id, display_flags, color, rect, tooltips) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
228 |
, m_text(text) |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
229 |
{} |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
230 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
231 |
/*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
|
232 |
}; |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
233 |
|
6273 | 234 |
struct CaptionBar : public CompositeWidget { |
235 |
typedef CompositeWidget super; |
|
236 |
||
237 |
static const int16 DEFAULT_HEIGHT = 14; |
|
238 |
||
239 |
protected: |
|
6275
bd57b30a8b81
(svn r8983) [cpp_gui] -Add: moving window by dragging CaptionBar
KUDr
parents:
6273
diff
changeset
|
240 |
StringID m_text; |
bd57b30a8b81
(svn r8983) [cpp_gui] -Add: moving window by dragging CaptionBar
KUDr
parents:
6273
diff
changeset
|
241 |
byte m_text_color; |
bd57b30a8b81
(svn r8983) [cpp_gui] -Add: moving window by dragging CaptionBar
KUDr
parents:
6273
diff
changeset
|
242 |
Point16 m_moving_offset; |
bd57b30a8b81
(svn r8983) [cpp_gui] -Add: moving window by dragging CaptionBar
KUDr
parents:
6273
diff
changeset
|
243 |
CaptureTicket m_ticket_moving; |
6273 | 244 |
|
245 |
public: |
|
246 |
CaptionBar() |
|
247 |
: CompositeWidget() |
|
248 |
, m_text(0) |
|
249 |
, m_text_color(0xFF) |
|
250 |
{} |
|
251 |
||
252 |
CaptionBar(CompositeWidget *container, WidgetId id, byte display_flags, byte color, byte text_color, StringID tooltips, StringID text) |
|
253 |
: CompositeWidget(container, id, display_flags, color, Rect16(0, 0, container->Width() - 1, DEFAULT_HEIGHT - 1), tooltips) |
|
254 |
, m_text(text) |
|
255 |
, m_text_color(text_color) |
|
256 |
{} |
|
257 |
||
258 |
/*virtual*/ void DrawBackground(EvtPaint &ev); |
|
259 |
||
260 |
/*virtual*/ void OnPaint(EvtPaint &ev); |
|
6275
bd57b30a8b81
(svn r8983) [cpp_gui] -Add: moving window by dragging CaptionBar
KUDr
parents:
6273
diff
changeset
|
261 |
/*virtual*/ void OnLeftClick(EvtClick &ev); |
bd57b30a8b81
(svn r8983) [cpp_gui] -Add: moving window by dragging CaptionBar
KUDr
parents:
6273
diff
changeset
|
262 |
void OnCapturePressed(EvtMouseOver &e); |
6273 | 263 |
}; |
264 |
||
6264
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
265 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
266 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
267 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
268 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
269 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
270 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
271 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
272 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
273 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
274 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
275 |
}; // namespace gui |
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
276 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
277 |
|
9fc3b5467396
(svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff
changeset
|
278 |
#endif /* WIDGET_H */ |