X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e320a79f187558effb04d92020b470372bbe456..6285be722384e07c2587e769dce7cabb8adbd31b:/src/os2/spinbutt.cpp diff --git a/src/os2/spinbutt.cpp b/src/os2/spinbutt.cpp index cbea725592..99e5852636 100644 --- a/src/os2/spinbutt.cpp +++ b/src/os2/spinbutt.cpp @@ -1,32 +1,56 @@ ///////////////////////////////////////////////////////////////////////////// // Name: spinbutt.cpp // Purpose: wxSpinButton -// Author: AUTHOR +// Author: David Webster // Modified by: -// Created: ??/??/98 +// Created: 10/15/99 // RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Copyright: (c) David Webster +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "spinbutt.h" + #pragma implementation "spinbutt.h" + #pragma implementation "spinbutbase.h" #endif -#include "wx/spinbutt.h" +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl) + +#ifndef WX_PRECOMP + #include "wx/wx.h" #endif +#if wxUSE_SPINBTN -wxSpinButton::wxSpinButton() -{ - m_min = 0; - m_max = 100; -} +// Can't resolve reference to CreateUpDownControl in +// TWIN32, but could probably use normal CreateWindow instead. + + +#include "wx/spinbutt.h" -bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) +IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent) + +#include "wx/os2/private.h" + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl) + +bool wxSpinButton::Create( + wxWindow* parent +, wxWindowID id +, const wxPoint& pos +, const wxSize& size +, long style +, const wxString& name +) { SetName(name); @@ -34,9 +58,6 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c SetParent(parent); - m_min = 0; - m_max = 100; - m_windowId = (id == -1) ? NewControlId() : id; // TODO create spin button @@ -47,32 +68,96 @@ wxSpinButton::~wxSpinButton() { } +// ---------------------------------------------------------------------------- +// size calculation +// ---------------------------------------------------------------------------- + +wxSize wxSpinButton::DoGetBestSize() const +{ + // TODO: +/* + if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 ) + { + // vertical control + return wxSize(GetSystemMetrics(SM_CXVSCROLL), + 2*GetSystemMetrics(SM_CYVSCROLL)); + } + else + { + // horizontal control + return wxSize(2*GetSystemMetrics(SM_CXHSCROLL), + GetSystemMetrics(SM_CYHSCROLL)); + } +*/ + return wxSize(0, 0); +} + +// ---------------------------------------------------------------------------- // Attributes -//////////////////////////////////////////////////////////////////////////// +// ---------------------------------------------------------------------------- int wxSpinButton::GetValue() const { - // TODO + // TODO return 0; } void wxSpinButton::SetValue(int val) { - // TODO + // TODO } void wxSpinButton::SetRange(int minVal, int maxVal) { - m_min = minVal; - m_max = maxVal; - // TODO + // TODO } -// Spin event -IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent) +bool wxSpinButton::OS2OnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control) +{ + wxCHECK_MSG( control, FALSE, wxT("scrolling what?") ) +// TODO: +/* + if ( wParam != SB_THUMBPOSITION ) + { + // probable SB_ENDSCROLL - we don't react to it + return FALSE; + } + + wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId); + event.SetPosition((short)pos); // cast is important for negative values! + event.SetEventObject(this); + + return GetEventHandler()->ProcessEvent(event); +*/ + return FALSE; +} -wxSpinEvent::wxSpinEvent(wxEventType commandType, int id): - wxScrollEvent(commandType, id) +bool wxSpinButton::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { + // TODO: +/* + LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam; + + wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP + : wxEVT_SCROLL_LINEDOWN, + m_windowId); + event.SetPosition(lpnmud->iPos + lpnmud->iDelta); + event.SetEventObject(this); + + bool processed = GetEventHandler()->ProcessEvent(event); + + *result = event.IsAllowed() ? 0 : 1; + + return processed; +*/ + return FALSE; +} + +bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id) +{ + // No command messages + return FALSE; } +#endif //wxUSE_SPINBTN