]> git.saurik.com Git - wxWidgets.git/blame - utils/dialoged/src/dlghndlr.h
Added to wxSystemSettings for better GTK+ themes compatibility
[wxWidgets.git] / utils / dialoged / src / dlghndlr.h
CommitLineData
457814b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dlghndlr.h
3// Purpose: Dialog handler
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _DLGHNDLR_H_
13#define _DLGHNDLR_H_
14
15#define wxDRAG_MODE_NONE 0
16#define wxDRAG_MODE_START_LEFT 1
17#define wxDRAG_MODE_CONTINUE_LEFT 2
18#define wxDRAG_MODE_START_RIGHT 3
19#define wxDRAG_MODE_CONTINUE_RIGHT 4
20#define wxDRAG_TYPE_NONE 0
21#define wxDRAG_TYPE_ITEM 100
22
23#define wxKEY_SHIFT 1
24#define wxKEY_CTRL 2
25
26class wxResourceEditorDialogHandler: public wxEvtHandler
27{
f6bcfd97
BP
28 DECLARE_CLASS(wxResourceEditorDialogHandler)
29public:
30 wxResourceManager *resourceManager;
31 wxPanel *handlerDialog;
32 wxItemResource *handlerResource;
33 wxEvtHandler *handlerOldHandler;
34
35 wxControl *dragItem;
36 int dragMode;
37 int dragType;
38 int dragTolerance;
39 bool checkTolerance;
40 int firstDragX;
41 int firstDragY;
42 int oldDragX;
43 int oldDragY;
44 bool m_mouseCaptured;
45 // long m_treeItem;
46
47 wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler,
48 wxResourceManager *manager);
49 ~wxResourceEditorDialogHandler(void);
50
51 void OnPaint(wxPaintEvent& event);
52 void OnMouseEvent(wxMouseEvent& event);
53 void OnSize(wxSizeEvent& event);
54
55 virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
56 virtual void OnLeftClick(int x, int y, int keys);
57 virtual void OnRightClick(int x, int y, int keys);
58 virtual void OnItemLeftClick(wxControl *item, int x, int y, int keys);
59 virtual void OnItemRightClick(wxControl *item, int x, int y, int keys);
60 virtual void OnItemSelect(wxControl *item, bool select);
61 virtual void OnItemMove(
62 wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {};
63 virtual void OnItemSize(
64 wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {};
65
66 void AddChildHandlers(void);
67 void PaintSelectionHandles(wxDC& dc);
68 void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle);
69
70 // Accessors
71 /*
72 inline long GetTreeItem() const { return m_treeItem; }
73 inline void SetTreeItem(long item) { m_treeItem = item; }
74 */
75
76 DECLARE_EVENT_TABLE()
457814b5
JS
77};
78
79class wxResourceEditorControlHandler: public wxEvtHandler
80{
f6bcfd97
BP
81 DECLARE_CLASS(wxResourceEditorControlHandler)
82public:
83 // wxResourceManager *resourceManager;
84 wxControl *handlerControl;
85 // wxItemResource *handlerResource;
86 wxEvtHandler *handlerOldHandler;
87
88 bool isSelected;
89 int handleSize; // selection handle size
90 int handleMargin; // Distance between item edge and handle edge
91 long m_treeItem;
92 static int dragOffsetX; // Distance between pointer at start of drag and
93 static int dragOffsetY; // top-left of item
94
95 wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler);
96 ~wxResourceEditorControlHandler(void);
97
98 void OnMouseEvent(wxMouseEvent& event);
99
100 // Manipulation and drawing of items in Edit Mode
101
102 // Calculate position of the 8 handles
103 virtual void CalcSelectionHandles(int *hx, int *hy);
104 virtual void DrawSelectionHandles(wxDC& dc, bool erase = FALSE);
105 virtual void DrawBoundingBox(wxDC& dc, int x, int y, int w, int h);
106 virtual void SelectItem(bool select);
107 virtual inline bool IsSelected(void) { return isSelected; }
108
109 // Returns TRUE or FALSE
110 virtual bool HitTest(int x, int y);
111
112 // Returns 0 (no hit), 1 - 8 for which selection handle
113 // (clockwise from top middle)
114 virtual int SelectionHandleHitTest(int x, int y);
115
116 // If selectionHandle is zero, not dragging the selection handle.
117 virtual void OnDragBegin(int x, int y, int keys, wxDC& dc, int selectionHandle);
118 virtual void OnDragContinue(bool paintIt, int x, int y, int keys, wxDC& dc, int selectionHandle);
119 virtual void OnDragEnd(int x, int y, int keys, wxDC& dc, int selectionHandle);
120
121 // These functions call panel functions
122 // by default.
123 virtual void OldOnMove(int x, int y);
124 virtual void OldOnSize(int w, int h);
125 virtual void OnLeftClick(int x, int y, int keys);
126 virtual void OnRightClick(int x, int y, int keys);
127 virtual void OnSelect(bool select);
128
129 // Accessors
130 /*
131 inline long GetTreeItem() const { return m_treeItem; }
132 inline void SetTreeItem(long item) { m_treeItem = item; }
133 */
134
135 DECLARE_EVENT_TABLE()
136};
ae8351fc 137
f6bcfd97
BP
138// This dialog, for testing dialogs, has to intercept commands before
139// they go up the hierarchy and accidentally set off arbitrary
140// Dialog Editor functionality
141class ResourceEditorDialogTester: public wxDialog
142{
143public:
144 ResourceEditorDialogTester() {}
145
146 bool ProcessEvent(wxEvent& event);
457814b5
JS
147};
148
149#endif
150