X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/92e164ff921b26a018c93f1e8d2e96aafcf6d690..c6ea1fdaf924be4ee49a19d12f76e4fcd257bb0a:/include/wx/generic/spinctlg.h diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index 9c18c06a6b..338dd70234 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -82,6 +82,9 @@ public: virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); virtual bool Reparent(wxWindowBase *newParent); +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip); +#endif // wxUSE_TOOLTIPS // get the subcontrols wxTextCtrl *GetText() const { return m_textCtrl; } @@ -89,9 +92,15 @@ public: // forwarded events from children windows void OnSpinButton(wxSpinEvent& event); - void OnTextEnter(wxCommandEvent& event); + void OnTextLostFocus(wxFocusEvent& event); void OnTextChar(wxKeyEvent& event); + // this window itself is used only as a container for its sub windows so it + // shouldn't accept the focus at all and any attempts to explicitly set + // focus to it should give focus to its text constol part + virtual bool AcceptsFocus() const { return false; } + virtual void SetFocus(); + friend class wxSpinCtrlTextGeneric; protected: @@ -105,8 +114,13 @@ protected: void DoSetRange(double min_val, double max_val); void DoSetIncrement(double inc); - // Ensure that the textctrl shows correct value - void SyncSpinToText(); + // update our value to reflect the text control contents (if it has been + // modified by user, do nothing otherwise) + // + // can also change the text control if its value is invalid + // + // return true if our value has changed + bool SyncSpinToText(); // Send the correct event type virtual void DoSendEvent() = 0; @@ -134,6 +148,8 @@ protected: private: // common part of all ctors void Init(); + + DECLARE_EVENT_TABLE() }; #else // !wxUSE_SPINBTN @@ -264,11 +280,10 @@ public: } // accessors - int GetValue(wxSPINCTRL_GETVALUE_FIX) const - { return wxRound( DoGetValue() ); } - int GetMin() const { return wxRound( m_min ); } - int GetMax() const { return wxRound( m_max ); } - int GetIncrement() const { return wxRound( m_increment ); } + int GetValue(wxSPINCTRL_GETVALUE_FIX) const { return int(DoGetValue()); } + int GetMin() const { return int(m_min); } + int GetMax() const { return int(m_max); } + int GetIncrement() const { return int(m_increment); } // operations void SetValue(const wxString& value)