src/widget/window_events.hpp
author KUDr
Sat, 03 Mar 2007 02:47:45 +0000
branchcpp_gui
changeset 6278 c09f5e53af9b
parent 6271 0ad100a98853
child 6282 c5b92f2d924f
permissions -rw-r--r--
(svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
-Fix: Moving top-left corner of widget now moves is instead of resizing
-Add: Resizing widget/window now generates OnResize() event
-Add: Resizing container now generates OnResizeParent() for all children
-Add: Widget anchors (widgets now resize/move when container widget resizes)
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 WINDOW_EVENT_H
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
     4
#define WINDOW_EVENT_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
namespace gui {
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
     7
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
template <> struct EventT<EVT_CREATE> : public EventBaseT<EVT_CREATE, &Widget::OnCreate> {
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    10
};
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    11
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    12
template <> struct EventT<EVT_DESTROY> : public EventBaseT<EVT_DESTROY, &Widget::OnDestroy> {
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    13
};
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    14
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    15
template <> struct EventT<EVT_PAINT> : public EventBaseT<EVT_PAINT, &Widget::OnPaint> {
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
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    18
template <> struct EventT<EVT_KEYPRESS> : public EventBaseT<EVT_KEYPRESS, &Widget::OnKeyPress> {
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    19
	bool   m_cont;     // continue the search? (default true)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    20
	uint16 m_key;      // 16-bit Unicode value of the key
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    21
	uint16 m_keycode;  // untranslated key (including shift-state)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    22
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    23
	EventT(bool cont, uint16 key, uint16 keycode)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    24
		: m_cont(cont)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    25
		, m_key(key)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    26
		, m_keycode(keycode)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    27
	{}
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    28
};
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
template <> struct EventT<EVT_CLICK> : public EventBaseT<EVT_CLICK, &Widget::OnLeftClick> {
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    31
	Point m_pt;
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    32
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    33
	EventT(const PointRaw &pt)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    34
		: m_pt(pt)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    35
	{}
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    36
};
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
template <> struct EventT<EVT_RCLICK> : public EventBaseT<EVT_RCLICK, &Widget::OnRightClick> {
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    39
	Point m_pt;
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    40
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    41
	EventT(const PointRaw &pt)
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    42
		: m_pt(pt)
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
};
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    45
6271
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    46
template <> struct EventT<EVT_MOUSEOVER> : public EventBaseT<EVT_MOUSEOVER, &Widget::OnMouseOver> {
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    47
	Point m_pt;
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    48
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    49
	EventT(const PointRaw &pt)
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    50
		: m_pt(pt)
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    51
	{}
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    52
};
0ad100a98853 (svn r8958) [cpp_gui] -Add: Widget can now capture specified gui events
KUDr
parents: 6264
diff changeset
    53
6278
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    54
template <> struct EventT<EVT_RESIZE> : public EventBaseT<EVT_RESIZE, &Widget::OnResize> {
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    55
	Point16 m_change;
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    56
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    57
	EventT(const PointRaw16 &change)
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    58
		: m_change(change)
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    59
	{}
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    60
};
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    61
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    62
template <> struct EventT<EVT_RESIZE_PARENT> : public EventBaseT<EVT_RESIZE_PARENT, &Widget::OnResizeParent> {
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    63
	Point16 m_change;
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    64
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    65
	EventT(const PointRaw16 &change)
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    66
		: m_change(change)
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    67
	{}
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    68
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    69
	EventT(const EvtResize &src)
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    70
		: m_change(src.m_change)
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    71
	{}
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    72
};
c09f5e53af9b (svn r8986) [cpp_gui] -Add: resizing window by dragging ResizeBox
KUDr
parents: 6271
diff changeset
    73
6264
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    74
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    75
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    76
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    77
}; // namespace gui
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    78
9fc3b5467396 (svn r8931) [cpp_gui] -Add: first OO widget type (TextButton) added only with basic functionality
KUDr
parents:
diff changeset
    79
#endif /* WINDOW_EVENT_H */