X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/637b7e4f3a0fd1c6bdfc21d28e37bcf760e3b364..da6f998486f1070e205f2e0a54f22a1b67cb32a4:/src/os2/spinbutt.cpp diff --git a/src/os2/spinbutt.cpp b/src/os2/spinbutt.cpp index 0c25a24f01..07942af8dd 100644 --- a/src/os2/spinbutt.cpp +++ b/src/os2/spinbutt.cpp @@ -1,10 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: spinbutt.cpp +// Name: src/os2/spinbutt.cpp // Purpose: wxSpinButton // Author: David Webster // Modified by: // Created: 10/15/99 -// RCS-ID: $Id$ // Copyright: (c) David Webster // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -28,8 +27,6 @@ extern void wxAssociateWinWithHandle( HWND hWnd ,wxWindowOS2* pWin ); -IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent) - #include "wx/os2/private.h" // ============================================================================ @@ -40,8 +37,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent) // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl) - bool wxSpinButton::Create( wxWindow* pParent , wxWindowID vId @@ -63,8 +58,11 @@ bool wxSpinButton::Create( m_windowId = NewControlId(); else m_windowId = vId; - m_backgroundColour = pParent->GetBackgroundColour(); - m_foregroundColour = pParent->GetForegroundColour(); + if (pParent) + { + m_backgroundColour = pParent->GetBackgroundColour(); + m_foregroundColour = pParent->GetForegroundColour(); + } SetName(rsName); SetParent(pParent); m_windowStyle = lStyle; @@ -86,12 +84,10 @@ bool wxSpinButton::Create( if (nY < 0 ) nY = 0; - long lSstyle = 0L; - - lSstyle = WS_VISIBLE | - WS_TABSTOP | - SPBS_MASTER | // We use only single field spin buttons - SPBS_NUMERICONLY; // We default to numeric data + long lSstyle = WS_VISIBLE | + WS_TABSTOP | + SPBS_MASTER | // We use only single field spin buttons + SPBS_NUMERICONLY; // We default to numeric data if (m_windowStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; @@ -118,12 +114,8 @@ bool wxSpinButton::Create( ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y-5); // compensate for the associated TextControl border - wxFont* pTextFont = new wxFont( 10 - ,wxMODERN - ,wxNORMAL - ,wxNORMAL - ); - SetFont(*pTextFont); + + SetFont(*wxSMALL_FONT); // // For OS/2 we want to hide the text portion so we can substitute an // independent text ctrl in its place. @@ -144,7 +136,6 @@ bool wxSpinButton::Create( ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc); #endif - delete pTextFont; return TRUE; } // end of wxSpinButton::Create @@ -159,12 +150,12 @@ wxSpinButton::~wxSpinButton() wxSize wxSpinButton::DoGetBestSize() const { // - // OS/2 PM does not really have system metrics so we'll just set it to - // 26x20 which is the size of the buttons and the borders. - // Also we have no horizontal spin buttons. + // OS/2 PM does not really have system metrics so we'll just set it to + // a square based on its height. // - wxSize best(26,20); - return best; + RECTL vRect; + ::WinQueryWindowRect(GetHwnd(),&vRect); + return wxSize(vRect.yTop,vRect.yTop); } // end of wxSpinButton::DoGetBestSize // ---------------------------------------------------------------------------- @@ -199,7 +190,7 @@ bool wxSpinButton::OS2OnScroll( int WXUNUSED(nOrientation), vEvent.SetPosition(nVal); vEvent.SetEventObject(this); - return(GetEventHandler()->ProcessEvent(vEvent)); + return(HandleWindowEvent(vEvent)); } // end of wxSpinButton::OS2OnScroll bool wxSpinButton::OS2Command( WXUINT WXUNUSED(uCmd),