added SpinCtrl,
updated a few headers, tried to set window size hints, no effect with KWM, git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3926 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# This file was automatically generated by tmake at 14:12, 1999/10/09
|
# This file was automatically generated by tmake at 09:29, 1999/10/11
|
||||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -892,6 +892,7 @@ GTK_GUIOBJS = \
|
|||||||
settings.o \
|
settings.o \
|
||||||
slider.o \
|
slider.o \
|
||||||
spinbutt.o \
|
spinbutt.o \
|
||||||
|
spinctrl.o \
|
||||||
statbmp.o \
|
statbmp.o \
|
||||||
statbox.o \
|
statbox.o \
|
||||||
statline.o \
|
statline.o \
|
||||||
@@ -951,6 +952,7 @@ GTK_GUIDEPS = \
|
|||||||
settings.d \
|
settings.d \
|
||||||
slider.d \
|
slider.d \
|
||||||
spinbutt.d \
|
spinbutt.d \
|
||||||
|
spinctrl.d \
|
||||||
statbmp.d \
|
statbmp.d \
|
||||||
statbox.d \
|
statbox.d \
|
||||||
statline.d \
|
statline.d \
|
||||||
|
@@ -326,6 +326,7 @@ scrolbar.cpp R
|
|||||||
settings.cpp R
|
settings.cpp R
|
||||||
slider.cpp R
|
slider.cpp R
|
||||||
spinbutt.cpp R
|
spinbutt.cpp R
|
||||||
|
spinctrl.cpp R
|
||||||
statbmp.cpp R
|
statbmp.cpp R
|
||||||
statbox.cpp R
|
statbox.cpp R
|
||||||
statline.cpp R
|
statline.cpp R
|
||||||
|
@@ -56,8 +56,7 @@ extern wxAcceleratorTable wxNullAcceleratorTable;
|
|||||||
|
|
||||||
class wxAcceleratorEntry: public wxObject
|
class wxAcceleratorEntry: public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
|
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
|
||||||
{ m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
|
{ m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
|
||||||
|
|
||||||
|
@@ -80,6 +80,7 @@ private:
|
|||||||
/// Set to TRUE while we are in wxYield().
|
/// Set to TRUE while we are in wxYield().
|
||||||
bool m_suppressIdleEvents;
|
bool m_suppressIdleEvents;
|
||||||
|
|
||||||
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxApp)
|
DECLARE_DYNAMIC_CLASS(wxApp)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -43,8 +43,6 @@ extern const wxChar *wxButtonNameStr;
|
|||||||
|
|
||||||
class wxBitmapButton: public wxButton
|
class wxBitmapButton: public wxButton
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxBitmapButton();
|
wxBitmapButton();
|
||||||
inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
||||||
@@ -93,6 +91,9 @@ public:
|
|||||||
wxBitmap m_disabled;
|
wxBitmap m_disabled;
|
||||||
wxBitmap m_focus;
|
wxBitmap m_focus;
|
||||||
wxBitmap m_selected;
|
wxBitmap m_selected;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -33,10 +33,7 @@ class wxBrush;
|
|||||||
|
|
||||||
class wxBrush: public wxGDIObject
|
class wxBrush: public wxGDIObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxBrush();
|
wxBrush();
|
||||||
wxBrush( const wxColour &colour, int style );
|
wxBrush( const wxColour &colour, int style );
|
||||||
wxBrush( const wxBitmap &stippleBitmap );
|
wxBrush( const wxBitmap &stippleBitmap );
|
||||||
@@ -58,7 +55,8 @@ class wxBrush: public wxGDIObject
|
|||||||
|
|
||||||
void Unshare();
|
void Unshare();
|
||||||
|
|
||||||
// no data :-)
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKBRUSHH__
|
#endif // __GTKBRUSHH__
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKBUTTONH__
|
#ifndef __GTKBUTTONH__
|
||||||
#define __GTKBUTTONH__
|
#define __GTKBUTTONH__
|
||||||
|
|
||||||
@@ -38,10 +37,7 @@ extern const wxChar *wxButtonNameStr;
|
|||||||
|
|
||||||
class wxButton: public wxControl
|
class wxButton: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxButton();
|
wxButton();
|
||||||
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
|
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -66,6 +62,9 @@ class wxButton: public wxControl
|
|||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKBUTTONH__
|
#endif // __GTKBUTTONH__
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKCHECKBOXH__
|
#ifndef __GTKCHECKBOXH__
|
||||||
#define __GTKCHECKBOXH__
|
#define __GTKCHECKBOXH__
|
||||||
|
|
||||||
@@ -41,8 +40,6 @@ extern const char *wxCheckBoxNameStr;
|
|||||||
|
|
||||||
class wxCheckBox: public wxControl
|
class wxCheckBox: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxCheckBox();
|
wxCheckBox();
|
||||||
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
|
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
|
||||||
@@ -73,6 +70,9 @@ public:
|
|||||||
|
|
||||||
GtkWidget *m_widgetCheckbox;
|
GtkWidget *m_widgetCheckbox;
|
||||||
GtkWidget *m_widgetLabel;
|
GtkWidget *m_widgetLabel;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -36,8 +36,6 @@ class wxCheckListBox;
|
|||||||
|
|
||||||
class wxCheckListBox : public wxListBox
|
class wxCheckListBox : public wxListBox
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxCheckListBox();
|
wxCheckListBox();
|
||||||
wxCheckListBox(wxWindow *parent, wxWindowID id,
|
wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||||
@@ -53,6 +51,9 @@ public:
|
|||||||
void Check( int index, bool check = TRUE );
|
void Check( int index, bool check = TRUE );
|
||||||
|
|
||||||
int GetItemHeight() const;
|
int GetItemHeight() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -38,8 +38,6 @@ extern const wxChar *wxChoiceNameStr;
|
|||||||
|
|
||||||
class wxChoice : public wxControl
|
class wxChoice : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxChoice)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxChoice();
|
wxChoice();
|
||||||
wxChoice( wxWindow *parent, wxWindowID id,
|
wxChoice( wxWindow *parent, wxWindowID id,
|
||||||
@@ -97,6 +95,9 @@ public:
|
|||||||
void EnableEvents();
|
void EnableEvents();
|
||||||
void AppendCommon( const wxString &item );
|
void AppendCommon( const wxString &item );
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,8 +44,6 @@ extern wxClipboard* wxTheClipboard;
|
|||||||
|
|
||||||
class wxClipboard : public wxObject
|
class wxClipboard : public wxObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxClipboard();
|
wxClipboard();
|
||||||
~wxClipboard();
|
~wxClipboard();
|
||||||
@@ -91,6 +89,9 @@ public:
|
|||||||
GdkAtom m_targetRequested;
|
GdkAtom m_targetRequested;
|
||||||
bool m_usePrimary;
|
bool m_usePrimary;
|
||||||
wxDataObject *m_receivedData;
|
wxDataObject *m_receivedData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -99,12 +100,13 @@ public:
|
|||||||
|
|
||||||
class wxClipboardModule: public wxModule
|
class wxClipboardModule: public wxModule
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxClipboardModule() {}
|
wxClipboardModule() {}
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
void OnExit();
|
void OnExit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -42,10 +42,7 @@ extern const wxChar* wxEmptyString;
|
|||||||
|
|
||||||
class wxComboBox : public wxControl
|
class wxComboBox : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline wxComboBox() {}
|
inline wxComboBox() {}
|
||||||
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& value = wxEmptyString,
|
const wxString& value = wxEmptyString,
|
||||||
@@ -108,11 +105,11 @@ public:
|
|||||||
void SetSelection( long from, long to );
|
void SetSelection( long from, long to );
|
||||||
void SetEditable( bool editable );
|
void SetEditable( bool editable );
|
||||||
|
|
||||||
|
// implementation
|
||||||
|
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
void OnChar( wxKeyEvent &event );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
// implementation
|
|
||||||
|
|
||||||
bool m_alreadySent;
|
bool m_alreadySent;
|
||||||
wxList m_clientDataList;
|
wxList m_clientDataList;
|
||||||
wxList m_clientObjectList;
|
wxList m_clientObjectList;
|
||||||
@@ -124,6 +121,8 @@ public:
|
|||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,8 +31,6 @@ class wxControl;
|
|||||||
|
|
||||||
class wxControl : public wxWindow
|
class wxControl : public wxWindow
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxControl();
|
wxControl();
|
||||||
wxControl( wxWindow *parent,
|
wxControl( wxWindow *parent,
|
||||||
@@ -50,6 +48,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKCONTROLH__
|
#endif // __GTKCONTROLH__
|
||||||
|
@@ -103,10 +103,7 @@ class wxRegion : public wxGDIObject
|
|||||||
|
|
||||||
class wxRegionIterator: public wxObject
|
class wxRegionIterator: public wxObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxRegionIterator();
|
wxRegionIterator();
|
||||||
wxRegionIterator(const wxRegion& region);
|
wxRegionIterator(const wxRegion& region);
|
||||||
|
|
||||||
@@ -127,10 +124,12 @@ class wxRegionIterator: public wxObject
|
|||||||
long GetHeight() const { return GetH(); }
|
long GetHeight() const { return GetH(); }
|
||||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
long m_current;
|
long m_current;
|
||||||
wxRegion m_region;
|
wxRegion m_region;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __GTKSPINPUTTH__
|
#ifndef __GTKSPINBUTTH__
|
||||||
#define __GTKSPINBUTTH__
|
#define __GTKSPINBUTTH__
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
class wxSpinButton : public wxSpinButtonBase
|
class wxSpinButton : public wxSpinButtonBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSpinButton() { }
|
wxSpinButton() { }
|
||||||
wxSpinButton( wxWindow *parent, wxWindowID id = -1,
|
wxSpinButton( wxWindow *parent, wxWindowID id = -1,
|
||||||
@@ -31,7 +29,6 @@ public:
|
|||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, name);
|
Create(parent, id, pos, size, style, name);
|
||||||
}
|
}
|
||||||
~wxSpinButton();
|
|
||||||
|
|
||||||
bool Create( wxWindow *parent, wxWindowID id = -1,
|
bool Create( wxWindow *parent, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
@@ -54,6 +51,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
62
include/wx/gtk/spinctrl.h
Normal file
62
include/wx/gtk/spinctrl.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: spinctrl.h
|
||||||
|
// Purpose: wxSpinCtrl class
|
||||||
|
// Author: Robert Roebling
|
||||||
|
// Modified by:
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __GTKSPINCTRLH__
|
||||||
|
#define __GTKSPINCTRLH__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxSpinButton
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxSpinCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxSpinCtrl() {}
|
||||||
|
wxSpinCtrl(wxWindow *parent,
|
||||||
|
wxWindowID id = -1,
|
||||||
|
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"))
|
||||||
|
{
|
||||||
|
Create(parent, id, pos, size, style, min, max, initial, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id = -1,
|
||||||
|
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"));
|
||||||
|
|
||||||
|
virtual int GetValue() const;
|
||||||
|
virtual void SetValue( int value );
|
||||||
|
virtual void SetRange( int minVal, int maxVal );
|
||||||
|
virtual int GetMin() const;
|
||||||
|
virtual int GetMax() const;
|
||||||
|
|
||||||
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
GtkAdjustment *m_adjust;
|
||||||
|
float m_oldPos;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// __GTKSPINCTRLH__
|
@@ -56,8 +56,7 @@ extern wxAcceleratorTable wxNullAcceleratorTable;
|
|||||||
|
|
||||||
class wxAcceleratorEntry: public wxObject
|
class wxAcceleratorEntry: public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
|
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
|
||||||
{ m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
|
{ m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
|
||||||
|
|
||||||
|
@@ -80,6 +80,7 @@ private:
|
|||||||
/// Set to TRUE while we are in wxYield().
|
/// Set to TRUE while we are in wxYield().
|
||||||
bool m_suppressIdleEvents;
|
bool m_suppressIdleEvents;
|
||||||
|
|
||||||
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxApp)
|
DECLARE_DYNAMIC_CLASS(wxApp)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -43,8 +43,6 @@ extern const wxChar *wxButtonNameStr;
|
|||||||
|
|
||||||
class wxBitmapButton: public wxButton
|
class wxBitmapButton: public wxButton
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxBitmapButton();
|
wxBitmapButton();
|
||||||
inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
inline wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
||||||
@@ -93,6 +91,9 @@ public:
|
|||||||
wxBitmap m_disabled;
|
wxBitmap m_disabled;
|
||||||
wxBitmap m_focus;
|
wxBitmap m_focus;
|
||||||
wxBitmap m_selected;
|
wxBitmap m_selected;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -33,10 +33,7 @@ class wxBrush;
|
|||||||
|
|
||||||
class wxBrush: public wxGDIObject
|
class wxBrush: public wxGDIObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxBrush();
|
wxBrush();
|
||||||
wxBrush( const wxColour &colour, int style );
|
wxBrush( const wxColour &colour, int style );
|
||||||
wxBrush( const wxBitmap &stippleBitmap );
|
wxBrush( const wxBitmap &stippleBitmap );
|
||||||
@@ -58,7 +55,8 @@ class wxBrush: public wxGDIObject
|
|||||||
|
|
||||||
void Unshare();
|
void Unshare();
|
||||||
|
|
||||||
// no data :-)
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKBRUSHH__
|
#endif // __GTKBRUSHH__
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKBUTTONH__
|
#ifndef __GTKBUTTONH__
|
||||||
#define __GTKBUTTONH__
|
#define __GTKBUTTONH__
|
||||||
|
|
||||||
@@ -38,10 +37,7 @@ extern const wxChar *wxButtonNameStr;
|
|||||||
|
|
||||||
class wxButton: public wxControl
|
class wxButton: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxButton();
|
wxButton();
|
||||||
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
|
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -66,6 +62,9 @@ class wxButton: public wxControl
|
|||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKBUTTONH__
|
#endif // __GTKBUTTONH__
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKCHECKBOXH__
|
#ifndef __GTKCHECKBOXH__
|
||||||
#define __GTKCHECKBOXH__
|
#define __GTKCHECKBOXH__
|
||||||
|
|
||||||
@@ -41,8 +40,6 @@ extern const char *wxCheckBoxNameStr;
|
|||||||
|
|
||||||
class wxCheckBox: public wxControl
|
class wxCheckBox: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxCheckBox();
|
wxCheckBox();
|
||||||
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
|
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
|
||||||
@@ -73,6 +70,9 @@ public:
|
|||||||
|
|
||||||
GtkWidget *m_widgetCheckbox;
|
GtkWidget *m_widgetCheckbox;
|
||||||
GtkWidget *m_widgetLabel;
|
GtkWidget *m_widgetLabel;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -36,8 +36,6 @@ class wxCheckListBox;
|
|||||||
|
|
||||||
class wxCheckListBox : public wxListBox
|
class wxCheckListBox : public wxListBox
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxCheckListBox();
|
wxCheckListBox();
|
||||||
wxCheckListBox(wxWindow *parent, wxWindowID id,
|
wxCheckListBox(wxWindow *parent, wxWindowID id,
|
||||||
@@ -53,6 +51,9 @@ public:
|
|||||||
void Check( int index, bool check = TRUE );
|
void Check( int index, bool check = TRUE );
|
||||||
|
|
||||||
int GetItemHeight() const;
|
int GetItemHeight() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -38,8 +38,6 @@ extern const wxChar *wxChoiceNameStr;
|
|||||||
|
|
||||||
class wxChoice : public wxControl
|
class wxChoice : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxChoice)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxChoice();
|
wxChoice();
|
||||||
wxChoice( wxWindow *parent, wxWindowID id,
|
wxChoice( wxWindow *parent, wxWindowID id,
|
||||||
@@ -97,6 +95,9 @@ public:
|
|||||||
void EnableEvents();
|
void EnableEvents();
|
||||||
void AppendCommon( const wxString &item );
|
void AppendCommon( const wxString &item );
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxChoice)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,8 +44,6 @@ extern wxClipboard* wxTheClipboard;
|
|||||||
|
|
||||||
class wxClipboard : public wxObject
|
class wxClipboard : public wxObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxClipboard();
|
wxClipboard();
|
||||||
~wxClipboard();
|
~wxClipboard();
|
||||||
@@ -91,6 +89,9 @@ public:
|
|||||||
GdkAtom m_targetRequested;
|
GdkAtom m_targetRequested;
|
||||||
bool m_usePrimary;
|
bool m_usePrimary;
|
||||||
wxDataObject *m_receivedData;
|
wxDataObject *m_receivedData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -99,12 +100,13 @@ public:
|
|||||||
|
|
||||||
class wxClipboardModule: public wxModule
|
class wxClipboardModule: public wxModule
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxClipboardModule() {}
|
wxClipboardModule() {}
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
void OnExit();
|
void OnExit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -42,10 +42,7 @@ extern const wxChar* wxEmptyString;
|
|||||||
|
|
||||||
class wxComboBox : public wxControl
|
class wxComboBox : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline wxComboBox() {}
|
inline wxComboBox() {}
|
||||||
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& value = wxEmptyString,
|
const wxString& value = wxEmptyString,
|
||||||
@@ -108,11 +105,11 @@ public:
|
|||||||
void SetSelection( long from, long to );
|
void SetSelection( long from, long to );
|
||||||
void SetEditable( bool editable );
|
void SetEditable( bool editable );
|
||||||
|
|
||||||
|
// implementation
|
||||||
|
|
||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
void OnChar( wxKeyEvent &event );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
// implementation
|
|
||||||
|
|
||||||
bool m_alreadySent;
|
bool m_alreadySent;
|
||||||
wxList m_clientDataList;
|
wxList m_clientDataList;
|
||||||
wxList m_clientObjectList;
|
wxList m_clientObjectList;
|
||||||
@@ -124,6 +121,8 @@ public:
|
|||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,8 +31,6 @@ class wxControl;
|
|||||||
|
|
||||||
class wxControl : public wxWindow
|
class wxControl : public wxWindow
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxControl();
|
wxControl();
|
||||||
wxControl( wxWindow *parent,
|
wxControl( wxWindow *parent,
|
||||||
@@ -50,6 +48,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKCONTROLH__
|
#endif // __GTKCONTROLH__
|
||||||
|
@@ -103,10 +103,7 @@ class wxRegion : public wxGDIObject
|
|||||||
|
|
||||||
class wxRegionIterator: public wxObject
|
class wxRegionIterator: public wxObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxRegionIterator();
|
wxRegionIterator();
|
||||||
wxRegionIterator(const wxRegion& region);
|
wxRegionIterator(const wxRegion& region);
|
||||||
|
|
||||||
@@ -127,10 +124,12 @@ class wxRegionIterator: public wxObject
|
|||||||
long GetHeight() const { return GetH(); }
|
long GetHeight() const { return GetH(); }
|
||||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
long m_current;
|
long m_current;
|
||||||
wxRegion m_region;
|
wxRegion m_region;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __GTKSPINPUTTH__
|
#ifndef __GTKSPINBUTTH__
|
||||||
#define __GTKSPINBUTTH__
|
#define __GTKSPINBUTTH__
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
class wxSpinButton : public wxSpinButtonBase
|
class wxSpinButton : public wxSpinButtonBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSpinButton() { }
|
wxSpinButton() { }
|
||||||
wxSpinButton( wxWindow *parent, wxWindowID id = -1,
|
wxSpinButton( wxWindow *parent, wxWindowID id = -1,
|
||||||
@@ -31,7 +29,6 @@ public:
|
|||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, name);
|
Create(parent, id, pos, size, style, name);
|
||||||
}
|
}
|
||||||
~wxSpinButton();
|
|
||||||
|
|
||||||
bool Create( wxWindow *parent, wxWindowID id = -1,
|
bool Create( wxWindow *parent, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
@@ -54,6 +51,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
62
include/wx/gtk1/spinctrl.h
Normal file
62
include/wx/gtk1/spinctrl.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: spinctrl.h
|
||||||
|
// Purpose: wxSpinCtrl class
|
||||||
|
// Author: Robert Roebling
|
||||||
|
// Modified by:
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __GTKSPINCTRLH__
|
||||||
|
#define __GTKSPINCTRLH__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxSpinButton
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxSpinCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxSpinCtrl() {}
|
||||||
|
wxSpinCtrl(wxWindow *parent,
|
||||||
|
wxWindowID id = -1,
|
||||||
|
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"))
|
||||||
|
{
|
||||||
|
Create(parent, id, pos, size, style, min, max, initial, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id = -1,
|
||||||
|
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"));
|
||||||
|
|
||||||
|
virtual int GetValue() const;
|
||||||
|
virtual void SetValue( int value );
|
||||||
|
virtual void SetRange( int minVal, int maxVal );
|
||||||
|
virtual int GetMin() const;
|
||||||
|
virtual int GetMax() const;
|
||||||
|
|
||||||
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
GtkAdjustment *m_adjust;
|
||||||
|
float m_oldPos;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// __GTKSPINCTRLH__
|
@@ -52,6 +52,8 @@ protected:
|
|||||||
|
|
||||||
#if defined(__WXMSW__) && defined(__WIN32__)
|
#if defined(__WXMSW__) && defined(__WIN32__)
|
||||||
#include "wx/msw/spinctrl.h"
|
#include "wx/msw/spinctrl.h"
|
||||||
|
#elif defined(__WXGTK__)
|
||||||
|
#include "wx/gtk/spinctrl.h"
|
||||||
#else // Win16 || !Win
|
#else // Win16 || !Win
|
||||||
#include "wx/generic/spinctrl.h"
|
#include "wx/generic/spinctrl.h"
|
||||||
#endif // platform
|
#endif // platform
|
||||||
|
@@ -277,6 +277,11 @@ public:
|
|||||||
int maxW = -1, int maxH = -1,
|
int maxW = -1, int maxH = -1,
|
||||||
int incW = -1, int incH = -1 );
|
int incW = -1, int incH = -1 );
|
||||||
|
|
||||||
|
int GetMinWidth() const { return m_minWidth; }
|
||||||
|
int GetMinHeight() const { return m_minHeight; }
|
||||||
|
int GetMaxWidth() const { return m_maxWidth; }
|
||||||
|
int GetMaxHeight() const { return m_maxHeight; }
|
||||||
|
|
||||||
// window state
|
// window state
|
||||||
// ------------
|
// ------------
|
||||||
|
|
||||||
|
@@ -484,16 +484,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
s << initialSpinValue;
|
s << initialSpinValue;
|
||||||
m_spintext = new wxTextCtrl( panel, -1, s, wxPoint(20,160), wxSize(80,-1) );
|
m_spintext = new wxTextCtrl( panel, -1, s, wxPoint(20,160), wxSize(80,-1) );
|
||||||
#if wxUSE_SPINBUTTON
|
#if wxUSE_SPINBUTTON
|
||||||
m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,159), wxSize(80, -1) );
|
m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(80, -1) );
|
||||||
m_spinbutton->SetRange(-10,30);
|
m_spinbutton->SetRange(-10,30);
|
||||||
m_spinbutton->SetValue(initialSpinValue);
|
m_spinbutton->SetValue(initialSpinValue);
|
||||||
|
|
||||||
m_btnProgress = new wxButton( panel, ID_BTNPROGRESS, "Show progress dialog",
|
m_btnProgress = new wxButton( panel, ID_BTNPROGRESS, "Show progress dialog",
|
||||||
wxPoint(408, 159) );
|
wxPoint(300, 160) );
|
||||||
#endif // wxUSE_SPINBUTTON
|
#endif // wxUSE_SPINBUTTON
|
||||||
|
|
||||||
#if wxUSE_SPINCTRL
|
#if wxUSE_SPINCTRL
|
||||||
m_spinctrl = new wxSpinCtrl( panel, -1, wxPoint(200, 159), wxSize(80, 20) );
|
m_spinctrl = new wxSpinCtrl( panel, -1, wxPoint(200, 160), wxSize(80, -1) );
|
||||||
m_spinctrl->SetRange(10,30);
|
m_spinctrl->SetRange(10,30);
|
||||||
m_spinctrl->SetValue(15);
|
m_spinctrl->SetValue(15);
|
||||||
#endif // wxUSE_SPINCTRL
|
#endif // wxUSE_SPINCTRL
|
||||||
|
@@ -38,33 +38,6 @@ extern bool g_isIdle;
|
|||||||
|
|
||||||
extern wxList wxPendingDelete;
|
extern wxList wxPendingDelete;
|
||||||
|
|
||||||
/*
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// instruct X to set the WM hint for positioning
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
static void gdk_window_set_position_hint( GdkWindow *window, gint x, gint y )
|
|
||||||
{
|
|
||||||
GdkWindowPrivate *priv;
|
|
||||||
XSizeHints size_hints;
|
|
||||||
|
|
||||||
g_return_if_fail (window != NULL);
|
|
||||||
|
|
||||||
priv = (GdkWindowPrivate*) window;
|
|
||||||
if (priv->destroyed) return;
|
|
||||||
|
|
||||||
size_hints.flags = PPosition;
|
|
||||||
size_hints.x = x;
|
|
||||||
size_hints.y = y;
|
|
||||||
|
|
||||||
XSetWMNormalHints (priv->xdisplay, priv->xwindow, &size_hints);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "delete_event"
|
// "delete_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -150,9 +123,18 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
|
|||||||
position in "realize" and "map" */
|
position in "realize" and "map" */
|
||||||
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
|
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
|
||||||
|
|
||||||
/*
|
/* set size hints */
|
||||||
gdk_window_set_position_hint( widget->window, win->m_x, win->m_y );
|
gint flag = GDK_HINT_POS;
|
||||||
*/
|
if ((win->GetMinWidth() != -1) || (win->GetMinHeight() != -1)) flag |= GDK_HINT_MIN_SIZE;
|
||||||
|
if ((win->GetMaxWidth() != -1) || (win->GetMaxHeight() != -1)) flag |= GDK_HINT_MAX_SIZE;
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
gdk_window_set_hints( win->m_widget->window,
|
||||||
|
win->m_x, win->m_y,
|
||||||
|
win->GetMinWidth(), win->GetMinHeight(),
|
||||||
|
win->GetMaxWidth(), win->GetMaxHeight(),
|
||||||
|
flag );
|
||||||
|
}
|
||||||
|
|
||||||
/* reset the icon */
|
/* reset the icon */
|
||||||
if (win->m_icon != wxNullIcon)
|
if (win->m_icon != wxNullIcon)
|
||||||
|
@@ -233,6 +233,19 @@ gtk_frame_realized_callback( GtkWidget *WXUNUSED(widget), wxFrame *win )
|
|||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
|
/* set size hints */
|
||||||
|
gint flag = GDK_HINT_POS;
|
||||||
|
if ((win->GetMinWidth() != -1) || (win->GetMinHeight() != -1)) flag |= GDK_HINT_MIN_SIZE;
|
||||||
|
if ((win->GetMaxWidth() != -1) || (win->GetMaxHeight() != -1)) flag |= GDK_HINT_MAX_SIZE;
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
gdk_window_set_hints( win->m_widget->window,
|
||||||
|
win->m_x, win->m_y,
|
||||||
|
win->GetMinWidth(), win->GetMinHeight(),
|
||||||
|
win->GetMaxWidth(), win->GetMaxHeight(),
|
||||||
|
flag );
|
||||||
|
}
|
||||||
|
|
||||||
/* reset the icon */
|
/* reset the icon */
|
||||||
if (win->m_icon != wxNullIcon)
|
if (win->m_icon != wxNullIcon)
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,7 @@ extern bool g_isIdle;
|
|||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
|
|
||||||
static const float sensitivity = 0.2;
|
static const float sensitivity = 0.02;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "value_changed"
|
// "value_changed"
|
||||||
@@ -101,7 +101,7 @@ bool wxSpinButton::Create(wxWindow *parent,
|
|||||||
wxSize new_size = size;
|
wxSize new_size = size;
|
||||||
new_size.x = 15;
|
new_size.x = 15;
|
||||||
if (new_size.y == -1)
|
if (new_size.y == -1)
|
||||||
new_size.y = 30;
|
new_size.y = 26;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, new_size ) ||
|
if (!PreCreation( parent, pos, new_size ) ||
|
||||||
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
|
||||||
@@ -134,10 +134,6 @@ bool wxSpinButton::Create(wxWindow *parent,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSpinButton::~wxSpinButton()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSpinButton::GetMin() const
|
int wxSpinButton::GetMin() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
199
src/gtk/spinctrl.cpp
Normal file
199
src/gtk/spinctrl.cpp
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: spinbutt.cpp
|
||||||
|
// Purpose: wxSpinCtrl
|
||||||
|
// Author: Robert
|
||||||
|
// Modified by:
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "spinctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/spinctrl.h"
|
||||||
|
|
||||||
|
#ifdef wxUSE_SPINBTN
|
||||||
|
|
||||||
|
#include "wx/utils.h"
|
||||||
|
#include "wx/spinbutt.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gdk/gdk.h"
|
||||||
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// idle system
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern void wxapp_install_idle_handler();
|
||||||
|
extern bool g_isIdle;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// data
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern bool g_blockEventsOnDrag;
|
||||||
|
|
||||||
|
static const float sensitivity = 0.02;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "value_changed"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win )
|
||||||
|
{
|
||||||
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
|
if (!win->m_hasVMT) return;
|
||||||
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
|
float diff = win->m_adjust->value - win->m_oldPos;
|
||||||
|
if (fabs(diff) < sensitivity) return;
|
||||||
|
win->m_oldPos = win->m_adjust->value;
|
||||||
|
|
||||||
|
wxEventType command = wxEVT_NULL;
|
||||||
|
|
||||||
|
float line_step = win->m_adjust->step_increment;
|
||||||
|
|
||||||
|
if (fabs(diff-line_step) < sensitivity) command = wxEVT_SCROLL_LINEDOWN;
|
||||||
|
else if (fabs(diff+line_step) < sensitivity) command = wxEVT_SCROLL_LINEUP;
|
||||||
|
else command = wxEVT_SCROLL_THUMBTRACK;
|
||||||
|
|
||||||
|
int value = (int)ceil(win->m_adjust->value);
|
||||||
|
|
||||||
|
wxSpinEvent event( command, win->GetId());
|
||||||
|
event.SetPosition( value );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
|
/* always send a thumbtrack event */
|
||||||
|
if (command != wxEVT_SCROLL_THUMBTRACK)
|
||||||
|
{
|
||||||
|
command = wxEVT_SCROLL_THUMBTRACK;
|
||||||
|
wxSpinEvent event2( command, win->GetId());
|
||||||
|
event2.SetPosition( value );
|
||||||
|
event2.SetEventObject( win );
|
||||||
|
win->GetEventHandler()->ProcessEvent( event2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxSpinCtrl
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl)
|
||||||
|
|
||||||
|
bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||||
|
const wxPoint& pos, const wxSize& size,
|
||||||
|
long style,
|
||||||
|
int min, int max, int initial,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
m_needParent = TRUE;
|
||||||
|
|
||||||
|
wxSize new_size = size;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = 26;
|
||||||
|
|
||||||
|
if (!PreCreation( parent, pos, new_size ) ||
|
||||||
|
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_oldPos = initial;
|
||||||
|
|
||||||
|
m_adjust = (GtkAdjustment*) gtk_adjustment_new( initial, min, max, 1.0, 5.0, 0.0);
|
||||||
|
|
||||||
|
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
|
||||||
|
|
||||||
|
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (m_windowStyle & wxSP_WRAP) );
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT (m_adjust),
|
||||||
|
"value_changed",
|
||||||
|
(GtkSignalFunc) gtk_spinctrl_callback,
|
||||||
|
(gpointer) this );
|
||||||
|
|
||||||
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
|
PostCreation();
|
||||||
|
|
||||||
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
|
|
||||||
|
Show( TRUE );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSpinCtrl::GetMin() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
|
||||||
|
return (int)ceil(m_adjust->lower);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSpinCtrl::GetMax() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
|
||||||
|
return (int)ceil(m_adjust->upper);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSpinCtrl::GetValue() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
|
||||||
|
return (int)ceil(m_adjust->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrl::SetValue( int value )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
|
||||||
|
|
||||||
|
float fpos = (float)value;
|
||||||
|
m_oldPos = fpos;
|
||||||
|
if (fabs(fpos-m_adjust->value) < sensitivity) return;
|
||||||
|
|
||||||
|
m_adjust->value = fpos;
|
||||||
|
|
||||||
|
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrl::SetRange(int minVal, int maxVal)
|
||||||
|
{
|
||||||
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
|
||||||
|
|
||||||
|
float fmin = (float)minVal;
|
||||||
|
float fmax = (float)maxVal;
|
||||||
|
|
||||||
|
if ((fabs(fmin-m_adjust->lower) < sensitivity) &&
|
||||||
|
(fabs(fmax-m_adjust->upper) < sensitivity))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_adjust->lower = fmin;
|
||||||
|
m_adjust->upper = fmax;
|
||||||
|
|
||||||
|
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
|
||||||
|
|
||||||
|
// these two calls are required due to some bug in GTK
|
||||||
|
Refresh();
|
||||||
|
SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSpinCtrl::IsOwnGtkWindow( GdkWindow *window )
|
||||||
|
{
|
||||||
|
return GTK_SPIN_BUTTON(m_widget)->panel == window;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrl::ApplyWidgetStyle()
|
||||||
|
{
|
||||||
|
SetWidgetStyle();
|
||||||
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -38,33 +38,6 @@ extern bool g_isIdle;
|
|||||||
|
|
||||||
extern wxList wxPendingDelete;
|
extern wxList wxPendingDelete;
|
||||||
|
|
||||||
/*
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// instruct X to set the WM hint for positioning
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
static void gdk_window_set_position_hint( GdkWindow *window, gint x, gint y )
|
|
||||||
{
|
|
||||||
GdkWindowPrivate *priv;
|
|
||||||
XSizeHints size_hints;
|
|
||||||
|
|
||||||
g_return_if_fail (window != NULL);
|
|
||||||
|
|
||||||
priv = (GdkWindowPrivate*) window;
|
|
||||||
if (priv->destroyed) return;
|
|
||||||
|
|
||||||
size_hints.flags = PPosition;
|
|
||||||
size_hints.x = x;
|
|
||||||
size_hints.y = y;
|
|
||||||
|
|
||||||
XSetWMNormalHints (priv->xdisplay, priv->xwindow, &size_hints);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "delete_event"
|
// "delete_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -150,9 +123,18 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
|
|||||||
position in "realize" and "map" */
|
position in "realize" and "map" */
|
||||||
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
|
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
|
||||||
|
|
||||||
/*
|
/* set size hints */
|
||||||
gdk_window_set_position_hint( widget->window, win->m_x, win->m_y );
|
gint flag = GDK_HINT_POS;
|
||||||
*/
|
if ((win->GetMinWidth() != -1) || (win->GetMinHeight() != -1)) flag |= GDK_HINT_MIN_SIZE;
|
||||||
|
if ((win->GetMaxWidth() != -1) || (win->GetMaxHeight() != -1)) flag |= GDK_HINT_MAX_SIZE;
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
gdk_window_set_hints( win->m_widget->window,
|
||||||
|
win->m_x, win->m_y,
|
||||||
|
win->GetMinWidth(), win->GetMinHeight(),
|
||||||
|
win->GetMaxWidth(), win->GetMaxHeight(),
|
||||||
|
flag );
|
||||||
|
}
|
||||||
|
|
||||||
/* reset the icon */
|
/* reset the icon */
|
||||||
if (win->m_icon != wxNullIcon)
|
if (win->m_icon != wxNullIcon)
|
||||||
|
@@ -233,6 +233,19 @@ gtk_frame_realized_callback( GtkWidget *WXUNUSED(widget), wxFrame *win )
|
|||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
|
|
||||||
|
/* set size hints */
|
||||||
|
gint flag = GDK_HINT_POS;
|
||||||
|
if ((win->GetMinWidth() != -1) || (win->GetMinHeight() != -1)) flag |= GDK_HINT_MIN_SIZE;
|
||||||
|
if ((win->GetMaxWidth() != -1) || (win->GetMaxHeight() != -1)) flag |= GDK_HINT_MAX_SIZE;
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
gdk_window_set_hints( win->m_widget->window,
|
||||||
|
win->m_x, win->m_y,
|
||||||
|
win->GetMinWidth(), win->GetMinHeight(),
|
||||||
|
win->GetMaxWidth(), win->GetMaxHeight(),
|
||||||
|
flag );
|
||||||
|
}
|
||||||
|
|
||||||
/* reset the icon */
|
/* reset the icon */
|
||||||
if (win->m_icon != wxNullIcon)
|
if (win->m_icon != wxNullIcon)
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,7 @@ extern bool g_isIdle;
|
|||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
extern bool g_blockEventsOnDrag;
|
||||||
|
|
||||||
static const float sensitivity = 0.2;
|
static const float sensitivity = 0.02;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "value_changed"
|
// "value_changed"
|
||||||
@@ -101,7 +101,7 @@ bool wxSpinButton::Create(wxWindow *parent,
|
|||||||
wxSize new_size = size;
|
wxSize new_size = size;
|
||||||
new_size.x = 15;
|
new_size.x = 15;
|
||||||
if (new_size.y == -1)
|
if (new_size.y == -1)
|
||||||
new_size.y = 30;
|
new_size.y = 26;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, new_size ) ||
|
if (!PreCreation( parent, pos, new_size ) ||
|
||||||
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
|
||||||
@@ -134,10 +134,6 @@ bool wxSpinButton::Create(wxWindow *parent,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSpinButton::~wxSpinButton()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSpinButton::GetMin() const
|
int wxSpinButton::GetMin() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
199
src/gtk1/spinctrl.cpp
Normal file
199
src/gtk1/spinctrl.cpp
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: spinbutt.cpp
|
||||||
|
// Purpose: wxSpinCtrl
|
||||||
|
// Author: Robert
|
||||||
|
// Modified by:
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Robert Roebling
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "spinctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/spinctrl.h"
|
||||||
|
|
||||||
|
#ifdef wxUSE_SPINBTN
|
||||||
|
|
||||||
|
#include "wx/utils.h"
|
||||||
|
#include "wx/spinbutt.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gdk/gdk.h"
|
||||||
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// idle system
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern void wxapp_install_idle_handler();
|
||||||
|
extern bool g_isIdle;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// data
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern bool g_blockEventsOnDrag;
|
||||||
|
|
||||||
|
static const float sensitivity = 0.02;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// "value_changed"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win )
|
||||||
|
{
|
||||||
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
|
if (!win->m_hasVMT) return;
|
||||||
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
|
float diff = win->m_adjust->value - win->m_oldPos;
|
||||||
|
if (fabs(diff) < sensitivity) return;
|
||||||
|
win->m_oldPos = win->m_adjust->value;
|
||||||
|
|
||||||
|
wxEventType command = wxEVT_NULL;
|
||||||
|
|
||||||
|
float line_step = win->m_adjust->step_increment;
|
||||||
|
|
||||||
|
if (fabs(diff-line_step) < sensitivity) command = wxEVT_SCROLL_LINEDOWN;
|
||||||
|
else if (fabs(diff+line_step) < sensitivity) command = wxEVT_SCROLL_LINEUP;
|
||||||
|
else command = wxEVT_SCROLL_THUMBTRACK;
|
||||||
|
|
||||||
|
int value = (int)ceil(win->m_adjust->value);
|
||||||
|
|
||||||
|
wxSpinEvent event( command, win->GetId());
|
||||||
|
event.SetPosition( value );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
|
/* always send a thumbtrack event */
|
||||||
|
if (command != wxEVT_SCROLL_THUMBTRACK)
|
||||||
|
{
|
||||||
|
command = wxEVT_SCROLL_THUMBTRACK;
|
||||||
|
wxSpinEvent event2( command, win->GetId());
|
||||||
|
event2.SetPosition( value );
|
||||||
|
event2.SetEventObject( win );
|
||||||
|
win->GetEventHandler()->ProcessEvent( event2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxSpinCtrl
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl)
|
||||||
|
|
||||||
|
bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||||
|
const wxPoint& pos, const wxSize& size,
|
||||||
|
long style,
|
||||||
|
int min, int max, int initial,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
m_needParent = TRUE;
|
||||||
|
|
||||||
|
wxSize new_size = size;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = 26;
|
||||||
|
|
||||||
|
if (!PreCreation( parent, pos, new_size ) ||
|
||||||
|
!CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( wxT("wxSpinCtrl creation failed") );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_oldPos = initial;
|
||||||
|
|
||||||
|
m_adjust = (GtkAdjustment*) gtk_adjustment_new( initial, min, max, 1.0, 5.0, 0.0);
|
||||||
|
|
||||||
|
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
|
||||||
|
|
||||||
|
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (m_windowStyle & wxSP_WRAP) );
|
||||||
|
|
||||||
|
gtk_signal_connect( GTK_OBJECT (m_adjust),
|
||||||
|
"value_changed",
|
||||||
|
(GtkSignalFunc) gtk_spinctrl_callback,
|
||||||
|
(gpointer) this );
|
||||||
|
|
||||||
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
|
PostCreation();
|
||||||
|
|
||||||
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
|
|
||||||
|
Show( TRUE );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSpinCtrl::GetMin() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
|
||||||
|
return (int)ceil(m_adjust->lower);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSpinCtrl::GetMax() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
|
||||||
|
return (int)ceil(m_adjust->upper);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSpinCtrl::GetValue() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") );
|
||||||
|
|
||||||
|
return (int)ceil(m_adjust->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrl::SetValue( int value )
|
||||||
|
{
|
||||||
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
|
||||||
|
|
||||||
|
float fpos = (float)value;
|
||||||
|
m_oldPos = fpos;
|
||||||
|
if (fabs(fpos-m_adjust->value) < sensitivity) return;
|
||||||
|
|
||||||
|
m_adjust->value = fpos;
|
||||||
|
|
||||||
|
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrl::SetRange(int minVal, int maxVal)
|
||||||
|
{
|
||||||
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
|
||||||
|
|
||||||
|
float fmin = (float)minVal;
|
||||||
|
float fmax = (float)maxVal;
|
||||||
|
|
||||||
|
if ((fabs(fmin-m_adjust->lower) < sensitivity) &&
|
||||||
|
(fabs(fmax-m_adjust->upper) < sensitivity))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_adjust->lower = fmin;
|
||||||
|
m_adjust->upper = fmax;
|
||||||
|
|
||||||
|
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
|
||||||
|
|
||||||
|
// these two calls are required due to some bug in GTK
|
||||||
|
Refresh();
|
||||||
|
SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSpinCtrl::IsOwnGtkWindow( GdkWindow *window )
|
||||||
|
{
|
||||||
|
return GTK_SPIN_BUTTON(m_widget)->panel == window;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrl::ApplyWidgetStyle()
|
||||||
|
{
|
||||||
|
SetWidgetStyle();
|
||||||
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user