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

@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextbackgroundpage.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 13/11/2010 11:17:25
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTBACKGROUNDPAGE_H_
#define _RICHTEXTBACKGROUNDPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/statline.h"
////@end includes
/*!
* Forward declarations
*/
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl;
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME ID_RICHTEXTBACKGROUNDPAGE
#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextBackgroundPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextBackgroundPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextBackgroundPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextBackgroundPage();
wxRichTextBackgroundPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE );
/// Destructor
~wxRichTextBackgroundPage();
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Gets the attributes from the formatting dialog
wxRichTextAttr* GetAttributes();
/// Data transfer
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
/// Respond to colour swatch click
void OnColourSwatch(wxCommandEvent& event);
////@begin wxRichTextBackgroundPage event handler declarations
////@end wxRichTextBackgroundPage event handler declarations
////@begin wxRichTextBackgroundPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextBackgroundPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextBackgroundPage member variables
wxCheckBox* m_backgroundColourCheckBox;
wxRichTextColourSwatchCtrl* m_backgroundColourSwatch;
/// Control identifiers
enum {
ID_RICHTEXTBACKGROUNDPAGE = 10845,
ID_RICHTEXT_BACKGROUND_COLOUR_CHECKBOX = 10846,
ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH = 10847
};
////@end wxRichTextBackgroundPage member variables
};
#endif
// _RICHTEXTBACKGROUNDPAGE_H_

View File

@@ -0,0 +1,251 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextborderspage.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 21/10/2010 11:34:24
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTBORDERSPAGE_H_
#define _RICHTEXTBORDERSPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/notebook.h"
#include "wx/statline.h"
////@end includes
/*!
* Forward declarations
*/
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBorderPreviewCtrl;
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTBORDERSPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME ID_RICHTEXTBORDERSPAGE
#define SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextBordersPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextBordersPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextBordersPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextBordersPage();
wxRichTextBordersPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE );
/// Destructor
~wxRichTextBordersPage();
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Gets the attributes from the formatting dialog
wxRichTextAttr* GetAttributes();
/// Data transfer
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
/// Updates the preview
void OnCommand(wxCommandEvent& event);
/// Fill style combo
virtual void FillStyleComboBox(wxComboBox* styleComboBox);
/// Set the border controls
static void SetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles);
/// Get data from the border controls
static void GetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles);
////@begin wxRichTextBordersPage event handler declarations
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX
void OnRichtextBorderCheckboxClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT
void OnRichtextBorderLeftUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT
void OnRichtextBorderRightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP
void OnRichtextBorderTopUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM
void OnRichtextBorderBottomUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT
void OnRichtextOutlineLeftUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT
void OnRichtextOutlineRightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP
void OnRichtextOutlineTopUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM
void OnRichtextOutlineBottomUpdate( wxUpdateUIEvent& event );
////@end wxRichTextBordersPage event handler declarations
////@begin wxRichTextBordersPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextBordersPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextBordersPage member variables
wxCheckBox* m_leftBorderCheckbox;
wxTextCtrl* m_leftBorderWidth;
wxComboBox* m_leftBorderWidthUnits;
wxComboBox* m_leftBorderStyle;
wxRichTextColourSwatchCtrl* m_leftBorderColour;
wxCheckBox* m_rightBorderCheckbox;
wxTextCtrl* m_rightBorderWidth;
wxComboBox* m_rightBorderWidthUnits;
wxComboBox* m_rightBorderStyle;
wxRichTextColourSwatchCtrl* m_rightBorderColour;
wxCheckBox* m_topBorderCheckbox;
wxTextCtrl* m_topBorderWidth;
wxComboBox* m_topBorderWidthUnits;
wxComboBox* m_topBorderStyle;
wxRichTextColourSwatchCtrl* m_topBorderColour;
wxCheckBox* m_bottomBorderCheckbox;
wxTextCtrl* m_bottomBorderWidth;
wxComboBox* m_bottomBorderWidthUnits;
wxComboBox* m_bottomBorderStyle;
wxRichTextColourSwatchCtrl* m_bottomBorderColour;
wxCheckBox* m_leftOutlineCheckbox;
wxTextCtrl* m_leftOutlineWidth;
wxComboBox* m_leftOutlineWidthUnits;
wxComboBox* m_leftOutlineStyle;
wxRichTextColourSwatchCtrl* m_leftOutlineColour;
wxCheckBox* m_rightOutlineCheckbox;
wxTextCtrl* m_rightOutlineWidth;
wxComboBox* m_rightOutlineWidthUnits;
wxComboBox* m_rightOutlineStyle;
wxRichTextColourSwatchCtrl* m_rightOutlineColour;
wxCheckBox* m_topOutlineCheckbox;
wxTextCtrl* m_topOutlineWidth;
wxComboBox* m_topOutlineWidthUnits;
wxComboBox* m_topOutlineStyle;
wxRichTextColourSwatchCtrl* m_topOutlineColour;
wxCheckBox* m_bottomOutlineCheckbox;
wxTextCtrl* m_bottomOutlineWidth;
wxComboBox* m_bottomOutlineWidthUnits;
wxComboBox* m_bottomOutlineStyle;
wxRichTextColourSwatchCtrl* m_bottomOutlineColour;
wxRichTextBorderPreviewCtrl* m_borderPreviewCtrl;
/// Control identifiers
enum {
ID_RICHTEXTBORDERSPAGE = 10800,
ID_RICHTEXTBORDERSPAGE_NOTEBOOK = 10801,
ID_RICHTEXTBORDERSPAGE_BORDERS = 10802,
ID_RICHTEXT_BORDER_LEFT_CHECKBOX = 10803,
ID_RICHTEXT_BORDER_LEFT = 10804,
ID_RICHTEXT_BORDER_LEFT_UNITS = 10805,
ID_RICHTEXT_BORDER_LEFT_STYLE = 10806,
ID_RICHTEXT_BORDER_LEFT_COLOUR = 10807,
ID_RICHTEXT_BORDER_RIGHT_CHECKBOX = 10808,
ID_RICHTEXT_BORDER_RIGHT = 10809,
ID_RICHTEXT_BORDER_RIGHT_UNITS = 10810,
ID_RICHTEXT_BORDER_RIGHT_STYLE = 10811,
ID_RICHTEXT_BORDER_RIGHT_COLOUR = 10812,
ID_RICHTEXT_BORDER_TOP_CHECKBOX = 10813,
ID_RICHTEXT_BORDER_TOP = 10814,
ID_RICHTEXT_BORDER_TOP_UNITS = 10815,
ID_RICHTEXT_BORDER_TOP_STYLE = 10816,
ID_RICHTEXT_BORDER_TOP_COLOUR = 10817,
ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX = 10818,
ID_RICHTEXT_BORDER_BOTTOM = 10819,
ID_RICHTEXT_BORDER_BOTTOM_UNITS = 10820,
ID_RICHTEXT_BORDER_BOTTOM_STYLE = 10821,
ID_RICHTEXT_BORDER_BOTTOM_COLOUR = 10822,
ID_RICHTEXTBORDERSPAGE_OUTLINE = 10823,
ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX = 10824,
ID_RICHTEXT_OUTLINE_LEFT = 10825,
ID_RICHTEXT_OUTLINE_LEFT_UNITS = 10826,
ID_RICHTEXT_OUTLINE_LEFT_STYLE = 10827,
ID_RICHTEXT_OUTLINE_LEFT_COLOUR = 10828,
ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX = 10829,
ID_RICHTEXT_OUTLINE_RIGHT = 10830,
ID_RICHTEXT_OUTLINE_RIGHT_UNITS = 10831,
ID_RICHTEXT_OUTLINE_RIGHT_STYLE = 10832,
ID_RICHTEXT_OUTLINE_RIGHT_COLOUR = 10833,
ID_RICHTEXT_OUTLINE_TOP_CHECKBOX = 10834,
ID_RICHTEXT_OUTLINE_TOP = 10835,
ID_RICHTEXT_OUTLINE_TOP_UNITS = 10836,
ID_RICHTEXT_OUTLINE_TOP_STYLE = 10837,
ID_RICHTEXT_OUTLINE_TOP_COLOUR = 10838,
ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX = 10839,
ID_RICHTEXT_OUTLINE_BOTTOM = 10840,
ID_RICHTEXT_OUTLINE_BOTTOM_UNITS = 10841,
ID_RICHTEXT_OUTLINE_BOTTOM_STYLE = 10842,
ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR = 10843,
ID_RICHTEXT_BORDER_PREVIEW = 10844
};
////@end wxRichTextBordersPage member variables
wxArrayInt m_borderStyles;
wxArrayString m_borderStyleNames;
bool m_ignoreUpdates;
};
class WXDLLIMPEXP_RICHTEXT wxRichTextBorderPreviewCtrl : public wxWindow
{
public:
wxRichTextBorderPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0);
void SetAttributes(wxRichTextAttr* attr) { m_attributes = attr; }
wxRichTextAttr* GetAttributes() const { return m_attributes; }
private:
wxRichTextAttr* m_attributes;
void OnPaint(wxPaintEvent& event);
DECLARE_EVENT_TABLE()
};
#endif
// _RICHTEXTBORDERSPAGE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,8 @@
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
#include "wx/spinbutt.h" // for wxSpinEvent
/*!
@@ -32,7 +34,7 @@ class wxRichTextCtrl;
////@begin control identifiers
#define SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE wxT("")
#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTBULLETSPAGE_IDNAME ID_RICHTEXTBULLETSPAGE
#define SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION wxDefaultPosition
@@ -42,10 +44,11 @@ class wxRichTextCtrl;
* wxRichTextBulletsPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxPanel
class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextBulletsPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors

View File

@@ -48,6 +48,13 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition;
#define wxRICHTEXT_CTRL_DOWN 0x02
#define wxRICHTEXT_ALT_DOWN 0x04
/* Extra flags
*/
// Don't draw guide lines around boxes and tables
#define wxRICHTEXT_EX_NO_GUIDELINES 0x00000100
/* Defaults
*/
@@ -66,14 +73,17 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition;
// Milliseconds before layout occurs after resize
#define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50
/* Identifiers
*/
#define wxID_RICHTEXT_PROPERTIES1 (wxID_HIGHEST + 1)
#define wxID_RICHTEXT_PROPERTIES2 (wxID_HIGHEST + 2)
#define wxID_RICHTEXT_PROPERTIES3 (wxID_HIGHEST + 3)
/*!
* Forward declarations
*/
/*!
* wxRichTextItem class declaration
*/
#if 0
// Drawing styles/states
#define wxRICHTEXT_SELECTED 0x01
#define wxRICHTEXT_TAGGED 0x02
@@ -81,6 +91,67 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition;
#define wxRICHTEXT_FOCUSSED 0x04
// The item itself has the focus
#define wxRICHTEXT_IS_FOCUS 0x08
#endif
// Normal selection occurs initially and as user drags within one container.
// Common ancestor selection occurs when the user starts dragging across containers
// that have a common ancestor, for example the cells in a table.
enum wxRichTextCtrlSelectionState
{
wxRichTextCtrlSelectionState_Normal,
wxRichTextCtrlSelectionState_CommonAncestor
};
/*!
* wxRichTextContextMenuPropertiesInfo keeps track of objects that appear in the context menu,
* whose properties are available to be edited.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo
{
public:
wxRichTextContextMenuPropertiesInfo() { Init(); }
// Operations
/// Initialisation
void Init() {}
/// Add an item
bool AddItem(const wxString& label, wxRichTextObject* obj);
/// Returns number of menu items were added.
int AddMenuItems(wxMenu* menu, int startCmd = wxID_RICHTEXT_PROPERTIES1) const;
/// Add appropriate menu items for the current container and clicked on object
/// (and container's parent, if appropriate).
int AddItems(wxRichTextObject* container, wxRichTextObject* obj);
/// Clear the items
void Clear() { m_objects.Clear(); m_labels.Clear(); }
// Accessors
/// Gets the nth label
wxString GetLabel(int n) const { return m_labels[n]; }
/// Gets the nth object
wxRichTextObject* GetObject(int n) const { return m_objects[n]; }
/// Get objects
wxRichTextObjectPtrArray& GetObjects() { return m_objects; }
const wxRichTextObjectPtrArray& GetObjects() const { return m_objects; }
/// Get labels
wxArrayString& GetLabels() { return m_labels; }
const wxArrayString& GetLabels() const { return m_labels; }
/// Get number of items
int GetCount() const { return m_objects.GetCount(); }
//wxArrayInt m_ids;
wxRichTextObjectPtrArray m_objects;
wxArrayString m_labels;
};
/*!
* wxRichTextCtrl class declaration
@@ -132,6 +203,11 @@ public:
virtual void GetSelection(long* from, long* to) const;
virtual wxString GetStringSelection() const;
const wxRichTextSelection& GetSelection() const { return m_selection; }
wxRichTextSelection& GetSelection() { return m_selection; }
void SetSelection(const wxRichTextSelection& sel) { m_selection = sel; }
/// Get filename
wxString GetFilename() const { return m_filename; }
@@ -185,12 +261,21 @@ public:
long GetSelectionAnchor() const { return m_selectionAnchor; }
void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; }
/// The wxRichTextObject object under mouse if any
wxRichTextObject* GetCurrentObject() const { return m_currentObject; }
void SetCurrentObject(wxRichTextObject* obj) { m_currentObject = obj; }
/// Anchor object if selecting multiple containers.
wxRichTextObject* GetSelectionAnchorObject() const { return m_selectionAnchorObject; }
void SetSelectionAnchorObject(wxRichTextObject* anchor) { m_selectionAnchorObject = anchor; }
wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo; }
const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo; }
/// The wxRichTextObject object that currently has the editing focus
wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; }
bool SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setCaretPosition = true);
// Operations
void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL); }
// editing
virtual void Clear();
virtual void Replace(long from, long to, const wxString& value);
@@ -229,13 +314,15 @@ public:
virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style);
virtual bool GetStyle(long position, wxTextAttr& style);
virtual bool GetStyle(long position, wxRichTextAttr& style);
virtual bool GetStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
// Set an image style
void SetImageStyle(wxRichTextImage *image, const wxRichTextAttr& textAttr);
// Set the style for a single object
virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr);
// get the common set of styles for the range
virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style);
virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
// extended style setting operation with flags including:
// wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY
// see richtextbuffer.h for more details.
@@ -243,6 +330,7 @@ public:
/// Get the content (uncombined) attributes for this position.
virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container);
virtual bool SetDefaultStyle(const wxTextAttr& style);
virtual bool SetDefaultStyle(const wxRichTextAttr& style);
@@ -316,8 +404,14 @@ public:
virtual void SelectAll();
virtual void SetEditable(bool editable);
/// Returns true if there was a selection and the object containing the selection
/// was the same as the current focus object.
virtual bool HasSelection() const;
/// Returns true if there was a selection, whether or not the current focus object
/// is the same as the selection's container object.
virtual bool HasUnfocusedSelection() const;
///// Functionality specific to wxRichTextCtrl
/// Write an image at the current insertion point. Supply optional type to use
@@ -338,6 +432,14 @@ public:
virtual bool WriteImage(const wxRichTextImageBlock& imageBlock,
const wxRichTextAttr& textAttr = wxRichTextAttr());
/// Write a text box at the current insertion point, returning the text box.
/// You can then call SetFocusObject() to set the focus to the new object.
virtual wxRichTextBox* WriteTextBox(const wxRichTextAttr& textAttr = wxRichTextAttr());
/// Write a table at the current insertion point, returning the table.
/// You can then call SetFocusObject() to set the focus to the new object.
virtual wxRichTextTable* WriteTable(int rows, int cols, const wxRichTextAttr& tableAttr = wxRichTextAttr(), const wxRichTextAttr& cellAttr = wxRichTextAttr());
/// Insert a newline (actually paragraph) at the current insertion point.
virtual bool Newline();
@@ -484,11 +586,12 @@ public:
wxRichTextRange GetSelectionRange() const;
void SetSelectionRange(const wxRichTextRange& range);
/// Get/set the selection range in character positions. -1, -1 means no selection.
/// Get/set the selection range in character positions. -2, -2 means no selection
/// -1, -1 means select everything.
/// The range is in internal format, i.e. a single character selection is denoted
/// by (n, n)
const wxRichTextRange& GetInternalSelectionRange() const { return m_selectionRange; }
void SetInternalSelectionRange(const wxRichTextRange& range) { m_selectionRange = range; }
wxRichTextRange GetInternalSelectionRange() const { return m_selection.GetRange(); }
void SetInternalSelectionRange(const wxRichTextRange& range) { m_selection.Set(range, GetFocusObject()); }
/// Add a new paragraph of text to the end of the buffer
virtual wxRichTextRange AddParagraph(const wxString& text);
@@ -501,7 +604,7 @@ public:
virtual bool LayoutContent(bool onlyVisibleRect = false);
/// Move the caret to the given character position
virtual bool MoveCaret(long pos, bool showAtLineStart = false);
virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL);
/// Move right
virtual bool MoveRight(int noPositions = 1, int flags = 0);
@@ -638,7 +741,7 @@ public:
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event);
void OnImage(wxCommandEvent& event);
void OnProperties(wxCommandEvent& event);
void OnClear(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
@@ -647,7 +750,7 @@ public:
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdateSelectAll(wxUpdateUIEvent& event);
void OnUpdateImage(wxUpdateUIEvent& event);
void OnUpdateProperties(wxUpdateUIEvent& event);
void OnUpdateClear(wxUpdateUIEvent& event);
// Show a context menu for Rich Edit controls (the standard
@@ -721,7 +824,7 @@ public:
virtual bool ShouldInheritColours() const { return false; }
/// Position the caret
virtual void PositionCaret();
virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL);
/// Extend the selection, returning true if the selection was
/// changed. Selections are in caret positions.
@@ -731,7 +834,7 @@ public:
virtual bool ScrollIntoView(long position, int keyCode);
/// Refresh the area affected by a selection change
bool RefreshForSelectionChange(const wxRichTextRange& oldSelection, const wxRichTextRange& newSelection);
bool RefreshForSelectionChange(const wxRichTextSelection& oldSelection, const wxRichTextSelection& newSelection);
/// The caret position is the character position just before the caret.
/// A value of -1 means the caret is at the start of the buffer.
@@ -753,8 +856,9 @@ public:
/// to the start of the next, which may be the exact same caret position.
void MoveCaretBack(long oldPosition) ;
/// Get the caret height and position for the given character position
bool GetCaretPositionForIndex(long position, wxRect& rect);
/// Get the caret height and position for the given character position. If container is null,
/// the current focus object will be used.
bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL);
/// Gets the line for the visible caret position. If the caret is
/// shown at the very end of the line, it means the next character is actually
@@ -812,19 +916,32 @@ public:
// Implementation
/// Font names take a long time to retrieve, so cache them (on demand)
static const wxArrayString& GetAvailableFontNames();
static void ClearAvailableFontNames();
/// Set up the caret for the given position and container, after a mouse click
bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox* container, long position, int hitTestFlags, bool extendSelection = false);
WX_FORWARD_TO_SCROLL_HELPER()
/// Find the caret position for the combination of hit-test flags and character position.
/// Returns the caret position and also an indication of where to place the caret (caretLineStart)
/// since this is ambiguous (same position used for end of line and start of next).
long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container,
bool& caretLineStart);
// implement wxTextEntry methods
virtual wxString DoGetValue() const;
/// Font names take a long time to retrieve, so cache them (on demand)
static const wxArrayString& GetAvailableFontNames();
static void ClearAvailableFontNames();
WX_FORWARD_TO_SCROLL_HELPER()
// implement wxTextEntry methods
virtual wxString DoGetValue() const;
protected:
// implement the wxTextEntry pure virtual method
virtual wxWindow *GetEditableWindow() { return this; }
// margins functions
virtual bool DoSetMargins(const wxPoint& pt);
virtual wxPoint DoGetMargins() const;
// FIXME: this does not work, it allows this code to compile but will fail
// during run-time
#ifndef __WXUNIVERSAL__
@@ -872,12 +989,17 @@ private:
long m_caretPositionForDefaultStyle;
/// Selection range in character positions. -2, -2 means no selection.
wxRichTextRange m_selectionRange;
wxRichTextSelection m_selection;
wxRichTextCtrlSelectionState m_selectionState;
/// Anchor so we know how to extend the selection
/// It's a caret position since it's between two characters.
long m_selectionAnchor;
/// Anchor object if selecting multiple container objects, such as grid cells.
wxRichTextObject* m_selectionAnchorObject;
/// Are we editable?
bool m_editable;
@@ -904,9 +1026,11 @@ private:
wxCursor m_urlCursor;
static wxArrayString sm_availableFontNames;
/// The wxRichTextObject object under mouse if any
wxRichTextObject* m_currentObject;
long m_imagePropertyId;
wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo;
/// The object that currently has the editing focus
wxRichTextParagraphLayoutBox* m_focusObject;
};
/*!
@@ -919,14 +1043,14 @@ public:
wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxNotifyEvent(commandType, winid),
m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL),
m_char((wxChar) 0)
m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL)
{ }
wxRichTextEvent(const wxRichTextEvent& event)
: wxNotifyEvent(event),
m_flags(event.m_flags), m_position(-1),
m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet),
m_char((wxChar) 0)
m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer)
{ }
long GetPosition() const { return m_position; }
@@ -947,15 +1071,23 @@ public:
wxChar GetCharacter() const { return m_char; }
void SetCharacter(wxChar ch) { m_char = ch; }
wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; }
void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; }
wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; }
void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; }
virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); }
protected:
int m_flags;
long m_position;
wxRichTextStyleSheet* m_oldStyleSheet;
wxRichTextStyleSheet* m_newStyleSheet;
wxRichTextRange m_range;
wxChar m_char;
int m_flags;
long m_position;
wxRichTextStyleSheet* m_oldStyleSheet;
wxRichTextStyleSheet* m_newStyleSheet;
wxRichTextRange m_range;
wxChar m_char;
wxRichTextParagraphLayoutBox* m_container;
wxRichTextParagraphLayoutBox* m_oldContainer;
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent)
@@ -982,6 +1114,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_D
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, wxRichTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, wxRichTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED, wxRichTextEvent );
typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&);

View File

@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextdialogpage.h
// Purpose: Formatting dialog page base class for wxRTC
// Author: Julian Smart
// Modified by:
// Created: 2010-11-14
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTDIALOGPAGE_H_
#define _WX_RICHTEXTDIALOGPAGE_H_
#if wxUSE_RICHTEXT
#include "wx/panel.h"
#include "wx/richtext/richtextuicustomization.h"
/**
@class wxRichTextDialogPage
The base class for formatting dialog pages.
**/
class WXDLLIMPEXP_RICHTEXT wxRichTextDialogPage: public wxPanel
{
public:
wxRichTextDialogPage() {}
wxRichTextDialogPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0)
{
Create(parent, id, pos, size, style);
}
DECLARE_BASE_CLASS_HELP_PROVISION()
};
#endif
// wxUSE_RICHTEXT
#endif
// _WX_RICHTEXTDIALOGPAGE_H_

View File

@@ -16,6 +16,8 @@
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
////@end includes
@@ -35,7 +37,7 @@ class wxRichTextFontPreviewCtrl;
////@begin control identifiers
#define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE wxT("")
#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE
#define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(200, 100)
#define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition
@@ -45,10 +47,11 @@ class wxRichTextFontPreviewCtrl;
* wxRichTextFontPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxPanel
class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextFontPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors

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;

View File

@@ -2,10 +2,10 @@
// Name: wx/richtext/richtextimagedlg.h
// Purpose:
// Author: Mingquan Yang
// Modified by:
// Modified by: Julian Smart
// Created: Wed 02 Jun 2010 11:27:23 CST
// RCS-ID:
// Copyright: (c) Mingquan Yang
// Copyright: (c) Mingquan Yang, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -17,7 +17,9 @@
/*!
* Includes
*/
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextformatdlg.h"
/*!
* Forward declarations
@@ -32,33 +34,32 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE _("Image Properties")
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME ID_WXRICHTEXTIMAGEPAGE
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION wxDefaultPosition
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE _("Object Properties")
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME ID_RICHTEXTOBJECTPROPERTIESDIALOG
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextImageDialog class declaration
* wxRichTextObjectPropertiesDialog class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextImageDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxRichTextImageDialog )
class WXDLLIMPEXP_RICHTEXT wxRichTextObjectPropertiesDialog: public wxRichTextFormattingDialog
{
DECLARE_DYNAMIC_CLASS( wxRichTextObjectPropertiesDialog )
DECLARE_EVENT_TABLE()
public:
/// Constructors
wxRichTextImageDialog();
wxRichTextImageDialog( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE );
wxRichTextObjectPropertiesDialog();
wxRichTextObjectPropertiesDialog( wxRichTextObject* obj, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE );
bool Create( wxRichTextObject* obj, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE );
/// Destructor
~wxRichTextImageDialog();
~wxRichTextObjectPropertiesDialog();
/// Initialises member variables
void Init();
@@ -66,77 +67,28 @@ public:
/// Creates the controls and sizers
void CreateControls();
/// Set the dimension into the value and units controls
void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl);
////@begin wxRichTextObjectPropertiesDialog event handler declarations
/// Get the dimension from the value and units controls
void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl);
////@begin wxRichTextImageDialog event handler declarations
////@end wxRichTextObjectPropertiesDialog event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_PARA_UP
void OnRichtextimagedialogParaUpClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_DOWN
void OnRichtextimagedialogDownClick( wxCommandEvent& event );
////@end wxRichTextImageDialog event handler declarations
////@begin wxRichTextImageDialog member function declarations
////@begin wxRichTextObjectPropertiesDialog member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextImageDialog member function declarations
////@end wxRichTextObjectPropertiesDialog member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
/// Set the image attribute
void SetImageAttr(const wxRichTextAttr& textAttr);
wxRichTextImage* ApplyImageAttr();
/// Set the anchored object
void SetImageObject(wxRichTextImage *image, wxRichTextBuffer* buffer);
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
private:
/// Convert CM to MM
bool ConvertFromString(const wxString& string, int& ret, int scale);
private:
wxRichTextAttr m_textAttr;
////@begin wxRichTextImageDialog member variables
wxComboBox* m_float;
wxTextCtrl* m_width;
wxComboBox* m_unitsW;
wxTextCtrl* m_height;
wxComboBox* m_unitsH;
wxTextCtrl* m_offset;
wxComboBox* m_unitsOffset;
wxButton* m_saveButton;
wxButton* m_cancelButton;
////@begin wxRichTextObjectPropertiesDialog member variables
/// Control identifiers
enum {
ID_WXRICHTEXTIMAGEPAGE = 10015,
ID_RICHTEXTIMAGEDIALOG_FLOATING_MODE = 10017,
ID_RICHTEXTIMAGEDIALOG_WIDTH = 10018,
ID_RICHTEXTIMAGEDIALOG_UNITS_W = 10019,
ID_RICHTEXTIMAGEDIALOG_HEIGHT = 10020,
ID_RICHTEXTIMAGEDIALOG_UNITS_H = 10021,
ID_RICHTEXTIMAGEDIALOG_OFFSET = 10022,
ID_RICHTEXTIMAGEDIALOG_OFFSET_UNITS = 10023,
ID_RICHTEXTIMAGEDIALOG_PARA_UP = 10024,
ID_RICHTEXTIMAGEDIALOG_DOWN = 10025
ID_RICHTEXTOBJECTPROPERTIESDIALOG = 10650
};
////@end wxRichTextImageDialog member variables
wxRichTextBuffer* m_buffer;
wxRichTextObject* m_image;
wxRichTextObject* m_parent;
////@end wxRichTextObjectPropertiesDialog member variables
};
#endif

View File

@@ -16,6 +16,8 @@
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/statline.h"
////@end includes
@@ -44,10 +46,11 @@ class wxRichTextCtrl;
* wxRichTextIndentsSpacingPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxPanel
class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors

View File

@@ -16,6 +16,8 @@
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/spinctrl.h"
#include "wx/notebook.h"
@@ -28,7 +30,7 @@
////@begin control identifiers
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE wxT("")
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition
@@ -38,10 +40,11 @@
* wxRichTextListStylePage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxPanel
class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors

View File

@@ -0,0 +1,179 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextmarginspage.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 20/10/2010 10:27:34
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTMARGINSPAGE_H_
#define _RICHTEXTMARGINSPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/statline.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTMARGINSPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME ID_WXRICHTEXTMARGINSPAGE
#define SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextMarginsPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextMarginsPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextMarginsPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextMarginsPage();
wxRichTextMarginsPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE );
/// Destructor
~wxRichTextMarginsPage();
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Gets the attributes from the formatting dialog
wxRichTextAttr* GetAttributes();
/// Data transfer
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
////@begin wxRichTextMarginsPage event handler declarations
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_MARGIN
void OnRichtextLeftMarginUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_MARGIN
void OnRichtextRightMarginUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_MARGIN
void OnRichtextTopMarginUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_MARGIN
void OnRichtextBottomMarginUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_PADDING
void OnRichtextLeftPaddingUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_PADDING
void OnRichtextRightPaddingUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_PADDING
void OnRichtextTopPaddingUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_PADDING
void OnRichtextBottomPaddingUpdate( wxUpdateUIEvent& event );
////@end wxRichTextMarginsPage event handler declarations
////@begin wxRichTextMarginsPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextMarginsPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextMarginsPage member variables
wxCheckBox* m_leftMarginCheckbox;
wxTextCtrl* m_marginLeft;
wxComboBox* m_unitsMarginLeft;
wxCheckBox* m_rightMarginCheckbox;
wxTextCtrl* m_marginRight;
wxComboBox* m_unitsMarginRight;
wxCheckBox* m_topMarginCheckbox;
wxTextCtrl* m_marginTop;
wxComboBox* m_unitsMarginTop;
wxCheckBox* m_bottomMarginCheckbox;
wxTextCtrl* m_marginBottom;
wxComboBox* m_unitsMarginBottom;
wxCheckBox* m_leftPaddingCheckbox;
wxTextCtrl* m_paddingLeft;
wxComboBox* m_unitsPaddingLeft;
wxCheckBox* m_rightPaddingCheckbox;
wxTextCtrl* m_paddingRight;
wxComboBox* m_unitsPaddingRight;
wxCheckBox* m_topPaddingCheckbox;
wxTextCtrl* m_paddingTop;
wxComboBox* m_unitsPaddingTop;
wxCheckBox* m_bottomPaddingCheckbox;
wxTextCtrl* m_paddingBottom;
wxComboBox* m_unitsPaddingBottom;
/// Control identifiers
enum {
ID_WXRICHTEXTMARGINSPAGE = 10750,
ID_RICHTEXT_LEFT_MARGIN_CHECKBOX = 10751,
ID_RICHTEXT_LEFT_MARGIN = 10752,
ID_RICHTEXT_LEFT_MARGIN_UNITS = 10753,
ID_RICHTEXT_RIGHT_MARGIN_CHECKBOX = 10754,
ID_RICHTEXT_RIGHT_MARGIN = 10755,
ID_RICHTEXT_RIGHT_MARGIN_UNITS = 10756,
ID_RICHTEXT_TOP_MARGIN_CHECKBOX = 10757,
ID_RICHTEXT_TOP_MARGIN = 10758,
ID_RICHTEXT_TOP_MARGIN_UNITS = 10759,
ID_RICHTEXT_BOTTOM_MARGIN_CHECKBOX = 10760,
ID_RICHTEXT_BOTTOM_MARGIN = 10761,
ID_RICHTEXT_BOTTOM_MARGIN_UNITS = 10762,
ID_RICHTEXT_LEFT_PADDING_CHECKBOX = 10763,
ID_RICHTEXT_LEFT_PADDING = 10764,
ID_RICHTEXT_LEFT_PADDING_UNITS = 10765,
ID_RICHTEXT_RIGHT_PADDING_CHECKBOX = 10766,
ID_RICHTEXT_RIGHT_PADDING = 10767,
ID_RICHTEXT_RIGHT_PADDING_UNITS = 10768,
ID_RICHTEXT_TOP_PADDING_CHECKBOX = 10769,
ID_RICHTEXT_TOP_PADDING = 10770,
ID_RICHTEXT_TOP_PADDING_UNITS = 10771,
ID_RICHTEXT_BOTTOM_PADDING_CHECKBOX = 10772,
ID_RICHTEXT_BOTTOM_PADDING = 10773,
ID_RICHTEXT_BOTTOM_PADDING_UNITS = 10774
};
////@end wxRichTextMarginsPage member variables
bool m_ignoreUpdates;
};
#endif
// _RICHTEXTMARGINSPAGE_H_

View File

@@ -145,6 +145,7 @@ private:
int m_numPages;
wxArrayInt m_pageBreaksStart;
wxArrayInt m_pageBreaksEnd;
wxArrayInt m_pageYOffsets;
int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom;
wxRichTextHeaderFooterData m_headerFooterData;

View File

@@ -0,0 +1,159 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextsizepage.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 20/10/2010 10:23:24
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSIZEPAGE_H_
#define _RICHTEXTSIZEPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
#include "wx/sizer.h"
////@begin includes
#include "wx/statline.h"
////@end includes
/*!
* Forward declarations
*/
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTSIZEPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTSIZEPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME ID_WXRICHTEXTSIZEPAGE
#define SYMBOL_WXRICHTEXTSIZEPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSIZEPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextSizePage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextSizePage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextSizePage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextSizePage();
wxRichTextSizePage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSIZEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSIZEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSIZEPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSIZEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSIZEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSIZEPAGE_STYLE );
/// Destructor
~wxRichTextSizePage();
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Gets the attributes from the formatting dialog
wxRichTextAttr* GetAttributes();
/// Data transfer
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
/// Show/hide position controls
void ShowPositionControls(bool show);
/// Show/hide floating controls
void ShowFloatingControls(bool show);
////@begin wxRichTextSizePage event handler declarations
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
void OnRichtextWidthUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
void OnRichtextHeightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
void OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OFFSET
void OnRichtextOffsetUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP
void OnRichtextParaUpClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_DOWN
void OnRichtextParaDownClick( wxCommandEvent& event );
////@end wxRichTextSizePage event handler declarations
////@begin wxRichTextSizePage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextSizePage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextSizePage member variables
wxBoxSizer* m_parentSizer;
wxBoxSizer* m_floatingControls;
wxComboBox* m_float;
wxCheckBox* m_widthCheckbox;
wxTextCtrl* m_width;
wxComboBox* m_unitsW;
wxCheckBox* m_heightCheckbox;
wxTextCtrl* m_height;
wxComboBox* m_unitsH;
wxBoxSizer* m_alignmentControls;
wxCheckBox* m_verticalAlignmentCheckbox;
wxComboBox* m_verticalAlignmentComboBox;
wxBoxSizer* m_positionControls;
wxBoxSizer* m_moveObjectParentSizer;
wxCheckBox* m_offsetYCheckbox;
wxTextCtrl* m_offset;
wxComboBox* m_unitsOffset;
wxBoxSizer* m_moveObjectSizer;
/// Control identifiers
enum {
ID_WXRICHTEXTSIZEPAGE = 10700,
ID_RICHTEXT_FLOATING_MODE = 10701,
ID_RICHTEXT_WIDTH_CHECKBOX = 10702,
ID_RICHTEXT_WIDTH = 10703,
ID_RICHTEXT_UNITS_W = 10704,
ID_RICHTEXT_HEIGHT_CHECKBOX = 10705,
ID_RICHTEXT_HEIGHT = 10706,
ID_RICHTEXT_UNITS_H = 10707,
ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX = 10708,
ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX = 10709,
ID_RICHTEXT_OFFSET_CHECKBOX = 10710,
ID_RICHTEXT_OFFSET = 10711,
ID_RICHTEXT_OFFSET_UNITS = 10712,
ID_RICHTEXT_PARA_UP = 10713,
ID_RICHTEXT_PARA_DOWN = 10714
};
////@end wxRichTextSizePage member variables
};
#endif
// _RICHTEXTSIZEPAGE_H_

View File

@@ -16,6 +16,8 @@
* Includes
*/
#include "wx/richtext/richtextuicustomization.h"
////@begin includes
////@end includes
@@ -31,6 +33,7 @@
class wxBoxSizer;
class wxRichTextStyleListCtrl;
class wxRichTextCtrl;
class wxStdDialogButtonSizer;
////@end forward declarations
class WXDLLIMPEXP_FWD_CORE wxButton;
@@ -79,6 +82,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors
@@ -207,6 +211,7 @@ public:
wxButton* m_closeButton;
wxBoxSizer* m_bottomButtonSizer;
wxCheckBox* m_restartNumberingCtrl;
wxStdDialogButtonSizer* m_stdButtonSizer;
wxButton* m_okButton;
wxButton* m_cancelButton;
/// Control identifiers

View File

@@ -12,13 +12,15 @@
#ifndef _RICHTEXTSTYLEPAGE_H_
#define _RICHTEXTSTYLEPAGE_H_
#include "wx/richtext/richtextdialogpage.h"
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTSTYLEPAGE_TITLE wxT("")
#define SYMBOL_WXRICHTEXTSTYLEPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME ID_RICHTEXTSTYLEPAGE
#define SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION wxDefaultPosition
@@ -28,10 +30,11 @@
* wxRichTextStylePage class declaration
*/
class wxRichTextStylePage: public wxPanel
class WXDLLIMPEXP_RICHTEXT wxRichTextStylePage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextStylePage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors

View File

@@ -240,6 +240,40 @@ protected:
wxRichTextAttr m_levelStyles[10];
};
/*!
* wxRichTextBoxStyleDefinition class declaration, for box attributes in objects such as wxRichTextBox.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextBoxStyleDefinition: public wxRichTextStyleDefinition
{
DECLARE_DYNAMIC_CLASS(wxRichTextBoxStyleDefinition)
public:
/// Copy constructor
wxRichTextBoxStyleDefinition(const wxRichTextBoxStyleDefinition& def) { Copy(def); }
/// Default constructor
wxRichTextBoxStyleDefinition(const wxString& name = wxEmptyString):
wxRichTextStyleDefinition(name) {}
// Destructor
virtual ~wxRichTextBoxStyleDefinition() {}
/// Copies from def
void Copy(const wxRichTextBoxStyleDefinition& def);
/// Assignment operator
void operator =(const wxRichTextBoxStyleDefinition& def) { Copy(def); }
/// Equality operator
bool operator ==(const wxRichTextBoxStyleDefinition& def) const;
/// Clones the object
virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextBoxStyleDefinition(*this); }
protected:
};
/*!
* The style sheet
*/
@@ -280,6 +314,9 @@ public:
/// Add a definition to the list style list
bool AddListStyle(wxRichTextListStyleDefinition* def);
/// Add a definition to the box style list
bool AddBoxStyle(wxRichTextBoxStyleDefinition* def);
/// Add a definition to the appropriate style list
bool AddStyle(wxRichTextStyleDefinition* def);
@@ -292,6 +329,9 @@ public:
/// Remove a list style
bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); }
/// Remove a box style
bool RemoveBoxStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_boxStyleDefinitions, def, deleteStyle); }
/// Remove a style
bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false);
@@ -304,6 +344,9 @@ public:
/// Find a list definition by name
wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); }
/// Find a box definition by name
wxRichTextBoxStyleDefinition* FindBoxStyle(const wxString& name, bool recurse = true) const { return (wxRichTextBoxStyleDefinition*) FindStyle(m_boxStyleDefinitions, name, recurse); }
/// Find any definition by name
wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const;
@@ -316,6 +359,9 @@ public:
/// Return the number of list styles
size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); }
/// Return the number of box styles
size_t GetBoxStyleCount() const { return m_boxStyleDefinitions.GetCount(); }
/// Return the nth character style
wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); }
@@ -325,6 +371,9 @@ public:
/// Return the nth list style
wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); }
/// Return the nth box style
wxRichTextBoxStyleDefinition* GetBoxStyle(size_t n) const { return (wxRichTextBoxStyleDefinition*) m_boxStyleDefinitions.Item(n)->GetData(); }
/// Delete all styles
void DeleteStyles();
@@ -372,6 +421,7 @@ protected:
wxList m_characterStyleDefinitions;
wxList m_paragraphStyleDefinitions;
wxList m_listStyleDefinitions;
wxList m_boxStyleDefinitions;
wxRichTextStyleSheet* m_previousSheet;
wxRichTextStyleSheet* m_nextSheet;
@@ -395,7 +445,8 @@ public:
wxRICHTEXT_STYLE_ALL,
wxRICHTEXT_STYLE_PARAGRAPH,
wxRICHTEXT_STYLE_CHARACTER,
wxRICHTEXT_STYLE_LIST
wxRICHTEXT_STYLE_LIST,
wxRICHTEXT_STYLE_BOX
};
wxRichTextStyleListBox()

View File

@@ -16,6 +16,7 @@
* Includes
*/
#include "wx/richtext/richtextuicustomization.h"
#include "wx/dialog.h"
#include "wx/vscroll.h"
@@ -29,6 +30,7 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
////@begin forward declarations
class wxSymbolListCtrl;
class wxStdDialogButtonSizer;
////@end forward declarations
// __UNICODE__ is a symbol used by DialogBlocks-generated code.
@@ -56,6 +58,7 @@ class WXDLLIMPEXP_RICHTEXT wxSymbolPickerDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxSymbolPickerDialog )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors
@@ -158,6 +161,7 @@ public:
#if defined(__UNICODE__)
wxComboBox* m_fromUnicodeCtrl;
#endif
wxStdDialogButtonSizer* m_stdButtonSizer;
wxString m_fontName;
wxString m_symbol;
bool m_fromUnicode;

View File

@@ -16,6 +16,8 @@
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
////@end includes
@@ -32,7 +34,7 @@
////@begin control identifiers
#define SYMBOL_WXRICHTEXTTABSPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE wxT("")
#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTTABSPAGE_IDNAME ID_RICHTEXTTABSPAGE
#define SYMBOL_WXRICHTEXTTABSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTTABSPAGE_POSITION wxDefaultPosition
@@ -42,10 +44,11 @@
* wxRichTextTabsPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxPanel
class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxRichTextDialogPage
{
DECLARE_DYNAMIC_CLASS( wxRichTextTabsPage )
DECLARE_EVENT_TABLE()
DECLARE_HELP_PROVISION()
public:
/// Constructors

View File

@@ -0,0 +1,123 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextuicustomization.h
// Purpose: UI customization base class for wxRTC
// Author: Julian Smart
// Modified by:
// Created: 2010-11-14
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTUICUSTOMIZATION_H_
#define _WX_RICHTEXTUICUSTOMIZATION_H_
#if wxUSE_RICHTEXT
/**
@class wxRichTextUICustomization
The base class for functionality to plug in to various rich text control dialogs,
currently allowing the application to respond to Help button clicks without the
need to derive new dialog classes.
The application will typically have calls like this in its initialisation:
wxRichTextFormattingDialog::SetHelpId(ID_HELP_FORMATTINGDIALOG);
wxRichTextFormattingDialog::SetUICustomization(& wxGetApp().GetRichTextUICustomization());
wxRichTextBordersPage::SetHelpId(ID_HELP_BORDERSPAGE);
Only the wxRichTextFormattingDialog class needs to have its customization object and help id set,
though the application set them for individual pages if it wants.
**/
class WXDLLIMPEXP_RICHTEXT wxRichTextUICustomization
{
public:
wxRichTextUICustomization() {}
virtual ~wxRichTextUICustomization() {}
/// Show the help given the current active window, and a help topic id.
virtual bool ShowHelp(wxWindow* win, long id) = 0;
};
/**
@class wxRichTextHelpInfo
This class is used as a static member of dialogs, to store the help topic for the dialog
and also the customization object that will allow help to be shown appropriately for the application.
**/
class WXDLLIMPEXP_RICHTEXT wxRichTextHelpInfo
{
public:
wxRichTextHelpInfo()
{
m_helpTopic = -1;
m_uiCustomization = NULL;
}
virtual ~wxRichTextHelpInfo() {}
virtual bool ShowHelp(wxWindow* win)
{
if (m_uiCustomization && m_helpTopic != -1)
return m_uiCustomization->ShowHelp(win, m_helpTopic);
else
return false;
}
/// Get the help topic identifier.
long GetHelpId() const { return m_helpTopic; }
/// Set the help topic identifier.
void SetHelpId(long id) { m_helpTopic = id; }
/// Get the UI customization object.
wxRichTextUICustomization* GetUICustomization() const { return m_uiCustomization; }
/// Set the UI customization object.
void SetUICustomization(wxRichTextUICustomization* customization) { m_uiCustomization = customization; }
/// Is there a valid help topic id?
bool HasHelpId() const { return m_helpTopic != -1; }
/// Is there a valid customization object?
bool HasUICustomization() const { return m_uiCustomization != NULL; }
protected:
wxRichTextUICustomization* m_uiCustomization;
long m_helpTopic;
};
/// Add this to the base class of dialogs
#define DECLARE_BASE_CLASS_HELP_PROVISION() \
virtual long GetHelpId() const = 0; \
virtual wxRichTextUICustomization* GetUICustomization() const = 0; \
virtual bool ShowHelp(wxWindow* win) = 0;
/// A macro to make it easy to add help topic provision and UI customization
/// to a class. Optionally, add virtual functions to a base class
/// using DECLARE_BASE_CLASS_HELP_PROVISION. This means that the formatting dialog
/// can obtain help topics from its individual pages without needing
/// to know in advance what page classes are being used, allowing for extension
/// of the formatting dialog.
#define DECLARE_HELP_PROVISION() \
virtual long GetHelpId() const { return sm_helpInfo.GetHelpId(); } \
virtual void SetHelpId(long id) { sm_helpInfo.SetHelpId(id); } \
virtual wxRichTextUICustomization* GetUICustomization() const { return sm_helpInfo.GetUICustomization(); } \
virtual void SetUICustomization(wxRichTextUICustomization* customization) { sm_helpInfo.SetUICustomization(customization); } \
virtual bool ShowHelp(wxWindow* win) { return sm_helpInfo.ShowHelp(win); } \
protected: \
static wxRichTextHelpInfo sm_helpInfo; \
public:
/// Add this to the implementation file for each dialog that needs help provision.
#define IMPLEMENT_HELP_PROVISION(theClass) \
wxRichTextHelpInfo theClass::sm_helpInfo;
#endif
// wxUSE_RICHTEXT
#endif
// _WX_RICHTEXTUICUSTOMIZATION_H_

View File

@@ -94,6 +94,7 @@ public:
wxString GetNodeContent(wxXmlNode *node);
wxString GetParamValue(wxXmlNode *node, const wxString& param);
wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false);
static wxXmlNode* FindNode(wxXmlNode* node, const wxString& name);
protected:
#if wxUSE_STREAMS