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"
|
|
|
|
class WXDLLEXPORT wxSpinCtrl;
|
|
|
|
WX_DEFINE_EXPORTED_ARRAY(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.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxSpinCtrl() { }
|
2001-12-17 17:56:41 -05:00
|
|
|
wxSpinCtrl( wxWindow* pParent
|
|
|
|
,wxWindowID vId = -1
|
|
|
|
,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
|
|
|
|
,wxWindowID vId = -1
|
|
|
|
,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
|
|
|
//
|
|
|
|
virtual bool Enable(bool bEnable = TRUE);
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-12-17 17:56:41 -05:00
|
|
|
virtual int GetValue(void) const;
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-12-17 17:56:41 -05:00
|
|
|
virtual bool SetFont(const wxFont &rFont);
|
|
|
|
virtual void SetFocus(void);
|
|
|
|
inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
|
2002-08-30 17:20:42 -04:00
|
|
|
void SetSelection( long lFrom
|
|
|
|
,long lTo
|
|
|
|
);
|
1999-10-15 17:00:38 -04:00
|
|
|
|
2001-12-17 17:56:41 -05:00
|
|
|
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
|
|
|
|
//
|
|
|
|
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_
|
|
|
|
|
|
|
|
|