Added a list style editor page to the formatting dialog.

Added a style organiser dialog, which can be used to browse
for and apply styles and can be limited to show one of
the three style types, or all three.
Added a font name cache since it's an expensive operation
that's used frequently by the rich text dialogs.
Added ability to switch off tooltips for new dialogs
(off by default). Improved the previews. Pressing tab or shift-tab
at the start of a list item now demotes or promotes the item.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-10-19 14:04:13 +00:00
parent 0c7e0a8771
commit dadd4f5523
20 changed files with 2892 additions and 259 deletions

View File

@@ -993,12 +993,12 @@ public:
/// Number/renumber any list elements in the given range.
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
/// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
/// Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously

View File

@@ -205,12 +205,12 @@ public:
/// Number/renumber any list elements in the given range
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
/// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
/// def/defName can be NULL/empty to indicate that the existing list style should be used.
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
// translate between the position (which is just an index in the text ctrl
@@ -737,6 +737,10 @@ public:
// Implementation
/// Font names take a long time to retrieve, so cache them (on demand)
static const wxArrayString& GetAvailableFontNames();
static void ClearAvailableFontNames();
WX_FORWARD_TO_SCROLL_HELPER()
// Overrides
@@ -799,6 +803,8 @@ private:
/// Threshold for doing delayed layout
long m_delayedLayoutThreshold;
static wxArrayString sm_availableFontNames;
};
/*!

View File

@@ -34,7 +34,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog;
class WXDLLIMPEXP_CORE wxImageList;
/*!
* Flags determining the pages to be created in the dialog
* Flags determining the pages and buttons to be created in the dialog
*/
#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001
@@ -42,6 +42,9 @@ class WXDLLIMPEXP_CORE wxImageList;
#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_HELP_BUTTON 0x0100
/*!
* Shorthand for common combinations of pages
@@ -110,7 +113,7 @@ public:
void Init();
bool Create(long flags, wxWindow* parent, const wxString& title, wxWindowID id,
bool Create(long flags, wxWindow* parent, const wxString& title = _("Formatting"), wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
@@ -168,6 +171,12 @@ public:
/// 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; }
/// Map book control page index to our page id
void AddPageId(int id) { m_pageIds.Add(id); }
@@ -180,6 +189,7 @@ protected:
wxArrayInt m_pageIds; // mapping of book control indexes to page ids
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
static bool sm_showToolTips;
DECLARE_EVENT_TABLE()
};

View File

@@ -0,0 +1,245 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextliststylepage.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 10/18/2006 11:36:37 AM
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTLISTSTYLEPAGE_H_
#define _RICHTEXTLISTSTYLEPAGE_H_
/*!
* Includes
*/
////@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 _("wxRichTextListStylePage")
#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 wxRichTextListStylePage: public wxPanel
{
DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage )
DECLARE_EVENT_TABLE()
public:
/// Constructors
wxRichTextListStylePage( );
wxRichTextListStylePage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME, 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();
virtual bool TransferDataToWindow();
/// Get attributes for selected level
wxTextAttrEx* GetAttributesForSelection();
/// Update for symbol-related controls
void OnSymbolUpdate( wxUpdateUIEvent& event );
/// Update for number-related controls
void OnNumberUpdate( wxUpdateUIEvent& event );
/// Just transfer to the window
void DoTransferDataToWindow();
/// Transfer from the window and preview
void TransferAndPreview();
////@begin wxRichTextListStylePage event handler declarations
/// wxEVT_COMMAND_SPINCTRL_UPDATED 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_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelTextUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
void OnLevelUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
void OnChooseFontClick( wxCommandEvent& event );
/// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
void OnStylelistboxSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_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 OnSymbolctrlUIUpdate( 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_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUpdated( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
void OnParenthesesctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
void OnParenthesesctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
void OnPeriodctrlClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
void OnPeriodctrlUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
void OnIndentLeftUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
void OnIndentFirstLineUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
void OnIndentRightUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
void OnSpacingBeforeUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
void OnSpacingAfterUpdated( wxCommandEvent& event );
/// wxEVT_COMMAND_COMBOBOX_SELECTED 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;
wxComboBox* m_symbolCtrl;
wxComboBox* m_symbolFontCtrl;
wxCheckBox* m_parenthesesCtrl;
wxCheckBox* m_periodCtrl;
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_SYMBOLSTATIC = 10621,
ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10622,
ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10623,
ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625,
ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626,
ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627,
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,237 @@
/////////////////////////////////////////////////////////////////////////////
// Name: richtextstyledlg.h
// Purpose:
// Author: Julian Smart
// Modified by:
// Created: 10/5/2006 12:05:31 PM
// RCS-ID:
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _RICHTEXTSTYLEDLG_H_
#define _RICHTEXTSTYLEDLG_H_
/*!
* Includes
*/
////@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;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE _("Style Organiser")
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*!
* 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_ALL 0x0800
// 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 wxRichTextStyleOrganiserDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
DECLARE_EVENT_TABLE()
public:
/// Constructors
wxRichTextStyleOrganiserDialog( );
wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME, 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 = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME, 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();
virtual bool TransferDataToWindow();
/// 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 = NULL);
/// 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_COMMAND_BUTTON_CLICKED 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_COMMAND_BUTTON_CLICKED 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_COMMAND_BUTTON_CLICKED 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_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
void OnRenameClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
void OnRenameUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
void OnEditClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
void OnEditUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
void OnDeleteClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
void OnDeleteUpdate( wxUpdateUIEvent& 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_applyStyle;
wxButton* m_renameStyle;
wxButton* m_editStyle;
wxButton* m_deleteStyle;
wxButton* m_closeButton;
wxBoxSizer* m_bottomButtonSizer;
wxCheckBox* m_restartNumberingCtrl;
wxButton* m_okButton;
wxButton* m_cancelButton;
/// Control identifiers
enum {
ID_RICHTEXTSTYLEORGANISERDIALOG = 10500,
ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501,
ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
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

@@ -12,20 +12,6 @@
#ifndef _RICHTEXTSTYLEPAGE_H_
#define _RICHTEXTSTYLEPAGE_H_
/*!
* Includes
*/
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/

View File

@@ -383,6 +383,7 @@ public:
m_richTextCtrl = NULL;
m_applyOnSelection = false;
m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
m_autoSetSelection = true;
}
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
@@ -414,9 +415,6 @@ public:
/// Apply the style
void ApplyStyle(int i);
/// React to selection
void OnSelect(wxCommandEvent& event);
/// Left click
void OnLeftDown(wxMouseEvent& event);
@@ -431,7 +429,8 @@ public:
/// 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 true; }
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; }
@@ -454,6 +453,7 @@ private:
wxRichTextCtrl* m_richTextCtrl;
bool m_applyOnSelection; // if true, applies style on selection
wxRichTextStyleType m_styleType; // style type to display
bool m_autoSetSelection;
};
/*!
@@ -462,6 +462,8 @@ private:
* style types.
*/
#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
{
DECLARE_CLASS(wxRichTextStyleListCtrl)
@@ -493,6 +495,9 @@ public:
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 manager
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
wxRichTextStyleSheet* GetStyleSheet() const;
@@ -501,9 +506,6 @@ public:
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
wxRichTextCtrl* GetRichTextCtrl() const;
/// Updates the style list box
void UpdateStyles();
/// Set/get the style type to display
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;

View File

@@ -24,10 +24,7 @@
*/
////@begin forward declarations
class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl;
class WXDLLIMPEXP_CORE wxComboBox;
class WXDLLIMPEXP_CORE wxStaticText;
class WXDLLIMPEXP_CORE wxTextCtrl;
class wxSymbolListCtrl;
////@end forward declarations
// __UNICODE__ is a symbol used by DialogBlocks-generated code.
@@ -93,6 +90,12 @@ public:
/// 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();
@@ -111,16 +114,12 @@ public:
void OnFromUnicodeSelected( wxCommandEvent& event );
#endif
#if defined(__WXMSW__) || \
defined(__WXMAC__) || \
defined(__WXGTK__) || \
defined(__WXPM__) || \
defined(__WXMGL__) || \
defined(__WXMOTIF__) || \
defined(__WXCOCOA__) || \
defined(__WXX11__) || \
defined(__WXPALMOS__)
#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOS2__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__)
/// wxEVT_UPDATE_UI event handler for wxID_OK
void OnOkUpdate( wxUpdateUIEvent& event );
#endif
#if defined(__WXMAC__)
/// wxEVT_UPDATE_UI event handler for wxID_OK
void OnOkUpdate( wxUpdateUIEvent& event );
@@ -148,9 +147,6 @@ public:
wxIcon GetIconResource( const wxString& name );
////@end wxSymbolPickerDialog member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin wxSymbolPickerDialog member variables
wxComboBox* m_fontCtrl;
#if defined(__UNICODE__)
@@ -178,6 +174,7 @@ public:
////@end wxSymbolPickerDialog member variables
bool m_dontUpdate;
static bool sm_showToolTips;
};
/*!