Implemented text boxes and tables, and further editing pages for backgrounds, borders and margins.

wxRTC functions now operate on the currently focused object, which by default is the whole buffer.
Up to three property commands are now shown on the context menu, depending on
available objects in the current hierarchy.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2011-01-14 11:57:44 +00:00
parent 3625820490
commit 603f702b4a
42 changed files with 19398 additions and 3272 deletions

View File

@@ -29,6 +29,7 @@
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextstyles.h"
#include "wx/richtext/richtextuicustomization.h"
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog;
class WXDLLIMPEXP_FWD_CORE wxImageList;
@@ -43,8 +44,12 @@ class WXDLLIMPEXP_FWD_CORE wxImageList;
#define wxRICHTEXT_FORMAT_BULLETS 0x0008
#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010
#define wxRICHTEXT_FORMAT_LIST_STYLE 0x0020
#define wxRICHTEXT_FORMAT_MARGINS 0x0040
#define wxRICHTEXT_FORMAT_SIZE 0x0080
#define wxRICHTEXT_FORMAT_BORDERS 0x0100
#define wxRICHTEXT_FORMAT_BACKGROUND 0x0200
#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x0100
#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x1000
/*!
* Indices for bullet styles in list control
@@ -99,7 +104,7 @@ public:
virtual int GetPageImage(int WXUNUSED(id)) const { return -1; }
/// Invoke help for the dialog
virtual bool ShowHelp(int WXUNUSED(page), wxRichTextFormattingDialog* WXUNUSED(dialog)) { return false; }
virtual bool ShowHelp(int page, wxRichTextFormattingDialog* dialog);
/// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create
virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog);
@@ -115,6 +120,8 @@ public:
class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog
{
DECLARE_CLASS(wxRichTextFormattingDialog)
DECLARE_HELP_PROVISION()
public:
wxRichTextFormattingDialog() { Init(); }
@@ -154,11 +161,24 @@ 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);
/// Gets and sets the attributes
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
/// 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; }
void SetObject(wxRichTextObject* obj) { m_object = obj; }
/// Transfers the data and from to the window
virtual bool TransferDataToWindow();
@@ -170,6 +190,7 @@ public:
/// Respond to help command
void OnHelp(wxCommandEvent& event);
void OnUpdateHelp(wxUpdateUIEvent& event);
/// Set/get image list
void SetImageList(wxImageList* imageList) { m_imageList = imageList; }
@@ -185,6 +206,9 @@ public:
/// Helper for pages to get the attributes
static wxRichTextAttr* GetDialogAttributes(wxWindow* win);
/// Helper for pages to get the reset attributes
static wxRichTextAttr* GetDialogResetAttributes(wxWindow* win);
/// Helper for pages to get the style
static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win);
@@ -194,15 +218,29 @@ public:
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
/// Set the dimension into the value and units controls
static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox);
/// 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
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;