1999-10-11 10:05:36 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: spinctrl.h
|
|
|
|
// Purpose: wxSpinCtrl class
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Robert Roebling
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-10-11 10:05:36 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKSPINCTRLH__
|
|
|
|
#define __GTKSPINCTRLH__
|
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-10-11 10:05:36 +00:00
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
1999-11-27 16:43:47 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_SPINCTRL
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
1999-10-28 13:04:45 +00:00
|
|
|
// wxSpinCtrl
|
1999-10-11 10:05:36 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxSpinCtrl : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxSpinCtrl() {}
|
|
|
|
wxSpinCtrl(wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
1999-10-28 13:04:45 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
1999-10-11 10:05:36 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSP_ARROW_KEYS,
|
|
|
|
int min = 0, int max = 100, int initial = 0,
|
|
|
|
const wxString& name = _T("wxSpinCtrl"))
|
|
|
|
{
|
1999-10-28 13:04:45 +00:00
|
|
|
Create(parent, id, value, pos, size, style, min, max, initial, name);
|
1999-10-11 10:05:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
1999-10-28 13:04:45 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
1999-10-11 10:05:36 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSP_ARROW_KEYS,
|
|
|
|
int min = 0, int max = 100, int initial = 0,
|
|
|
|
const wxString& name = _T("wxSpinCtrl"));
|
|
|
|
|
1999-10-28 13:04:45 +00:00
|
|
|
void SetValue(const wxString& text);
|
2004-01-22 15:20:34 +00:00
|
|
|
void SetSelection(long from, long to);
|
1999-10-28 13:04:45 +00:00
|
|
|
|
1999-10-11 10:05:36 +00: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 17:26:25 +00:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
|
|
|
|
1999-10-28 13:04:45 +00:00
|
|
|
// implementation
|
1999-10-29 17:20:44 +00:00
|
|
|
void OnChar( wxKeyEvent &event );
|
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
2000-01-02 16:25:28 +00:00
|
|
|
void GtkDisableEvents();
|
|
|
|
void GtkEnableEvents();
|
1999-10-11 10:05:36 +00:00
|
|
|
|
|
|
|
GtkAdjustment *m_adjust;
|
|
|
|
float m_oldPos;
|
|
|
|
|
1999-12-29 19:18:01 +00:00
|
|
|
protected:
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2004-05-06 17:26:25 +00: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 10:05:36 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
1999-10-29 17:20:44 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
1999-10-11 10:05:36 +00:00
|
|
|
};
|
|
|
|
|
1999-11-27 16:43:47 +00:00
|
|
|
#endif
|
|
|
|
// wxUSE_SPINCTRL
|
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
#endif
|
|
|
|
// __GTKSPINCTRLH__
|