]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/toolbar.h
mingw32 doesn't define _tsystem so provide one ourselves (bug 1726904)
[wxWidgets.git] / include / wx / cocoa / toolbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/toolbar.h
3 // Purpose: wxToolBar
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/08/17
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_TOOLBAR_H__
13 #define __WX_COCOA_TOOLBAR_H__
14
15 #if wxUSE_TOOLBAR
16
17 // ========================================================================
18 // wxToolBar
19 // ========================================================================
20 typedef struct _NSPoint NSPoint;
21 class wxToolBarTool;
22
23 class wxToolBar : public wxToolBarBase
24 {
25 DECLARE_DYNAMIC_CLASS(wxToolBar)
26 // ------------------------------------------------------------------------
27 // initialization
28 // ------------------------------------------------------------------------
29 public:
30 wxToolBar() { Init(); }
31 wxToolBar( wxWindow *parent,
32 wxWindowID toolid,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = 0,
36 const wxString& name = wxToolBarNameStr )
37 {
38 Init();
39
40 Create(parent, toolid, pos, size, style, name);
41 }
42
43 bool Create( wxWindow *parent,
44 wxWindowID toolid,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = 0,
48 const wxString& name = wxToolBarNameStr );
49
50 virtual ~wxToolBar();
51
52 protected:
53 // common part of all ctors
54 void Init();
55
56 // ------------------------------------------------------------------------
57 // Cocoa
58 // ------------------------------------------------------------------------
59 protected:
60 virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse, WX_NSEvent theEvent);
61 virtual bool Cocoa_drawRect(const NSRect &rect);
62 virtual bool Cocoa_mouseDown(WX_NSEvent theEvent);
63 virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent);
64 wxToolBarTool *CocoaFindToolForPosition(const NSPoint& pos) const;
65 void CocoaToolClickEnded();
66 // ------------------------------------------------------------------------
67 // Implementation
68 // ------------------------------------------------------------------------
69 public:
70 // override base class virtuals
71 virtual void SetMargins(int x, int y);
72 virtual void SetToolSeparation(int separation);
73
74 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
75
76 virtual void SetToolShortHelp(int toolid, const wxString& helpString);
77
78 virtual void SetWindowStyleFlag( long style );
79
80 // implementation from now on
81 // --------------------------
82
83 void OnInternalIdle();
84 virtual bool Realize();
85 virtual wxSize DoGetBestSize() const;
86
87 void SetOwningFrame(wxFrame *owningFrame)
88 { m_owningFrame = owningFrame; }
89 protected:
90 // implement base class pure virtuals
91 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
92 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
93
94 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
95 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
96 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
97
98 virtual wxToolBarToolBase *CreateTool(int toolid,
99 const wxString& label,
100 const wxBitmap& bitmap1,
101 const wxBitmap& bitmap2,
102 wxItemKind kind,
103 wxObject *clientData,
104 const wxString& shortHelpString,
105 const wxString& longHelpString);
106 virtual wxToolBarToolBase *CreateTool(wxControl *control,
107 const wxString& label);
108
109 wxSize m_bestSize;
110 wxFrame *m_owningFrame;
111 wxToolBarTool *m_mouseDownTool;
112 };
113
114 #endif // wxUSE_TOOLBAR
115
116 #endif // __WX_COCOA_TOOLBAR_H__