initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit bf6b52fd94
9654 changed files with 4035664 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
/* XPM */
static const char *image_placeholder24x24_xpm[] = {
/* columns rows colors chars-per-pixel */
"24 24 2 1",
" c #7E97A9",
". c #EBEBFF",
/* pixels */
" ...... ......",
" ...... ......",
" ...... ......",
" ...... ......",
" ...... ......",
" ...... ......",
"...... ...... ",
"...... ...... ",
"...... ...... ",
"...... ...... ",
"...... ...... ",
"...... ...... ",
" ...... ......",
" ...... ......",
" ...... ......",
" ...... ......",
" ...... ......",
" ...... ......",
"...... ...... ",
"...... ...... ",
"...... ...... ",
"...... ...... ",
"...... ...... ",
"...... ...... "
};

View File

@@ -0,0 +1,155 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextbackgroundpage.h
// Purpose: Declares the rich text formatting dialog background
// properties page.
// Author: Julian Smart
// Created: 13/11/2010 11:17:25
// Copyright: (c) Julian Smart
// Licence: wxWindows 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
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextBackgroundPage);
wxDECLARE_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() override;
virtual bool TransferDataFromWindow() override;
/// Respond to colour swatch click
void OnColourSwatch(wxCommandEvent& event);
////@begin wxRichTextBackgroundPage event handler declarations
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET
void OnRichtextShadowUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSHADOWCOLOURSWATCHCTRL
void OnRichtextshadowcolourswatchctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_SPREAD
void OnRichtextShadowSpreadUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_BLUR_DISTANCE
void OnRichtextShadowBlurUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_OPACITY
void OnRichtextShadowOpacityUpdate( wxUpdateUIEvent& event );
////@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;
wxBoxSizer* m_shadowBox;
wxCheckBox* m_useShadow;
wxTextCtrl* m_offsetX;
wxComboBox* m_unitsHorizontalOffset;
wxTextCtrl* m_offsetY;
wxComboBox* m_unitsVerticalOffset;
wxCheckBox* m_shadowColourCheckBox;
wxRichTextColourSwatchCtrl* m_shadowColourSwatch;
wxCheckBox* m_useShadowSpread;
wxTextCtrl* m_spread;
wxComboBox* m_unitsShadowSpread;
wxCheckBox* m_useBlurDistance;
wxTextCtrl* m_blurDistance;
wxComboBox* m_unitsBlurDistance;
wxCheckBox* m_useShadowOpacity;
wxTextCtrl* m_opacity;
/// Control identifiers
enum {
ID_RICHTEXTBACKGROUNDPAGE = 10845,
ID_RICHTEXT_BACKGROUND_COLOUR_CHECKBOX = 10846,
ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH = 10847,
ID_RICHTEXT_USE_SHADOW = 10840,
ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET = 10703,
ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS = 10712,
ID_RICHTEXT_SHADOW_VERTICAL_OFFSET = 10841,
ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS = 10842,
ID_RICHTEXT_USE_SHADOW_COLOUR = 10843,
ID_RICHTEXTSHADOWCOLOURSWATCHCTRL = 10844,
ID_RICHTEXT_USE_SHADOW_SPREAD = 10851,
ID_RICHTEXT_SHADOW_SPREAD = 10848,
ID_RICHTEXT_SHADOW_SPREAD_UNITS = 10849,
ID_RICHTEXT_USE_BLUR_DISTANCE = 10855,
ID_RICHTEXT_SHADOW_BLUR_DISTANCE = 10852,
ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS = 10853,
ID_RICHTEXT_USE_SHADOW_OPACITY = 10856,
ID_RICHTEXT_SHADOW_OPACITY = 10854
};
////@end wxRichTextBackgroundPage member variables
};
#endif
// _RICHTEXTBACKGROUNDPAGE_H_

View File

@@ -0,0 +1,301 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextborderspage.h
// Purpose: A border editing page for the wxRTC formatting dialog.
// Author: Julian Smart
// Created: 21/10/2010 11:34:24
// Copyright: (c) Julian Smart
// Licence: wxWindows 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
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextBordersPage);
wxDECLARE_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() override;
virtual bool TransferDataFromWindow() override;
/// Updates the synchronization checkboxes to reflect the state of the attributes
void UpdateSyncControls();
/// Updates the preview
void OnCommand(wxCommandEvent& event);
/// Fill style combo
virtual void FillStyleComboBox(wxComboBox* styleComboBox);
/// Set the border controls
static void SetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox,
wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles);
/// Get data from the border controls
static void GetBorderValue(wxTextAttrBorder& border, 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_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXT_BORDER_LEFT
void OnRichtextBorderLeftValueTextUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT
void OnRichtextBorderLeftUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_BORDER_LEFT_UNITS
void OnRichtextBorderLeftUnitsSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_BORDER_LEFT_STYLE
void OnRichtextBorderLeftStyleSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT_CHECKBOX
void OnRichtextBorderOtherCheckboxUpdate( 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_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_SYNCHRONIZE
void OnRichtextBorderSynchronizeClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_SYNCHRONIZE
void OnRichtextBorderSynchronizeUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXT_OUTLINE_LEFT
void OnRichtextOutlineLeftTextUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT
void OnRichtextOutlineLeftUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_OUTLINE_LEFT_UNITS
void OnRichtextOutlineLeftUnitsSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_OUTLINE_LEFT_STYLE
void OnRichtextOutlineLeftStyleSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX
void OnRichtextOutlineOtherCheckboxUpdate( 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 );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_OUTLINE_SYNCHRONIZE
void OnRichtextOutlineSynchronizeClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_SYNCHRONIZE
void OnRichtextOutlineSynchronizeUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBORDERSPAGE_CORNER_TEXT
void OnRichtextborderspageCornerUpdate( 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_borderSyncCtrl;
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;
wxCheckBox* m_outlineSyncCtrl;
wxCheckBox* m_cornerRadiusCheckBox;
wxTextCtrl* m_cornerRadiusText;
wxComboBox* m_cornerRadiusUnits;
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_RICHTEXT_BORDER_SYNCHRONIZE = 10845,
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_OUTLINE_SYNCHRONIZE = 10846,
ID_RICHTEXTBORDERSPAGE_CORNER = 10847,
ID_RICHTEXTBORDERSPAGE_CORNER_CHECKBOX = 10848,
ID_RICHTEXTBORDERSPAGE_CORNER_TEXT = 10849,
ID_RICHTEXTBORDERSPAGE_CORNER_UNITS = 10850,
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);
wxDECLARE_EVENT_TABLE();
};
#endif
// _RICHTEXTBORDERSPAGE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,219 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextbulletspage.h
// Purpose: Declares the rich text formatting dialog bullets page.
// Author: Julian Smart
// Created: 10/4/2006 10:32:31 AM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTBULLETSPAGE_H_
#define _RICHTEXTBULLETSPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
#include "wx/spinbutt.h" // for wxSpinEvent
/*!
* Forward declarations
*/
////@begin forward declarations
class wxSpinCtrl;
class wxRichTextCtrl;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTBULLETSPAGE_IDNAME ID_RICHTEXTBULLETSPAGE
#define SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextBulletsPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxRichTextDialogPage
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextBulletsPage);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextBulletsPage( );
wxRichTextBulletsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE );
/// Initialise members
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Updates the bullets preview
void UpdatePreview();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Gets the attributes associated with the main formatting dialog
wxRichTextAttr* GetAttributes();
/// Update for symbol-related controls
void OnSymbolUpdate( wxUpdateUIEvent& event );
/// Update for number-related controls
void OnNumberUpdate( wxUpdateUIEvent& event );
/// Update for standard bullet-related controls
void OnStandardBulletUpdate( wxUpdateUIEvent& event );
////@begin wxRichTextBulletsPage event handler declarations
/// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
void OnStylelistboxSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
void OnPeriodctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
void OnPeriodctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
void OnParenthesesctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
void OnParenthesesctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL
void OnRightParenthesisCtrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL
void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL
void OnBulletAlignmentCtrlSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
void OnSymbolstaticUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
void OnSymbolctrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
void OnSymbolctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
void OnSymbolctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
void OnChooseSymbolClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
void OnChooseSymbolUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC
void OnNamestaticUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
void OnNamectrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
void OnNamectrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
void OnNamectrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
void OnNumberstaticUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
void OnNumberctrlUpdated( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
void OnNumberctrlUp( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
void OnNumberctrlDown( wxSpinEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
void OnNumberctrlTextUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
void OnNumberctrlUpdate( wxUpdateUIEvent& event );
////@end wxRichTextBulletsPage event handler declarations
////@begin wxRichTextBulletsPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextBulletsPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextBulletsPage member variables
wxListBox* m_styleListBox;
wxCheckBox* m_periodCtrl;
wxCheckBox* m_parenthesesCtrl;
wxCheckBox* m_rightParenthesisCtrl;
wxComboBox* m_bulletAlignmentCtrl;
wxComboBox* m_symbolCtrl;
wxComboBox* m_symbolFontCtrl;
wxComboBox* m_bulletNameCtrl;
wxSpinCtrl* m_numberCtrl;
wxRichTextCtrl* m_previewCtrl;
/// Control identifiers
enum {
ID_RICHTEXTBULLETSPAGE = 10300,
ID_RICHTEXTBULLETSPAGE_STYLELISTBOX = 10305,
ID_RICHTEXTBULLETSPAGE_PERIODCTRL = 10313,
ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL = 10311,
ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL = 10306,
ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL = 10315,
ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC = 10301,
ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10307,
ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10308,
ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL = 10309,
ID_RICHTEXTBULLETSPAGE_NAMESTATIC = 10303,
ID_RICHTEXTBULLETSPAGE_NAMECTRL = 10304,
ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC = 10302,
ID_RICHTEXTBULLETSPAGE_NUMBERCTRL = 10310,
ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL = 10314
};
////@end wxRichTextBulletsPage member variables
bool m_hasBulletStyle;
bool m_hasBulletNumber;
bool m_hasBulletSymbol;
bool m_dontUpdate;
};
#endif
// _RICHTEXTBULLETSPAGE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextdialogpage.h
// Purpose: Formatting dialog page base class for wxRTC
// Author: Julian Smart
// Created: 2010-11-14
// 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:
wxDECLARE_CLASS(wxRichTextDialogPage);
wxRichTextDialogPage() = default;
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

@@ -0,0 +1,210 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextfontpage.h
// Purpose: Font page for wxRichTextFormattingDialog
// Author: Julian Smart
// Created: 2006-10-02
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTFONTPAGE_H_
#define _RICHTEXTFONTPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/spinbutt.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
class wxSpinButton;
class wxRichTextFontListBox;
class wxRichTextColourSwatchCtrl;
class wxRichTextFontPreviewCtrl;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE
#define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(200, 100)
#define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextFontPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxRichTextDialogPage
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextFontPage);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextFontPage( );
wxRichTextFontPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE );
/// Initialise members
void Init();
/// Creation
bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE );
/// Creates the controls and sizers
void CreateControls();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Updates the font preview
void UpdatePreview();
void OnFaceListBoxSelected( wxCommandEvent& event );
void OnColourClicked( wxCommandEvent& event );
/// Gets the attributes associated with the main formatting dialog
wxRichTextAttr* GetAttributes();
/// Determines which text effect controls should be shown.
/// Currently only wxTEXT_ATTR_EFFECT_RTL and wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION may
/// be removed from the page. By default, these effects are not shown as they
/// have no effect in the editor.
static int GetAllowedTextEffects() { return sm_allowedTextEffects; }
/// Sets the allowed text effects in the page.
static void SetAllowedTextEffects(int allowed) { sm_allowedTextEffects = allowed; }
////@begin wxRichTextFontPage event handler declarations
/// wxEVT_IDLE event handler for ID_RICHTEXTFONTPAGE
void OnIdle( wxIdleEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL
void OnFaceTextCtrlUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
void OnSizeTextCtrlUpdated( wxCommandEvent& event );
/// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
void OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
void OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& event );
/// wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZE_UNITS
void OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX
void OnSizeListBoxSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL
void OnStyleCtrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL
void OnWeightCtrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
void OnUnderliningCtrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
void OnStrikethroughctrlClick( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL
void OnCapsctrlClick( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT
void OnRichtextfontpageSuperscriptClick( wxCommandEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT
void OnRichtextfontpageSubscriptClick( wxCommandEvent& event );
////@end wxRichTextFontPage event handler declarations
////@begin wxRichTextFontPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextFontPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextFontPage member variables
wxBoxSizer* m_innerSizer;
wxTextCtrl* m_faceTextCtrl;
wxTextCtrl* m_sizeTextCtrl;
wxSpinButton* m_fontSizeSpinButtons;
wxChoice* m_sizeUnitsCtrl;
wxBoxSizer* m_fontListBoxParent;
wxRichTextFontListBox* m_faceListBox;
wxListBox* m_sizeListBox;
wxComboBox* m_styleCtrl;
wxComboBox* m_weightCtrl;
wxComboBox* m_underliningCtrl;
wxCheckBox* m_textColourLabel;
wxRichTextColourSwatchCtrl* m_colourCtrl;
wxCheckBox* m_bgColourLabel;
wxRichTextColourSwatchCtrl* m_bgColourCtrl;
wxCheckBox* m_strikethroughCtrl;
wxCheckBox* m_capitalsCtrl;
wxCheckBox* m_smallCapitalsCtrl;
wxCheckBox* m_superscriptCtrl;
wxCheckBox* m_subscriptCtrl;
wxBoxSizer* m_rtlParentSizer;
wxCheckBox* m_rtlCtrl;
wxCheckBox* m_suppressHyphenationCtrl;
wxRichTextFontPreviewCtrl* m_previewCtrl;
/// Control identifiers
enum {
ID_RICHTEXTFONTPAGE = 10000,
ID_RICHTEXTFONTPAGE_FACETEXTCTRL = 10001,
ID_RICHTEXTFONTPAGE_SIZETEXTCTRL = 10002,
ID_RICHTEXTFONTPAGE_SPINBUTTONS = 10003,
ID_RICHTEXTFONTPAGE_SIZE_UNITS = 10004,
ID_RICHTEXTFONTPAGE_FACELISTBOX = 10005,
ID_RICHTEXTFONTPAGE_SIZELISTBOX = 10006,
ID_RICHTEXTFONTPAGE_STYLECTRL = 10007,
ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10008,
ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10009,
ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL = 10010,
ID_RICHTEXTFONTPAGE_COLOURCTRL = 10011,
ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL = 10012,
ID_RICHTEXTFONTPAGE_BGCOLOURCTRL = 10013,
ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10014,
ID_RICHTEXTFONTPAGE_CAPSCTRL = 10015,
ID_RICHTEXTFONTPAGE_SMALLCAPSCTRL = 10016,
ID_RICHTEXTFONTPAGE_SUPERSCRIPT = 10017,
ID_RICHTEXTFONTPAGE_SUBSCRIPT = 10018,
ID_RICHTEXTFONTPAGE_RIGHT_TO_LEFT = 10020,
ID_RICHTEXTFONTPAGE_SUBSCRIPT_SUPPRESS_HYPHENATION = 10021,
ID_RICHTEXTFONTPAGE_PREVIEWCTRL = 10019
};
////@end wxRichTextFontPage member variables
bool m_dontUpdate;
bool m_colourPresent;
bool m_bgColourPresent;
static int sm_allowedTextEffects;
};
#endif
// _RICHTEXTFONTPAGE_H_

View File

@@ -0,0 +1,379 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextformatdlg.h
// Purpose: Formatting dialog for wxRichTextCtrl
// Author: Julian Smart
// Created: 2006-10-01
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTFORMATDLG_H_
#define _WX_RICHTEXTFORMATDLG_H_
/*!
* Includes
*/
#include "wx/defs.h"
#if wxUSE_RICHTEXT
#include "wx/propdlg.h"
#include "wx/bookctrl.h"
#include "wx/withimages.h"
#include "wx/colourdata.h"
#if wxUSE_HTML
#include "wx/htmllbox.h"
#endif
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextstyles.h"
#include "wx/richtext/richtextuicustomization.h"
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog;
class WXDLLIMPEXP_FWD_CORE wxComboBox;
class WXDLLIMPEXP_FWD_CORE wxCheckBox;
/*!
* Flags determining the pages and buttons to be created in the dialog
*/
#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001
#define wxRICHTEXT_FORMAT_FONT 0x0002
#define wxRICHTEXT_FORMAT_TABS 0x0004
#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 0x1000
/*!
* Indices for bullet styles in list control
*/
enum {
wxRICHTEXT_BULLETINDEX_NONE = 0,
wxRICHTEXT_BULLETINDEX_ARABIC,
wxRICHTEXT_BULLETINDEX_UPPER_CASE,
wxRICHTEXT_BULLETINDEX_LOWER_CASE,
wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN,
wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN,
wxRICHTEXT_BULLETINDEX_OUTLINE,
wxRICHTEXT_BULLETINDEX_SYMBOL,
wxRICHTEXT_BULLETINDEX_BITMAP,
wxRICHTEXT_BULLETINDEX_STANDARD
};
/*!
* Shorthand for common combinations of pages
*/
#define wxRICHTEXT_FORMAT_PARAGRAPH (wxRICHTEXT_FORMAT_INDENTS_SPACING | wxRICHTEXT_FORMAT_BULLETS | wxRICHTEXT_FORMAT_TABS | wxRICHTEXT_FORMAT_FONT)
#define wxRICHTEXT_FORMAT_CHARACTER (wxRICHTEXT_FORMAT_FONT)
#define wxRICHTEXT_FORMAT_STYLE (wxRICHTEXT_FORMAT_PARAGRAPH | wxRICHTEXT_FORMAT_STYLE_EDITOR)
/*!
* Factory for formatting dialog
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialogFactory: public wxObject
{
public:
wxRichTextFormattingDialogFactory() = default;
virtual ~wxRichTextFormattingDialogFactory() = default;
// Overridables
/// Create all pages, under the dialog's book control, also calling AddPage
virtual bool CreatePages(long pages, wxRichTextFormattingDialog* dialog);
/// Create a page, given a page identifier
virtual wxPanel* CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog);
/// Enumerate all available page identifiers
virtual int GetPageId(int i) const;
/// Get the number of available page identifiers
virtual int GetPageIdCount() const;
/// Get the image index for the given page identifier
virtual int GetPageImage(int WXUNUSED(id)) const { return -1; }
/// Invoke help for the dialog
virtual bool ShowHelp(int page, wxRichTextFormattingDialog* dialog);
/// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create
virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog);
/// Create the main dialog buttons
virtual bool CreateButtons(wxRichTextFormattingDialog* dialog);
};
/*!
* Formatting dialog for a wxRichTextCtrl
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog,
public wxWithImages
{
wxDECLARE_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,
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE)
{
Init();
Create(flags, parent, title, id, pos, sz, style);
}
~wxRichTextFormattingDialog();
void Init();
bool Create(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
/// Get attributes from the given range
virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range);
/// Set the attributes and optionally update the display
virtual bool SetStyle(const wxRichTextAttr& style, bool update = true);
/// Set the style definition and optionally update the display
virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true);
/// Get the style definition, if any
virtual wxRichTextStyleDefinition* GetStyleDefinition() const { return m_styleDefinition; }
/// Get the style sheet, if any
virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
/// Update the display
virtual bool UpdateDisplay();
/// 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; }
/// 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; }
void SetObject(wxRichTextObject* obj) { m_object = obj; }
/// Transfers the data and from to the window
virtual bool TransferDataToWindow() override;
virtual bool TransferDataFromWindow() override;
/// Apply the styles when a different tab is selected, so the previews are
/// up to date
void OnTabChanged(wxBookCtrlEvent& event);
/// Respond to help command
void OnHelp(wxCommandEvent& event);
void OnUpdateHelp(wxUpdateUIEvent& event);
/// Get/set formatting factory object
static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory);
static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; }
/// Helper for pages to get the top-level dialog
static wxRichTextFormattingDialog* GetDialog(wxWindow* win);
/// 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);
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
/// Set the dimension into the value and units controls. Optionally pass units to
/// specify the ordering of units in the combobox.
static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = nullptr);
/// Get the dimension from the value and units controls Optionally pass units to
/// specify the ordering of units in the combobox.
static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = nullptr);
/// Convert from a string to a dimension integer.
static bool ConvertFromString(const wxString& str, int& ret, int unit);
/// 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;
/// Whether to restore the last-selected page.
static bool GetRestoreLastPage() { return sm_restoreLastPage; }
static void SetRestoreLastPage(bool b) { sm_restoreLastPage = b; }
/// The page identifier of the last page selected (not the control id)
static int GetLastPage() { return sm_lastPage; }
static void SetLastPage(int lastPage) { sm_lastPage = lastPage; }
/// Sets the custom colour data for use by the colour dialog.
static void SetColourData(const wxColourData& colourData) { sm_colourData = colourData; }
/// Returns the custom colour data for use by the colour dialog.
static wxColourData GetColourData() { return sm_colourData; }
protected:
wxRichTextAttr m_attributes;
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
bool m_ignoreUpdates;
static wxColourData sm_colourData;
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
static bool sm_showToolTips;
static bool sm_restoreLastPage;
static int sm_lastPage;
wxDECLARE_EVENT_TABLE();
};
//-----------------------------------------------------------------------------
// helper class - wxRichTextFontPreviewCtrl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_RICHTEXT wxRichTextFontPreviewCtrl : public wxWindow
{
public:
wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0);
void SetTextEffects(int effects) { m_textEffects = effects; }
int GetTextEffects() const { return m_textEffects; }
private:
int m_textEffects;
void OnPaint(wxPaintEvent& event);
wxDECLARE_EVENT_TABLE();
};
/*
* A control for displaying a small preview of a colour or bitmap
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextColourSwatchCtrl: public wxControl
{
wxDECLARE_CLASS(wxRichTextColourSwatchCtrl);
public:
wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
~wxRichTextColourSwatchCtrl();
void OnMouseEvent(wxMouseEvent& event);
void SetColour(const wxColour& colour) { m_colour = colour; SetBackgroundColour(m_colour); }
wxColour& GetColour() { return m_colour; }
virtual wxSize DoGetBestSize() const override { return GetSize(); }
protected:
wxColour m_colour;
wxDECLARE_EVENT_TABLE();
};
/*!
* wxRichTextFontListBox class declaration
* A listbox to display fonts.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextFontListBox: public wxHtmlListBox
{
wxDECLARE_CLASS(wxRichTextFontListBox);
wxDECLARE_EVENT_TABLE();
public:
wxRichTextFontListBox()
{
Init();
}
wxRichTextFontListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
virtual ~wxRichTextFontListBox();
void Init()
{
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
/// Creates a suitable HTML fragment for a font
wxString CreateHTML(const wxString& facename) const;
/// Get font name for index
wxString GetFaceName(size_t i) const ;
/// Set selection for string, returning the index.
int SetFaceNameSelection(const wxString& name);
/// Updates the font list
void UpdateFonts();
/// Does this face name exist?
bool HasFaceName(const wxString& faceName) const { return m_faceNames.Index(faceName) != wxNOT_FOUND; }
/// Returns the array of face names
const wxArrayString& GetFaceNames() const { return m_faceNames; }
protected:
/// Returns the HTML for this item
virtual wxString OnGetItem(size_t n) const override;
private:
wxArrayString m_faceNames;
};
#endif
// wxUSE_RICHTEXT
#endif
// _WX_RICHTEXTFORMATDLG_H_

View File

@@ -0,0 +1,146 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtexthtml.h
// Purpose: HTML I/O for wxRichTextCtrl
// Author: Julian Smart
// Created: 2005-09-30
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTHTML_H_
#define _WX_RICHTEXTHTML_H_
/*!
* Includes
*/
#include "wx/richtext/richtextbuffer.h"
// Use CSS styles where applicable, otherwise use non-CSS workarounds
#define wxRICHTEXT_HANDLER_USE_CSS 0x1000
/*!
* wxRichTextHTMLHandler
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextHTMLHandler);
public:
wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML);
/// Can we save using this handler?
virtual bool CanSave() const override { return true; }
/// Can we load using this handler?
virtual bool CanLoad() const override { return false; }
/// Can we handle this filename (if using files)? By default, checks the extension.
virtual bool CanHandle(const wxString& filename) const override;
// Accessors and operations unique to this handler
/// Set and get the list of image locations generated by the last operation
void SetTemporaryImageLocations(const wxArrayString& locations) { m_imageLocations = locations; }
const wxArrayString& GetTemporaryImageLocations() const { return m_imageLocations; }
/// Clear the image locations generated by the last operation
void ClearTemporaryImageLocations() { m_imageLocations.Clear(); }
/// Delete the in-memory or temporary files generated by the last operation
bool DeleteTemporaryImages();
/// Delete the in-memory or temporary files generated by the last operation. This is a static
/// function that can be used to delete the saved locations from an earlier operation,
/// for example after the user has viewed the HTML file.
static bool DeleteTemporaryImages(int flags, const wxArrayString& imageLocations);
/// Reset the file counter, in case, for example, the same names are required each time
static void SetFileCounter(int counter) { sm_fileCounter = counter; }
/// Set and get the directory for storing temporary files. If empty, the system
/// temporary directory will be used.
void SetTempDir(const wxString& tempDir) { m_tempDir = tempDir; }
const wxString& GetTempDir() const { return m_tempDir; }
/// Set and get mapping from point size to HTML font size. There should be 7 elements,
/// one for each HTML font size, each element specifying the maximum point size for that
/// HTML font size. E.g. 8, 10, 13, 17, 22, 29, 100
void SetFontSizeMapping(const wxArrayInt& fontSizeMapping) { m_fontSizeMapping = fontSizeMapping; }
wxArrayInt GetFontSizeMapping() const { return m_fontSizeMapping; }
protected:
// Implementation
#if wxUSE_STREAMS
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) override;
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) override;
/// Output character formatting
void BeginCharacterFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, const wxRichTextAttr& paraStyle, wxTextOutputStream& stream );
void EndCharacterFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, const wxRichTextAttr& paraStyle, wxTextOutputStream& stream );
/// Output paragraph formatting
void BeginParagraphFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, wxTextOutputStream& stream);
void EndParagraphFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, wxTextOutputStream& stream);
/// Output font tag
void OutputFont(const wxRichTextAttr& style, wxTextOutputStream& stream);
/// Closes lists to level (-1 means close all)
void CloseLists(int level, wxTextOutputStream& str);
/// Writes an image to its base64 equivalent, or to the memory filesystem, or to a file
void WriteImage(wxRichTextImage* image, wxOutputStream& stream);
/// Converts from pt to size property compatible height
long PtToSize(long size);
/// Typical base64 encoder
wxChar* b64enc(unsigned char* input, size_t in_len);
/// Gets the mime type of the given wxBITMAP_TYPE
const wxChar* GetMimeType(int imageType);
/// Gets the html equivalent of the specified value
wxString GetAlignment(const wxRichTextAttr& thisStyle);
/// Generates &nbsp; array for indentations
wxString SymbolicIndent(long indent);
/// Finds the html equivalent of the specified bullet
int TypeOfList(const wxRichTextAttr& thisStyle, wxString& tag);
#endif
// Data members
wxRichTextBuffer* m_buffer;
/// Indentation values of the table tags
wxArrayInt m_indents;
/// Stack of list types: 0 = ol, 1 = ul
wxArrayInt m_listTypes;
/// Is there any opened font tag?
bool m_font;
/// Are we in a table?
bool m_inTable;
/// A list of the image files or in-memory images created by the last operation.
wxArrayString m_imageLocations;
/// A location for the temporary files
wxString m_tempDir;
/// A mapping from point size to HTML font size
wxArrayInt m_fontSizeMapping;
/// A counter for generating filenames
static int sm_fileCounter;
};
#endif
// _WX_RICHTEXTXML_H_

View File

@@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextimagedlg.h
// Purpose: A dialog for editing image properties.
// Author: Mingquan Yang
// Modified by: Julian Smart
// Created: Wed 02 Jun 2010 11:27:23 CST
// Copyright: (c) Mingquan Yang, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/dialog.h"
#ifndef _RICHTEXTIMAGEDLG_H_
#define _RICHTEXTIMAGEDLG_H_
/*!
* Forward declarations
*/
class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxComboBox;
class WXDLLIMPEXP_FWD_CORE wxCheckBox;
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
/*!
* Includes
*/
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextformatdlg.h"
/*!
* Control identifiers
*/
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE wxGetTranslation("Object Properties")
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME ID_RICHTEXTOBJECTPROPERTIESDIALOG
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION wxDefaultPosition
/*!
* wxRichTextObjectPropertiesDialog class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextObjectPropertiesDialog: public wxRichTextFormattingDialog
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextObjectPropertiesDialog);
wxDECLARE_EVENT_TABLE();
public:
/// Constructors
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( 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
~wxRichTextObjectPropertiesDialog();
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
////@begin wxRichTextObjectPropertiesDialog event handler declarations
////@end wxRichTextObjectPropertiesDialog event handler declarations
////@begin wxRichTextObjectPropertiesDialog member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextObjectPropertiesDialog member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextObjectPropertiesDialog member variables
/// Control identifiers
enum {
ID_RICHTEXTOBJECTPROPERTIESDIALOG = 10650
};
////@end wxRichTextObjectPropertiesDialog member variables
};
#endif
// _RICHTEXTIMAGEDLG_H_

View File

@@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextindentspage.h
// Purpose: Declares the rich text formatting dialog indent page.
// Author: Julian Smart
// Created: 10/3/2006 2:28:21 PM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTINDENTSPAGE_H_
#define _RICHTEXTINDENTSPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/statline.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxRichTextCtrl;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_IDNAME ID_RICHTEXTINDENTSSPACINGPAGE
#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextIndentsSpacingPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxRichTextDialogPage
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextIndentsSpacingPage);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextIndentsSpacingPage( );
wxRichTextIndentsSpacingPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE );
/// Initialise members
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Updates the paragraph preview
void UpdatePreview();
/// Gets the attributes associated with the main formatting dialog
wxRichTextAttr* GetAttributes();
////@begin wxRichTextIndentsSpacingPage event handler declarations
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT
void OnAlignmentLeftSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT
void OnAlignmentRightSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED
void OnAlignmentJustifiedSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED
void OnAlignmentCentredSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE
void OnAlignmentIndeterminateSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT
void OnIndentLeftUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST
void OnIndentLeftFirstUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT
void OnIndentRightUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL
void OnRichtextOutlinelevelSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE
void OnSpacingBeforeUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER
void OnSpacingAfterUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE
void OnSpacingLineSelected( wxCommandEvent& event );
////@end wxRichTextIndentsSpacingPage event handler declarations
////@begin wxRichTextIndentsSpacingPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextIndentsSpacingPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextIndentsSpacingPage member variables
wxRadioButton* m_alignmentLeft;
wxRadioButton* m_alignmentRight;
wxRadioButton* m_alignmentJustified;
wxRadioButton* m_alignmentCentred;
wxRadioButton* m_alignmentIndeterminate;
wxTextCtrl* m_indentLeft;
wxTextCtrl* m_indentLeftFirst;
wxTextCtrl* m_indentRight;
wxComboBox* m_outlineLevelCtrl;
wxTextCtrl* m_spacingBefore;
wxTextCtrl* m_spacingAfter;
wxComboBox* m_spacingLine;
wxCheckBox* m_pageBreakCtrl;
wxRichTextCtrl* m_previewCtrl;
/// Control identifiers
enum {
ID_RICHTEXTINDENTSSPACINGPAGE = 10100,
ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT = 10102,
ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT = 10110,
ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED = 10111,
ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED = 10112,
ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE = 10101,
ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT = 10103,
ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST = 10104,
ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT = 10113,
ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL = 10105,
ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE = 10114,
ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER = 10116,
ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE = 10115,
ID_RICHTEXTINDENTSSPACINGPAGE_PAGEBREAK = 10106,
ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL = 10109
};
////@end wxRichTextIndentsSpacingPage member variables
bool m_dontUpdate;
};
#endif
// _RICHTEXTINDENTSPAGE_H_

View File

@@ -0,0 +1,277 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextliststylepage.h
// Purpose: Declares the rich text formatting dialog list style page.
// Author: Julian Smart
// Created: 10/18/2006 11:36:37 AM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTLISTSTYLEPAGE_H_
#define _RICHTEXTLISTSTYLEPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
#include "wx/spinctrl.h"
#include "wx/notebook.h"
#include "wx/statline.h"
////@end includes
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextListStylePage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxRichTextDialogPage
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextListStylePage);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextListStylePage( );
wxRichTextListStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Updates the bullets preview
void UpdatePreview();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Get attributes for selected level
wxRichTextAttr* GetAttributesForSelection();
/// Update for symbol-related controls
void OnSymbolUpdate( wxUpdateUIEvent& event );
/// Update for number-related controls
void OnNumberUpdate( wxUpdateUIEvent& event );
/// Update for standard bullet-related controls
void OnStandardBulletUpdate( wxUpdateUIEvent& event );
/// Just transfer to the window
void DoTransferDataToWindow();
/// Transfer from the window and preview
void TransferAndPreview();
////@begin wxRichTextListStylePage event handler declarations
/// wxEVT_SPINCTRL event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUpdated( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUp( wxSpinEvent& event );
/// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelDown( wxSpinEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelTextUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
void OnChooseFontClick( wxCommandEvent& event );
/// wxEVT_LISTBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
void OnStylelistboxSelected( wxCommandEvent& event );
/// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
void OnPeriodctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
void OnPeriodctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
void OnParenthesesctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
void OnParenthesesctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
void OnRightParenthesisCtrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
void OnBulletAlignmentCtrlSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
void OnSymbolstaticUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
void OnSymbolctrlSelected( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
void OnSymbolctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
void OnSymbolctrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
void OnChooseSymbolClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
void OnChooseSymbolUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlSelected( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
void OnNamestaticUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
void OnNamectrlSelected( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
void OnNamectrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
void OnNamectrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event );
/// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event );
/// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event );
/// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event );
/// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
void OnIndentLeftUpdated( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
void OnIndentFirstLineUpdated( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
void OnIndentRightUpdated( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
void OnSpacingBeforeUpdated( wxCommandEvent& event );
/// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
void OnSpacingAfterUpdated( wxCommandEvent& event );
/// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
void OnLineSpacingSelected( wxCommandEvent& event );
////@end wxRichTextListStylePage event handler declarations
////@begin wxRichTextListStylePage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextListStylePage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextListStylePage member variables
wxSpinCtrl* m_levelCtrl;
wxListBox* m_styleListBox;
wxCheckBox* m_periodCtrl;
wxCheckBox* m_parenthesesCtrl;
wxCheckBox* m_rightParenthesisCtrl;
wxComboBox* m_bulletAlignmentCtrl;
wxComboBox* m_symbolCtrl;
wxComboBox* m_symbolFontCtrl;
wxComboBox* m_bulletNameCtrl;
wxRadioButton* m_alignmentLeft;
wxRadioButton* m_alignmentRight;
wxRadioButton* m_alignmentJustified;
wxRadioButton* m_alignmentCentred;
wxRadioButton* m_alignmentIndeterminate;
wxTextCtrl* m_indentLeft;
wxTextCtrl* m_indentLeftFirst;
wxTextCtrl* m_indentRight;
wxTextCtrl* m_spacingBefore;
wxTextCtrl* m_spacingAfter;
wxComboBox* m_spacingLine;
wxRichTextCtrl* m_previewCtrl;
/// Control identifiers
enum {
ID_RICHTEXTLISTSTYLEPAGE = 10616,
ID_RICHTEXTLISTSTYLEPAGE_LEVEL = 10617,
ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT = 10604,
ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK = 10618,
ID_RICHTEXTLISTSTYLEPAGE_BULLETS = 10619,
ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX = 10620,
ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627,
ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626,
ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL = 10602,
ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL = 10603,
ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC = 10621,
ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL = 10622,
ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL = 10623,
ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625,
ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC = 10600,
ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL = 10601,
ID_RICHTEXTLISTSTYLEPAGE_SPACING = 10628,
ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT = 10629,
ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT = 10630,
ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED = 10631,
ID_RICHTEXTLISTSTYLEPAGE_CENTERED = 10632,
ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE = 10633,
ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT = 10634,
ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE = 10635,
ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT = 10636,
ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE = 10637,
ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER = 10638,
ID_RICHTEXTLISTSTYLEPAGE_LINESPACING = 10639,
ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL = 10640
};
////@end wxRichTextListStylePage member variables
bool m_dontUpdate;
int m_currentLevel;
};
#endif
// _RICHTEXTLISTSTYLEPAGE_H_

View File

@@ -0,0 +1,176 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextmarginspage.h
// Purpose: Declares the rich text formatting dialog margins page.
// Author: Julian Smart
// Created: 20/10/2010 10:27:34
// Copyright: (c) Julian Smart
// Licence: wxWindows 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
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextMarginsPage);
wxDECLARE_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() override;
virtual bool TransferDataFromWindow() override;
////@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

@@ -0,0 +1,251 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextprint.h
// Purpose: Rich text printing classes
// Author: Julian Smart
// Created: 2006-10-23
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTPRINT_H_
#define _WX_RICHTEXTPRINT_H_
#include "wx/defs.h"
#if wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE
#include "wx/richtext/richtextbuffer.h"
#include "wx/print.h"
#include "wx/printdlg.h"
#define wxRICHTEXT_PRINT_MAX_PAGES 99999
// Header/footer page identifiers
enum wxRichTextOddEvenPage {
wxRICHTEXT_PAGE_ODD,
wxRICHTEXT_PAGE_EVEN,
wxRICHTEXT_PAGE_ALL
};
// Header/footer text locations
enum wxRichTextPageLocation {
wxRICHTEXT_PAGE_LEFT,
wxRICHTEXT_PAGE_CENTRE,
wxRICHTEXT_PAGE_RIGHT
};
/*!
* Header/footer data
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextHeaderFooterData: public wxObject
{
public:
wxRichTextHeaderFooterData() { Init(); }
wxRichTextHeaderFooterData(const wxRichTextHeaderFooterData& data): wxObject() { Copy(data); }
/// Initialise
void Init() { m_headerMargin = 20; m_footerMargin = 20; m_showOnFirstPage = true; }
/// Copy
void Copy(const wxRichTextHeaderFooterData& data);
/// Assignment
void operator= (const wxRichTextHeaderFooterData& data) { Copy(data); }
/// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
/// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
/// Set/get text
void SetText(const wxString& text, int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location);
wxString GetText(int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location) const;
/// Set/get margins between text and header or footer, in tenths of a millimeter
void SetMargins(int headerMargin, int footerMargin) { m_headerMargin = headerMargin; m_footerMargin = footerMargin; }
int GetHeaderMargin() const { return m_headerMargin; }
int GetFooterMargin() const { return m_footerMargin; }
/// Set/get whether to show header or footer on first page
void SetShowOnFirstPage(bool showOnFirstPage) { m_showOnFirstPage = showOnFirstPage; }
bool GetShowOnFirstPage() const { return m_showOnFirstPage; }
/// Clear all text
void Clear();
/// Set/get font
void SetFont(const wxFont& font) { m_font = font; }
const wxFont& GetFont() const { return m_font; }
/// Set/get colour
void SetTextColour(const wxColour& col) { m_colour = col; }
const wxColour& GetTextColour() const { return m_colour; }
wxDECLARE_CLASS(wxRichTextHeaderFooterData);
private:
// Strings for left, centre, right, top, bottom, odd, even
wxString m_text[12];
wxFont m_font;
wxColour m_colour;
int m_headerMargin;
int m_footerMargin;
bool m_showOnFirstPage;
};
/*!
* wxRichTextPrintout
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextPrintout : public wxPrintout
{
public:
wxRichTextPrintout(const wxString& title = wxGetTranslation("Printout"));
virtual ~wxRichTextPrintout();
/// The buffer to print
void SetRichTextBuffer(wxRichTextBuffer* buffer) { m_richTextBuffer = buffer; }
wxRichTextBuffer* GetRichTextBuffer() const { return m_richTextBuffer; }
/// Set/get header/footer data
void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; }
const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; }
/// Sets margins in 10ths of millimetre. Defaults to 1 inch for margins.
void SetMargins(int top = 254, int bottom = 254, int left = 254, int right = 254);
/// Calculate scaling and rectangles, setting the device context scaling
void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& headerRect, wxRect& footerRect);
// wxPrintout virtual functions
virtual bool OnPrintPage(int page) override;
virtual bool HasPage(int page) override;
virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override;
virtual bool OnBeginDocument(int startPage, int endPage) override;
virtual void OnPreparePrinting() override;
private:
/// Renders one page into dc
void RenderPage(wxDC *dc, int page);
/// Substitute keywords
static bool SubstituteKeywords(wxString& str, const wxString& title, int pageNum, int pageCount);
private:
wxRichTextBuffer* m_richTextBuffer;
int m_numPages;
wxArrayInt m_pageBreaksStart;
wxArrayInt m_pageBreaksEnd;
wxArrayInt m_pageYOffsets;
int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom;
wxRichTextHeaderFooterData m_headerFooterData;
wxDECLARE_NO_COPY_CLASS(wxRichTextPrintout);
};
/*
*! wxRichTextPrinting
* A simple interface to perform wxRichTextBuffer printing.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextPrinting : public wxObject
{
public:
wxRichTextPrinting(const wxString& name = wxGetTranslation("Printing"), wxWindow *parentWindow = nullptr);
virtual ~wxRichTextPrinting();
/// Preview the file or buffer
#if wxUSE_FFILE && wxUSE_STREAMS
bool PreviewFile(const wxString& richTextFile);
#endif
bool PreviewBuffer(const wxRichTextBuffer& buffer);
/// Print the file or buffer
#if wxUSE_FFILE && wxUSE_STREAMS
bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
#endif
bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
/// Shows page setup dialog
void PageSetup();
/// Set/get header/footer data
void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; }
const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; }
/// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
/// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT
void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
/// Show header/footer on first page, or not
void SetShowOnFirstPage(bool show) { m_headerFooterData.SetShowOnFirstPage(show); }
/// Set the font
void SetHeaderFooterFont(const wxFont& font) { m_headerFooterData.SetFont(font); }
/// Set the colour
void SetHeaderFooterTextColour(const wxColour& font) { m_headerFooterData.SetTextColour(font); }
/// Get print and page setup data
wxPrintData *GetPrintData();
wxPageSetupDialogData *GetPageSetupData() { return m_pageSetupData; }
/// Set print and page setup data
void SetPrintData(const wxPrintData& printData);
void SetPageSetupData(const wxPageSetupDialogData& pageSetupData);
/// Set the rich text buffer pointer, deleting the existing object if present
void SetRichTextBufferPreview(wxRichTextBuffer* buf);
wxRichTextBuffer* GetRichTextBufferPreview() const { return m_richTextBufferPreview; }
void SetRichTextBufferPrinting(wxRichTextBuffer* buf);
wxRichTextBuffer* GetRichTextBufferPrinting() const { return m_richTextBufferPrinting; }
/// Set/get the parent window
void SetParentWindow(wxWindow* parent) { m_parentWindow = parent; }
wxWindow* GetParentWindow() const { return m_parentWindow; }
/// Set/get the title
void SetTitle(const wxString& title) { m_title = title; }
const wxString& GetTitle() const { return m_title; }
/// Set/get the preview rect
void SetPreviewRect(const wxRect& rect) { m_previewRect = rect; }
const wxRect& GetPreviewRect() const { return m_previewRect; }
protected:
virtual wxRichTextPrintout *CreatePrintout();
virtual bool DoPreview(wxRichTextPrintout *printout1, wxRichTextPrintout *printout2);
virtual bool DoPrint(wxRichTextPrintout *printout, bool showPrintDialog);
private:
wxPrintData* m_printData;
wxPageSetupDialogData* m_pageSetupData;
wxRichTextHeaderFooterData m_headerFooterData;
wxString m_title;
wxWindow* m_parentWindow;
wxRichTextBuffer* m_richTextBufferPreview;
wxRichTextBuffer* m_richTextBufferPrinting;
wxRect m_previewRect;
wxDECLARE_NO_COPY_CLASS(wxRichTextPrinting);
};
#endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE
#endif // _WX_RICHTEXTPRINT_H_

View File

@@ -0,0 +1,303 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextsizepage.h
// Purpose: Declares the rich text formatting dialog size page.
// Author: Julian Smart
// Created: 20/10/2010 10:23:24
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSIZEPAGE_H_
#define _RICHTEXTSIZEPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
#include "wx/sizer.h"
////@begin includes
#include "wx/statline.h"
#include "wx/valgen.h"
////@end includes
#include "wx/stattext.h"
/*!
* 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
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextSizePage);
wxDECLARE_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() override;
virtual bool TransferDataFromWindow() override;
/// Show/hide position controls
static void ShowPositionControls(bool show) { sm_showPositionControls = show; }
/// Show/hide minimum and maximum size controls
static void ShowMinMaxSizeControls(bool show) { sm_showMinMaxSizeControls = show; }
/// Show/hide position mode controls
static void ShowPositionModeControls(bool show) { sm_showPositionModeControls = show; }
/// Show/hide right/bottom position controls
static void ShowRightBottomPositionControls(bool show) { sm_showRightBottomPositionControls = show; }
/// Show/hide floating and alignment controls
static void ShowFloatingAndAlignmentControls(bool show) { sm_showFloatingAndAlignmentControls = show; }
/// Show/hide floating controls
static void ShowFloatingControls(bool show) { sm_showFloatingControls = show; }
/// Show/hide alignment controls
static void ShowAlignmentControls(bool show) { sm_showAlignmentControls = show; }
/// Enable the position and size units
static void EnablePositionAndSizeUnits(bool enable) { sm_enablePositionAndSizeUnits = enable; }
/// Enable the checkboxes for position and size
static void EnablePositionAndSizeCheckboxes(bool enable) { sm_enablePositionAndSizeCheckboxes = enable; }
/// Enable the move object controls
static void ShowMoveObjectControls(bool enable) { sm_showMoveObjectControls = enable; }
////@begin wxRichTextSizePage event handler declarations
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX
void OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH
void OnRichtextWidthUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_UNITS_W
void OnRichtextWidthUnitsUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT
void OnRichtextHeightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_UNITS_H
void OnRichtextHeightUnitsUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH
void OnRichtextMinWidthUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT
void OnRichtextMinHeightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH
void OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT
void OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT
void OnRichtextLeftUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS
void OnRichtextLeftUnitsUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP
void OnRichtextTopUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_UNITS
void OnRichtextTopUnitsUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT
void OnRichtextRightUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_UNITS
void OnRichtextRightUnitsUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM
void OnRichtextBottomUpdate( wxUpdateUIEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_UNITS
void OnRichtextBottomUnitsUpdate( 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
int GetPositionMode() const { return m_positionMode ; }
void SetPositionMode(int value) { m_positionMode = value ; }
/// 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_floatingAlignmentSizer;
wxBoxSizer* m_floatingSizer;
wxChoice* m_float;
wxBoxSizer* m_alignmentSizer;
wxCheckBox* m_verticalAlignmentCheckbox;
wxChoice* m_verticalAlignmentComboBox;
wxFlexGridSizer* m_sizeSizer;
wxBoxSizer* m_widthSizer;
wxCheckBox* m_widthCheckbox;
wxStaticText* m_widthLabel;
wxTextCtrl* m_width;
wxComboBox* m_unitsW;
wxBoxSizer* m_heightSizer;
wxCheckBox* m_heightCheckbox;
wxStaticText* m_heightLabel;
wxTextCtrl* m_height;
wxComboBox* m_unitsH;
wxCheckBox* m_minWidthCheckbox;
wxBoxSizer* m_minWidthSizer;
wxTextCtrl* m_minWidth;
wxComboBox* m_unitsMinW;
wxCheckBox* m_minHeightCheckbox;
wxBoxSizer* m_minHeightSizer;
wxTextCtrl* m_minHeight;
wxComboBox* m_unitsMinH;
wxCheckBox* m_maxWidthCheckbox;
wxBoxSizer* m_maxWidthSizer;
wxTextCtrl* m_maxWidth;
wxComboBox* m_unitsMaxW;
wxCheckBox* m_maxHeightCheckbox;
wxBoxSizer* m_maxHeightSizer;
wxTextCtrl* m_maxHeight;
wxComboBox* m_unitsMaxH;
wxBoxSizer* m_positionControls;
wxBoxSizer* m_moveObjectParentSizer;
wxBoxSizer* m_positionModeSizer;
wxChoice* m_positionModeCtrl;
wxFlexGridSizer* m_positionGridSizer;
wxBoxSizer* m_leftSizer;
wxCheckBox* m_positionLeftCheckbox;
wxStaticText* m_leftLabel;
wxTextCtrl* m_left;
wxComboBox* m_unitsLeft;
wxBoxSizer* m_topSizer;
wxCheckBox* m_positionTopCheckbox;
wxStaticText* m_topLabel;
wxTextCtrl* m_top;
wxComboBox* m_unitsTop;
wxBoxSizer* m_rightSizer;
wxCheckBox* m_positionRightCheckbox;
wxStaticText* m_rightLabel;
wxBoxSizer* m_rightPositionSizer;
wxTextCtrl* m_right;
wxComboBox* m_unitsRight;
wxBoxSizer* m_bottomSizer;
wxCheckBox* m_positionBottomCheckbox;
wxStaticText* m_bottomLabel;
wxBoxSizer* m_bottomPositionSizer;
wxTextCtrl* m_bottom;
wxComboBox* m_unitsBottom;
wxBoxSizer* m_moveObjectSizer;
int m_positionMode;
/// Control identifiers
enum {
ID_WXRICHTEXTSIZEPAGE = 10700,
ID_RICHTEXT_FLOATING_MODE = 10701,
ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX = 10708,
ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX = 10709,
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_MIN_WIDTH_CHECKBOX = 10715,
ID_RICHTEXT_MIN_WIDTH = 10716,
ID_RICHTEXT_UNITS_MIN_W = 10717,
ID_RICHTEXT_MIN_HEIGHT_CHECKBOX = 10718,
ID_RICHTEXT_MIN_HEIGHT = 10719,
ID_RICHTEXT_UNITS_MIN_H = 10720,
ID_RICHTEXT_MAX_WIDTH_CHECKBOX = 10721,
ID_RICHTEXT_MAX_WIDTH = 10722,
ID_RICHTEXT_UNITS_MAX_W = 10723,
ID_RICHTEXT_MAX_HEIGHT_CHECKBOX = 10724,
ID_RICHTEXT_MAX_HEIGHT = 10725,
ID_RICHTEXT_UNITS_MAX_H = 10726,
ID_RICHTEXT_POSITION_MODE = 10735,
ID_RICHTEXT_LEFT_CHECKBOX = 10710,
ID_RICHTEXT_LEFT = 10711,
ID_RICHTEXT_LEFT_UNITS = 10712,
ID_RICHTEXT_TOP_CHECKBOX = 10710,
ID_RICHTEXT_TOP = 10728,
ID_RICHTEXT_TOP_UNITS = 10729,
ID_RICHTEXT_RIGHT_CHECKBOX = 10727,
ID_RICHTEXT_RIGHT = 10730,
ID_RICHTEXT_RIGHT_UNITS = 10731,
ID_RICHTEXT_BOTTOM_CHECKBOX = 10732,
ID_RICHTEXT_BOTTOM = 10733,
ID_RICHTEXT_BOTTOM_UNITS = 10734,
ID_RICHTEXT_PARA_UP = 10713,
ID_RICHTEXT_PARA_DOWN = 10714
};
////@end wxRichTextSizePage member variables
static bool sm_showFloatingControls;
static bool sm_showPositionControls;
static bool sm_showMinMaxSizeControls;
static bool sm_showPositionModeControls;
static bool sm_showRightBottomPositionControls;
static bool sm_showAlignmentControls;
static bool sm_showFloatingAndAlignmentControls;
static bool sm_enablePositionAndSizeUnits;
static bool sm_enablePositionAndSizeCheckboxes;
static bool sm_showMoveObjectControls;
};
#endif
// _RICHTEXTSIZEPAGE_H_

View File

@@ -0,0 +1,256 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextstyledlg.h
// Purpose: Declares the rich text style editor dialog.
// Author: Julian Smart
// Created: 10/5/2006 12:05:31 PM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSTYLEDLG_H_
#define _RICHTEXTSTYLEDLG_H_
/*!
* Includes
*/
#include "wx/dialog.h"
#include "wx/richtext/richtextuicustomization.h"
////@begin includes
////@end includes
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextstyles.h"
#include "wx/richtext/richtextctrl.h"
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
class wxRichTextStyleListCtrl;
class wxRichTextCtrl;
class wxStdDialogButtonSizer;
////@end forward declarations
class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxCheckBox;
/*!
* Control identifiers
*/
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE wxGetTranslation(wxASCII_STR("Style Organiser"))
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition
/*!
* Flags for specifying permitted operations
*/
#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
// The permitted style types to show
#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
#define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
// Common combinations
#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES)
#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
/*!
* wxRichTextStyleOrganiserDialog class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextStyleOrganiserDialog);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextStyleOrganiserDialog( );
wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
/// Creation
bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
/// Creates the controls and sizers
void CreateControls();
/// Initialise member variables
void Init();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Set/get style sheet
void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
/// Set/get control
void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
/// Set/get flags
void SetFlags(int flags) { m_flags = flags; }
int GetFlags() const { return m_flags; }
/// Show preview for given or selected preview
void ShowPreview(int sel = -1);
/// Clears the preview
void ClearPreview();
/// List selection
void OnListSelection(wxCommandEvent& event);
/// Get/set restart numbering boolean
bool GetRestartNumbering() const { return m_restartNumbering; }
void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
/// Get selected style name or definition
wxString GetSelectedStyle() const;
wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
/// Apply the style
bool ApplyStyle(wxRichTextCtrl* ctrl = nullptr);
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
////@begin wxRichTextStyleOrganiserDialog event handler declarations
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
void OnNewCharClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
void OnNewCharUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
void OnNewParaClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
void OnNewParaUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
void OnNewListClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
void OnNewListUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
void OnNewBoxClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
void OnNewBoxUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
void OnRenameClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
void OnRenameUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
void OnEditClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
void OnEditUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
void OnDeleteClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
void OnDeleteUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for wxID_HELP
void OnHelpClick( wxCommandEvent& event );
////@end wxRichTextStyleOrganiserDialog event handler declarations
////@begin wxRichTextStyleOrganiserDialog member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextStyleOrganiserDialog member function declarations
////@begin wxRichTextStyleOrganiserDialog member variables
wxBoxSizer* m_innerSizer;
wxBoxSizer* m_buttonSizerParent;
wxRichTextStyleListCtrl* m_stylesListBox;
wxRichTextCtrl* m_previewCtrl;
wxBoxSizer* m_buttonSizer;
wxButton* m_newCharacter;
wxButton* m_newParagraph;
wxButton* m_newList;
wxButton* m_newBox;
wxButton* m_applyStyle;
wxButton* m_renameStyle;
wxButton* m_editStyle;
wxButton* m_deleteStyle;
wxButton* m_closeButton;
wxBoxSizer* m_bottomButtonSizer;
wxCheckBox* m_restartNumberingCtrl;
wxStdDialogButtonSizer* m_stdButtonSizer;
wxButton* m_okButton;
wxButton* m_cancelButton;
/// Control identifiers
enum {
ID_RICHTEXTSTYLEORGANISERDIALOG = 10500,
ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501,
ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510,
ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512,
ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503,
ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502,
ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506,
ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507,
ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511
};
////@end wxRichTextStyleOrganiserDialog member variables
private:
wxRichTextCtrl* m_richTextCtrl;
wxRichTextStyleSheet* m_richTextStyleSheet;
bool m_dontUpdate;
int m_flags;
static bool sm_showToolTips;
bool m_restartNumbering;
};
#endif
// _RICHTEXTSTYLEDLG_H_

View File

@@ -0,0 +1,98 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextstylepage.h
// Purpose: Declares the rich text formatting dialog style page.
// Author: Julian Smart
// Created: 10/5/2006 11:34:55 AM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#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 wxEmptyString
#define SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME ID_RICHTEXTSTYLEPAGE
#define SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextStylePage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStylePage: public wxRichTextDialogPage
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextStylePage);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextStylePage( );
wxRichTextStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE );
/// Initialise members
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Gets the attributes associated with the main formatting dialog
wxRichTextAttr* GetAttributes();
/// Determines whether the style name can be edited
bool GetNameIsEditable() const { return m_nameIsEditable; }
void SetNameIsEditable(bool editable) { m_nameIsEditable = editable; }
////@begin wxRichTextStylePage event handler declarations
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEPAGE_NEXT_STYLE
void OnNextStyleUpdate( wxUpdateUIEvent& event );
////@end wxRichTextStylePage event handler declarations
////@begin wxRichTextStylePage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextStylePage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextStylePage member variables
wxTextCtrl* m_styleName;
wxComboBox* m_basedOn;
wxComboBox* m_nextStyle;
/// Control identifiers
enum {
ID_RICHTEXTSTYLEPAGE = 10403,
ID_RICHTEXTSTYLEPAGE_STYLE_NAME = 10404,
ID_RICHTEXTSTYLEPAGE_BASED_ON = 10405,
ID_RICHTEXTSTYLEPAGE_NEXT_STYLE = 10406
};
////@end wxRichTextStylePage member variables
bool m_nameIsEditable;
};
#endif
// _RICHTEXTSTYLEPAGE_H_

View File

@@ -0,0 +1,756 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextstyles.h
// Purpose: Style management for wxRichTextCtrl
// Author: Julian Smart
// Created: 2005-09-30
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTSTYLES_H_
#define _WX_RICHTEXTSTYLES_H_
/*!
* Includes
*/
#include "wx/defs.h"
#if wxUSE_RICHTEXT
#include "wx/richtext/richtextbuffer.h"
#if wxUSE_HTML
#include "wx/htmllbox.h"
#endif
#if wxUSE_COMBOCTRL
#include "wx/combo.h"
#endif
#include "wx/choice.h"
/*!
* Forward declarations
*/
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer;
/*!
* wxRichTextStyleDefinition class declaration
* A base class for paragraph and character styles.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject
{
wxDECLARE_CLASS(wxRichTextStyleDefinition);
public:
/// Copy constructors
wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def)
: wxObject()
{
Init();
Copy(def);
}
/// Default constructor
wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; }
/// Destructor
virtual ~wxRichTextStyleDefinition() = default;
/// Initialises members
void Init() {}
/// Copies from def
void Copy(const wxRichTextStyleDefinition& def);
/// Equality test
bool Eq(const wxRichTextStyleDefinition& def) const;
/// Assignment operator
void operator =(const wxRichTextStyleDefinition& def) { Copy(def); }
/// Equality operator
bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); }
/// Override to clone the object
wxNODISCARD virtual wxRichTextStyleDefinition* Clone() const = 0;
/// Sets and gets the name of the style
void SetName(const wxString& name) { m_name = name; }
const wxString& GetName() const { return m_name; }
/// Sets and gets the style description
void SetDescription(const wxString& descr) { m_description = descr; }
const wxString& GetDescription() const { return m_description; }
/// Sets and gets the name of the style that this style is based on
void SetBaseStyle(const wxString& name) { m_baseStyle = name; }
const wxString& GetBaseStyle() const { return m_baseStyle; }
/// Sets and gets the style
void SetStyle(const wxRichTextAttr& style) { m_style = style; }
const wxRichTextAttr& GetStyle() const { return m_style; }
wxRichTextAttr& GetStyle() { return m_style; }
/// Gets the style combined with the base style
virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
/**
Returns the definition's properties.
*/
wxRichTextProperties& GetProperties() { return m_properties; }
/**
Returns the definition's properties.
*/
const wxRichTextProperties& GetProperties() const { return m_properties; }
/**
Sets the definition's properties.
*/
void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
protected:
wxString m_name;
wxString m_baseStyle;
wxString m_description;
wxRichTextAttr m_style;
wxRichTextProperties m_properties;
};
/*!
* wxRichTextCharacterStyleDefinition class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition);
public:
/// Default constructor
wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString):
wxRichTextStyleDefinition(name) {}
/// Destructor
virtual ~wxRichTextCharacterStyleDefinition() = default;
/// Clones the object
wxNODISCARD virtual wxRichTextStyleDefinition* Clone() const override { return new wxRichTextCharacterStyleDefinition(*this); }
protected:
};
/*!
* wxRichTextParagraphStyleDefinition class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition);
public:
/// Copy constructor
wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; }
/// Default constructor
wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString):
wxRichTextStyleDefinition(name) {}
// Destructor
virtual ~wxRichTextParagraphStyleDefinition() = default;
/// Sets and gets the next style
void SetNextStyle(const wxString& name) { m_nextStyle = name; }
const wxString& GetNextStyle() const { return m_nextStyle; }
/// Copies from def
void Copy(const wxRichTextParagraphStyleDefinition& def);
/// Assignment operator
void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); }
/// Equality operator
bool operator ==(const wxRichTextParagraphStyleDefinition& def) const;
/// Clones the object
wxNODISCARD virtual wxRichTextStyleDefinition* Clone() const override { return new wxRichTextParagraphStyleDefinition(*this); }
protected:
/// The next style to use when adding a paragraph after this style.
wxString m_nextStyle;
};
/*!
* wxRichTextListStyleDefinition class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition);
public:
/// Copy constructor
wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); }
/// Default constructor
wxRichTextListStyleDefinition(const wxString& name = wxEmptyString):
wxRichTextParagraphStyleDefinition(name) { Init(); }
/// Destructor
virtual ~wxRichTextListStyleDefinition() = default;
/// Copies from def
void Copy(const wxRichTextListStyleDefinition& def);
/// Assignment operator
void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); }
/// Equality operator
bool operator ==(const wxRichTextListStyleDefinition& def) const;
/// Clones the object
wxNODISCARD virtual wxRichTextStyleDefinition* Clone() const override { return new wxRichTextListStyleDefinition(*this); }
/// Sets/gets the attributes for the given level
void SetLevelAttributes(int i, const wxRichTextAttr& attr);
wxRichTextAttr* GetLevelAttributes(int i);
const wxRichTextAttr* GetLevelAttributes(int i) const;
/// Convenience function for setting the major attributes for a list level specification
void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
/// Finds the level corresponding to the given indentation
int FindLevelForIndent(int indent) const;
/// Combine the base and list style with a paragraph style, using the given indent (from which
/// an appropriate level is found)
wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = nullptr);
/// Combine the base and list style, using the given indent (from which
/// an appropriate level is found)
wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = nullptr);
/// Combine the base and list style, using the given level from which
/// an appropriate level is found)
wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = nullptr);
/// Gets the number of available levels
int GetLevelCount() const { return 10; }
/// Is this a numbered list?
bool IsNumbered(int i) const;
protected:
/// The styles for each level (up to 10)
wxRichTextAttr m_levelStyles[10];
};
/*!
* wxRichTextBoxStyleDefinition class declaration, for box attributes in objects such as wxRichTextBox.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextBoxStyleDefinition: public wxRichTextStyleDefinition
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextBoxStyleDefinition);
public:
/// Copy constructor
wxRichTextBoxStyleDefinition(const wxRichTextBoxStyleDefinition& def): wxRichTextStyleDefinition(def) { Copy(def); }
/// Default constructor
wxRichTextBoxStyleDefinition(const wxString& name = wxEmptyString):
wxRichTextStyleDefinition(name) {}
// Destructor
virtual ~wxRichTextBoxStyleDefinition() = default;
/// 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
wxNODISCARD virtual wxRichTextStyleDefinition* Clone() const override { return new wxRichTextBoxStyleDefinition(*this); }
protected:
};
/*!
* The style sheet
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject
{
wxDECLARE_CLASS(wxRichTextStyleSheet);
public:
/// Constructors
wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)
: wxObject()
{
Init();
Copy(sheet);
}
wxRichTextStyleSheet() { Init(); }
virtual ~wxRichTextStyleSheet();
/// Initialisation
void Init();
/// Copy
void Copy(const wxRichTextStyleSheet& sheet);
/// Assignment
void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); }
/// Equality
bool operator==(const wxRichTextStyleSheet& sheet) const;
/// Add a definition to the character style list
bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def);
/// Add a definition to the paragraph style list
bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def);
/// 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);
/// Remove a character style
bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); }
/// Remove a paragraph style
bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); }
/// 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);
/// Find a character definition by name
wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); }
/// Find a paragraph definition by name
wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); }
/// 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;
/// Return the number of character styles
size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); }
/// Return the number of paragraph styles
size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); }
/// 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(); }
/// Return the nth paragraph style
wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); }
/// 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();
/// Insert into list of style sheets
bool InsertSheet(wxRichTextStyleSheet* before);
/// Append to list of style sheets
bool AppendSheet(wxRichTextStyleSheet* after);
/// Unlink from the list of style sheets
void Unlink();
/// Get/set next sheet
wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; }
void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; }
/// Get/set previous sheet
wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; }
void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; }
/// Sets and gets the name of the style sheet
void SetName(const wxString& name) { m_name = name; }
const wxString& GetName() const { return m_name; }
/// Sets and gets the style description
void SetDescription(const wxString& descr) { m_description = descr; }
const wxString& GetDescription() const { return m_description; }
/**
Returns the sheet's properties.
*/
wxRichTextProperties& GetProperties() { return m_properties; }
/**
Returns the sheet's properties.
*/
const wxRichTextProperties& GetProperties() const { return m_properties; }
/**
Sets the sheet's properties.
*/
void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
/// Implementation
/// Add a definition to one of the style lists
bool AddStyle(wxList& list, wxRichTextStyleDefinition* def);
/// Remove a style
bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle);
/// Find a definition by name
wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const;
protected:
wxString m_description;
wxString m_name;
wxList m_characterStyleDefinitions;
wxList m_paragraphStyleDefinitions;
wxList m_listStyleDefinitions;
wxList m_boxStyleDefinitions;
wxRichTextStyleSheet* m_previousSheet;
wxRichTextStyleSheet* m_nextSheet;
wxRichTextProperties m_properties;
};
#if wxUSE_HTML
/*!
* wxRichTextStyleListBox class declaration
* A listbox to display styles.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox
{
wxDECLARE_CLASS(wxRichTextStyleListBox);
wxDECLARE_EVENT_TABLE();
public:
/// Which type of style definition is currently showing?
enum wxRichTextStyleType
{
wxRICHTEXT_STYLE_ALL,
wxRICHTEXT_STYLE_PARAGRAPH,
wxRICHTEXT_STYLE_CHARACTER,
wxRICHTEXT_STYLE_LIST,
wxRICHTEXT_STYLE_BOX
};
wxRichTextStyleListBox()
{
Init();
}
wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
virtual ~wxRichTextStyleListBox();
void Init()
{
m_styleSheet = nullptr;
m_richTextCtrl = nullptr;
m_applyOnSelection = false;
m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
m_autoSetSelection = true;
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
/// Creates a suitable HTML fragment for a definition
wxString CreateHTML(wxRichTextStyleDefinition* def) const;
/// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; }
wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
/// Associates the control with a wxRichTextCtrl
void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
/// Get style for index
wxRichTextStyleDefinition* GetStyle(size_t i) const ;
/// Get index for style name
int GetIndexForStyle(const wxString& name) const ;
/// Set selection for string, returning the index.
int SetStyleSelection(const wxString& name);
/// Updates the list
void UpdateStyles();
/// Apply the style
void ApplyStyle(int i);
/// Left click
void OnLeftDown(wxMouseEvent& event);
/// Left double-click
void OnLeftDoubleClick(wxMouseEvent& event);
/// Auto-select from style under caret in idle time
void OnIdle(wxIdleEvent& event);
/// Convert units in tends of a millimetre to device units
int ConvertTenthsMMToPixels(wxReadOnlyDC& dc, int units) const;
/// Can we set the selection based on the editor caret position?
/// Need to override this if being used in a combobox popup
virtual bool CanAutoSetSelection() { return m_autoSetSelection; }
virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; }
/// Set whether the style should be applied as soon as the item is selected (the default)
void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
bool GetApplyOnSelection() const { return m_applyOnSelection; }
/// Set the style type to display
void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); }
wxRichTextStyleType GetStyleType() const { return m_styleType; }
/// Helper for listbox and combo control
static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType);
protected:
/// Returns the HTML for this item
virtual wxString OnGetItem(size_t n) const override;
private:
wxRichTextStyleSheet* m_styleSheet;
wxRichTextCtrl* m_richTextCtrl;
bool m_applyOnSelection; // if true, applies style on selection
wxRichTextStyleType m_styleType; // style type to display
bool m_autoSetSelection;
wxArrayString m_styleNames;
};
/*!
* wxRichTextStyleListCtrl class declaration
* This is a container for the list control plus a combobox to switch between
* style types.
*/
#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
{
wxDECLARE_CLASS(wxRichTextStyleListCtrl);
wxDECLARE_EVENT_TABLE();
public:
/// Constructors
wxRichTextStyleListCtrl()
{
Init();
}
wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
/// Constructors
virtual ~wxRichTextStyleListCtrl();
/// Member initialisation
void Init()
{
m_styleListBox = nullptr;
m_styleChoice = nullptr;
m_dontUpdate = false;
}
/// Creates the windows
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
/// Updates the style list box
void UpdateStyles();
/// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
wxRichTextStyleSheet* GetStyleSheet() const;
/// Associates the control with a wxRichTextCtrl
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
wxRichTextCtrl* GetRichTextCtrl() const;
/// Set/get the style type to display
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
/// Get the choice index for style type
int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType);
/// Get the style type for choice index
wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i);
/// Get the listbox
wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; }
/// Get the choice
wxChoice* GetStyleChoice() const { return m_styleChoice; }
/// React to style type choice
void OnChooseType(wxCommandEvent& event);
/// Lay out the controls
void OnSize(wxSizeEvent& event);
private:
wxRichTextStyleListBox* m_styleListBox;
wxChoice* m_styleChoice;
bool m_dontUpdate;
};
#if wxUSE_COMBOCTRL
/*!
* Style drop-down for a wxComboCtrl
*/
class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup
{
public:
virtual void Init() override
{
m_itemHere = -1; // hot item in list
m_value = -1;
}
virtual bool Create( wxWindow* parent ) override;
virtual wxWindow *GetControl() override { return this; }
virtual void SetStringValue( const wxString& s ) override;
virtual wxString GetStringValue() const override;
/// Can we set the selection based on the editor caret position?
// virtual bool CanAutoSetSelection() { return ((m_combo == nullptr) || !m_combo->IsPopupShown()); }
virtual bool CanAutoSetSelection() override { return false; }
//
// Popup event handlers
//
// Mouse hot-tracking
void OnMouseMove(wxMouseEvent& event);
// On mouse left, set the value and close the popup
void OnMouseClick(wxMouseEvent& WXUNUSED(event));
protected:
int m_itemHere; // hot item in popup
int m_value;
private:
wxDECLARE_EVENT_TABLE();
};
/*!
* wxRichTextStyleComboCtrl
* A combo for applying styles.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl
{
wxDECLARE_CLASS(wxRichTextStyleComboCtrl);
wxDECLARE_EVENT_TABLE();
public:
wxRichTextStyleComboCtrl()
{
Init();
}
wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxCB_READONLY)
{
Init();
Create(parent, id, pos, size, style);
}
virtual ~wxRichTextStyleComboCtrl() = default;
void Init()
{
m_stylePopup = nullptr;
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0);
/// Updates the list
void UpdateStyles() { m_stylePopup->UpdateStyles(); }
/// Associates the control with a style sheet
void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); }
wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); }
/// Associates the control with a wxRichTextCtrl
void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); }
wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); }
/// Gets the style popup
wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; }
/// Auto-select from style under caret in idle time
void OnIdle(wxIdleEvent& event);
protected:
wxRichTextStyleComboPopup* m_stylePopup;
};
#endif
// wxUSE_COMBOCTRL
#endif
// wxUSE_HTML
#endif
// wxUSE_RICHTEXT
#endif
// _WX_RICHTEXTSTYLES_H_

View File

@@ -0,0 +1,359 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextsymboldlg.h
// Purpose: Declares the symbol picker dialog.
// Author: Julian Smart
// Created: 10/5/2006 3:11:58 PM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSYMBOLDLG_H_
#define _RICHTEXTSYMBOLDLG_H_
/*!
* Includes
*/
#include "wx/richtext/richtextuicustomization.h"
#include "wx/dialog.h"
#include "wx/vscroll.h"
/*!
* Forward declarations
*/
class WXDLLIMPEXP_FWD_CORE wxStaticText;
class WXDLLIMPEXP_FWD_CORE wxComboBox;
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
////@begin forward declarations
class wxSymbolListCtrl;
class wxStdDialogButtonSizer;
////@end forward declarations
/*!
* Symbols
*/
#define SYMBOL_WXSYMBOLPICKERDIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX)
#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE wxGetTranslation("Symbols")
#define SYMBOL_WXSYMBOLPICKERDIALOG_IDNAME ID_SYMBOLPICKERDIALOG
#define SYMBOL_WXSYMBOLPICKERDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXSYMBOLPICKERDIALOG_POSITION wxDefaultPosition
/*!
* wxSymbolPickerDialog class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxSymbolPickerDialog: public wxDialog
{
wxDECLARE_DYNAMIC_CLASS(wxSymbolPickerDialog);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxSymbolPickerDialog( );
wxSymbolPickerDialog( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont,
wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE );
/// Creation
bool Create( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont,
wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE );
/// Initialises members variables
void Init();
/// Creates the controls and sizers
void CreateControls();
/// Update the display
void UpdateSymbolDisplay(bool updateSymbolList = true, bool showAtSubset = true);
/// Respond to symbol selection
void OnSymbolSelected( wxCommandEvent& event );
/// Set Unicode mode
void SetUnicodeMode(bool unicodeMode);
/// Show at the current subset selection
void ShowAtSubset();
/// Get the selected symbol character
int GetSymbolChar() const;
/// Is there a selection?
bool HasSelection() const { return !m_symbol.IsEmpty(); }
/// Specifying normal text?
bool UseNormalFont() const { return m_fontName.IsEmpty(); }
/// Should we show tooltips?
static bool ShowToolTips() { return sm_showToolTips; }
/// Determines whether tooltips will be shown
static void SetShowToolTips(bool show) { sm_showToolTips = show; }
/// Data transfer
virtual bool TransferDataToWindow() override;
////@begin wxSymbolPickerDialog event handler declarations
/// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FONT
void OnFontCtrlSelected( wxCommandEvent& event );
/// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_SUBSET
void OnSubsetSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_SYMBOLPICKERDIALOG_SUBSET
void OnSymbolpickerdialogSubsetUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FROM
void OnFromUnicodeSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for wxID_OK
void OnOkUpdate( wxUpdateUIEvent& event );
/// wxEVT_BUTTON event handler for wxID_HELP
void OnHelpClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for wxID_HELP
void OnHelpUpdate( wxUpdateUIEvent& event );
////@end wxSymbolPickerDialog event handler declarations
////@begin wxSymbolPickerDialog member function declarations
wxString GetFontName() const { return m_fontName ; }
void SetFontName(const wxString& value) { m_fontName = value; }
bool GetFromUnicode() const { return m_fromUnicode ; }
void SetFromUnicode(bool value) { m_fromUnicode = value ; }
wxString GetNormalTextFontName() const { return m_normalTextFontName ; }
void SetNormalTextFontName(const wxString& value) { m_normalTextFontName = value; }
wxString GetSymbol() const { return m_symbol ; }
void SetSymbol(const wxString& value) { m_symbol = value; }
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxSymbolPickerDialog member function declarations
////@begin wxSymbolPickerDialog member variables
wxComboBox* m_fontCtrl;
wxComboBox* m_subsetCtrl;
wxSymbolListCtrl* m_symbolsCtrl;
wxStaticText* m_symbolStaticCtrl;
wxTextCtrl* m_characterCodeCtrl;
wxComboBox* m_fromUnicodeCtrl;
wxStdDialogButtonSizer* m_stdButtonSizer;
wxString m_fontName;
bool m_fromUnicode;
wxString m_normalTextFontName;
wxString m_symbol;
/// Control identifiers
enum {
ID_SYMBOLPICKERDIALOG = 10600,
ID_SYMBOLPICKERDIALOG_FONT = 10602,
ID_SYMBOLPICKERDIALOG_SUBSET = 10605,
ID_SYMBOLPICKERDIALOG_LISTCTRL = 10608,
ID_SYMBOLPICKERDIALOG_CHARACTERCODE = 10601,
ID_SYMBOLPICKERDIALOG_FROM = 10603
};
////@end wxSymbolPickerDialog member variables
bool m_dontUpdate;
static bool sm_showToolTips;
};
/*!
* The scrolling symbol list.
*/
class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl : public wxVScrolledWindow
{
public:
// constructors and such
// ---------------------
// default constructor, you must call Create() later
wxSymbolListCtrl() { Init(); }
// normal constructor which calls Create() internally
wxSymbolListCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr))
{
Init();
(void)Create(parent, id, pos, size, style, name);
}
// really creates the control and sets the initial number of items in it
// (which may be changed later with SetItemCount())
//
// returns true on success or false if the control couldn't be created
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr));
// dtor does some internal cleanup
virtual ~wxSymbolListCtrl();
// accessors
// ---------
// set the current font
virtual bool SetFont(const wxFont& font) override;
// set Unicode/ASCII mode
void SetUnicodeMode(bool unicodeMode);
// get the index of the currently selected item or wxNOT_FOUND if there is no selection
int GetSelection() const;
// is this item selected?
bool IsSelected(int item) const;
// is this item the current one?
bool IsCurrentItem(int item) const { return item == m_current; }
// get the margins around each cell
wxPoint GetMargins() const { return m_ptMargins; }
// get the background colour of selected cells
const wxColour& GetSelectionBackground() const { return m_colBgSel; }
// operations
// ----------
// set the selection to the specified item, if it is wxNOT_FOUND the
// selection is unset
void SetSelection(int selection);
// make this item visible
void EnsureVisible(int item);
// set the margins: horizontal margin is the distance between the window
// border and the item contents while vertical margin is half of the
// distance between items
//
// by default both margins are 0
void SetMargins(const wxPoint& pt);
void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); }
// set the cell size
void SetCellSize(const wxSize& sz) { m_cellSize = sz; }
const wxSize& GetCellSize() const { return m_cellSize; }
// change the background colour of the selected cells
void SetSelectionBackground(const wxColour& col);
virtual wxVisualAttributes GetDefaultAttributes() const override
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// Get min/max symbol values
int GetMinSymbolValue() const { return m_minSymbolValue; }
int GetMaxSymbolValue() const { return m_maxSymbolValue; }
// Respond to size change
void OnSize(wxSizeEvent& event);
protected:
// draws a line of symbols
virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
// gets the line height
virtual wxCoord OnGetRowHeight(size_t line) const override;
// event handlers
void OnPaint(wxPaintEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnLeftDClick(wxMouseEvent& event);
// common part of all ctors
void Init();
// send the wxEVT_LISTBOX event
void SendSelectedEvent();
// change the current item (in single selection listbox it also implicitly
// changes the selection); current may be wxNOT_FOUND in which case there
// will be no current item any more
//
// return true if the current item changed, false otherwise
bool DoSetCurrent(int current);
// flags for DoHandleItemClick
enum
{
ItemClick_Shift = 1, // item shift-clicked
ItemClick_Ctrl = 2, // ctrl
ItemClick_Kbd = 4 // item selected from keyboard
};
// common part of keyboard and mouse handling processing code
void DoHandleItemClick(int item, int flags);
// calculate line number from symbol value
int SymbolValueToLineNumber(int item);
// initialise control from current min/max values
void SetupCtrl(bool scrollToSelection = true);
// hit testing
int HitTest(const wxPoint& pt);
private:
// the current item or wxNOT_FOUND
int m_current;
// margins
wxPoint m_ptMargins;
// the selection bg colour
wxColour m_colBgSel;
// double buffer
wxBitmap* m_doubleBuffer;
// cell size
wxSize m_cellSize;
// minimum and maximum symbol value
int m_minSymbolValue;
// minimum and maximum symbol value
int m_maxSymbolValue;
// number of items per line
int m_symbolsPerLine;
// Unicode/ASCII mode
bool m_unicodeMode;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxSymbolListCtrl);
wxDECLARE_ABSTRACT_CLASS(wxSymbolListCtrl);
};
#endif
// _RICHTEXTSYMBOLDLG_H_

View File

@@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtexttabspage.h
// Purpose: Declares the rich text formatting dialog tabs page.
// Author: Julian Smart
// Created: 10/4/2006 8:03:20 AM
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTTABSPAGE_H_
#define _RICHTEXTTABSPAGE_H_
/*!
* Includes
*/
#include "wx/richtext/richtextdialogpage.h"
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTTABSPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE wxEmptyString
#define SYMBOL_WXRICHTEXTTABSPAGE_IDNAME ID_RICHTEXTTABSPAGE
#define SYMBOL_WXRICHTEXTTABSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTTABSPAGE_POSITION wxDefaultPosition
////@end control identifiers
/*!
* wxRichTextTabsPage class declaration
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxRichTextDialogPage
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextTabsPage);
wxDECLARE_EVENT_TABLE();
DECLARE_HELP_PROVISION()
public:
/// Constructors
wxRichTextTabsPage( );
wxRichTextTabsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE );
/// Creates the controls and sizers
void CreateControls();
/// Initialise members
void Init();
/// Transfer data from/to window
virtual bool TransferDataFromWindow() override;
virtual bool TransferDataToWindow() override;
/// Sorts the tab array
virtual void SortTabs();
/// Gets the attributes associated with the main formatting dialog
wxRichTextAttr* GetAttributes();
////@begin wxRichTextTabsPage event handler declarations
/// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTTABSPAGE_TABLIST
void OnTablistSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_NEW_TAB
void OnNewTabClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_NEW_TAB
void OnNewTabUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB
void OnDeleteTabClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB
void OnDeleteTabUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS
void OnDeleteAllTabsClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS
void OnDeleteAllTabsUpdate( wxUpdateUIEvent& event );
////@end wxRichTextTabsPage event handler declarations
////@begin wxRichTextTabsPage member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end wxRichTextTabsPage member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxRichTextTabsPage member variables
wxTextCtrl* m_tabEditCtrl;
wxListBox* m_tabListCtrl;
/// Control identifiers
enum {
ID_RICHTEXTTABSPAGE = 10200,
ID_RICHTEXTTABSPAGE_TABEDIT = 10213,
ID_RICHTEXTTABSPAGE_TABLIST = 10214,
ID_RICHTEXTTABSPAGE_NEW_TAB = 10201,
ID_RICHTEXTTABSPAGE_DELETE_TAB = 10202,
ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS = 10203
};
////@end wxRichTextTabsPage member variables
bool m_tabsPresent;
};
#endif
// _RICHTEXTTABSPAGE_H_

View File

@@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextuicustomization.h
// Purpose: UI customization base class for wxRTC
// Author: Julian Smart
// Created: 2010-11-14
// Copyright: (c) Julian Smart
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTUICUSTOMIZATION_H_
#define _WX_RICHTEXTUICUSTOMIZATION_H_
#if wxUSE_RICHTEXT
#include "wx/window.h"
/**
@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::GetHelpInfo().SetHelpId(ID_HELP_FORMATTINGDIALOG);
wxRichTextFormattingDialog::GetHelpInfo().SetUICustomization(& wxGetApp().GetRichTextUICustomization());
wxRichTextBordersPage::GetHelpInfo().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() = default;
virtual ~wxRichTextUICustomization() = default;
/// 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 = nullptr;
}
virtual ~wxRichTextHelpInfo() = default;
virtual bool ShowHelp(wxWindow* win)
{
if ( !m_uiCustomization || m_helpTopic == -1 )
return false;
return m_uiCustomization->ShowHelp(win, m_helpTopic);
}
/// 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 != nullptr; }
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() \
wxWARNING_SUPPRESS_MISSING_OVERRIDE() \
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); } \
wxWARNING_RESTORE_MISSING_OVERRIDE() \
public: \
static wxRichTextHelpInfo& GetHelpInfo() { return sm_helpInfo; }\
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

@@ -0,0 +1,238 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/richtext/richtextxml.h
// Purpose: XML and HTML I/O for wxRichTextCtrl
// Author: Julian Smart
// Created: 2005-09-30
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RICHTEXTXML_H_
#define _WX_RICHTEXTXML_H_
/*!
* Includes
*/
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextstyles.h"
#if wxUSE_RICHTEXT && wxUSE_XML
/*!
@class wxRichTextXMLHelper
A utility class to help with XML import/export, that can be used outside
saving a buffer if needed.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHelper: public wxObject
{
public:
wxRichTextXMLHelper() { Init(); }
wxRichTextXMLHelper(const wxString& enc) { Init(); SetupForSaving(enc); }
~wxRichTextXMLHelper();
void Init();
void SetupForSaving(const wxString& enc);
void Clear();
void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; }
const wxString& GetFileEncoding() const { return m_fileEncoding; }
// Convert a colour to a 6-digit hex string
static wxString ColourToHexString(const wxColour& col);
// Convert 6-digit hex string to a colour
static wxColour HexStringToColour(const wxString& hex);
static wxString MakeString(const int& v) { return wxString::Format(wxT("%d"), v); }
static wxString MakeString(const long& v) { return wxString::Format(wxT("%ld"), v); }
static wxString MakeString(const double& v) { return wxString::Format(wxS("%.2f"), v); }
static wxString MakeString(const wxString& s) { return s; }
static wxString MakeString(const wxColour& col) { return wxT("#") + ColourToHexString(col); }
static bool HasParam(wxXmlNode* node, const wxString& param);
static wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param);
static wxString GetNodeContent(wxXmlNode *node);
static wxString GetParamValue(wxXmlNode *node, const wxString& param);
static wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString);
static wxXmlNode* FindNode(wxXmlNode* node, const wxString& name);
static wxString AttributeToXML(const wxString& str);
static bool RichTextFixFaceName(wxString& facename);
static long ColourStringToLong(const wxString& colStr);
static wxTextAttrDimension ParseDimension(const wxString& dimStr);
// Make a string from the given property. This can be overridden for custom variants.
virtual wxString MakeStringFromProperty(const wxVariant& var);
// Create a proprty from the string read from the XML file.
virtual wxVariant MakePropertyFromString(const wxString& name, const wxString& value, const wxString& type);
// Import properties
virtual bool ImportProperties(wxRichTextProperties& properties, wxXmlNode* node);
virtual bool ImportStyle(wxRichTextAttr& attr, wxXmlNode* node, bool isPara = false);
virtual bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node);
// Get flags, as per handler flags
int GetFlags() const { return m_flags; }
void SetFlags(int flags) { m_flags = flags; }
#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
// write string to output
static void OutputString(wxOutputStream& stream, const wxString& str,
wxMBConv *convMem, wxMBConv *convFile);
static void OutputIndentation(wxOutputStream& stream, int indent);
// Same as above, but create entities first.
// Translates '<' to "&lt;", '>' to "&gt;" and '&' to "&amp;"
static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
wxMBConv *convMem, wxMBConv *convFile);
void OutputString(wxOutputStream& stream, const wxString& str);
void OutputStringEnt(wxOutputStream& stream, const wxString& str);
static void AddString(wxString& str, const int& v) { str << wxString::Format(wxT("%d"), v); }
static void AddString(wxString& str, const long& v) { str << wxString::Format(wxT("%ld"), v); }
static void AddString(wxString& str, const double& v) { str << wxString::Format(wxS("%.2f"), v); }
static void AddString(wxString& str, const wxChar* s) { str << s; }
static void AddString(wxString& str, const wxString& s) { str << s; }
static void AddString(wxString& str, const wxColour& col) { str << wxT("#") << ColourToHexString(col); }
static void AddAttribute(wxString& str, const wxString& name, const int& v);
static void AddAttribute(wxString& str, const wxString& name, const long& v);
static void AddAttribute(wxString& str, const wxString& name, const double& v);
static void AddAttribute(wxString& str, const wxString& name, const wxChar* s);
static void AddAttribute(wxString& str, const wxString& name, const wxString& s);
static void AddAttribute(wxString& str, const wxString& name, const wxColour& col);
static void AddAttribute(wxString& str, const wxString& name, const wxTextAttrDimension& dim);
static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrDimensions& dims);
static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrBorder& border);
static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrBorders& borders);
/// Create a string containing style attributes
static wxString AddAttributes(const wxRichTextAttr& attr, bool isPara = false);
/// Create a string containing style attributes, plus further object 'attributes' (shown, id)
static wxString AddAttributes(wxRichTextObject* obj, bool isPara = false);
virtual bool ExportStyleDefinition(wxOutputStream& stream, wxRichTextStyleDefinition* def, int level);
virtual bool WriteProperties(wxOutputStream& stream, const wxRichTextProperties& properties, int level);
#endif
#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
static void AddAttribute(wxXmlNode* node, const wxString& name, const int& v);
static void AddAttribute(wxXmlNode* node, const wxString& name, const long& v);
static void AddAttribute(wxXmlNode* node, const wxString& name, const double& v);
static void AddAttribute(wxXmlNode* node, const wxString& name, const wxString& s);
static void AddAttribute(wxXmlNode* node, const wxString& name, const wxColour& col);
static void AddAttribute(wxXmlNode* node, const wxString& name, const wxTextAttrDimension& dim);
static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrDimensions& dims);
static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrBorder& border);
static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrBorders& borders);
static bool AddAttributes(wxXmlNode* node, wxRichTextAttr& attr, bool isPara = false);
static bool AddAttributes(wxXmlNode* node, wxRichTextObject* obj, bool isPara = false);
virtual bool ExportStyleDefinition(wxXmlNode* parent, wxRichTextStyleDefinition* def);
// Write the properties
virtual bool WriteProperties(wxXmlNode* node, const wxRichTextProperties& properties);
#endif
public:
#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
// Used during saving
wxMBConv* m_convMem;
wxMBConv* m_convFile;
bool m_deleteConvFile;
#endif
wxString m_fileEncoding;
int m_flags;
};
/*!
@class wxRichTextXMLHandler
Implements XML loading and saving. Two methods of saving are included:
writing directly to a text stream, and populating a wxXmlDocument
before writing it. The former method is considerably faster, so we favour
that one, even though the code is a little less elegant.
*/
class WXDLLIMPEXP_FWD_XML wxXmlNode;
class WXDLLIMPEXP_FWD_XML wxXmlDocument;
class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler
{
wxDECLARE_DYNAMIC_CLASS(wxRichTextXMLHandler);
public:
wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML)
: wxRichTextFileHandler(name, ext, type)
{ Init(); }
void Init();
#if wxUSE_STREAMS
#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
/// Recursively export an object
bool ExportXML(wxOutputStream& stream, wxRichTextObject& obj, int level);
#endif
#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
bool ExportXML(wxXmlNode* parent, wxRichTextObject& obj);
#endif
/// Recursively import an object
bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node);
#endif
/// Creates an object given an XML element name
virtual wxRichTextObject* CreateObjectForXMLName(wxRichTextObject* parent, const wxString& name) const;
/// Can we save using this handler?
virtual bool CanSave() const override { return true; }
/// Can we load using this handler?
virtual bool CanLoad() const override { return true; }
/// Returns the XML helper object, implementing functionality
/// that can be reused elsewhere.
wxRichTextXMLHelper& GetHelper() { return m_helper; }
// Implementation
/**
Call with XML node name, C++ class name so that wxRTC can read in the node.
If you add a custom object, call this.
*/
static void RegisterNodeName(const wxString& nodeName, const wxString& className);
/**
Cleans up the mapping between node name and C++ class.
*/
static void ClearNodeToClassMap();
protected:
#if wxUSE_STREAMS
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) override;
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) override;
#endif
wxRichTextXMLHelper m_helper;
};
#endif
// wxUSE_RICHTEXT && wxUSE_XML
#endif
// _WX_RICHTEXTXML_H_