]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/toolbar.h
wxLaunchDefaultBrowser
[wxWidgets.git] / include / wx / cocoa / toolbar.h
CommitLineData
7dafb55f
DE
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
65571936 9// Licence: wxWindows licence
7dafb55f
DE
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __WX_COCOA_TOOLBAR_H__
13#define __WX_COCOA_TOOLBAR_H__
14
15#if wxUSE_TOOLBAR
16
17// ========================================================================
18// wxToolBar
19// ========================================================================
20typedef struct _NSPoint NSPoint;
21class wxToolBarTool;
22
23class wxToolBar : public wxToolBarBase
24{
25 DECLARE_DYNAMIC_CLASS(wxToolBar)
26// ------------------------------------------------------------------------
27// initialization
28// ------------------------------------------------------------------------
29public:
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
52protected:
53 // common part of all ctors
54 void Init();
55
56// ------------------------------------------------------------------------
57// Cocoa
58// ------------------------------------------------------------------------
59protected:
60 virtual bool Cocoa_drawRect(const NSRect &rect);
61 virtual bool Cocoa_mouseDown(WX_NSEvent theEvent);
62 virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent);
63 wxToolBarTool *CocoaFindToolForPosition(const NSPoint& pos) const;
e2eafeff 64 void CocoaToolClickEnded();
7dafb55f
DE
65// ------------------------------------------------------------------------
66// Implementation
67// ------------------------------------------------------------------------
68public:
69 // override base class virtuals
70 virtual void SetMargins(int x, int y);
71 virtual void SetToolSeparation(int separation);
72
73 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
74
75 virtual void SetToolShortHelp(int toolid, const wxString& helpString);
76
77 virtual void SetWindowStyleFlag( long style );
78
79 // implementation from now on
80 // --------------------------
81
82 void OnInternalIdle();
83 virtual bool Realize();
84 virtual wxSize DoGetBestSize() const;
85
86 void SetOwningFrame(wxFrame *owningFrame)
87 { m_owningFrame = owningFrame; }
88protected:
89 // implement base class pure virtuals
90 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
91 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
92
93 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
94 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
95 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
96
97 virtual wxToolBarToolBase *CreateTool(int toolid,
98 const wxString& label,
99 const wxBitmap& bitmap1,
100 const wxBitmap& bitmap2,
101 wxItemKind kind,
102 wxObject *clientData,
103 const wxString& shortHelpString,
104 const wxString& longHelpString);
105 virtual wxToolBarToolBase *CreateTool(wxControl *control);
106
107 wxSize m_bestSize;
108 wxFrame *m_owningFrame;
109 wxToolBarTool *m_mouseDownTool;
110};
111
112#endif // wxUSE_TOOLBAR
113
114#endif // __WX_COCOA_TOOLBAR_H__