X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2be72ac2833cc4cadaa5054b5867348f6b2ea139..51623cc53f350935337e57930eaaf1afe9a48c3b:/include/wx/richtext/richtextformatdlg.h diff --git a/include/wx/richtext/richtextformatdlg.h b/include/wx/richtext/richtextformatdlg.h index de3aa666a8..ec785a5b00 100644 --- a/include/wx/richtext/richtextformatdlg.h +++ b/include/wx/richtext/richtextformatdlg.h @@ -22,6 +22,7 @@ #include "wx/propdlg.h" #include "wx/bookctrl.h" +#include "wx/withimages.h" #if wxUSE_HTML #include "wx/htmllbox.h" @@ -32,7 +33,6 @@ #include "wx/richtext/richtextuicustomization.h" class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog; -class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_FWD_CORE wxComboBox; class WXDLLIMPEXP_FWD_CORE wxCheckBox; @@ -88,7 +88,7 @@ public: wxRichTextFormattingDialogFactory() {} virtual ~wxRichTextFormattingDialogFactory() {} -// Overrideables +// Overridables /// Create all pages, under the dialog's book control, also calling AddPage virtual bool CreatePages(long pages, wxRichTextFormattingDialog* dialog); @@ -119,12 +119,15 @@ public: * Formatting dialog for a wxRichTextCtrl */ -class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog +class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog, + public wxWithImages { DECLARE_CLASS(wxRichTextFormattingDialog) DECLARE_HELP_PROVISION() public: + enum { Option_AllowPixelFontSize = 0x0001 }; + wxRichTextFormattingDialog() { Init(); } wxRichTextFormattingDialog(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, @@ -163,7 +166,7 @@ public: /// Apply attributes to the given range virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE); - + /// Apply attributes to the object being edited, if any virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); @@ -171,12 +174,18 @@ public: const wxRichTextAttr& GetAttributes() const { return m_attributes; } wxRichTextAttr& GetAttributes() { return m_attributes; } void SetAttributes(const wxRichTextAttr& attr) { m_attributes = attr; } -#if 0 - /// Gets and sets the attributes that the user wants to reset - const wxRichTextAttr& GetResetAttributes() const { return m_resetAttributes; } - wxRichTextAttr& GetResetAttributes() { return m_resetAttributes; } - void SetResetAttributes(const wxRichTextAttr& attr) { m_resetAttributes = attr; } -#endif + + /// Sets the dialog options, determining what the interface presents to the user. + /// Currently the only option is Option_AllowPixelFontSize. + void SetOptions(int options) { m_options = options; } + + /// Gets the dialog options, determining what the interface presents to the user. + /// Currently the only option is Option_AllowPixelFontSize. + int GetOptions() const { return m_options; } + + /// Returns @true if the given option is present. + bool HasOption(int option) const { return (m_options & option) != 0; } + /// If editing the attributes for a particular object, such as an image, /// set the object so the code can initialize attributes such as size correctly. wxRichTextObject* GetObject() const { return m_object; } @@ -194,10 +203,6 @@ public: void OnHelp(wxCommandEvent& event); void OnUpdateHelp(wxUpdateUIEvent& event); - /// Set/get image list - void SetImageList(wxImageList* imageList) { m_imageList = imageList; } - wxImageList* GetImageList() const { return m_imageList; } - /// Get/set formatting factory object static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory); static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; } @@ -225,25 +230,24 @@ public: /// Get the dimension from the value and units controls static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox); - + /// Convert CM to MM static bool ConvertFromString(const wxString& string, int& ret, int scale); /// Map book control page index to our page id void AddPageId(int id) { m_pageIds.Add(id); } - + /// Find a page by class wxWindow* FindPage(wxClassInfo* info) const; protected: - wxImageList* m_imageList; wxRichTextAttr m_attributes; - //wxRichTextAttr m_resetAttributes; wxRichTextStyleDefinition* m_styleDefinition; wxRichTextStyleSheet* m_styleSheet; wxRichTextObject* m_object; wxArrayInt m_pageIds; // mapping of book control indexes to page ids + int m_options; // UI options static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory; static bool sm_showToolTips;