#include </home/zeitlin/src/wx/github/interface/wx/richtext/richtextformatdlg.h>
This dialog allows the user to edit a character and/or paragraph style.
In the constructor, specify the pages that will be created. Use wxRichTextFormattingDialog::GetStyle() to retrieve the common style for a given range, and then use wxRichTextFormattingDialog::ApplyStyle() to apply the user-selected formatting to a control.
以下に例を示します:
wxRichTextRange range; if (m_richTextCtrl-HasSelection()) range = m_richTextCtrl-GetSelectionRange(); else range = wxRichTextRange(0, m_richTextCtrl-GetLastPosition()+1); int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING| \ wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS; wxRichTextFormattingDialog formatDlg(pages, this); formatDlg.GetStyle(m_richTextCtrl, range); if (formatDlg.ShowModal() == wxID_OK) { formatDlg.ApplyStyle(m_richTextCtrl, range); }
Public Types | |
enum | { Option_AllowPixelFontSize = 0x0001 } |
Public Member Functions | |
wxRichTextFormattingDialog () | |
Default ctor. | |
wxRichTextFormattingDialog (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) | |
Constructors. | |
virtual | ~wxRichTextFormattingDialog () |
Destructor. | |
virtual bool | ApplyStyle (wxRichTextCtrl *ctrl, const wxRichTextRange &range, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE) |
Apply attributes to the given range, only changing attributes that need to be changed. | |
bool | Create (long flags, wxWindow *parent, const wxString &title=wxGetTranslation("Formatting"), wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &sz=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE) |
Creation: see wxRichTextFormattingDialog() "the constructor" for details about the parameters. | |
wxImageList * | GetImageList () const |
Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook. | |
virtual bool | GetStyle (wxRichTextCtrl *ctrl, const wxRichTextRange &range) |
Gets common attributes from the given range and calls SetAttributes(). | |
virtual wxRichTextStyleDefinition * | GetStyleDefinition () const |
Gets the associated style definition, if any. | |
virtual wxRichTextStyleSheet * | GetStyleSheet () const |
Gets the associated style sheet, if any. | |
void | SetAttributes (const wxTextAttr &attr) |
Sets the attributes to be edited. | |
void | SetOptions (int options) |
Sets the dialog options, determining what the interface presents to the user. | |
int | GetOptions () const |
Gets the dialog options, determining what the interface presents to the user. | |
bool | HasOption (int option) const |
Returns true if the given option is present. | |
void | SetImageList (wxImageList *imageList) |
Sets the image list associated with the dialog's property sheet. | |
virtual bool | SetStyle (const wxTextAttr &style, bool update=true) |
Sets the attributes and optionally updates the display, if update is true. | |
virtual bool | SetStyleDefinition (const wxRichTextStyleDefinition &styleDef, wxRichTextStyleSheet *sheet, bool update=true) |
Sets the style definition and optionally update the display, if update is true. | |
virtual bool | UpdateDisplay () |
Updates the display. | |
const wxTextAttr & | GetAttributes () const |
Gets the attributes being edited. | |
wxTextAttr & | GetAttributes () |
Gets the attributes being edited. | |
Static Public Member Functions | |
static wxRichTextFormattingDialog * | GetDialog (wxWindow *win) |
Helper for pages to get the top-level dialog. | |
static wxTextAttr * | GetDialogAttributes (wxWindow *win) |
Helper for pages to get the attributes. | |
static wxRichTextStyleDefinition * | GetDialogStyleDefinition (wxWindow *win) |
Helper for pages to get the style. | |
static wxRichTextFormattingDialogFactory * | GetFormattingDialogFactory () |
Returns the object to be used to customize the dialog and provide pages. | |
static void | SetFormattingDialogFactory (wxRichTextFormattingDialogFactory *factory) |
Sets the formatting factory object to be used for customization and page creation. |
wxRichTextFormattingDialog::wxRichTextFormattingDialog | ( | ) |
Default ctor.
wxRichTextFormattingDialog::wxRichTextFormattingDialog | ( | 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 |
||
) |
Constructors.
flags | The pages to show. |
parent | The dialog's parent. |
title | The dialog's title. |
id | The dialog's ID. |
pos | The dialog's position. |
sz | The dialog's size. |
style | The dialog's window style. |
virtual wxRichTextFormattingDialog::~wxRichTextFormattingDialog | ( | ) | [virtual] |
Destructor.
virtual bool wxRichTextFormattingDialog::ApplyStyle | ( | wxRichTextCtrl * | ctrl, |
const wxRichTextRange & | range, | ||
int | flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE |
||
) | [virtual] |
Apply attributes to the given range, only changing attributes that need to be changed.
bool wxRichTextFormattingDialog::Create | ( | long | flags, |
wxWindow * | parent, | ||
const wxString & | title = wxGetTranslation("Formatting") , |
||
wxWindowID | id = wxID_ANY , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | sz = wxDefaultSize , |
||
long | style = wxDEFAULT_DIALOG_STYLE |
||
) |
Creation: see wxRichTextFormattingDialog() "the constructor" for details about the parameters.
wxTextAttr& wxRichTextFormattingDialog::GetAttributes | ( | ) |
Gets the attributes being edited.
const wxTextAttr& wxRichTextFormattingDialog::GetAttributes | ( | ) | const |
Gets the attributes being edited.
static wxRichTextFormattingDialog* wxRichTextFormattingDialog::GetDialog | ( | wxWindow * | win | ) | [static] |
Helper for pages to get the top-level dialog.
static wxTextAttr* wxRichTextFormattingDialog::GetDialogAttributes | ( | wxWindow * | win | ) | [static] |
Helper for pages to get the attributes.
static wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetDialogStyleDefinition | ( | wxWindow * | win | ) | [static] |
Helper for pages to get the style.
static wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::GetFormattingDialogFactory | ( | ) | [static] |
Returns the object to be used to customize the dialog and provide pages.
wxImageList* wxRichTextFormattingDialog::GetImageList | ( | ) | const |
Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
int wxRichTextFormattingDialog::GetOptions | ( | ) | const [inline] |
Gets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
virtual bool wxRichTextFormattingDialog::GetStyle | ( | wxRichTextCtrl * | ctrl, |
const wxRichTextRange & | range | ||
) | [virtual] |
Gets common attributes from the given range and calls SetAttributes().
Attributes that do not have common values in the given range will be omitted from the style's flags.
virtual wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetStyleDefinition | ( | ) | const [virtual] |
Gets the associated style definition, if any.
virtual wxRichTextStyleSheet* wxRichTextFormattingDialog::GetStyleSheet | ( | ) | const [virtual] |
Gets the associated style sheet, if any.
bool wxRichTextFormattingDialog::HasOption | ( | int | option | ) | const [inline] |
Returns true if the given option is present.
void wxRichTextFormattingDialog::SetAttributes | ( | const wxTextAttr & | attr | ) |
Sets the attributes to be edited.
static void wxRichTextFormattingDialog::SetFormattingDialogFactory | ( | wxRichTextFormattingDialogFactory * | factory | ) | [static] |
Sets the formatting factory object to be used for customization and page creation.
It deletes the existing factory object.
void wxRichTextFormattingDialog::SetImageList | ( | wxImageList * | imageList | ) |
Sets the image list associated with the dialog's property sheet.
void wxRichTextFormattingDialog::SetOptions | ( | int | options | ) | [inline] |
Sets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
virtual bool wxRichTextFormattingDialog::SetStyle | ( | const wxTextAttr & | style, |
bool | update = true |
||
) | [virtual] |
Sets the attributes and optionally updates the display, if update is true.
virtual bool wxRichTextFormattingDialog::SetStyleDefinition | ( | const wxRichTextStyleDefinition & | styleDef, |
wxRichTextStyleSheet * | sheet, | ||
bool | update = true |
||
) | [virtual] |
Sets the style definition and optionally update the display, if update is true.
virtual bool wxRichTextFormattingDialog::UpdateDisplay | ( | ) | [virtual] |
Updates the display.