// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
// ----------------------------------------------------------------------------
WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins);
// ----------------------------------------------------------------------------
wxSpinCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
wxSpinCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int min = 0, int max = 100, int initial = 0,
int min = 0, int max = 100, int initial = 0,
Create(parent, id, value, pos, size, style, min, max, initial, name);
}
Create(parent, id, value, pos, size, style, min, max, initial, name);
}
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int min = 0, int max = 100, int initial = 0,
int min = 0, int max = 100, int initial = 0,
// a wxTextCtrl-like method (but we can't have GetValue returning wxString
// because the base class already has one returning int!)
// a wxTextCtrl-like method (but we can't have GetValue returning wxString
// because the base class already has one returning int!)
// another wxTextCtrl-like method
void SetSelection(long from, long to);
// another wxTextCtrl-like method
void SetSelection(long from, long to);
virtual bool SetFont(const wxFont &font);
virtual void SetFocus();
virtual bool Enable(bool enable = true);
virtual bool Show(bool show = true);
virtual bool SetFont(const wxFont &font);
virtual void SetFocus();
virtual bool Enable(bool enable = true);
virtual bool Show(bool show = true);
// wxSpinButton doesn't accept focus, but we do
virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); }
// wxSpinButton doesn't accept focus, but we do
virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); }
+ // we're like wxTextCtrl and not (default) wxButton
+ virtual wxVisualAttributes GetDefaultAttributes() const
+ {
+ return GetClassDefaultAttributes(GetWindowVariant());
+ }
+
+ static wxVisualAttributes
+ GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL)
+ {
+ return GetCompositeControlsDefaultAttributes(variant);
+ }
+
// process a WM_COMMAND generated by the buddy text control
bool ProcessTextCommand(WXWORD cmd, WXWORD id);
// process a WM_COMMAND generated by the buddy text control
bool ProcessTextCommand(WXWORD cmd, WXWORD id);
protected:
virtual void DoGetPosition(int *x, int *y) const;
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual wxSize DoGetBestSize() const;
protected:
virtual void DoGetPosition(int *x, int *y) const;
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual wxSize DoGetBestSize() const;
- // the handler for wxSpinButton events
- void OnSpinChange(wxSpinEvent& event);
+ virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
+ virtual bool MSWOnScroll(int orientation, WXWORD wParam,
+ WXWORD pos, WXHWND control);
void OnChar(wxKeyEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnKillFocus(wxFocusEvent& event);
void OnChar(wxKeyEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnKillFocus(wxFocusEvent& event);
- // all existing wxSpinCtrls - this allows to find the one corresponding to
- // the given buddy window in GetSpinForTextCtrl()
- static wxArraySpins ms_allSpins;
+ // Block text update event after SetValue()
+ bool m_blockEvent;
+ // Common part of all ctors.
+ void Init();
+
+ // Adjust the text control style depending on whether we need to enter only
+ // digits or may need to enter something else (e.g. "-" sign, "x"
+ // hexadecimal prefix, ...) in it.
+ void UpdateBuddyStyle();
+
+