2. added generation of event for EVT_SPINCTRL handler to wxSpinCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5073
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
\constfunc{wxString}{GetValue}{\void}
\constfunc{wxString}{GetValue}{\void}
-Gets the contents of the control.
+Gets the contents of the control. Notice that for a multiline text control,
+the lines will be separated by (Unix-style) '\\n' characters, even under
+Windows where they are separated by "\\r\\n" sequence in the native control.
\membersection{wxTextCtrl::IsModified}\label{wxtextctrlismodified}
\membersection{wxTextCtrl::IsModified}\label{wxtextctrlismodified}
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual wxSize DoGetBestSize() const;
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual wxSize DoGetBestSize() const;
+ // the handler for wxSpinButton events
+ void OnSpinChange(wxSpinEvent& event);
+
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
};
#endif // _WX_MSW_SPINCTRL_H_
};
#endif // _WX_MSW_SPINCTRL_H_
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
wxWindow *top_frame = m_parent;
while (top_frame->GetParent() && !(top_frame->GetParent()->m_isFrame))
top_frame = top_frame->GetParent();
wxWindow *top_frame = m_parent;
while (top_frame->GetParent() && !(top_frame->GetParent()->m_isFrame))
top_frame = top_frame->GetParent();
- GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+ GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
- if (window->default_widget)
+ if (window->default_widget)
{
gtk_widget_activate (window->default_widget);
{
gtk_widget_activate (window->default_widget);
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
wxWindow *top_frame = m_parent;
while (top_frame->GetParent() && !(top_frame->GetParent()->m_isFrame))
top_frame = top_frame->GetParent();
wxWindow *top_frame = m_parent;
while (top_frame->GetParent() && !(top_frame->GetParent()->m_isFrame))
top_frame = top_frame->GetParent();
- GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+ GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
- if (window->default_widget)
+ if (window->default_widget)
{
gtk_widget_activate (window->default_widget);
{
gtk_widget_activate (window->default_widget);
void wxButton::MakeOwnerDrawn()
{
long style = GetWindowLong(GetHwnd(), GWL_STYLE);
void wxButton::MakeOwnerDrawn()
{
long style = GetWindowLong(GetHwnd(), GWL_STYLE);
- if ( !(style & BS_OWNERDRAW) )
+ if ( (style & BS_OWNERDRAW) != BS_OWNERDRAW )
{
// make it so
style |= BS_OWNERDRAW;
{
// make it so
style |= BS_OWNERDRAW;
DrawFocusRect(hdc, &rectFocus);
}
DrawFocusRect(hdc, &rectFocus);
}
+ if ( pushed )
+ {
+ // the label is shifted by 1 pixel to create "pushed" effect
+ OffsetRect(&rectBtn, 1, 1);
+ }
+
DrawButtonText(hdc, &rectBtn, GetLabel(),
state & ODS_DISABLED ? GetSysColor(COLOR_GRAYTEXT)
: colFg);
DrawButtonText(hdc, &rectBtn, GetLabel(),
state & ODS_DISABLED ? GetSysColor(COLOR_GRAYTEXT)
: colFg);
// wxWin macros
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
- IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
- IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
+IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
// ----------------------------------------------------------------------------
// wxSpinButton
// ----------------------------------------------------------------------------
// wxSpinButton
// macros
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
- IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
+
+BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
+ EVT_SPIN(-1, wxSpinCtrl::OnSpinChange)
+END_EVENT_TABLE()
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// constants
+// ----------------------------------------------------------------------------
+// event processing
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
+{
+ wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
+ event.SetEventObject(this);
+ event.SetInt(eventSpin.GetPosition());
+
+ (void)GetEventHandler()->ProcessEvent(event);
+
+ if ( eventSpin.GetSkipped() )
+ {
+ event.Skip();
+ }
+}
+
// ----------------------------------------------------------------------------
// size calculations
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// size calculations
// ----------------------------------------------------------------------------