29#include <wx/tbarbase.h>
30#include <wx/dynarray.h>
42 wxItemKind kind, wxString tooltip, wxString label) {
44 m_tipString = tooltip;
47 m_bmpNormal = bmpNormal;
48 m_bmpDisabled = bmpDisabled;
54 wxString tooltip, wxString label) {
56 m_tipString = tooltip;
59 m_bmpNormal = bmpNormal;
60 m_bmpDisabled = wxNullBitmap;
68 wxItemKind m_toolKind;
73 wxBitmap m_bmpDisabled;
74 wxToolBarToolBase *m_tool;
77 wxString m_NormalIconSVG;
78 wxString m_RolloverIconSVG;
79 wxString m_ToggledIconSVG;
82typedef std::vector<ToolbarItemContainer *> ArrayOfToolbarItemContainer;
91 float scale_factor, wxString icon_name,
92 wxPoint position = wxDefaultPosition);
93 void OnPaint(wxPaintEvent &event);
94 void MouseEvent(wxMouseEvent &event);
95 void SetColorScheme(ColorScheme cs);
96 wxBitmap &GetBitmap() {
return m_bitmap; }
102 float m_scale_factor;
105 wxString m_icon_name;
107 DECLARE_EVENT_TABLE()
110#define TOOLTIPON_TIMER 10000
111#define TOOLTIPOFF_TIMER 10001
114 TOOLBAR_HIDE_TO_GRABBER = 0,
115 TOOLBAR_HIDE_TO_FIRST_TOOL,
132 const wxPoint &pos = wxDefaultPosition,
133 const wxSize &size = wxDefaultSize,
134 long style = wxNO_BORDER | wxTB_HORIZONTAL,
135 const wxString &name = wxToolBarNameStr)
139 Create(parent, winid, pos, size, style, name);
142 bool Create(wxWindow *parent, wxWindowID winid,
143 const wxPoint &pos = wxDefaultPosition,
144 const wxSize &size = wxDefaultSize,
145 long style = wxNO_BORDER | wxTB_HORIZONTAL,
146 const wxString &name = wxToolBarNameStr);
150 virtual void SetToggledBackgroundColour(wxColour c) {
151 m_toggle_bg_color = c;
153 virtual void SetColorScheme(ColorScheme cs);
159 void OnPaint(wxPaintEvent &event);
160 void OnSize(wxSizeEvent &event);
162 void OnKillFocus(wxFocusEvent &event);
163 void OnToolTipTimerEvent(wxTimerEvent &event);
164 void OnToolTipOffTimerEvent(wxTimerEvent &event);
166 wxToolBarToolBase *AddTool(
int toolid,
const wxString &label,
167 const wxBitmap &bitmap,
168 const wxBitmap &bmpDisabled,
169 wxItemKind kind = wxITEM_NORMAL,
170 const wxString &shortHelp = wxEmptyString,
171 const wxString &longHelp = wxEmptyString,
172 wxObject *data = NULL);
174 wxToolBarToolBase *AddTool(
int toolid,
const wxString &label,
175 const wxBitmap &bitmap,
176 const wxString &shortHelp = wxEmptyString,
177 wxItemKind kind = wxITEM_NORMAL) {
178 return AddTool(toolid, label, bitmap, wxNullBitmap, kind, shortHelp);
181 wxToolBarToolBase *InsertTool(
size_t pos,
int id,
const wxString &label,
182 const wxBitmap &bitmap,
183 const wxBitmap &bmpDisabled, wxItemKind kind,
184 const wxString &shortHelp,
185 const wxString &longHelp, wxObject *clientData);
187 wxToolBarToolBase *InsertTool(
size_t pos, wxToolBarToolBase *tool);
190 virtual bool OnLeftClick(
int toolid,
bool toggleDown);
193 virtual void OnRightClick(
int toolid,
long x,
long y);
197 virtual void OnMouseEnter(
int toolid);
198 virtual void DoPluginToolUp();
200 size_t GetToolsCount()
const {
return m_tools.GetCount(); }
201 void SetToolShowCount(
int count) { m_nShowTools = count; }
202 int GetToolShowCount() {
return m_nShowTools; }
204 int GetNoRowsOrColumns() {
return m_currentRowsOrColumns; };
205 int GetLineCount() {
return m_LineCount; };
206 int GetVisibleToolCount();
208 void SetToolNormalBitmapEx(wxToolBarToolBase *tool,
const wxString &iconname);
209 void SetToolNormalBitmapSVG(wxToolBarToolBase *tool, wxString fileSVG);
211 void EnableRolloverBitmaps(
bool enable) {
212 m_tbenableRolloverBitmaps = enable;
216 virtual wxControl *FindControl(
int toolid);
219 virtual wxToolBarToolBase *AddSeparator();
220 virtual wxToolBarToolBase *InsertSeparator(
size_t pos);
224 virtual wxToolBarToolBase *RemoveTool(
int toolid);
227 virtual bool DeleteToolByPos(
size_t pos);
228 virtual bool DeleteTool(
int toolid);
231 virtual void ClearTools();
235 virtual bool Realize();
240 virtual void EnableTool(
int toolid,
bool enable);
241 virtual void ToggleTool(
int toolid,
bool toggle);
243 virtual void SetToolBitmaps(
int toolid, wxBitmap *bmp, wxBitmap *bmpRollover);
244 virtual void SetToolBitmapsSVG(
int id, wxString fileSVGNormal,
245 wxString fileSVGRollover,
246 wxString fileSVGToggled);
248 void InvalidateBitmaps();
251 virtual wxObject *GetToolClientData(
int toolid)
const;
252 virtual void SetToolClientData(
int toolid, wxObject *clientData);
255 virtual int GetToolPos(
int id)
const;
258 virtual bool GetToolState(
int toolid)
const;
260 virtual bool GetToolEnabled(
int toolid)
const;
262 virtual void SetToolShortHelp(
int toolid,
const wxString &helpString);
263 virtual wxString GetToolShortHelp(
int toolid)
const;
264 virtual void SetToolLongHelp(
int toolid,
const wxString &helpString);
265 virtual wxString GetToolLongHelp(
int toolid)
const;
267 virtual void SetToolTooltipHiViz(
int id,
bool b_hiviz);
269 virtual void SetSizeFactor(
float factor) {
270 m_sizefactor = factor;
277 void SetMaxRowsCols(
int rows,
int cols) {
281 int GetMaxRows()
const {
return m_maxRows; }
282 int GetMaxCols()
const {
return m_maxCols; }
286 virtual void SetToolBitmapSize(
const wxSize &size) {
287 m_defaultWidth = size.x;
288 m_defaultHeight = size.y;
290 virtual wxSize GetToolBitmapSize()
const {
291 return wxSize(m_defaultWidth, m_defaultHeight);
296 virtual wxSize GetToolSize()
const {
return GetToolBitmapSize(); }
298 virtual wxRect GetToolRect(
int tool_id);
302 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
305 wxToolBarToolBase *FindById(
int toolid)
const;
308 bool IsVertical()
const {
309 return HasFlag(wxTB_LEFT | wxTB_RIGHT | wxTB_VERTICAL);
313 wxToolBarToolsList m_tools;
320 wxCoord m_defaultWidth, m_defaultHeight;
324 void EnableTooltips();
325 void DisableTooltips();
332 virtual wxToolBarToolBase *DoAddTool(
333 int toolid,
const wxString &label,
const wxBitmap &bitmap,
334 const wxBitmap &bmpDisabled, wxItemKind kind,
335 const wxString &shortHelp = wxEmptyString,
336 const wxString &longHelp = wxEmptyString, wxObject *clientData = NULL,
337 wxCoord xPos = wxDefaultCoord, wxCoord yPos = wxDefaultCoord);
339 virtual bool DoInsertTool(
size_t pos, wxToolBarToolBase *tool);
340 virtual bool DoDeleteTool(
size_t pos, wxToolBarToolBase *tool);
342 virtual void DoEnableTool(wxToolBarToolBase *tool,
bool enable);
343 virtual void DoToggleTool(wxToolBarToolBase *tool,
bool toggle);
345 virtual wxToolBarToolBase *CreateTool(
int winid,
const wxString &label,
346 const wxBitmap &bmpNormal,
347 const wxBitmap &bmpDisabled,
348 wxItemKind kind, wxObject *clientData,
349 const wxString &shortHelp,
350 const wxString &longHelp);
353 void DrawTool(wxToolBarToolBase *tool);
354 virtual void DrawTool(wxDC &dc, wxToolBarToolBase *tool);
355 virtual void SpringUpButton(
int index);
357 int m_currentRowsOrColumns;
360 int m_pressedTool, m_currentTool;
362 wxCoord m_lastX, m_lastY;
363 wxCoord m_maxWidth, m_maxHeight;
364 wxCoord m_xPos, m_yPos;
366 wxColour m_toggle_bg_color;
367 wxColour m_toolOutlineColour;
371 ColorScheme m_currentColorScheme;
373 wxTimer m_tooltip_timer;
375 wxTimer m_tooltipoff_timer;
377 bool m_btooltip_show;
379 bool m_btoolbar_is_zooming;
385 int m_last_plugin_down_id;
388 bool m_tbenableRolloverBitmaps;
391 DECLARE_EVENT_TABLE()
399#define DESTROY_TIMER 3
402 DECLARE_EVENT_TABLE()
411 void OnClose(wxCloseEvent &event);
412 void OnWindowCreate(wxWindowCreateEvent &event);
413 void OnToolLeftClick(wxCommandEvent &event);
414 virtual void OnKeyDown(wxKeyEvent &event);
415 virtual void OnKeyUp(wxKeyEvent &event);
416 void MouseEvent(wxMouseEvent &event);
417 void FadeTimerEvent(wxTimerEvent &event);
418 bool IsToolbarShown() {
return (m_ptoolbar != 0); }
419 float GetScaleFactor() {
return m_sizefactor; }
420 void SetGrabber(wxString icon_name);
421 void DestroyTimerEvent(wxTimerEvent &event);
423 void EnableSubmerge(
bool enable) { m_benableSubmerge = enable; }
427 void SetToolbarHideMethod(
int n_method) { n_toolbarHideMethod = n_method; }
429 void SetToolConfigString(wxString
string) { m_configString = string; }
430 wxString GetToolConfigString() {
return m_configString; }
432 float GetSizeFactor() {
return m_sizefactor; }
434 void CreateConfigMenu();
437 void SetCornerRadius(
int radius) { m_cornerRadius = radius; }
439 void SetGrabberEnable(
bool bShow) { m_bGrabberEnable = bShow; }
441 void SubmergeToGrabber();
442 bool isSubmergedToGrabber();
444 void SurfaceFromGrabber();
447 void EnableTooltips() {
448 if (m_ptoolbar) m_ptoolbar->EnableTooltips();
450 void DisableTooltips() {
451 if (m_ptoolbar) m_ptoolbar->DisableTooltips();
453 void UpdateRecoveryWindow(
bool b_toolbarEnable);
454 void EnableTool(
int toolid,
bool enable);
455 void SetToolShortHelp(
int toolid,
const wxString &helpString);
457 void DestroyToolBar();
458 void ToggleOrientation();
459 void MoveDialogInScreenCoords(wxPoint posn, wxPoint posn_old);
460 void SetDefaultPosition();
461 void LockPosition(
bool lock) { m_block = lock; }
462 virtual void SetColorScheme(ColorScheme cs);
463 ColorScheme GetColorScheme() {
return m_cs; }
464 bool CheckSurfaceRequest(wxMouseEvent &event);
465 void GetFrameRelativePosition(
int *x,
int *y);
466 void RestoreRelativePosition(
int x,
int y);
468 void SetGeometry(
bool bAvoid, wxRect rectAvoid);
469 void SetMinX(
int offset) { m_dock_min_x = offset; }
470 void SetMinY(
int offset) { m_dock_min_y = offset; }
471 long GetOrient() {
return m_orient; }
472 wxSize GetToolSize();
474 void RefreshFadeTimer();
475 void SetAutoHideTimer(
int time);
476 void SetAutoHide(
bool hide) { m_bAutoHideToolbar = hide; }
478 size_t GetToolCount();
479 void SetToolShowMask(wxString mask);
480 wxString GetToolShowMask(
void) {
return m_toolShowMask; }
482 void SetToolShowCount(
int count);
483 int GetToolShowCount(
void);
489 int GetDockX() {
return m_dock_x; }
490 int GetDockY() {
return m_dock_y; }
491 void SetDockX(
int x) { m_dock_x = x; }
492 void SetDockY(
int y) { m_dock_y = y; }
494 void SetYAuxOffset(
int offset) { m_auxOffsetY = offset; }
496 void SetCanToggleOrientation(
bool enable) { b_canToggleOrientation = enable; }
497 bool GetCanToggleOrientation() {
return b_canToggleOrientation; }
499 bool toolbarConfigChanged;
503 wxMenu *m_FloatingToolbarConfigMenu;
505 wxString m_tblastAISiconName;
506 wxToolBarToolBase *m_pTBAISTool;
507 bool m_toolbar_scale_tools_shown;
508 void SetBackGroundColorString(wxString colorRef);
509 void SetULDockPosition(wxPoint position);
511 ArrayOfToolbarItemContainer m_Items;
514 int RebuildToolbar();
515 void EnableRolloverBitmaps(
bool bEnable);
516 bool GetEnableRolloverBitmaps() {
return m_enableRolloverBitmaps; }
522 void DoFade(
int value);
525 bool m_bsubmergedToGrabber;
528 wxBoxSizer *m_topSizer;
533 wxTimer m_fade_timer;
546 bool m_marginsInvisible;
548 wxTimer m_destroyTimer;
550 wxSize m_recoversize;
552 bool m_bAutoHideToolbar;
553 int m_nAutoHideToolbar;
554 bool m_benableSubmerge;
555 bool m_bGrabberEnable;
557 wxString m_backcolorString;
559 wxString m_toolShowMask;
560 int n_toolbarHideMethod;
561 bool b_canToggleOrientation;
562 wxString m_configString;
563 bool m_enableRolloverBitmaps;
571 std::vector<wxRadioButton *> choices;
578#define SYMBOL_ToolbarChoices_STYLE \
579 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
583 DECLARE_EVENT_TABLE()
589 const wxString &caption = _T(
""),
590 const wxPoint &pos = wxDefaultPosition,
591 const wxSize &size = wxDefaultSize,
592 long style = SYMBOL_ToolbarChoices_STYLE);
596 void SetColorScheme(ColorScheme cs);
597 void RecalculateSize(
void);
600 void OnCancelClick(wxCommandEvent &event);
601 void OnOkClick(wxCommandEvent &event);
603 wxButton *m_CancelButton;
604 wxButton *m_OKButton;
606 std::vector<wxCheckBox *> cboxes;
607 wxMenu *m_configMenu;