1999-10-15 17:00:38 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: msw/spinctrl.h
|
|
|
|
// Purpose: wxSpinCtrl class declaration for Win32
|
|
|
|
// Author: David Webster
|
|
|
|
// Modified by:
|
|
|
|
// Created: 10/15/99
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) David Webster
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-10-15 17:00:38 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_MSW_SPINCTRL_H_
|
|
|
|
#define _WX_MSW_SPINCTRL_H_
|
|
|
|
|
|
|
|
#include "wx/spinbutt.h" // the base class
|
2001-12-17 17:56:41 -05:00
|
|
|
#include "wx/dynarray.h"
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
|
2005-07-21 13:18:43 -04:00
|
|
|
WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
|
1999-10-15 17:00:38 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-10-28 18:38:37 -04:00
|
|
|
// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
|
1999-10-15 17:00:38 -04:00
|
|
|
// text window whose contents is automatically updated when the spin
|
|
|
|
// control is clicked.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton
|
1999-10-15 17:00:38 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxSpinCtrl() { }
|
2001-12-17 17:56:41 -05:00
|
|
|
wxSpinCtrl( wxWindow* pParent
|
2005-07-21 13:18:43 -04:00
|
|
|
,wxWindowID vId = wxID_ANY
|
2001-12-17 17:56:41 -05: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
|
|
|
|
,const wxString& rsName = _T("wxSpinCtrl")
|
|
|
|
)
|
1999-10-15 17:00:38 -04:00
|
|
|
{
|
2001-12-17 17:56:41 -05:00
|
|
|
Create(pParent, vId, rsValue, rPos, rSize, lStyle, nMin, nMax, nInitial, rsName);
|
1999-10-15 17:00:38 -04:00
|
|
|
}
|
2001-12-17 17:56:41 -05:00
|
|
|
virtual ~wxSpinCtrl();
|
|
|
|
|
|
|
|
bool Create(wxWindow* pParent
|
2005-07-21 13:18:43 -04:00
|
|
|
,wxWindowID vId = wxID_ANY
|
2001-12-17 17:56:41 -05: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
|
|
|
|
,const wxString& rsName = _T("wxSpinCtrl")
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// A wxTextCtrl-like method (but we can't have GetValue returning wxString
|
2000-01-05 09:07:15 -05:00
|
|
|
// because the base class already has one returning int!)
|
2001-12-17 17:56:41 -05:00
|
|
|
//
|
|
|
|
void SetValue(const wxString& rsText);
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-12-17 17:56:41 -05:00
|
|
|
//
|
2000-01-05 09:07:15 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
2001-12-17 17:56:41 -05:00
|
|
|
//
|
2005-07-21 13:18:43 -04:00
|
|
|
virtual bool Enable(bool bEnable = true);
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2005-07-21 13:18:43 -04:00
|
|
|
virtual int GetValue(void) const;
|
|
|
|
|
|
|
|
virtual bool SetFont(const wxFont &rFont);
|
|
|
|
virtual void SetFocus(void);
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-12-17 17:56:41 -05:00
|
|
|
inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
|
1999-10-15 17:00:38 -04:00
|
|
|
|
2005-07-21 13:18:43 -04:00
|
|
|
void SetSelection(long lFrom, long lTo);
|
|
|
|
|
|
|
|
virtual bool Show(bool bShow = true);
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-12-17 17:56:41 -05:00
|
|
|
//
|
|
|
|
// wxSpinButton doesn't accept focus, but we do
|
|
|
|
//
|
2005-07-21 13:18:43 -04:00
|
|
|
inline virtual bool AcceptsFocus(void) const { return false; }
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-12-17 17:56:41 -05: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 11:47:35 -04:00
|
|
|
void OnSetFocus(wxFocusEvent& rEvent);
|
2001-12-17 17:56:41 -05:00
|
|
|
|
|
|
|
WXHWND m_hWndBuddy;
|
|
|
|
static wxArraySpins m_svAllSpins;
|
1999-10-15 17:00:38 -04:00
|
|
|
|
2000-01-05 09:07:15 -05:00
|
|
|
private:
|
1999-10-15 17:00:38 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
2000-01-05 09:07:15 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-12-17 17:56:41 -05:00
|
|
|
}; // end of CLASS wxSpinCtrl
|
1999-10-15 17:00:38 -04:00
|
|
|
|
|
|
|
#endif // _WX_MSW_SPINCTRL_H_
|