2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: richtext/richtextstyledlg.h
|
2008-03-09 13:09:29 -04:00
|
|
|
// Purpose: interface of wxRichTextStyleOrganiserDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRichTextStyleOrganiserDialog
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-09 12:30:57 -04:00
|
|
|
This class shows a style sheet and allows the user to edit, add and remove styles.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
It can also be used as a style browser, for example if the application is not
|
|
|
|
using a permanent wxRichTextStyleComboCtrl or wxRichTextStyleListCtrl to
|
|
|
|
present styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxrichtext}
|
2008-03-09 13:09:29 -04:00
|
|
|
@category{richtext}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxRichTextStyleOrganiserDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Default ctor.
|
|
|
|
*/
|
|
|
|
wxRichTextStyleOrganiserDialog();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a
|
2008-10-09 12:30:57 -04:00
|
|
|
text control to apply a selected style to (or @NULL), followed by the usual
|
|
|
|
window parameters.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
To specify the operations available to the user, pass a combination of these
|
|
|
|
values to @e flags:
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
- @b wxRICHTEXT_ORGANISER_DELETE_STYLES: Provides a button for deleting styles.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_CREATE_STYLES: Provides buttons for creating styles.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_APPLY_STYLES: Provides a button for applying the
|
|
|
|
currently selected style to the selection.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_EDIT_STYLES: Provides a button for editing styles.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_RENAME_STYLES: Provides a button for renaming styles.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_OK_CANCEL: Provides OK and Cancel buttons.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_RENUMBER: Provides a checkbox for specifying that
|
|
|
|
the selection should be renumbered.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
The following flags determine what will be displayed in the style list:
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
- @b wxRICHTEXT_ORGANISER_SHOW_CHARACTER: Displays character styles only.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH: Displays paragraph styles only.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_SHOW_LIST: Displays list styles only.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_SHOW_ALL: Displays all styles.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
The following symbols define commonly-used combinations of flags:
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
- @b wxRICHTEXT_ORGANISER_ORGANISE:
|
|
|
|
Enable all style editing operations so the dialog behaves as a style organiser.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_BROWSE:
|
|
|
|
Show a list of all styles and their previews, but only allow application of a
|
|
|
|
style or cancellation of the dialog. This makes the dialog behave as a style browser.
|
|
|
|
- @b wxRICHTEXT_ORGANISER_BROWSE_NUMBERING:
|
|
|
|
Enables only list style browsing, plus a control to specify renumbering.
|
|
|
|
This allows the dialog to be used for applying list styles to the selection.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxRichTextStyleOrganiserDialog(int flags,
|
|
|
|
wxRichTextStyleSheet* sheet,
|
|
|
|
wxRichTextCtrl* ctrl,
|
|
|
|
wxWindow* parent,
|
2008-10-09 12:30:57 -04:00
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& caption = _("Style Organiser"),
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Applies the selected style to selection in the given control or the control
|
|
|
|
passed to the constructor.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Creates the dialog. See the ctor.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-09 12:30:57 -04:00
|
|
|
bool Create(int flags,
|
|
|
|
wxRichTextStyleSheet* sheet,
|
2008-03-08 08:52:38 -05:00
|
|
|
wxRichTextCtrl* ctrl,
|
|
|
|
wxWindow* parent,
|
2008-10-09 12:30:57 -04:00
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& caption = _("Style Organiser"),
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the user has opted to restart numbering.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool GetRestartNumbering() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the associated rich text control (if any).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextCtrl* GetRichTextCtrl() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns selected style name.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetSelectedStyle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns selected style definition.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the associated style sheet.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextStyleSheet* GetStyleSheet() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the flags used to control the interface presented to the user.
|
|
|
|
*/
|
|
|
|
void SetFlags(int flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Checks or unchecks the restart numbering checkbox.
|
|
|
|
*/
|
|
|
|
void SetRestartNumbering(bool restartNumbering);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the control to be associated with the dialog, for the purposes of applying
|
|
|
|
a style to the selection.
|
|
|
|
*/
|
|
|
|
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Determines whether tooltips will be shown.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
static void SetShowToolTips(bool show);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the associated style sheet.
|
|
|
|
*/
|
|
|
|
void SetStyleSheet(wxRichTextStyleSheet* sheet);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the flags used to control the interface presented to the user.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetFlags() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|