1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/toolbar.h
4 // Author: David Elliott
7 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __WX_COCOA_TOOLBAR_H__
12 #define __WX_COCOA_TOOLBAR_H__
16 // ========================================================================
18 // ========================================================================
19 #if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
20 typedef struct CGPoint NSPoint
;
22 typedef struct _NSPoint NSPoint
;
27 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
29 DECLARE_DYNAMIC_CLASS(wxToolBar
)
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 wxToolBar() { Init(); }
35 wxToolBar( wxWindow
*parent
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
40 const wxString
& name
= wxToolBarNameStr
)
44 Create(parent
, toolid
, pos
, size
, style
, name
);
47 bool Create( wxWindow
*parent
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
52 const wxString
& name
= wxToolBarNameStr
);
57 // common part of all ctors
60 // ------------------------------------------------------------------------
62 // ------------------------------------------------------------------------
64 virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse
, WX_NSEvent theEvent
);
65 virtual bool Cocoa_drawRect(const NSRect
&rect
);
66 virtual bool Cocoa_mouseDown(WX_NSEvent theEvent
);
67 virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent
);
68 wxToolBarTool
*CocoaFindToolForPosition(const NSPoint
& pos
) const;
69 void CocoaToolClickEnded();
70 // ------------------------------------------------------------------------
72 // ------------------------------------------------------------------------
74 // override base class virtuals
75 virtual void SetMargins(int x
, int y
);
76 virtual void SetToolSeparation(int separation
);
78 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
80 virtual void SetToolShortHelp(int toolid
, const wxString
& helpString
);
82 virtual void SetWindowStyleFlag( long style
);
84 // implementation from now on
85 // --------------------------
87 void OnInternalIdle();
88 virtual bool Realize();
89 virtual wxSize
DoGetBestSize() const;
91 void SetOwningFrame(wxFrame
*owningFrame
)
92 { m_owningFrame
= owningFrame
; }
94 // implement base class pure virtuals
95 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
96 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
98 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
99 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
100 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
102 virtual wxToolBarToolBase
*CreateTool(int toolid
,
103 const wxString
& label
,
104 const wxBitmap
& bitmap1
,
105 const wxBitmap
& bitmap2
,
107 wxObject
*clientData
,
108 const wxString
& shortHelpString
,
109 const wxString
& longHelpString
);
110 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
111 const wxString
& label
);
114 wxFrame
*m_owningFrame
;
115 wxToolBarTool
*m_mouseDownTool
;
118 #endif // wxUSE_TOOLBAR
120 #endif // __WX_COCOA_TOOLBAR_H__