1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/toolbar.h
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_TOOLBAR_H__
13 #define __WX_COCOA_TOOLBAR_H__
17 // ========================================================================
19 // ========================================================================
20 #if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
21 typedef struct CGPoint NSPoint
;
23 typedef struct _NSPoint NSPoint
;
28 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
30 DECLARE_DYNAMIC_CLASS(wxToolBar
)
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 wxToolBar() { Init(); }
36 wxToolBar( wxWindow
*parent
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
41 const wxString
& name
= wxToolBarNameStr
)
45 Create(parent
, toolid
, pos
, size
, style
, name
);
48 bool Create( wxWindow
*parent
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
53 const wxString
& name
= wxToolBarNameStr
);
58 // common part of all ctors
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
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 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
75 // override base class virtuals
76 virtual void SetMargins(int x
, int y
);
77 virtual void SetToolSeparation(int separation
);
79 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
81 virtual void SetToolShortHelp(int toolid
, const wxString
& helpString
);
83 virtual void SetWindowStyleFlag( long style
);
85 // implementation from now on
86 // --------------------------
88 void OnInternalIdle();
89 virtual bool Realize();
90 virtual wxSize
DoGetBestSize() const;
92 void SetOwningFrame(wxFrame
*owningFrame
)
93 { m_owningFrame
= owningFrame
; }
95 // implement base class pure virtuals
96 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
97 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
99 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
100 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
101 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
103 virtual wxToolBarToolBase
*CreateTool(int toolid
,
104 const wxString
& label
,
105 const wxBitmap
& bitmap1
,
106 const wxBitmap
& bitmap2
,
108 wxObject
*clientData
,
109 const wxString
& shortHelpString
,
110 const wxString
& longHelpString
);
111 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
112 const wxString
& label
);
115 wxFrame
*m_owningFrame
;
116 wxToolBarTool
*m_mouseDownTool
;
119 #endif // wxUSE_TOOLBAR
121 #endif // __WX_COCOA_TOOLBAR_H__