Document wxBitmapToggleButton, add update UI event in Base class for all toggle buttons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
86
docs/latex/wx/bitmaptglbutn.tex
Normal file
86
docs/latex/wx/bitmaptglbutn.tex
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% Name: bitmaptglbtn.tex
|
||||||
|
%% Purpose: wxBitmapToggleButton documentation
|
||||||
|
%% Author: Robert Roebling
|
||||||
|
%% License: wxWindows license
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\section{\class{wxBitmapToggleButton}}\label{wxbitmaptogglebutton}
|
||||||
|
|
||||||
|
wxBitmapToggleButton is a a \helpref{wxToggleButton}{wxtogglebutton}
|
||||||
|
that contains a bitmap instead of text.
|
||||||
|
|
||||||
|
This control emits a update UI event.
|
||||||
|
|
||||||
|
\wxheading{Derived from}
|
||||||
|
|
||||||
|
\helpref{wxControl}{wxcontrol}\\
|
||||||
|
\helpref{wxWindow}{wxwindow}\\
|
||||||
|
\helpref{wxEvtHandler}{wxevthandler}\\
|
||||||
|
\helpref{wxObject}{wxobject}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/tglbtn.h>
|
||||||
|
|
||||||
|
\wxheading{Library}
|
||||||
|
|
||||||
|
\helpref{wxCore}{librarieslist}
|
||||||
|
|
||||||
|
\wxheading{Window styles}
|
||||||
|
|
||||||
|
There are no special styles for wxBitmapToggleButton.
|
||||||
|
|
||||||
|
\wxheading{Event handling}
|
||||||
|
|
||||||
|
\twocolwidtha{7cm}
|
||||||
|
\begin{twocollist}\itemsep=0pt
|
||||||
|
\twocolitem{{\bf EVT\_TOGGLEBUTTON(id, func)}}{Handles a toggle button click event.}
|
||||||
|
\end{twocollist}
|
||||||
|
|
||||||
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
\membersection{wxBitmapToggleButton::wxBitmapToggleButton}\label{wxbitmaptogglebuttonconstr}
|
||||||
|
|
||||||
|
\func{}{wxBitmapToggleButton}{\void}
|
||||||
|
|
||||||
|
Default constructor.
|
||||||
|
|
||||||
|
\func{}{wxBitmapToggleButton}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
|
||||||
|
\param{const wxBitmap\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
|
||||||
|
\param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp
|
||||||
|
\param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}}
|
||||||
|
|
||||||
|
Constructor, creating and showing a toggle button with the bitmap {\it label}.
|
||||||
|
Internally calls Create().
|
||||||
|
|
||||||
|
\membersection{wxBitmapToggleButton::Create}\label{wxbitmaptogglebuttoncreate}
|
||||||
|
|
||||||
|
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
|
||||||
|
\param{const wxBitmap\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
|
||||||
|
\param{const wxSize\& }{size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp
|
||||||
|
\param{const wxValidator\& }{val}, \param{const wxString\& }{name = ``checkBox"}}
|
||||||
|
|
||||||
|
Create method for two-step construction.
|
||||||
|
|
||||||
|
\membersection{wxBitmapToggleButton::GetValue}\label{wxbitmaptogglebuttongetvalue}
|
||||||
|
|
||||||
|
\constfunc{bool}{GetValue}{\void}
|
||||||
|
|
||||||
|
Gets the state of the toggle button.
|
||||||
|
|
||||||
|
\wxheading{Return value}
|
||||||
|
|
||||||
|
Returns {\tt true} if it is pressed, {\tt false} otherwise.
|
||||||
|
|
||||||
|
\membersection{wxBitmapToggleButton::SetValue}\label{wxbitmaptogglebuttonsetvalue}
|
||||||
|
|
||||||
|
\func{void}{SetValue}{\param{bool}{ state}}
|
||||||
|
|
||||||
|
Sets the toggle button to the given state. This does not cause a
|
||||||
|
{\tt EVT\_TOGGLEBUTTON} event to be emitted.
|
||||||
|
|
||||||
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{state}{If {\tt true}, the button is pressed.}
|
||||||
|
|
@@ -93,6 +93,7 @@ that are not static can have \helpref{validators}{wxvalidator} associated with t
|
|||||||
\twocolitem{\helpref{wxBitmapButton}{wxbitmapbutton}}{Push button control, displaying a bitmap}
|
\twocolitem{\helpref{wxBitmapButton}{wxbitmapbutton}}{Push button control, displaying a bitmap}
|
||||||
\twocolitem{\helpref{wxBitmapComboBox}{wxbitmapcombobox}}{A combobox with bitmaps next to text items}
|
\twocolitem{\helpref{wxBitmapComboBox}{wxbitmapcombobox}}{A combobox with bitmaps next to text items}
|
||||||
\twocolitem{\helpref{wxToggleButton}{wxtogglebutton}}{A button which stays pressed when clicked by user.}
|
\twocolitem{\helpref{wxToggleButton}{wxtogglebutton}}{A button which stays pressed when clicked by user.}
|
||||||
|
\twocolitem{\helpref{wxBitmapToggleButton}{wxbitmaptogglebutton}}{A toggle button with bitmaps.}
|
||||||
\twocolitem{\helpref{wxCalendarCtrl}{wxcalendarctrl}}{Control showing an entire calendar month}
|
\twocolitem{\helpref{wxCalendarCtrl}{wxcalendarctrl}}{Control showing an entire calendar month}
|
||||||
\twocolitem{\helpref{wxCheckBox}{wxcheckbox}}{Checkbox control}
|
\twocolitem{\helpref{wxCheckBox}{wxcheckbox}}{Checkbox control}
|
||||||
\twocolitem{\helpref{wxCheckListBox}{wxchecklistbox}}{A listbox with a checkbox to the left of each item}
|
\twocolitem{\helpref{wxCheckListBox}{wxchecklistbox}}{A listbox with a checkbox to the left of each item}
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
\input autoobj.tex
|
\input autoobj.tex
|
||||||
\input bitmap.tex
|
\input bitmap.tex
|
||||||
\input bitmapcombobox.tex
|
\input bitmapcombobox.tex
|
||||||
|
\input bitmaptgnbtn.tex
|
||||||
\input bbutton.tex
|
\input bbutton.tex
|
||||||
\input bmpdatob.tex
|
\input bmpdatob.tex
|
||||||
\input bmphand.tex
|
\input bmphand.tex
|
||||||
|
@@ -15,6 +15,8 @@ wxToggleButton is a button that stays pressed when clicked by the user. In
|
|||||||
other words, it is similar to \helpref{wxCheckBox}{wxcheckbox} in
|
other words, it is similar to \helpref{wxCheckBox}{wxcheckbox} in
|
||||||
functionality but looks like a \helpref{wxButton}{wxbutton}.
|
functionality but looks like a \helpref{wxButton}{wxbutton}.
|
||||||
|
|
||||||
|
Since wxWidgets version 2.9.0 this control emits a update UI event.
|
||||||
|
|
||||||
You can see wxToggleButton in action in the sixth page of the
|
You can see wxToggleButton in action in the sixth page of the
|
||||||
\helpref{controls}{samplecontrols} sample.
|
\helpref{controls}{samplecontrols} sample.
|
||||||
|
|
||||||
@@ -48,7 +50,8 @@ See also \helpref{window styles overview}{windowstyles}.
|
|||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxCheckBox}{wxcheckbox}, \helpref{wxButton}{wxbutton}
|
\helpref{wxCheckBox}{wxcheckbox}, \helpref{wxButton}{wxbutton},
|
||||||
|
\helpref{wxToggleBitmapButton}{wxtogglebitmapbutton}
|
||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
@@ -123,3 +126,4 @@ Sets the toggle button to the given state. This does not cause a
|
|||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
\docparam{state}{If {\tt true}, the button is pressed.}
|
\docparam{state}{If {\tt true}, the button is pressed.}
|
||||||
|
|
||||||
|
@@ -29,15 +29,15 @@ class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
|
|||||||
extern WXDLLIMPEXP_CORE const char wxCheckBoxNameStr[];
|
extern WXDLLIMPEXP_CORE const char wxCheckBoxNameStr[];
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToggleBitmapButton
|
// wxBitmapToggleButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxControl
|
class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
wxToggleBitmapButton() {}
|
wxBitmapToggleButton() {}
|
||||||
wxToggleBitmapButton(wxWindow *parent,
|
wxBitmapToggleButton(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxBitmap& label,
|
const wxBitmap& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -82,14 +82,14 @@ protected:
|
|||||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
|
DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToggleButton
|
// wxToggleButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxToggleButton: public wxControl
|
class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
|
@@ -24,6 +24,53 @@ BEGIN_DECLARE_EVENT_TYPES()
|
|||||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19)
|
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19)
|
||||||
END_DECLARE_EVENT_TYPES()
|
END_DECLARE_EVENT_TYPES()
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxToggleButtonBase
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxToggleButtonBase : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxToggleButtonBase() { }
|
||||||
|
|
||||||
|
// Get/set the value
|
||||||
|
virtual void SetValue(bool state) = 0;
|
||||||
|
virtual bool GetValue() const = 0;
|
||||||
|
|
||||||
|
void UpdateWindowUI(long flags)
|
||||||
|
{
|
||||||
|
wxControl::UpdateWindowUI(flags);
|
||||||
|
|
||||||
|
if ( !IsShown() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxWindow *tlw = wxGetTopLevelParent( this );
|
||||||
|
if (tlw && wxPendingDelete.Member( tlw ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxUpdateUIEvent event( GetId() );
|
||||||
|
event.SetEventObject(this);
|
||||||
|
|
||||||
|
if (GetEventHandler()->ProcessEvent(event) )
|
||||||
|
{
|
||||||
|
if ( event.GetSetChecked() )
|
||||||
|
SetValue( event.GetChecked() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buttons on MSW can look bad if they are not native colours, because
|
||||||
|
// then they become owner-drawn and not theme-drawn. Disable it here
|
||||||
|
// in wxToggleButtonBase to make it consistent.
|
||||||
|
virtual bool ShouldInheritColours() const { return false; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// choose the default border for this window
|
||||||
|
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||||
|
|
||||||
|
DECLARE_NO_COPY_CLASS(wxToggleButtonBase)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#define EVT_TOGGLEBUTTON(id, fn) \
|
#define EVT_TOGGLEBUTTON(id, fn) \
|
||||||
wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn))
|
wx__DECLARE_EVT1(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, wxCommandEventHandler(fn))
|
||||||
|
|
||||||
|
@@ -121,6 +121,7 @@ bool wxGenericValidator::TransferToWindow(void)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOGGLEBTN
|
#if wxUSE_TOGGLEBTN
|
||||||
if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
|
if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
|
||||||
{
|
{
|
||||||
@@ -131,6 +132,17 @@ bool wxGenericValidator::TransferToWindow(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
#if defined(__WXMAC__) || defined(__WXGTK20__)
|
||||||
|
if (m_validatorWindow->IsKindOf(CLASSINFO(wxBitmapToggleButton)) )
|
||||||
|
{
|
||||||
|
wxBitmapToggleButton * pControl = (wxBitmapToggleButton *) m_validatorWindow;
|
||||||
|
if (m_pBool)
|
||||||
|
{
|
||||||
|
pControl->SetValue(*m_pBool);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// int controls
|
// int controls
|
||||||
|
@@ -44,12 +44,12 @@ static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxTog
|
|||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// wxToggleBitmapButton
|
// wxBitmapToggleButton
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToggleBitmapButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxControl)
|
||||||
|
|
||||||
bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxBitmap &label, const wxPoint &pos,
|
const wxBitmap &label, const wxPoint &pos,
|
||||||
const wxSize &size, long style,
|
const wxSize &size, long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
@@ -60,7 +60,7 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if (!PreCreation(parent, pos, size) ||
|
if (!PreCreation(parent, pos, size) ||
|
||||||
!CreateBase(parent, id, pos, size, style, validator, name ))
|
!CreateBase(parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed"));
|
wxFAIL_MSG(wxT("wxBitmapToggleButton creation failed"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
// void SetValue(bool state)
|
// void SetValue(bool state)
|
||||||
// Set the value of the toggle button.
|
// Set the value of the toggle button.
|
||||||
void wxToggleBitmapButton::SetValue(bool state)
|
void wxBitmapToggleButton::SetValue(bool state)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
||||||
|
|
||||||
@@ -102,14 +102,14 @@ void wxToggleBitmapButton::SetValue(bool state)
|
|||||||
|
|
||||||
// bool GetValue() const
|
// bool GetValue() const
|
||||||
// Get the value of the toggle button.
|
// Get the value of the toggle button.
|
||||||
bool wxToggleBitmapButton::GetValue() const
|
bool wxBitmapToggleButton::GetValue() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
|
wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
|
||||||
|
|
||||||
return gtk_toggle_button_get_active((GtkToggleButton*)m_widget);
|
return gtk_toggle_button_get_active((GtkToggleButton*)m_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
void wxBitmapToggleButton::SetLabel(const wxBitmap& label)
|
||||||
{
|
{
|
||||||
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
|
|||||||
OnSetBitmap();
|
OnSetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::OnSetBitmap()
|
void wxBitmapToggleButton::OnSetBitmap()
|
||||||
{
|
{
|
||||||
if (!m_bitmap.Ok()) return;
|
if (!m_bitmap.Ok()) return;
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ void wxToggleBitmapButton::OnSetBitmap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToggleBitmapButton::Enable(bool enable /*=true*/)
|
bool wxBitmapToggleButton::Enable(bool enable /*=true*/)
|
||||||
{
|
{
|
||||||
if (!wxControl::Enable(enable))
|
if (!wxControl::Enable(enable))
|
||||||
return false;
|
return false;
|
||||||
@@ -147,20 +147,20 @@ bool wxToggleBitmapButton::Enable(bool enable /*=true*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
void wxBitmapToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||||
{
|
{
|
||||||
gtk_widget_modify_style(m_widget, style);
|
gtk_widget_modify_style(m_widget, style);
|
||||||
gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
|
gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
wxToggleBitmapButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
|
wxBitmapToggleButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
|
||||||
{
|
{
|
||||||
return GTK_BUTTON(m_widget)->event_window;
|
return GTK_BUTTON(m_widget)->event_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the "best" size for this control.
|
// Get the "best" size for this control.
|
||||||
wxSize wxToggleBitmapButton::DoGetBestSize() const
|
wxSize wxBitmapToggleButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize best;
|
wxSize best;
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ wxSize wxToggleBitmapButton::DoGetBestSize() const
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
wxVisualAttributes
|
wxVisualAttributes
|
||||||
wxToggleBitmapButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
wxBitmapToggleButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
||||||
{
|
{
|
||||||
return GetDefaultAttributesFromGTKWidget(gtk_toggle_button_new);
|
return GetDefaultAttributesFromGTKWidget(gtk_toggle_button_new);
|
||||||
}
|
}
|
||||||
|
@@ -104,12 +104,12 @@ wxInt32 wxToggleButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEV
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxToggleBitmapButton
|
// wxBitmapToggleButton
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToggleBitmapButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxControl)
|
||||||
|
|
||||||
bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxBitmap& label,
|
const wxBitmap& label,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, long style,
|
const wxSize& size, long style,
|
||||||
@@ -137,7 +137,7 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxToggleBitmapButton::DoGetBestSize() const
|
wxSize wxBitmapToggleButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
if (!m_bitmap.IsOk())
|
if (!m_bitmap.IsOk())
|
||||||
return wxSize(20,20);
|
return wxSize(20,20);
|
||||||
@@ -145,23 +145,23 @@ wxSize wxToggleBitmapButton::DoGetBestSize() const
|
|||||||
return wxSize ( m_bitmap.GetWidth()+6, m_bitmap.GetHeight()+6 ) ;
|
return wxSize ( m_bitmap.GetWidth()+6, m_bitmap.GetHeight()+6 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::SetValue(bool val)
|
void wxBitmapToggleButton::SetValue(bool val)
|
||||||
{
|
{
|
||||||
m_peer->SetValue( val ) ;
|
m_peer->SetValue( val ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToggleBitmapButton::GetValue() const
|
bool wxBitmapToggleButton::GetValue() const
|
||||||
{
|
{
|
||||||
return m_peer->GetValue() ;
|
return m_peer->GetValue() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleBitmapButton::Command(wxCommandEvent & event)
|
void wxBitmapToggleButton::Command(wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
SetValue((event.GetInt() != 0));
|
SetValue((event.GetInt() != 0));
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt32 wxToggleBitmapButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
wxInt32 wxBitmapToggleButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
|
||||||
event.SetInt(GetValue());
|
event.SetInt(GetValue());
|
||||||
|
Reference in New Issue
Block a user