1. corrected some owner-drawn buttons bugs
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
This commit is contained in:
parent
57160afe2b
commit
9750fc4245
@ -319,7 +319,9 @@ consisting of the from and to values.}
|
||||
|
||||
\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}
|
||||
|
||||
|
@ -63,9 +63,14 @@ protected:
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// the handler for wxSpinButton events
|
||||
void OnSpinChange(wxSpinEvent& event);
|
||||
|
||||
WXHWND m_hwndBuddy;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_SPINCTRL_H_
|
||||
|
@ -305,7 +305,7 @@ static void DrawRect(HDC hdc, const RECT& r)
|
||||
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;
|
||||
@ -475,6 +475,12 @@ bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
||||
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);
|
||||
|
@ -54,8 +54,8 @@
|
||||
// wxWin macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSpinButton
|
||||
|
@ -50,7 +50,11 @@
|
||||
// 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
|
||||
@ -201,6 +205,24 @@ bool wxSpinCtrl::SetFont(const wxFont& font)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user