]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/toolbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/toolbar.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
30 #include "wx/dynarray.h"
34 #include "wx/settings.h"
35 #include "wx/bitmap.h"
36 #include "wx/dcmemory.h"
37 #include "wx/control.h"
40 #include "wx/toolbar.h"
41 #include "wx/sysopt.h"
43 #include "wx/palmos/private.h"
45 #include "wx/palmos/wrapcctl.h"
47 #include "wx/app.h" // for GetComCtl32Version
49 // ----------------------------------------------------------------------------
50 // conditional compilation
51 // ----------------------------------------------------------------------------
53 // wxWidgets previously always considered that toolbar buttons have light grey
54 // (0xc0c0c0) background and so ignored any bitmap masks - however, this
55 // doesn't work with XPMs which then appear to have black background. To make
56 // this work, we must respect the bitmap masks - which we do now. This should
57 // be ok in any case, but to restore 100% compatible with the old version
58 // behaviour, you can set this to 0.
59 #define USE_BITMAP_MASKS 1
61 // ----------------------------------------------------------------------------
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxControl
)
81 style ( wxNO_BORDER | wxTB_HORIZONTAL)
90 BEGIN_EVENT_TABLE(wxToolBar
, wxToolBarBase
)
91 EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent
)
94 // ----------------------------------------------------------------------------
96 // ----------------------------------------------------------------------------
98 class wxToolBarTool
: public wxToolBarToolBase
101 wxToolBarTool(wxToolBar
*tbar
,
103 const wxString
& label
,
104 const wxBitmap
& bmpNormal
,
105 const wxBitmap
& bmpDisabled
,
107 wxObject
*clientData
,
108 const wxString
& shortHelp
,
109 const wxString
& longHelp
)
110 : wxToolBarToolBase(tbar
, id
, label
, bmpNormal
, bmpDisabled
, kind
,
111 clientData
, shortHelp
, longHelp
)
115 wxToolBarTool(wxToolBar
*tbar
, wxControl
*control
)
116 : wxToolBarToolBase(tbar
, control
)
120 virtual void SetLabel(const wxString
& label
)
124 // set/get the number of separators which we use to cover the space used by
125 // a control in the toolbar
126 void SetSeparatorsCount(size_t count
) { m_nSepCount
= count
; }
127 size_t GetSeparatorsCount() const { return m_nSepCount
; }
132 DECLARE_NO_COPY_CLASS(wxToolBarTool
)
136 // ============================================================================
138 // ============================================================================
140 // ----------------------------------------------------------------------------
142 // ----------------------------------------------------------------------------
144 wxToolBarToolBase
*wxToolBar::CreateTool(int id
,
145 const wxString
& label
,
146 const wxBitmap
& bmpNormal
,
147 const wxBitmap
& bmpDisabled
,
149 wxObject
*clientData
,
150 const wxString
& shortHelp
,
151 const wxString
& longHelp
)
153 return new wxToolBarTool(this, id
, label
, bmpNormal
, bmpDisabled
, kind
,
154 clientData
, shortHelp
, longHelp
);
157 wxToolBarToolBase
*wxToolBar::CreateTool(wxControl
*control
)
159 return new wxToolBarTool(this, control
);
162 // ----------------------------------------------------------------------------
163 // wxToolBar construction
164 // ----------------------------------------------------------------------------
166 void wxToolBar::Init()
170 bool wxToolBar::Create(wxWindow
*parent
,
175 const wxString
& name
)
180 void wxToolBar::Recreate()
184 wxToolBar::~wxToolBar()
188 wxSize
wxToolBar::DoGetBestSize() const
193 // ----------------------------------------------------------------------------
194 // adding/removing tools
195 // ----------------------------------------------------------------------------
197 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos
), wxToolBarToolBase
*tool
)
202 bool wxToolBar::DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
)
207 bool wxToolBar::Realize()
212 // ----------------------------------------------------------------------------
214 // ----------------------------------------------------------------------------
216 void wxToolBar::SetToolBitmapSize(const wxSize
& size
)
220 void wxToolBar::SetRows(int nRows
)
224 // The button size is bigger than the bitmap size
225 wxSize
wxToolBar::GetToolSize() const
231 wxToolBarToolBase
*GetItemSkippingDummySpacers(const wxToolBarToolsList
& tools
,
237 wxToolBarToolBase
*wxToolBar::FindToolForPosition(wxCoord x
, wxCoord y
) const
242 void wxToolBar::UpdateSize()
246 // ----------------------------------------------------------------------------
248 // ----------------------------------------------------------------------------
250 void wxToolBar::DoEnableTool(wxToolBarToolBase
*tool
, bool enable
)
254 void wxToolBar::DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
)
258 void wxToolBar::DoSetToggle(wxToolBarToolBase
*WXUNUSED(tool
), bool WXUNUSED(toggle
))
262 // ----------------------------------------------------------------------------
264 // ----------------------------------------------------------------------------
266 void wxToolBar::OnMouseEvent(wxMouseEvent
& event
)
270 #endif // wxUSE_TOOLBAR