implemented, tested and documented wxTextCtrl::SetMaxLength()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -120,6 +120,7 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14)
|
||||
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10)
|
||||
|
@@ -74,6 +74,8 @@ public:
|
||||
// clears the dirty flag
|
||||
virtual void DiscardEdits();
|
||||
|
||||
virtual void SetMaxLength(unsigned long len);
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text);
|
||||
|
@@ -74,6 +74,8 @@ public:
|
||||
// clears the dirty flag
|
||||
virtual void DiscardEdits();
|
||||
|
||||
virtual void SetMaxLength(unsigned long len);
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: textctrl.h
|
||||
// Name: wx/msw/textctrl.h
|
||||
// Purpose: wxTextCtrl class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
// clears the dirty flag
|
||||
virtual void DiscardEdits();
|
||||
|
||||
virtual void SetMaxLength(unsigned long len);
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text);
|
||||
@@ -164,18 +166,21 @@ public:
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
|
||||
protected:
|
||||
#if wxUSE_RICHEDIT
|
||||
bool m_isRich; // Are we using rich text edit to implement this?
|
||||
#endif
|
||||
|
||||
// call this to increase the size limit (will do nothing if the current
|
||||
// limit is big enough)
|
||||
void AdjustSpaceLimit();
|
||||
//
|
||||
// returns true if we increased the limit to allow entering more text,
|
||||
// false if we hit the limit set by SetMaxLength() and so didn't change it
|
||||
bool AdjustSpaceLimit();
|
||||
|
||||
// override some base class virtuals
|
||||
virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
#if wxUSE_RICHEDIT
|
||||
bool m_isRich; // Are we using rich text edit to implement this?
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
||||
|
@@ -174,6 +174,10 @@ public:
|
||||
// clears the dirty flag
|
||||
virtual void DiscardEdits() = 0;
|
||||
|
||||
// set the max number of characters which may be entered in a single line
|
||||
// text control
|
||||
virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text) = 0;
|
||||
@@ -289,6 +293,7 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
|
||||
@@ -332,6 +337,7 @@ typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&);
|
||||
#define EVT_TEXT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_TEXT_ENTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_TEXT_URL(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_URL, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxTextUrlEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_TEXT_MAXLEN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_MAXLEN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
|
Reference in New Issue
Block a user