X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dba006200f4b262f2381cfcbc2657cd0680502c3..9afe6c17502fc82d9af19c260ab4b8bedb7fe70e:/src/generic/spinctlg.cpp diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 0da033d763..eb52e041a2 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -109,7 +109,7 @@ public: protected: void OnSpinButton(wxSpinEvent& eventSpin) { -#ifdef __WXMAC__ +#if defined(__WXMAC__) || defined(__WXMOTIF__) m_spin->SetTextValue(eventSpin.GetPosition()); wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId()); @@ -134,7 +134,7 @@ BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) - + // ============================================================================ // implementation // ============================================================================ @@ -235,18 +235,15 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) { wxControl::DoMoveWindow(x, y, width, height); - wxPoint p = GetParent() ? - GetParent()->GetClientAreaOrigin() : wxPoint(0,0); - // position the subcontrols inside the client area wxSize sizeBtn = m_btn->GetSize(); wxCoord wText = width - sizeBtn.x; - m_text->SetSize(x-p.x, y-p.y, wText, height); + m_text->SetSize(x, y, wText, height); #ifdef __WXMAC__ - m_btn->SetSize(x-p.x + wText + MARGIN, y-p.y, -1, -1); + m_btn->SetSize(x + wText + MARGIN, y, -1, -1); #else - m_btn->SetSize(x-p.x + wText + MARGIN, y-p.y, -1, height); + m_btn->SetSize(x + wText + MARGIN, y, -1, height); #endif } @@ -369,5 +366,12 @@ void wxSpinCtrl::SetRange(int min, int max) m_btn->SetRange(min, max); } +void wxSpinCtrl::SetSelection(long from, long to) +{ + wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetSelection") ); + + m_text->SetSelection(from, to); +} + #endif // wxUSE_SPINCTRL #endif // !wxPort-with-native-spinctrl