1999-10-15 21:00:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-20 00:14:35 +00:00
|
|
|
// Name: wx/os2/spinctrl.h
|
1999-10-15 21:00:38 +00:00
|
|
|
// Purpose: wxSpinCtrl class declaration for Win32
|
|
|
|
// Author: David Webster
|
|
|
|
// Modified by:
|
|
|
|
// Created: 10/15/99
|
|
|
|
// Copyright: (c) David Webster
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-10-15 21:00:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_MSW_SPINCTRL_H_
|
|
|
|
#define _WX_MSW_SPINCTRL_H_
|
|
|
|
|
|
|
|
#include "wx/spinbutt.h" // the base class
|
2001-12-17 22:56:41 +00:00
|
|
|
#include "wx/dynarray.h"
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
|
2005-07-21 17:18:43 +00:00
|
|
|
WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
|
1999-10-15 21:00:38 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-10-28 22:38:37 +00:00
|
|
|
// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
|
1999-10-15 21:00:38 +00:00
|
|
|
// text window whose contents is automatically updated when the spin
|
|
|
|
// control is clicked.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton
|
1999-10-15 21:00:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxSpinCtrl() { }
|
2001-12-17 22:56:41 +00:00
|
|
|
wxSpinCtrl( wxWindow* pParent
|
2005-07-21 17:18:43 +00:00
|
|
|
,wxWindowID vId = wxID_ANY
|
2001-12-17 22:56:41 +00:00
|
|
|
,const wxString& rsValue = wxEmptyString
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = wxSP_ARROW_KEYS
|
|
|
|
,int nMin = 0
|
|
|
|
,int nMax = 100
|
|
|
|
,int nInitial = 0
|
2009-07-23 20:30:22 +00:00
|
|
|
,const wxString& rsName = wxT("wxSpinCtrl")
|
2001-12-17 22:56:41 +00:00
|
|
|
)
|
1999-10-15 21:00:38 +00:00
|
|
|
{
|
2001-12-17 22:56:41 +00:00
|
|
|
Create(pParent, vId, rsValue, rPos, rSize, lStyle, nMin, nMax, nInitial, rsName);
|
1999-10-15 21:00:38 +00:00
|
|
|
}
|
2001-12-17 22:56:41 +00:00
|
|
|
virtual ~wxSpinCtrl();
|
|
|
|
|
|
|
|
bool Create(wxWindow* pParent
|
2005-07-21 17:18:43 +00:00
|
|
|
,wxWindowID vId = wxID_ANY
|
2001-12-17 22:56:41 +00:00
|
|
|
,const wxString& rsValue = wxEmptyString
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = wxSP_ARROW_KEYS
|
|
|
|
,int nMin = 0
|
|
|
|
,int nMax = 100
|
|
|
|
,int nInitial = 0
|
2009-07-23 20:30:22 +00:00
|
|
|
,const wxString& rsName = wxT("wxSpinCtrl")
|
2001-12-17 22:56:41 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// A wxTextCtrl-like method (but we can't have GetValue returning wxString
|
2000-01-05 14:07:15 +00:00
|
|
|
// because the base class already has one returning int!)
|
2001-12-17 22:56:41 +00:00
|
|
|
//
|
|
|
|
void SetValue(const wxString& rsText);
|
2000-01-05 14:07:15 +00:00
|
|
|
|
2001-12-17 22:56:41 +00:00
|
|
|
//
|
2000-01-05 14:07:15 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
2001-12-17 22:56:41 +00:00
|
|
|
//
|
2005-07-21 17:18:43 +00:00
|
|
|
virtual bool Enable(bool bEnable = true);
|
2000-01-05 14:07:15 +00:00
|
|
|
|
2005-07-21 17:18:43 +00:00
|
|
|
virtual int GetValue(void) const;
|
|
|
|
|
|
|
|
virtual bool SetFont(const wxFont &rFont);
|
|
|
|
virtual void SetFocus(void);
|
2000-01-05 14:07:15 +00:00
|
|
|
|
2001-12-17 22:56:41 +00:00
|
|
|
inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
|
1999-10-15 21:00:38 +00:00
|
|
|
|
2005-07-21 17:18:43 +00:00
|
|
|
void SetSelection(long lFrom, long lTo);
|
|
|
|
|
|
|
|
virtual bool Show(bool bShow = true);
|
2000-01-05 14:07:15 +00:00
|
|
|
|
2001-12-17 22:56:41 +00:00
|
|
|
//
|
|
|
|
// wxSpinButton doesn't accept focus, but we do
|
|
|
|
//
|
2005-07-21 17:18:43 +00:00
|
|
|
inline virtual bool AcceptsFocus(void) const { return false; }
|
2000-01-05 14:07:15 +00:00
|
|
|
|
2001-12-17 22:56:41 +00:00
|
|
|
//
|
|
|
|
// Return the spinctrl object whose buddy is the given window or NULL
|
|
|
|
// Doesn't really do much under OS/2
|
|
|
|
//
|
|
|
|
static wxSpinCtrl* GetSpinForTextCtrl(WXHWND hWndBuddy);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Process a WM_COMMAND generated by the buddy text control
|
|
|
|
//
|
|
|
|
bool ProcessTextCommand( WXWORD wCmd
|
|
|
|
,WXWORD wId
|
|
|
|
);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void DoGetPosition( int* nlX
|
|
|
|
,int* nlY
|
|
|
|
) const;
|
|
|
|
void DoMoveWindow( int nX
|
|
|
|
,int nY
|
|
|
|
,int nWidth
|
|
|
|
,int nHeight
|
|
|
|
);
|
|
|
|
virtual wxSize DoGetBestSize(void) const;
|
|
|
|
virtual void DoGetSize( int* pnWidth
|
|
|
|
,int* pnHeight
|
|
|
|
) const;
|
|
|
|
|
|
|
|
//
|
|
|
|
// The handler for wxSpinButton events
|
|
|
|
//
|
|
|
|
void OnSpinChange(wxSpinEvent& rEvent);
|
|
|
|
void OnChar(wxKeyEvent& rEvent);
|
2003-04-17 15:47:35 +00:00
|
|
|
void OnSetFocus(wxFocusEvent& rEvent);
|
2001-12-17 22:56:41 +00:00
|
|
|
|
|
|
|
WXHWND m_hWndBuddy;
|
|
|
|
static wxArraySpins m_svAllSpins;
|
1999-10-15 21:00:38 +00:00
|
|
|
|
2000-01-05 14:07:15 +00:00
|
|
|
private:
|
1999-10-15 21:00:38 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
2000-01-05 14:07:15 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-12-17 22:56:41 +00:00
|
|
|
}; // end of CLASS wxSpinCtrl
|
1999-10-15 21:00:38 +00:00
|
|
|
|
|
|
|
#endif // _WX_MSW_SPINCTRL_H_
|