X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7e7a19f1527e548d0d1931a653dd17a16fba4338..f1a736636c32fa9cda80447c9f17287484ea8094:/include/wx/textctrl.h diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index 74b3944339..318af3e53f 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/textctrl.h -// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl +// Purpose: wxTextAttr and wxTextCtrlBase class - the interface of wxTextCtrl // Author: Vadim Zeitlin // Modified by: // Created: 13.07.99 @@ -165,31 +165,39 @@ enum wxTextAttrFlags { wxTEXT_ATTR_TEXT_COLOUR = 0x00000001, wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002, + wxTEXT_ATTR_FONT_FACE = 0x00000004, wxTEXT_ATTR_FONT_SIZE = 0x00000008, wxTEXT_ATTR_FONT_WEIGHT = 0x00000010, wxTEXT_ATTR_FONT_ITALIC = 0x00000020, wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040, wxTEXT_ATTR_FONT_ENCODING = 0x02000000, + wxTEXT_ATTR_FONT_FAMILY = 0x04000000, wxTEXT_ATTR_FONT = \ ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ - wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING ), + wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ), wxTEXT_ATTR_ALIGNMENT = 0x00000080, wxTEXT_ATTR_LEFT_INDENT = 0x00000100, wxTEXT_ATTR_RIGHT_INDENT = 0x00000200, wxTEXT_ATTR_TABS = 0x00000400, - wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800, wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000, wxTEXT_ATTR_LINE_SPACING = 0x00002000, wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000, wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000, wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000, + wxTEXT_ATTR_BULLET_STYLE = 0x00020000, wxTEXT_ATTR_BULLET_NUMBER = 0x00040000, wxTEXT_ATTR_BULLET_TEXT = 0x00080000, wxTEXT_ATTR_BULLET_NAME = 0x00100000, + + wxTEXT_ATTR_BULLET = \ + ( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \ + wxTEXT_ATTR_BULLET_NAME ), + + wxTEXT_ATTR_URL = 0x00200000, wxTEXT_ATTR_PAGE_BREAK = 0x00400000, wxTEXT_ATTR_EFFECTS = 0x00800000, @@ -200,14 +208,13 @@ enum wxTextAttrFlags */ wxTEXT_ATTR_CHARACTER = \ - (wxTEXT_ATTR_FONT|wxTEXT_ATTR_FONT_ENCODING|wxTEXT_ATTR_EFFECTS| \ + (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \ wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL), wxTEXT_ATTR_PARAGRAPH = \ (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ - wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\ - wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL), + wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL), wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) }; @@ -306,11 +313,12 @@ public: void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; } - void SetFontStyle(int fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } - void SetFontWeight(int fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } + void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } + void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; } void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; } + void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; } // Set font void SetFont(const wxFont& font, int flags = wxTEXT_ATTR_FONT) { GetFontAttributes(font, flags); } @@ -344,11 +352,12 @@ public: long GetFlags() const { return m_flags; } int GetFontSize() const { return m_fontSize; } - int GetFontStyle() const { return m_fontStyle; } - int GetFontWeight() const { return m_fontWeight; } + wxFontStyle GetFontStyle() const { return m_fontStyle; } + wxFontWeight GetFontWeight() const { return m_fontWeight; } bool GetFontUnderlined() const { return m_fontUnderlined; } const wxString& GetFontFaceName() const { return m_fontFaceName; } wxFontEncoding GetFontEncoding() const { return m_fontEncoding; } + wxFontFamily GetFontFamily() const { return m_fontFamily; } wxFont GetFont() const; @@ -358,7 +367,6 @@ public: int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } - // TODO: should return the relative wxTextAttr* enumeration values int GetLineSpacing() const { return m_lineSpacing; } int GetBulletStyle() const { return m_bulletStyle; } int GetBulletNumber() const { return m_bulletNumber; } @@ -383,6 +391,7 @@ public: bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); } bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); } bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); } + bool HasFontFamily() const { return HasFlag(wxTEXT_ATTR_FONT_FAMILY); } bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); } bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); } @@ -485,8 +494,9 @@ private: wxColour m_colText, m_colBack; int m_fontSize; - int m_fontStyle; - int m_fontWeight; + wxFontStyle m_fontStyle; + wxFontWeight m_fontWeight; + wxFontFamily m_fontFamily; bool m_fontUnderlined; wxString m_fontFaceName; @@ -587,7 +597,7 @@ protected: wxTextAttr m_defaultStyle; - DECLARE_NO_COPY_CLASS(wxTextAreaBase) + wxDECLARE_NO_COPY_CLASS(wxTextAreaBase); }; // this class defines wxTextCtrl interface, wxTextCtrlBase actually implements @@ -602,7 +612,7 @@ public: wxTextCtrlIface() { } private: - DECLARE_NO_COPY_CLASS(wxTextCtrlIface) + wxDECLARE_NO_COPY_CLASS(wxTextCtrlIface); }; // ---------------------------------------------------------------------------- @@ -682,8 +692,11 @@ protected: virtual bool DoLoadFile(const wxString& file, int fileType); virtual bool DoSaveFile(const wxString& file, int fileType); +private: + // implement the wxTextEntry pure virtual method + virtual wxWindow *GetEditableWindow() { return this; } - DECLARE_NO_COPY_CLASS(wxTextCtrlBase) + wxDECLARE_NO_COPY_CLASS(wxTextCtrlBase); DECLARE_ABSTRACT_CLASS(wxTextCtrlBase) }; @@ -719,10 +732,12 @@ protected: // wxTextCtrl events // ---------------------------------------------------------------------------- -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TEXT_UPDATED; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TEXT_ENTER; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TEXT_URL; -extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TEXT_MAXLEN; +class WXDLLIMPEXP_FWD_CORE wxTextUrlEvent; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_ENTER, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_URL, wxTextUrlEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_MAXLEN, wxCommandEvent); class WXDLLIMPEXP_CORE wxTextUrlEvent : public wxCommandEvent { @@ -769,7 +784,7 @@ typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); #define wxTextEventHandler(func) wxCommandEventHandler(func) #define wxTextUrlEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTextUrlEventFunction, &func) + wxEVENT_HANDLER_CAST(wxTextUrlEventFunction, func) #define wx__DECLARE_TEXTEVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_ ## evt, id, wxTextEventHandler(fn))