X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b1414681c6134c9d70b0d9cd58b89b07ae41249..899c6fad2638bb9a0c7554f4a08c6d49ab6bbeb7:/include/wx/textctrl.h diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index 1af64850c2..9d66c98012 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -46,6 +46,10 @@ #endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM #endif +#if defined(__WXMSW__) && defined(__MINGW32__) + #include "wx/msw/winundef.h" +#endif + class WXDLLEXPORT wxTextCtrl; class WXDLLEXPORT wxTextCtrlBase; @@ -64,7 +68,12 @@ typedef long wxTextCoord; // constants // ---------------------------------------------------------------------------- -WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr; +extern WXDLLEXPORT_DATA(const wxChar*) wxTextCtrlNameStr; + +// this is intentionally not enum to avoid warning fixes with +// typecasting from enum type to wxTextCoord +const wxTextCoord wxOutOfRangeTextCoord = -1; +const wxTextCoord wxInvalidTextCoord = -2; // ---------------------------------------------------------------------------- // wxTextCtrl style flags @@ -97,7 +106,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr; // automatically detect the URLs and generate the events when mouse is // moved/clicked over an URL // -// this is for Win32 richedit controls only so far +// this is for Win32 richedit and wxGTK2 multiline controls only so far #define wxTE_AUTO_URL 0x1000 // by default, the Windows text control doesn't show the selection when it @@ -254,8 +263,8 @@ public: // creation // -------- - wxTextCtrlBase(); - ~wxTextCtrlBase(); + wxTextCtrlBase(){} + ~wxTextCtrlBase(){} // accessors // --------- @@ -355,7 +364,7 @@ public: virtual void SetInsertionPoint(long pos) = 0; virtual void SetInsertionPointEnd() = 0; virtual long GetInsertionPoint() const = 0; - virtual long GetLastPosition() const = 0; + virtual wxTextPos GetLastPosition() const = 0; virtual void SetSelection(long from, long to) = 0; virtual void SelectAll(); @@ -466,10 +475,20 @@ public: typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); -#define EVT_TEXT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_UPDATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ), -#define EVT_TEXT_ENTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_ENTER, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ), -#define EVT_TEXT_URL(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_URL, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) wxStaticCastEvent( wxTextUrlEventFunction, & fn ), (wxObject *) NULL ), -#define EVT_TEXT_MAXLEN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_MAXLEN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ), +#define wxTextEventHandler(func) wxCommandEventHandler(func) +#define wxTextUrlEventHandler(func) \ + (wxObjectEventFunction)wxStaticCastEvent(wxTextUrlEventFunction, &func) + +#define wx__DECLARE_TEXTEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextEventHandler(fn)) + +#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextUrlEventHandler(fn)) + +#define EVT_TEXT(id, fn) wx__DECLARE_TEXTEVT(UPDATED, id, fn) +#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn) +#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn) +#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn) #ifndef NO_TEXT_WINDOW_STREAM