]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/aui/toolbar.h | |
3 | // Purpose: wxaui: wx advanced user interface - docking window manager | |
4 | // Author: Benjamin I. Williams | |
5 | // Modified by: | |
6 | // Created: 2008-08-04 | |
7 | // RCS-ID: $Id: framemanager.h 53135 2008-04-12 02:31:04Z VZ $ | |
8 | // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. | |
9 | // Licence: wxWindows Library Licence, Version 3.1 | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_AUIBAR_H_ | |
13 | #define _WX_AUIBAR_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | ||
17 | #if wxUSE_AUI | |
18 | ||
19 | #include "wx/control.h" | |
20 | #include "wx/sizer.h" | |
21 | #include "wx/pen.h" | |
22 | ||
23 | //class WXDLLIMPEXP_FWD_CORE wxSizerItem; | |
24 | ||
25 | enum wxAuiToolBarStyle | |
26 | { | |
27 | wxAUI_TB_TEXT = 1 << 0, | |
28 | wxAUI_TB_NO_TOOLTIPS = 1 << 1, | |
29 | wxAUI_TB_NO_AUTORESIZE = 1 << 2, | |
30 | wxAUI_TB_GRIPPER = 1 << 3, | |
31 | wxAUI_TB_OVERFLOW = 1 << 4, | |
32 | wxAUI_TB_VERTICAL = 1 << 5, | |
33 | wxAUI_TB_HORZ_LAYOUT = 1 << 6, | |
34 | wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT), | |
35 | wxAUI_TB_DEFAULT_STYLE = 0 | |
36 | }; | |
37 | ||
38 | enum wxAuiToolBarArtSetting | |
39 | { | |
40 | wxAUI_TBART_SEPARATOR_SIZE = 0, | |
41 | wxAUI_TBART_GRIPPER_SIZE = 1, | |
42 | wxAUI_TBART_OVERFLOW_SIZE = 2 | |
43 | }; | |
44 | ||
45 | enum wxAuiToolBarToolTextOrientation | |
46 | { | |
47 | wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented | |
48 | wxAUI_TBTOOL_TEXT_RIGHT = 1, | |
49 | wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented | |
50 | wxAUI_TBTOOL_TEXT_BOTTOM = 3 | |
51 | }; | |
52 | ||
53 | ||
54 | // aui toolbar event class | |
55 | ||
56 | class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent | |
57 | { | |
58 | public: | |
59 | wxAuiToolBarEvent(wxEventType command_type = wxEVT_NULL, | |
60 | int win_id = 0) | |
61 | : wxNotifyEvent(command_type, win_id) | |
62 | { | |
63 | is_dropdown_clicked = false; | |
64 | click_pt = wxPoint(-1, -1); | |
65 | rect = wxRect(-1,-1, 0, 0); | |
66 | tool_id = -1; | |
67 | } | |
68 | #ifndef SWIG | |
69 | wxAuiToolBarEvent(const wxAuiToolBarEvent& c) : wxNotifyEvent(c) | |
70 | { | |
71 | is_dropdown_clicked = c.is_dropdown_clicked; | |
72 | click_pt = c.click_pt; | |
73 | rect = c.rect; | |
74 | tool_id = c.tool_id; | |
75 | } | |
76 | #endif | |
77 | wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); } | |
78 | ||
79 | bool IsDropDownClicked() const { return is_dropdown_clicked; } | |
80 | void SetDropDownClicked(bool c) { is_dropdown_clicked = c; } | |
81 | ||
82 | wxPoint GetClickPoint() const { return click_pt; } | |
83 | void SetClickPoint(const wxPoint& p) { click_pt = p; } | |
84 | ||
85 | wxRect GetItemRect() const { return rect; } | |
86 | void SetItemRect(const wxRect& r) { rect = r; } | |
87 | ||
88 | int GetToolId() const { return tool_id; } | |
89 | void SetToolId(int id) { tool_id = id; } | |
90 | ||
91 | private: | |
92 | ||
93 | bool is_dropdown_clicked; | |
94 | wxPoint click_pt; | |
95 | wxRect rect; | |
96 | int tool_id; | |
97 | ||
98 | #ifndef SWIG | |
99 | private: | |
100 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent) | |
101 | #endif | |
102 | }; | |
103 | ||
104 | ||
105 | class WXDLLIMPEXP_AUI wxAuiToolBarItem | |
106 | { | |
107 | friend class wxAuiToolBar; | |
108 | ||
109 | public: | |
110 | ||
111 | wxAuiToolBarItem() | |
112 | { | |
113 | window = NULL; | |
114 | sizer_item = NULL; | |
115 | spacer_pixels = 0; | |
116 | id = 0; | |
117 | kind = wxITEM_NORMAL; | |
118 | state = 0; // normal, enabled | |
119 | proportion = 0; | |
120 | active = true; | |
121 | dropdown = true; | |
122 | sticky = true; | |
123 | user_data = 0; | |
124 | } | |
125 | ||
126 | wxAuiToolBarItem(const wxAuiToolBarItem& c) | |
127 | { | |
128 | Assign(c); | |
129 | } | |
130 | ||
131 | wxAuiToolBarItem& operator=(const wxAuiToolBarItem& c) | |
132 | { | |
133 | Assign(c); | |
134 | return *this; | |
135 | } | |
136 | ||
137 | void Assign(const wxAuiToolBarItem& c) | |
138 | { | |
139 | window = c.window; | |
140 | label = c.label; | |
141 | bitmap = c.bitmap; | |
142 | disabled_bitmap = c.disabled_bitmap; | |
143 | hover_bitmap = c.hover_bitmap; | |
144 | short_help = c.short_help; | |
145 | long_help = c.long_help; | |
146 | sizer_item = c.sizer_item; | |
147 | min_size = c.min_size; | |
148 | spacer_pixels = c.spacer_pixels; | |
149 | id = c.id; | |
150 | kind = c.kind; | |
151 | state = c.state; | |
152 | proportion = c.proportion; | |
153 | active = c.active; | |
154 | dropdown = c.dropdown; | |
155 | sticky = c.sticky; | |
156 | user_data = c.user_data; | |
157 | } | |
158 | ||
159 | ||
160 | void SetWindow(wxWindow* w) { window = w; } | |
161 | wxWindow* GetWindow() { return window; } | |
162 | ||
163 | void SetId(int new_id) { id = new_id; } | |
164 | int GetId() const { return id; } | |
165 | ||
166 | void SetKind(int new_kind) { kind = new_kind; } | |
167 | int GetKind() const { return kind; } | |
168 | ||
169 | void SetState(int new_state) { state = new_state; } | |
170 | int GetState() const { return state; } | |
171 | ||
172 | void SetSizerItem(wxSizerItem* s) { sizer_item = s; } | |
173 | wxSizerItem* GetSizerItem() const { return sizer_item; } | |
174 | ||
175 | void SetLabel(const wxString& s) { label = s; } | |
176 | const wxString& GetLabel() const { return label; } | |
177 | ||
178 | void SetBitmap(const wxBitmap& bmp) { bitmap = bmp; } | |
179 | const wxBitmap& GetBitmap() const { return bitmap; } | |
180 | ||
181 | void SetDisabledBitmap(const wxBitmap& bmp) { disabled_bitmap = bmp; } | |
182 | const wxBitmap& GetDisabledBitmap() const { return disabled_bitmap; } | |
183 | ||
184 | void SetHoverBitmap(const wxBitmap& bmp) { hover_bitmap = bmp; } | |
185 | const wxBitmap& GetHoverBitmap() const { return hover_bitmap; } | |
186 | ||
187 | void SetShortHelp(const wxString& s) { short_help = s; } | |
188 | const wxString& GetShortHelp() const { return short_help; } | |
189 | ||
190 | void SetLongHelp(const wxString& s) { long_help = s; } | |
191 | const wxString& GetLongHelp() const { return long_help; } | |
192 | ||
193 | void SetMinSize(const wxSize& s) { min_size = s; } | |
194 | const wxSize& GetMinSize() const { return min_size; } | |
195 | ||
196 | void SetSpacerPixels(int s) { spacer_pixels = s; } | |
197 | int GetSpacerPixels() const { return spacer_pixels; } | |
198 | ||
199 | void SetProportion(int p) { proportion = p; } | |
200 | int GetProportion() const { return proportion; } | |
201 | ||
202 | void SetActive(bool b) { active = b; } | |
203 | bool IsActive() const { return active; } | |
204 | ||
205 | void SetHasDropDown(bool b) { dropdown = b; } | |
206 | bool HasDropDown() const { return dropdown; } | |
207 | ||
208 | void SetSticky(bool b) { sticky = b; } | |
209 | bool IsSticky() const { return sticky; } | |
210 | ||
211 | void SetUserData(long l) { user_data = l; } | |
212 | long GetUserData() const { return user_data; } | |
213 | ||
214 | private: | |
215 | ||
216 | wxWindow* window; // item's associated window | |
217 | wxString label; // label displayed on the item | |
218 | wxBitmap bitmap; // item's bitmap | |
219 | wxBitmap disabled_bitmap; // item's disabled bitmap | |
220 | wxBitmap hover_bitmap; // item's hover bitmap | |
221 | wxString short_help; // short help (for tooltip) | |
222 | wxString long_help; // long help (for status bar) | |
223 | wxSizerItem* sizer_item; // sizer item | |
224 | wxSize min_size; // item's minimum size | |
225 | int spacer_pixels; // size of a spacer | |
226 | int id; // item's id | |
227 | int kind; // item's kind | |
228 | int state; // state | |
229 | int proportion; // proportion | |
230 | bool active; // true if the item is currently active | |
231 | bool dropdown; // true if the item has a dropdown button | |
232 | bool sticky; // overrides button states if true (always active) | |
233 | long user_data; // user-specified data | |
234 | }; | |
235 | ||
236 | #ifndef SWIG | |
237 | WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI); | |
238 | #endif | |
239 | ||
240 | ||
241 | ||
242 | ||
243 | // tab art class | |
244 | ||
245 | class WXDLLIMPEXP_AUI wxAuiToolBarArt | |
246 | { | |
247 | public: | |
248 | ||
249 | wxAuiToolBarArt() { } | |
250 | virtual ~wxAuiToolBarArt() { } | |
251 | ||
252 | virtual wxAuiToolBarArt* Clone() = 0; | |
253 | virtual void SetFlags(unsigned int flags) = 0; | |
254 | virtual void SetFont(const wxFont& font) = 0; | |
255 | virtual void SetTextOrientation(int orientation) = 0; | |
256 | ||
257 | virtual void DrawBackground( | |
258 | wxDC& dc, | |
259 | wxWindow* wnd, | |
260 | const wxRect& rect) = 0; | |
261 | ||
262 | virtual void DrawLabel( | |
263 | wxDC& dc, | |
264 | wxWindow* wnd, | |
265 | const wxAuiToolBarItem& item, | |
266 | const wxRect& rect) = 0; | |
267 | ||
268 | virtual void DrawButton( | |
269 | wxDC& dc, | |
270 | wxWindow* wnd, | |
271 | const wxAuiToolBarItem& item, | |
272 | const wxRect& rect) = 0; | |
273 | ||
274 | virtual void DrawDropDownButton( | |
275 | wxDC& dc, | |
276 | wxWindow* wnd, | |
277 | const wxAuiToolBarItem& item, | |
278 | const wxRect& rect) = 0; | |
279 | ||
280 | virtual void DrawControlLabel( | |
281 | wxDC& dc, | |
282 | wxWindow* wnd, | |
283 | const wxAuiToolBarItem& item, | |
284 | const wxRect& rect) = 0; | |
285 | ||
286 | virtual void DrawSeparator( | |
287 | wxDC& dc, | |
288 | wxWindow* wnd, | |
289 | const wxRect& rect) = 0; | |
290 | ||
291 | virtual void DrawGripper( | |
292 | wxDC& dc, | |
293 | wxWindow* wnd, | |
294 | const wxRect& rect) = 0; | |
295 | ||
296 | virtual void DrawOverflowButton( | |
297 | wxDC& dc, | |
298 | wxWindow* wnd, | |
299 | const wxRect& rect, | |
300 | int state) = 0; | |
301 | ||
302 | virtual wxSize GetLabelSize( | |
303 | wxDC& dc, | |
304 | wxWindow* wnd, | |
305 | const wxAuiToolBarItem& item) = 0; | |
306 | ||
307 | virtual wxSize GetToolSize( | |
308 | wxDC& dc, | |
309 | wxWindow* wnd, | |
310 | const wxAuiToolBarItem& item) = 0; | |
311 | ||
312 | virtual int GetElementSize(int element_id) = 0; | |
313 | virtual void SetElementSize(int element_id, int size) = 0; | |
314 | ||
315 | virtual int ShowDropDown( | |
316 | wxWindow* wnd, | |
317 | const wxAuiToolBarItemArray& items) = 0; | |
318 | }; | |
319 | ||
320 | ||
321 | ||
322 | class WXDLLIMPEXP_AUI wxAuiDefaultToolBarArt : public wxAuiToolBarArt | |
323 | { | |
324 | ||
325 | public: | |
326 | ||
327 | wxAuiDefaultToolBarArt(); | |
328 | virtual ~wxAuiDefaultToolBarArt(); | |
329 | ||
330 | virtual wxAuiToolBarArt* Clone(); | |
331 | virtual void SetFlags(unsigned int flags); | |
332 | virtual void SetFont(const wxFont& font); | |
333 | virtual void SetTextOrientation(int orientation); | |
334 | ||
335 | virtual void DrawBackground( | |
336 | wxDC& dc, | |
337 | wxWindow* wnd, | |
338 | const wxRect& rect); | |
339 | ||
340 | virtual void DrawLabel( | |
341 | wxDC& dc, | |
342 | wxWindow* wnd, | |
343 | const wxAuiToolBarItem& item, | |
344 | const wxRect& rect); | |
345 | ||
346 | virtual void DrawButton( | |
347 | wxDC& dc, | |
348 | wxWindow* wnd, | |
349 | const wxAuiToolBarItem& item, | |
350 | const wxRect& rect); | |
351 | ||
352 | virtual void DrawDropDownButton( | |
353 | wxDC& dc, | |
354 | wxWindow* wnd, | |
355 | const wxAuiToolBarItem& item, | |
356 | const wxRect& rect); | |
357 | ||
358 | virtual void DrawControlLabel( | |
359 | wxDC& dc, | |
360 | wxWindow* wnd, | |
361 | const wxAuiToolBarItem& item, | |
362 | const wxRect& rect); | |
363 | ||
364 | virtual void DrawSeparator( | |
365 | wxDC& dc, | |
366 | wxWindow* wnd, | |
367 | const wxRect& rect); | |
368 | ||
369 | virtual void DrawGripper( | |
370 | wxDC& dc, | |
371 | wxWindow* wnd, | |
372 | const wxRect& rect); | |
373 | ||
374 | virtual void DrawOverflowButton( | |
375 | wxDC& dc, | |
376 | wxWindow* wnd, | |
377 | const wxRect& rect, | |
378 | int state); | |
379 | ||
380 | virtual wxSize GetLabelSize( | |
381 | wxDC& dc, | |
382 | wxWindow* wnd, | |
383 | const wxAuiToolBarItem& item); | |
384 | ||
385 | virtual wxSize GetToolSize( | |
386 | wxDC& dc, | |
387 | wxWindow* wnd, | |
388 | const wxAuiToolBarItem& item); | |
389 | ||
390 | virtual int GetElementSize(int element); | |
391 | virtual void SetElementSize(int element_id, int size); | |
392 | ||
393 | virtual int ShowDropDown(wxWindow* wnd, | |
394 | const wxAuiToolBarItemArray& items); | |
395 | ||
396 | protected: | |
397 | ||
398 | wxBitmap m_button_dropdown_bmp; | |
399 | wxBitmap m_disabled_button_dropdown_bmp; | |
400 | wxBitmap m_overflow_bmp; | |
401 | wxBitmap m_disabled_overflow_bmp; | |
402 | wxColour m_base_colour; | |
403 | wxColour m_highlight_colour; | |
404 | wxFont m_font; | |
405 | unsigned int m_flags; | |
406 | int m_text_orientation; | |
407 | ||
408 | wxPen m_gripper_pen1; | |
409 | wxPen m_gripper_pen2; | |
410 | wxPen m_gripper_pen3; | |
411 | ||
412 | int m_separator_size; | |
413 | int m_gripper_size; | |
414 | int m_overflow_size; | |
415 | }; | |
416 | ||
417 | ||
418 | ||
419 | ||
420 | class WXDLLIMPEXP_AUI wxAuiToolBar : public wxControl | |
421 | { | |
422 | public: | |
423 | ||
424 | wxAuiToolBar(wxWindow* parent, | |
425 | wxWindowID id = -1, | |
426 | const wxPoint& position = wxDefaultPosition, | |
427 | const wxSize& size = wxDefaultSize, | |
428 | long style = wxAUI_TB_DEFAULT_STYLE); | |
429 | ~wxAuiToolBar(); | |
430 | ||
431 | void SetWindowStyleFlag(long style); | |
432 | ||
433 | void SetArtProvider(wxAuiToolBarArt* art); | |
434 | wxAuiToolBarArt* GetArtProvider() const; | |
435 | ||
436 | bool SetFont(const wxFont& font); | |
437 | ||
438 | ||
439 | void AddTool(int tool_id, | |
440 | const wxString& label, | |
441 | const wxBitmap& bitmap, | |
442 | const wxString& short_help_string = wxEmptyString, | |
443 | wxItemKind kind = wxITEM_NORMAL); | |
444 | ||
445 | void AddTool(int tool_id, | |
446 | const wxString& label, | |
447 | const wxBitmap& bitmap, | |
448 | const wxBitmap& disabled_bitmap, | |
449 | wxItemKind kind, | |
450 | const wxString& short_help_string, | |
451 | const wxString& long_help_string, | |
452 | wxObject* client_data); | |
453 | ||
454 | void AddTool(int tool_id, | |
455 | const wxBitmap& bitmap, | |
456 | const wxBitmap& disabled_bitmap, | |
457 | bool toggle = false, | |
458 | wxObject* client_data = NULL, | |
459 | const wxString& short_help_string = wxEmptyString, | |
460 | const wxString& long_help_string = wxEmptyString) | |
461 | { | |
462 | AddTool(tool_id, | |
463 | wxEmptyString, | |
464 | bitmap, | |
465 | disabled_bitmap, | |
466 | toggle ? wxITEM_CHECK : wxITEM_NORMAL, | |
467 | short_help_string, | |
468 | long_help_string, | |
469 | client_data); | |
470 | } | |
471 | ||
472 | void AddLabel(int tool_id, | |
473 | const wxString& label = wxEmptyString, | |
474 | const int width = -1); | |
475 | void AddControl(wxControl* control, | |
476 | const wxString& label = wxEmptyString); | |
477 | void AddSeparator(); | |
478 | void AddSpacer(int pixels); | |
479 | void AddStretchSpacer(int proportion = 1); | |
480 | ||
481 | bool Realize(); | |
482 | ||
483 | wxControl* FindControl(int window_id); | |
484 | wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const; | |
485 | wxAuiToolBarItem* FindToolByIndex(int idx) const; | |
486 | wxAuiToolBarItem* FindTool(int tool_id) const; | |
487 | ||
488 | void ClearTools() { Clear() ; } | |
489 | void Clear(); | |
490 | bool DeleteTool(int tool_id); | |
491 | bool DeleteByIndex(int tool_id); | |
492 | ||
493 | size_t GetToolCount() const; | |
494 | int GetToolPos(int tool_id) const { return GetToolIndex(tool_id); } | |
495 | int GetToolIndex(int tool_id) const; | |
496 | bool GetToolFits(int tool_id) const; | |
497 | wxRect GetToolRect(int tool_id) const; | |
498 | bool GetToolFitsByIndex(int tool_id) const; | |
499 | bool GetToolBarFits() const; | |
500 | ||
501 | void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); } | |
502 | void SetMargins(int x, int y) { SetMargins(x, x, y, y); } | |
503 | void SetMargins(int left, int right, int top, int bottom); | |
504 | ||
505 | void SetToolBitmapSize(const wxSize& size); | |
506 | wxSize GetToolBitmapSize() const; | |
507 | ||
508 | bool GetOverflowVisible() const; | |
509 | void SetOverflowVisible(bool visible); | |
510 | ||
511 | bool GetGripperVisible() const; | |
512 | void SetGripperVisible(bool visible); | |
513 | ||
514 | void ToggleTool(int tool_id, bool state); | |
515 | bool GetToolToggled(int tool_id) const; | |
516 | ||
517 | void EnableTool(int tool_id, bool state); | |
518 | bool GetToolEnabled(int tool_id) const; | |
519 | ||
520 | void SetToolDropDown(int tool_id, bool dropdown); | |
521 | bool GetToolDropDown(int tool_id) const; | |
522 | ||
523 | void SetToolBorderPadding(int padding); | |
524 | int GetToolBorderPadding() const; | |
525 | ||
526 | void SetToolTextOrientation(int orientation); | |
527 | int GetToolTextOrientation() const; | |
528 | ||
529 | void SetToolPacking(int packing); | |
530 | int GetToolPacking() const; | |
531 | ||
532 | void SetToolProportion(int tool_id, int proportion); | |
533 | int GetToolProportion(int tool_id) const; | |
534 | ||
535 | void SetToolSeparation(int separation); | |
536 | int GetToolSeparation() const; | |
537 | ||
538 | void SetToolSticky(int tool_id, bool sticky); | |
539 | bool GetToolSticky(int tool_id) const; | |
540 | ||
541 | wxString GetToolLabel(int tool_id) const; | |
542 | void SetToolLabel(int tool_id, const wxString& label); | |
543 | ||
544 | wxBitmap GetToolBitmap(int tool_id) const; | |
545 | void SetToolBitmap(int tool_id, const wxBitmap& bitmap); | |
546 | ||
547 | wxString GetToolShortHelp(int tool_id) const; | |
548 | void SetToolShortHelp(int tool_id, const wxString& help_string); | |
549 | ||
550 | wxString GetToolLongHelp(int tool_id) const; | |
551 | void SetToolLongHelp(int tool_id, const wxString& help_string); | |
552 | ||
553 | void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend, | |
554 | const wxAuiToolBarItemArray& append); | |
555 | ||
556 | protected: | |
557 | ||
558 | virtual void OnCustomRender(wxDC& WXUNUSED(dc), | |
559 | const wxAuiToolBarItem& WXUNUSED(item), | |
560 | const wxRect& WXUNUSED(rect)) { } | |
561 | ||
562 | protected: | |
563 | ||
564 | void DoIdleUpdate(); | |
565 | void SetOrientation(int orientation); | |
566 | void SetHoverItem(wxAuiToolBarItem* item); | |
567 | void SetPressedItem(wxAuiToolBarItem* item); | |
568 | void RefreshOverflowState(); | |
569 | ||
570 | int GetOverflowState() const; | |
571 | wxRect GetOverflowRect() const; | |
572 | wxSize GetLabelSize(const wxString& label); | |
573 | wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const; | |
574 | ||
575 | void DoSetSize(int x, | |
576 | int y, | |
577 | int width, | |
578 | int height, | |
579 | int sizeFlags = wxSIZE_AUTO); | |
580 | ||
581 | protected: // handlers | |
582 | ||
583 | void OnSize(wxSizeEvent& evt); | |
584 | void OnIdle(wxIdleEvent& evt); | |
585 | void OnPaint(wxPaintEvent& evt); | |
586 | void OnEraseBackground(wxEraseEvent& evt); | |
587 | void OnLeftDown(wxMouseEvent& evt); | |
588 | void OnLeftUp(wxMouseEvent& evt); | |
589 | void OnRightDown(wxMouseEvent& evt); | |
590 | void OnRightUp(wxMouseEvent& evt); | |
591 | void OnMiddleDown(wxMouseEvent& evt); | |
592 | void OnMiddleUp(wxMouseEvent& evt); | |
593 | void OnMotion(wxMouseEvent& evt); | |
594 | void OnLeaveWindow(wxMouseEvent& evt); | |
595 | void OnSetCursor(wxSetCursorEvent& evt); | |
596 | ||
597 | protected: | |
598 | ||
599 | wxAuiToolBarItemArray m_items; // array of toolbar items | |
600 | wxAuiToolBarArt* m_art; // art provider | |
601 | wxBoxSizer* m_sizer; // main sizer for toolbar | |
602 | wxAuiToolBarItem* m_action_item; // item that's being acted upon (pressed) | |
603 | wxAuiToolBarItem* m_tip_item; // item that has its tooltip shown | |
604 | wxBitmap m_bitmap; // double-buffer bitmap | |
605 | wxSizerItem* m_gripper_sizer_item; | |
606 | wxSizerItem* m_overflow_sizer_item; | |
607 | wxSize m_absolute_min_size; | |
608 | wxPoint m_action_pos; // position of left-mouse down | |
609 | wxAuiToolBarItemArray m_custom_overflow_prepend; | |
610 | wxAuiToolBarItemArray m_custom_overflow_append; | |
611 | ||
612 | int m_button_width; | |
613 | int m_button_height; | |
614 | int m_sizer_element_count; | |
615 | int m_left_padding; | |
616 | int m_right_padding; | |
617 | int m_top_padding; | |
618 | int m_bottom_padding; | |
619 | int m_tool_packing; | |
620 | int m_tool_border_padding; | |
621 | int m_tool_text_orientation; | |
622 | int m_overflow_state; | |
623 | bool m_dragging; | |
624 | bool m_gripper_visible; | |
625 | bool m_overflow_visible; | |
626 | long m_style; | |
627 | ||
628 | DECLARE_EVENT_TABLE() | |
629 | DECLARE_CLASS(wxAuiToolBar) | |
630 | }; | |
631 | ||
632 | ||
633 | ||
634 | ||
635 | // wx event machinery | |
636 | ||
637 | #ifndef SWIG | |
638 | ||
639 | BEGIN_DECLARE_EVENT_TYPES() | |
640 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, 0) | |
641 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, 0) | |
642 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, 0) | |
643 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, 0) | |
644 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, 0) | |
645 | END_DECLARE_EVENT_TYPES() | |
646 | ||
647 | typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&); | |
648 | ||
649 | #define wxAuiToolBarEventHandler(func) \ | |
650 | (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiToolBarEventFunction, &func) | |
651 | ||
652 | #define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \ | |
653 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn)) | |
654 | #define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \ | |
655 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn)) | |
656 | #define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \ | |
657 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn)) | |
658 | #define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \ | |
659 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn)) | |
660 | #define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \ | |
661 | wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn)) | |
662 | ||
663 | #else | |
664 | ||
665 | // wxpython/swig event work | |
666 | %constant wxEventType wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN; | |
667 | %constant wxEventType wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK; | |
668 | %constant wxEventType wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK; | |
669 | %constant wxEventType wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK; | |
670 | %constant wxEventType wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG; | |
671 | ||
672 | %pythoncode { | |
673 | EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, 1 ) | |
674 | EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, 1 ) | |
675 | EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, 1 ) | |
676 | EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, 1 ) | |
677 | EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, 1 ) | |
678 | } | |
679 | #endif // SWIG | |
680 | ||
681 | #endif // wxUSE_AUI | |
682 | #endif // _WX_AUIBAR_H_ | |
683 |