]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/auibar.h
Document wxKill(wxSIGTERM) reliance on having an open window in wxMSW.
[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,
526502d1 42 wxAUI_TB_PLAIN_BACKGROUND = 1 << 8,
9578058d 43 wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
e5dcae09 44 wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL),
1154f91b
BW
45 wxAUI_TB_DEFAULT_STYLE = 0
46};
47
48enum wxAuiToolBarArtSetting
49{
50 wxAUI_TBART_SEPARATOR_SIZE = 0,
51 wxAUI_TBART_GRIPPER_SIZE = 1,
52 wxAUI_TBART_OVERFLOW_SIZE = 2
53};
54
55enum wxAuiToolBarToolTextOrientation
56{
57 wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented
58 wxAUI_TBTOOL_TEXT_RIGHT = 1,
59 wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented
60 wxAUI_TBTOOL_TEXT_BOTTOM = 3
61};
62
63
64// aui toolbar event class
65
66class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent
67{
68public:
9a29fe70
VZ
69 wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL,
70 int winId = 0)
71 : wxNotifyEvent(commandType, winId)
1154f91b 72 {
9a29fe70
VZ
73 m_isDropdownClicked = false;
74 m_clickPt = wxPoint(-1, -1);
75 m_rect = wxRect(-1,-1, 0, 0);
76 m_toolId = -1;
1154f91b
BW
77 }
78#ifndef SWIG
79 wxAuiToolBarEvent(const wxAuiToolBarEvent& c) : wxNotifyEvent(c)
80 {
9a29fe70
VZ
81 m_isDropdownClicked = c.m_isDropdownClicked;
82 m_clickPt = c.m_clickPt;
83 m_rect = c.m_rect;
84 m_toolId = c.m_toolId;
1154f91b
BW
85 }
86#endif
87 wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); }
88
9a29fe70
VZ
89 bool IsDropDownClicked() const { return m_isDropdownClicked; }
90 void SetDropDownClicked(bool c) { m_isDropdownClicked = c; }
9da38912 91
9a29fe70
VZ
92 wxPoint GetClickPoint() const { return m_clickPt; }
93 void SetClickPoint(const wxPoint& p) { m_clickPt = p; }
9da38912 94
9a29fe70
VZ
95 wxRect GetItemRect() const { return m_rect; }
96 void SetItemRect(const wxRect& r) { m_rect = r; }
9da38912 97
9a29fe70
VZ
98 int GetToolId() const { return m_toolId; }
99 void SetToolId(int toolId) { m_toolId = toolId; }
9da38912 100
e42f2c16
BW
101private:
102
9a29fe70
VZ
103 bool m_isDropdownClicked;
104 wxPoint m_clickPt;
105 wxRect m_rect;
106 int m_toolId;
9da38912 107
1154f91b
BW
108private:
109 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent)
1154f91b
BW
110};
111
112
113class WXDLLIMPEXP_AUI wxAuiToolBarItem
114{
e42f2c16 115 friend class wxAuiToolBar;
8e190381 116
1154f91b
BW
117public:
118
119 wxAuiToolBarItem()
120 {
9a29fe70
VZ
121 m_window = NULL;
122 m_sizerItem = NULL;
123 m_spacerPixels = 0;
124 m_toolId = 0;
125 m_kind = wxITEM_NORMAL;
126 m_state = 0; // normal, enabled
127 m_proportion = 0;
128 m_active = true;
129 m_dropDown = true;
130 m_sticky = true;
131 m_userData = 0;
132 m_alignment = wxALIGN_CENTER;
1154f91b 133 }
9da38912 134
1154f91b
BW
135 wxAuiToolBarItem(const wxAuiToolBarItem& c)
136 {
137 Assign(c);
138 }
9da38912 139
1154f91b
BW
140 wxAuiToolBarItem& operator=(const wxAuiToolBarItem& c)
141 {
142 Assign(c);
143 return *this;
144 }
9da38912 145
1154f91b
BW
146 void Assign(const wxAuiToolBarItem& c)
147 {
9a29fe70
VZ
148 m_window = c.m_window;
149 m_label = c.m_label;
150 m_bitmap = c.m_bitmap;
151 m_disabledBitmap = c.m_disabledBitmap;
152 m_hoverBitmap = c.m_hoverBitmap;
153 m_shortHelp = c.m_shortHelp;
154 m_longHelp = c.m_longHelp;
155 m_sizerItem = c.m_sizerItem;
156 m_minSize = c.m_minSize;
157 m_spacerPixels = c.m_spacerPixels;
158 m_toolId = c.m_toolId;
159 m_kind = c.m_kind;
160 m_state = c.m_state;
161 m_proportion = c.m_proportion;
162 m_active = c.m_active;
163 m_dropDown = c.m_dropDown;
164 m_sticky = c.m_sticky;
165 m_userData = c.m_userData;
166 m_alignment = c.m_alignment;
1154f91b 167 }
8e190381
FM
168
169
9a29fe70
VZ
170 void SetWindow(wxWindow* w) { m_window = w; }
171 wxWindow* GetWindow() { return m_window; }
8e190381 172
9a29fe70
VZ
173 void SetId(int newId) { m_toolId = newId; }
174 int GetId() const { return m_toolId; }
8e190381 175
9a29fe70
VZ
176 void SetKind(int newKind) { m_kind = newKind; }
177 int GetKind() const { return m_kind; }
8e190381 178
9a29fe70
VZ
179 void SetState(int newState) { m_state = newState; }
180 int GetState() const { return m_state; }
8e190381 181
9a29fe70
VZ
182 void SetSizerItem(wxSizerItem* s) { m_sizerItem = s; }
183 wxSizerItem* GetSizerItem() const { return m_sizerItem; }
8e190381 184
9a29fe70
VZ
185 void SetLabel(const wxString& s) { m_label = s; }
186 const wxString& GetLabel() const { return m_label; }
8e190381 187
9a29fe70
VZ
188 void SetBitmap(const wxBitmap& bmp) { m_bitmap = bmp; }
189 const wxBitmap& GetBitmap() const { return m_bitmap; }
8e190381 190
9a29fe70
VZ
191 void SetDisabledBitmap(const wxBitmap& bmp) { m_disabledBitmap = bmp; }
192 const wxBitmap& GetDisabledBitmap() const { return m_disabledBitmap; }
8e190381 193
9a29fe70
VZ
194 void SetHoverBitmap(const wxBitmap& bmp) { m_hoverBitmap = bmp; }
195 const wxBitmap& GetHoverBitmap() const { return m_hoverBitmap; }
8e190381 196
9a29fe70
VZ
197 void SetShortHelp(const wxString& s) { m_shortHelp = s; }
198 const wxString& GetShortHelp() const { return m_shortHelp; }
8e190381 199
9a29fe70
VZ
200 void SetLongHelp(const wxString& s) { m_longHelp = s; }
201 const wxString& GetLongHelp() const { return m_longHelp; }
8e190381 202
9a29fe70
VZ
203 void SetMinSize(const wxSize& s) { m_minSize = s; }
204 const wxSize& GetMinSize() const { return m_minSize; }
8e190381 205
9a29fe70
VZ
206 void SetSpacerPixels(int s) { m_spacerPixels = s; }
207 int GetSpacerPixels() const { return m_spacerPixels; }
8e190381 208
9a29fe70
VZ
209 void SetProportion(int p) { m_proportion = p; }
210 int GetProportion() const { return m_proportion; }
8e190381 211
9a29fe70
VZ
212 void SetActive(bool b) { m_active = b; }
213 bool IsActive() const { return m_active; }
8e190381 214
72ae0b51
VZ
215 void SetHasDropDown(bool b)
216 {
217 wxCHECK_RET( !b || m_kind == wxITEM_NORMAL,
218 wxS("Only normal tools can have drop downs") );
219
220 m_dropDown = b;
221 }
222
9a29fe70 223 bool HasDropDown() const { return m_dropDown; }
8e190381 224
9a29fe70
VZ
225 void SetSticky(bool b) { m_sticky = b; }
226 bool IsSticky() const { return m_sticky; }
8e190381 227
9a29fe70
VZ
228 void SetUserData(long l) { m_userData = l; }
229 long GetUserData() const { return m_userData; }
9da38912 230
9a29fe70
VZ
231 void SetAlignment(int l) { m_alignment = l; }
232 int GetAlignment() const { return m_alignment; }
0eefa659 233
e42f2c16 234private:
9da38912 235
9a29fe70
VZ
236 wxWindow* m_window; // item's associated window
237 wxString m_label; // label displayed on the item
238 wxBitmap m_bitmap; // item's bitmap
239 wxBitmap m_disabledBitmap; // item's disabled bitmap
240 wxBitmap m_hoverBitmap; // item's hover bitmap
241 wxString m_shortHelp; // short help (for tooltip)
242 wxString m_longHelp; // long help (for status bar)
243 wxSizerItem* m_sizerItem; // sizer item
244 wxSize m_minSize; // item's minimum size
245 int m_spacerPixels; // size of a spacer
246 int m_toolId; // item's id
247 int m_kind; // item's kind
248 int m_state; // state
249 int m_proportion; // proportion
250 bool m_active; // true if the item is currently active
251 bool m_dropDown; // true if the item has a dropdown button
252 bool m_sticky; // overrides button states if true (always active)
253 long m_userData; // user-specified data
254 int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
1154f91b
BW
255};
256
257#ifndef SWIG
258WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI);
259#endif
260
261
262
263
264// tab art class
265
266class WXDLLIMPEXP_AUI wxAuiToolBarArt
267{
268public:
269
270 wxAuiToolBarArt() { }
271 virtual ~wxAuiToolBarArt() { }
9da38912 272
1154f91b 273 virtual wxAuiToolBarArt* Clone() = 0;
9da38912 274 virtual void SetFlags(unsigned int flags) = 0;
8bc10f32 275 virtual unsigned int GetFlags() = 0;
1154f91b 276 virtual void SetFont(const wxFont& font) = 0;
8bc10f32 277 virtual wxFont GetFont() = 0;
1154f91b 278 virtual void SetTextOrientation(int orientation) = 0;
8bc10f32 279 virtual int GetTextOrientation() = 0;
1154f91b
BW
280
281 virtual void DrawBackground(
282 wxDC& dc,
283 wxWindow* wnd,
9da38912
VZ
284 const wxRect& rect) = 0;
285
526502d1
VZ
286 virtual void DrawPlainBackground(
287 wxDC& dc,
288 wxWindow* wnd,
289 const wxRect& rect) = 0;
290
1154f91b
BW
291 virtual void DrawLabel(
292 wxDC& dc,
293 wxWindow* wnd,
294 const wxAuiToolBarItem& item,
295 const wxRect& rect) = 0;
9da38912 296
1154f91b
BW
297 virtual void DrawButton(
298 wxDC& dc,
299 wxWindow* wnd,
300 const wxAuiToolBarItem& item,
301 const wxRect& rect) = 0;
9da38912 302
1154f91b
BW
303 virtual void DrawDropDownButton(
304 wxDC& dc,
305 wxWindow* wnd,
306 const wxAuiToolBarItem& item,
307 const wxRect& rect) = 0;
9da38912 308
1154f91b
BW
309 virtual void DrawControlLabel(
310 wxDC& dc,
311 wxWindow* wnd,
312 const wxAuiToolBarItem& item,
313 const wxRect& rect) = 0;
9da38912 314
1154f91b
BW
315 virtual void DrawSeparator(
316 wxDC& dc,
317 wxWindow* wnd,
318 const wxRect& rect) = 0;
9da38912 319
1154f91b
BW
320 virtual void DrawGripper(
321 wxDC& dc,
322 wxWindow* wnd,
323 const wxRect& rect) = 0;
324
325 virtual void DrawOverflowButton(
326 wxDC& dc,
327 wxWindow* wnd,
328 const wxRect& rect,
329 int state) = 0;
9da38912 330
1154f91b
BW
331 virtual wxSize GetLabelSize(
332 wxDC& dc,
333 wxWindow* wnd,
334 const wxAuiToolBarItem& item) = 0;
9da38912 335
1154f91b
BW
336 virtual wxSize GetToolSize(
337 wxDC& dc,
338 wxWindow* wnd,
339 const wxAuiToolBarItem& item) = 0;
9da38912 340
9a29fe70
VZ
341 virtual int GetElementSize(int elementId) = 0;
342 virtual void SetElementSize(int elementId, int size) = 0;
9da38912 343
1154f91b
BW
344 virtual int ShowDropDown(
345 wxWindow* wnd,
346 const wxAuiToolBarItemArray& items) = 0;
347};
348
349
350
351class WXDLLIMPEXP_AUI wxAuiDefaultToolBarArt : public wxAuiToolBarArt
352{
353
354public:
355
356 wxAuiDefaultToolBarArt();
357 virtual ~wxAuiDefaultToolBarArt();
9da38912 358
1154f91b
BW
359 virtual wxAuiToolBarArt* Clone();
360 virtual void SetFlags(unsigned int flags);
8bc10f32 361 virtual unsigned int GetFlags();
1154f91b 362 virtual void SetFont(const wxFont& font);
8bc10f32 363 virtual wxFont GetFont();
1154f91b 364 virtual void SetTextOrientation(int orientation);
8bc10f32 365 virtual int GetTextOrientation();
1154f91b
BW
366
367 virtual void DrawBackground(
368 wxDC& dc,
369 wxWindow* wnd,
9da38912
VZ
370 const wxRect& rect);
371
526502d1
VZ
372 virtual void DrawPlainBackground(wxDC& dc,
373 wxWindow* wnd,
374 const wxRect& rect);
375
1154f91b
BW
376 virtual void DrawLabel(
377 wxDC& dc,
378 wxWindow* wnd,
379 const wxAuiToolBarItem& item,
380 const wxRect& rect);
9da38912 381
1154f91b
BW
382 virtual void DrawButton(
383 wxDC& dc,
384 wxWindow* wnd,
385 const wxAuiToolBarItem& item,
386 const wxRect& rect);
9da38912 387
1154f91b
BW
388 virtual void DrawDropDownButton(
389 wxDC& dc,
390 wxWindow* wnd,
391 const wxAuiToolBarItem& item,
392 const wxRect& rect);
9da38912 393
1154f91b
BW
394 virtual void DrawControlLabel(
395 wxDC& dc,
396 wxWindow* wnd,
397 const wxAuiToolBarItem& item,
398 const wxRect& rect);
9da38912 399
1154f91b
BW
400 virtual void DrawSeparator(
401 wxDC& dc,
402 wxWindow* wnd,
403 const wxRect& rect);
9da38912 404
1154f91b
BW
405 virtual void DrawGripper(
406 wxDC& dc,
407 wxWindow* wnd,
408 const wxRect& rect);
9da38912 409
1154f91b
BW
410 virtual void DrawOverflowButton(
411 wxDC& dc,
412 wxWindow* wnd,
413 const wxRect& rect,
414 int state);
9da38912 415
1154f91b
BW
416 virtual wxSize GetLabelSize(
417 wxDC& dc,
418 wxWindow* wnd,
419 const wxAuiToolBarItem& item);
9da38912 420
1154f91b
BW
421 virtual wxSize GetToolSize(
422 wxDC& dc,
423 wxWindow* wnd,
424 const wxAuiToolBarItem& item);
9da38912 425
1154f91b 426 virtual int GetElementSize(int element);
9a29fe70 427 virtual void SetElementSize(int elementId, int size);
1154f91b
BW
428
429 virtual int ShowDropDown(wxWindow* wnd,
430 const wxAuiToolBarItemArray& items);
431
432protected:
433
9a29fe70
VZ
434 wxBitmap m_buttonDropDownBmp;
435 wxBitmap m_disabledButtonDropDownBmp;
436 wxBitmap m_overflowBmp;
437 wxBitmap m_disabledOverflowBmp;
438 wxColour m_baseColour;
439 wxColour m_highlightColour;
1154f91b
BW
440 wxFont m_font;
441 unsigned int m_flags;
9a29fe70 442 int m_textOrientation;
9da38912 443
9a29fe70
VZ
444 wxPen m_gripperPen1;
445 wxPen m_gripperPen2;
446 wxPen m_gripperPen3;
9da38912 447
9a29fe70
VZ
448 int m_separatorSize;
449 int m_gripperSize;
450 int m_overflowSize;
1154f91b
BW
451};
452
453
454
455
456class WXDLLIMPEXP_AUI wxAuiToolBar : public wxControl
457{
458public:
46e67202 459 wxAuiToolBar() { Init(); }
1154f91b
BW
460
461 wxAuiToolBar(wxWindow* parent,
46e67202
VZ
462 wxWindowID id = wxID_ANY,
463 const wxPoint& pos = wxDefaultPosition,
1154f91b 464 const wxSize& size = wxDefaultSize,
46e67202
VZ
465 long style = wxAUI_TB_DEFAULT_STYLE)
466 {
467 Init();
468 Create(parent, id, pos, size, style);
469 }
470
7bce8439 471 virtual ~wxAuiToolBar();
9da38912 472
46e67202
VZ
473 bool Create(wxWindow* parent,
474 wxWindowID id = wxID_ANY,
475 const wxPoint& pos = wxDefaultPosition,
476 const wxSize& size = wxDefaultSize,
873271f0 477 long style = wxAUI_TB_DEFAULT_STYLE);
46e67202 478
a69b365f 479 virtual void SetWindowStyleFlag(long style);
9da38912 480
1154f91b
BW
481 void SetArtProvider(wxAuiToolBarArt* art);
482 wxAuiToolBarArt* GetArtProvider() const;
483
484 bool SetFont(const wxFont& font);
9da38912 485
1154f91b 486
9a29fe70 487 wxAuiToolBarItem* AddTool(int toolId,
1154f91b
BW
488 const wxString& label,
489 const wxBitmap& bitmap,
9a29fe70 490 const wxString& shortHelpString = wxEmptyString,
1154f91b 491 wxItemKind kind = wxITEM_NORMAL);
9da38912 492
9a29fe70 493 wxAuiToolBarItem* AddTool(int toolId,
1154f91b
BW
494 const wxString& label,
495 const wxBitmap& bitmap,
9a29fe70 496 const wxBitmap& disabledBitmap,
1154f91b 497 wxItemKind kind,
9a29fe70
VZ
498 const wxString& shortHelpString,
499 const wxString& longHelpString,
500 wxObject* clientData);
9da38912 501
9a29fe70 502 wxAuiToolBarItem* AddTool(int toolId,
1154f91b 503 const wxBitmap& bitmap,
9a29fe70 504 const wxBitmap& disabledBitmap,
1154f91b 505 bool toggle = false,
9a29fe70
VZ
506 wxObject* clientData = NULL,
507 const wxString& shortHelpString = wxEmptyString,
508 const wxString& longHelpString = wxEmptyString)
1154f91b 509 {
9a29fe70 510 return AddTool(toolId,
1154f91b
BW
511 wxEmptyString,
512 bitmap,
9a29fe70 513 disabledBitmap,
1154f91b 514 toggle ? wxITEM_CHECK : wxITEM_NORMAL,
9a29fe70
VZ
515 shortHelpString,
516 longHelpString,
517 clientData);
1154f91b 518 }
9da38912 519
9a29fe70 520 wxAuiToolBarItem* AddLabel(int toolId,
1154f91b
BW
521 const wxString& label = wxEmptyString,
522 const int width = -1);
7bce8439 523 wxAuiToolBarItem* AddControl(wxControl* control,
1154f91b 524 const wxString& label = wxEmptyString);
7bce8439
BW
525 wxAuiToolBarItem* AddSeparator();
526 wxAuiToolBarItem* AddSpacer(int pixels);
527 wxAuiToolBarItem* AddStretchSpacer(int proportion = 1);
9da38912 528
1154f91b
BW
529 bool Realize();
530
9a29fe70 531 wxControl* FindControl(int windowId);
1154f91b
BW
532 wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const;
533 wxAuiToolBarItem* FindToolByIndex(int idx) const;
9a29fe70 534 wxAuiToolBarItem* FindTool(int toolId) const;
9da38912 535
1154f91b
BW
536 void ClearTools() { Clear() ; }
537 void Clear();
9a29fe70
VZ
538 bool DeleteTool(int toolId);
539 bool DeleteByIndex(int toolId);
9da38912 540
1154f91b 541 size_t GetToolCount() const;
9a29fe70
VZ
542 int GetToolPos(int toolId) const { return GetToolIndex(toolId); }
543 int GetToolIndex(int toolId) const;
544 bool GetToolFits(int toolId) const;
545 wxRect GetToolRect(int toolId) const;
546 bool GetToolFitsByIndex(int toolId) const;
1154f91b 547 bool GetToolBarFits() const;
9da38912 548
1154f91b
BW
549 void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); }
550 void SetMargins(int x, int y) { SetMargins(x, x, y, y); }
551 void SetMargins(int left, int right, int top, int bottom);
9da38912 552
1154f91b
BW
553 void SetToolBitmapSize(const wxSize& size);
554 wxSize GetToolBitmapSize() const;
555
556 bool GetOverflowVisible() const;
557 void SetOverflowVisible(bool visible);
9da38912 558
1154f91b
BW
559 bool GetGripperVisible() const;
560 void SetGripperVisible(bool visible);
9da38912 561
9a29fe70
VZ
562 void ToggleTool(int toolId, bool state);
563 bool GetToolToggled(int toolId) const;
9da38912 564
9a29fe70
VZ
565 void EnableTool(int toolId, bool state);
566 bool GetToolEnabled(int toolId) const;
9da38912 567
9a29fe70
VZ
568 void SetToolDropDown(int toolId, bool dropdown);
569 bool GetToolDropDown(int toolId) const;
1154f91b
BW
570
571 void SetToolBorderPadding(int padding);
572 int GetToolBorderPadding() const;
9da38912 573
1154f91b
BW
574 void SetToolTextOrientation(int orientation);
575 int GetToolTextOrientation() const;
9da38912 576
1154f91b
BW
577 void SetToolPacking(int packing);
578 int GetToolPacking() const;
9da38912 579
9a29fe70
VZ
580 void SetToolProportion(int toolId, int proportion);
581 int GetToolProportion(int toolId) const;
9da38912 582
1154f91b
BW
583 void SetToolSeparation(int separation);
584 int GetToolSeparation() const;
9da38912 585
9a29fe70
VZ
586 void SetToolSticky(int toolId, bool sticky);
587 bool GetToolSticky(int toolId) const;
9da38912 588
9a29fe70
VZ
589 wxString GetToolLabel(int toolId) const;
590 void SetToolLabel(int toolId, const wxString& label);
9da38912 591
9a29fe70
VZ
592 wxBitmap GetToolBitmap(int toolId) const;
593 void SetToolBitmap(int toolId, const wxBitmap& bitmap);
9da38912 594
9a29fe70
VZ
595 wxString GetToolShortHelp(int toolId) const;
596 void SetToolShortHelp(int toolId, const wxString& helpString);
9da38912 597
9a29fe70
VZ
598 wxString GetToolLongHelp(int toolId) const;
599 void SetToolLongHelp(int toolId, const wxString& helpString);
9da38912 600
1154f91b
BW
601 void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend,
602 const wxAuiToolBarItemArray& append);
9da38912 603
e5dcae09 604 // get size of hint rectangle for a particular dock location
9a29fe70 605 wxSize GetHintSize(int dockDirection) const;
e5dcae09
VZ
606 bool IsPaneValid(const wxAuiPaneInfo& pane) const;
607
3ac17397
VZ
608 // Override to call DoIdleUpdate().
609 virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
610
1154f91b 611protected:
46e67202 612 void Init();
1154f91b
BW
613
614 virtual void OnCustomRender(wxDC& WXUNUSED(dc),
615 const wxAuiToolBarItem& WXUNUSED(item),
616 const wxRect& WXUNUSED(rect)) { }
617
618protected:
619
620 void DoIdleUpdate();
621 void SetOrientation(int orientation);
622 void SetHoverItem(wxAuiToolBarItem* item);
623 void SetPressedItem(wxAuiToolBarItem* item);
624 void RefreshOverflowState();
9da38912 625
1154f91b
BW
626 int GetOverflowState() const;
627 wxRect GetOverflowRect() const;
628 wxSize GetLabelSize(const wxString& label);
629 wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const;
630
631 void DoSetSize(int x,
632 int y,
633 int width,
634 int height,
635 int sizeFlags = wxSIZE_AUTO);
9da38912 636
1154f91b
BW
637protected: // handlers
638
639 void OnSize(wxSizeEvent& evt);
640 void OnIdle(wxIdleEvent& evt);
641 void OnPaint(wxPaintEvent& evt);
642 void OnEraseBackground(wxEraseEvent& evt);
643 void OnLeftDown(wxMouseEvent& evt);
644 void OnLeftUp(wxMouseEvent& evt);
645 void OnRightDown(wxMouseEvent& evt);
646 void OnRightUp(wxMouseEvent& evt);
647 void OnMiddleDown(wxMouseEvent& evt);
648 void OnMiddleUp(wxMouseEvent& evt);
649 void OnMotion(wxMouseEvent& evt);
650 void OnLeaveWindow(wxMouseEvent& evt);
4a21ea9d 651 void OnCaptureLost(wxMouseCaptureLostEvent& evt);
1154f91b 652 void OnSetCursor(wxSetCursorEvent& evt);
9da38912 653
1154f91b
BW
654protected:
655
656 wxAuiToolBarItemArray m_items; // array of toolbar items
657 wxAuiToolBarArt* m_art; // art provider
658 wxBoxSizer* m_sizer; // main sizer for toolbar
9a29fe70
VZ
659 wxAuiToolBarItem* m_actionItem; // item that's being acted upon (pressed)
660 wxAuiToolBarItem* m_tipItem; // item that has its tooltip shown
1154f91b 661 wxBitmap m_bitmap; // double-buffer bitmap
9a29fe70
VZ
662 wxSizerItem* m_gripperSizerItem;
663 wxSizerItem* m_overflowSizerItem;
664 wxSize m_absoluteMinSize;
665 wxPoint m_actionPos; // position of left-mouse down
666 wxAuiToolBarItemArray m_customOverflowPrepend;
667 wxAuiToolBarItemArray m_customOverflowAppend;
668
669 int m_buttonWidth;
670 int m_buttonHeight;
671 int m_sizerElementCount;
672 int m_leftPadding;
673 int m_rightPadding;
674 int m_topPadding;
675 int m_bottomPadding;
676 int m_toolPacking;
677 int m_toolBorderPadding;
678 int m_toolTextOrientation;
679 int m_overflowState;
1154f91b 680 bool m_dragging;
9a29fe70
VZ
681 bool m_gripperVisible;
682 bool m_overflowVisible;
9da38912 683
e5dcae09
VZ
684 bool RealizeHelper(wxClientDC& dc, bool horizontal);
685 static bool IsPaneValid(long style, const wxAuiPaneInfo& pane);
686 bool IsPaneValid(long style) const;
687 void SetArtFlags() const;
688 wxOrientation m_orientation;
689 wxSize m_horzHintSize;
690 wxSize m_vertHintSize;
691
4a21ea9d
VZ
692private:
693 // Common part of OnLeaveWindow() and OnCaptureLost().
694 void DoResetMouseState();
695
1154f91b
BW
696 DECLARE_EVENT_TABLE()
697 DECLARE_CLASS(wxAuiToolBar)
698};
699
700
701
702
703// wx event machinery
704
705#ifndef SWIG
706
ce7fe42e
VZ
707wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
708wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
709wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
710wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent );
711wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent );
1154f91b
BW
712
713typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&);
714
715#define wxAuiToolBarEventHandler(func) \
3c778901 716 wxEVENT_HANDLER_CAST(wxAuiToolBarEventFunction, func)
9da38912 717
1154f91b 718#define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \
ce7fe42e 719 wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn))
1154f91b 720#define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \
ce7fe42e 721 wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn))
1154f91b 722#define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \
ce7fe42e 723 wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn))
1154f91b 724#define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \
ce7fe42e 725 wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn))
1154f91b 726#define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \
ce7fe42e 727 wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn))
1154f91b
BW
728
729#else
730
731// wxpython/swig event work
ce7fe42e
VZ
732%constant wxEventType wxEVT_AUITOOLBAR_TOOL_DROPDOWN;
733%constant wxEventType wxEVT_AUITOOLBAR_OVERFLOW_CLICK;
734%constant wxEventType wxEVT_AUITOOLBAR_RIGHT_CLICK;
735%constant wxEventType wxEVT_AUITOOLBAR_MIDDLE_CLICK;
736%constant wxEventType wxEVT_AUITOOLBAR_BEGIN_DRAG;
1154f91b
BW
737
738%pythoncode {
ce7fe42e
VZ
739 EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 )
740 EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 )
741 EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 )
742 EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 )
743 EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 )
1154f91b
BW
744}
745#endif // SWIG
746
ce7fe42e
VZ
747// old wxEVT_COMMAND_* constants
748#define wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN wxEVT_AUITOOLBAR_TOOL_DROPDOWN
749#define wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK wxEVT_AUITOOLBAR_OVERFLOW_CLICK
750#define wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK wxEVT_AUITOOLBAR_RIGHT_CLICK
751#define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK
752#define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG
753
1154f91b
BW
754#endif // wxUSE_AUI
755#endif // _WX_AUIBAR_H_
756