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