]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/toolbar.h
No changes, just removed hard tabs and trailing white space.
[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 #if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
21 typedef struct CGPoint NSPoint;
22 #else
23 typedef struct _NSPoint NSPoint;
24 #endif
25
26 class wxToolBarTool;
27
28 class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
29 {
30 DECLARE_DYNAMIC_CLASS(wxToolBar)
31 // ------------------------------------------------------------------------
32 // initialization
33 // ------------------------------------------------------------------------
34 public:
35 wxToolBar() { Init(); }
36 wxToolBar( wxWindow *parent,
37 wxWindowID toolid,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = 0,
41 const wxString& name = wxToolBarNameStr )
42 {
43 Init();
44
45 Create(parent, toolid, pos, size, style, name);
46 }
47
48 bool Create( wxWindow *parent,
49 wxWindowID toolid,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 long style = 0,
53 const wxString& name = wxToolBarNameStr );
54
55 virtual ~wxToolBar();
56
57 protected:
58 // common part of all ctors
59 void Init();
60
61 // ------------------------------------------------------------------------
62 // Cocoa
63 // ------------------------------------------------------------------------
64 protected:
65 virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse, WX_NSEvent theEvent);
66 virtual bool Cocoa_drawRect(const NSRect &rect);
67 virtual bool Cocoa_mouseDown(WX_NSEvent theEvent);
68 virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent);
69 wxToolBarTool *CocoaFindToolForPosition(const NSPoint& pos) const;
70 void CocoaToolClickEnded();
71 // ------------------------------------------------------------------------
72 // Implementation
73 // ------------------------------------------------------------------------
74 public:
75 // override base class virtuals
76 virtual void SetMargins(int x, int y);
77 virtual void SetToolSeparation(int separation);
78
79 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
80
81 virtual void SetToolShortHelp(int toolid, const wxString& helpString);
82
83 virtual void SetWindowStyleFlag( long style );
84
85 // implementation from now on
86 // --------------------------
87
88 void OnInternalIdle();
89 virtual bool Realize();
90 virtual wxSize DoGetBestSize() const;
91
92 void SetOwningFrame(wxFrame *owningFrame)
93 { m_owningFrame = owningFrame; }
94 protected:
95 // implement base class pure virtuals
96 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
97 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
98
99 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
100 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
101 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
102
103 virtual wxToolBarToolBase *CreateTool(int toolid,
104 const wxString& label,
105 const wxBitmap& bitmap1,
106 const wxBitmap& bitmap2,
107 wxItemKind kind,
108 wxObject *clientData,
109 const wxString& shortHelpString,
110 const wxString& longHelpString);
111 virtual wxToolBarToolBase *CreateTool(wxControl *control,
112 const wxString& label);
113
114 wxSize m_bestSize;
115 wxFrame *m_owningFrame;
116 wxToolBarTool *m_mouseDownTool;
117 };
118
119 #endif // wxUSE_TOOLBAR
120
121 #endif // __WX_COCOA_TOOLBAR_H__