+ wxToolBarBase *GetToolBar() const { return m_tbar; }
+
+ // style
+ bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; }
+ bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; }
+ bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; }
+ int GetStyle() const { return m_toolStyle; }
+ wxItemKind GetKind() const
+ {
+ wxASSERT_MSG( IsButton(), _T("only makes sense for buttons") );
+
+ return m_kind;
+ }
+
+ // state
+ bool IsEnabled() const { return m_enabled; }
+ bool IsToggled() const { return m_toggled; }
+ bool CanBeToggled() const
+ { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
+
+ // attributes
+ const wxBitmap& GetNormalBitmap() const { return m_bmpNormal; }
+ const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; }
+
+ const wxBitmap& GetBitmap() const
+ { return IsEnabled() ? GetNormalBitmap() : GetDisabledBitmap(); }
+
+ wxString GetLabel() const { return m_label; }
+
+ wxString GetShortHelp() const { return m_shortHelpString; }
+ wxString GetLongHelp() const { return m_longHelpString; }
+
+ wxObject *GetClientData() const
+ {
+ if ( m_toolStyle == wxTOOL_STYLE_CONTROL )
+ {
+ return (wxObject*)m_control->GetClientData();
+ }
+ else
+ {
+ return m_clientData;
+ }
+ }
+
+ // modifiers: return TRUE if the state really changed
+ bool Enable(bool enable);
+ bool Toggle(bool toggle);
+ bool SetToggle(bool toggle);
+ bool SetShortHelp(const wxString& help);
+ bool SetLongHelp(const wxString& help);
+
+ void Toggle() { Toggle(!IsToggled()); }
+
+ void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; }
+ void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; }
+
+ virtual void SetLabel(const wxString& label) { m_label = label; }
+
+ void SetClientData(wxObject *clientData)
+ {
+ if ( m_toolStyle == wxTOOL_STYLE_CONTROL )
+ {
+ m_control->SetClientData(clientData);
+ }
+ else
+ {
+ m_clientData = clientData;
+ }
+ }
+
+ // add tool to/remove it from a toolbar
+ virtual void Detach() { m_tbar = (wxToolBarBase *)NULL; }
+ virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; }
+
+ // compatibility only, don't use
+#if WXWIN_COMPATIBILITY_2_2
+ const wxBitmap& GetBitmap1() const { return GetNormalBitmap(); }
+ const wxBitmap& GetBitmap2() const { return GetDisabledBitmap(); }
+
+ void SetBitmap1(const wxBitmap& bmp) { SetNormalBitmap(bmp); }
+ void SetBitmap2(const wxBitmap& bmp) { SetDisabledBitmap(bmp); }
+#endif // WXWIN_COMPATIBILITY_2_2
+
+protected:
+ wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL)
+
+ // tool parameters
+ int m_toolStyle; // see enum wxToolBarToolStyle
+ int m_id; // the tool id, wxID_SEPARATOR for separator
+ wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO