1999-10-11 06:05:36 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-22 21:28:01 -05:00
|
|
|
// Name: wx/gtk1/spinctrl.h
|
1999-10-11 06:05:36 -04:00
|
|
|
// Purpose: wxSpinCtrl class
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-10-11 06:05:36 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKSPINCTRLH__
|
|
|
|
#define __GTKSPINCTRLH__
|
|
|
|
|
1999-11-27 11:43:47 -05:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_SPINCTRL
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
1999-10-28 09:04:45 -04:00
|
|
|
// wxSpinCtrl
|
1999-10-11 06:05:36 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl
|
1999-10-11 06:05:36 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxSpinCtrl() {}
|
|
|
|
wxSpinCtrl(wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
1999-10-28 09:04:45 -04:00
|
|
|
const wxString& value = wxEmptyString,
|
1999-10-11 06:05:36 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSP_ARROW_KEYS,
|
|
|
|
int min = 0, int max = 100, int initial = 0,
|
2009-07-23 16:30:22 -04:00
|
|
|
const wxString& name = wxT("wxSpinCtrl"))
|
1999-10-11 06:05:36 -04:00
|
|
|
{
|
1999-10-28 09:04:45 -04:00
|
|
|
Create(parent, id, value, pos, size, style, min, max, initial, name);
|
1999-10-11 06:05:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
1999-10-28 09:04:45 -04:00
|
|
|
const wxString& value = wxEmptyString,
|
1999-10-11 06:05:36 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSP_ARROW_KEYS,
|
|
|
|
int min = 0, int max = 100, int initial = 0,
|
2009-07-23 16:30:22 -04:00
|
|
|
const wxString& name = wxT("wxSpinCtrl"));
|
1999-10-11 06:05:36 -04:00
|
|
|
|
1999-10-28 09:04:45 -04:00
|
|
|
void SetValue(const wxString& text);
|
2004-01-22 10:20:34 -05:00
|
|
|
void SetSelection(long from, long to);
|
1999-10-28 09:04:45 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
virtual int GetValue() const;
|
|
|
|
virtual void SetValue( int value );
|
|
|
|
virtual void SetRange( int minVal, int maxVal );
|
|
|
|
virtual int GetMin() const;
|
|
|
|
virtual int GetMax() const;
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2006-01-22 21:28:01 -05:00
|
|
|
|
1999-10-28 09:04:45 -04:00
|
|
|
// implementation
|
1999-10-29 13:20:44 -04:00
|
|
|
void OnChar( wxKeyEvent &event );
|
2006-01-22 21:28:01 -05:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
2000-01-02 11:25:28 -05:00
|
|
|
void GtkDisableEvents();
|
|
|
|
void GtkEnableEvents();
|
1999-10-11 06:05:36 -04:00
|
|
|
|
|
|
|
GtkAdjustment *m_adjust;
|
|
|
|
float m_oldPos;
|
|
|
|
|
2012-09-20 08:33:05 -04:00
|
|
|
virtual int GetBase() const { return m_base; }
|
|
|
|
virtual bool SetBase(int base);
|
|
|
|
|
|
|
|
protected:
|
1999-12-29 14:18:01 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
// Widgets that use the style->base colour for the BG colour should
|
|
|
|
// override this and return true.
|
|
|
|
virtual bool UseGTKStyleBase() const { return true; }
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
private:
|
2012-09-20 08:33:05 -04:00
|
|
|
// Common part of all ctors.
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
m_base = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
int m_base;
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
1999-10-29 13:20:44 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1999-10-11 06:05:36 -04:00
|
|
|
};
|
|
|
|
|
1999-11-27 11:43:47 -05:00
|
|
|
#endif
|
|
|
|
// wxUSE_SPINCTRL
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
#endif
|
|
|
|
// __GTKSPINCTRLH__
|