#include "wx/richtext/richtexthtml.h"
#include "wx/richtext/richtextformatdlg.h"
#include "wx/richtext/richtextsymboldlg.h"
+#include "wx/richtext/richtextstyledlg.h"
// ----------------------------------------------------------------------------
// resources
void OnParagraphSpacingLess(wxCommandEvent& event);
void OnNumberList(wxCommandEvent& event);
+ void OnBulletsAndNumbering(wxCommandEvent& event);
void OnItemizeList(wxCommandEvent& event);
void OnRenumberList(wxCommandEvent& event);
void OnPromoteList(wxCommandEvent& event);
void OnViewHTML(wxCommandEvent& event);
void OnSwitchStyleSheets(wxCommandEvent& event);
+ void OnManageStyles(wxCommandEvent& event);
// Forward command events to the current rich text control, if any
bool ProcessEvent(wxEvent& event);
ID_FORMAT_LINE_SPACING_SINGLE,
ID_FORMAT_NUMBER_LIST,
+ ID_FORMAT_BULLETS_AND_NUMBERING,
ID_FORMAT_ITEMIZE_LIST,
ID_FORMAT_RENUMBER_LIST,
ID_FORMAT_PROMOTE_LIST,
ID_VIEW_HTML,
ID_SWITCH_STYLE_SHEETS,
+ ID_MANAGE_STYLES,
ID_RICHTEXT_CTRL,
ID_RICHTEXT_STYLE_LIST,
EVT_MENU(ID_INSERT_SYMBOL, MyFrame::OnInsertSymbol)
EVT_MENU(ID_FORMAT_NUMBER_LIST, MyFrame::OnNumberList)
+ EVT_MENU(ID_FORMAT_BULLETS_AND_NUMBERING, MyFrame::OnBulletsAndNumbering)
EVT_MENU(ID_FORMAT_ITEMIZE_LIST, MyFrame::OnItemizeList)
EVT_MENU(ID_FORMAT_RENUMBER_LIST, MyFrame::OnRenumberList)
EVT_MENU(ID_FORMAT_PROMOTE_LIST, MyFrame::OnPromoteList)
EVT_MENU(ID_VIEW_HTML, MyFrame::OnViewHTML)
EVT_MENU(ID_SWITCH_STYLE_SHEETS, MyFrame::OnSwitchStyleSheets)
+ EVT_MENU(ID_MANAGE_STYLES, MyFrame::OnManageStyles)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
formatMenu->Append(ID_FORMAT_PARAGRAPH, _("&Paragraph..."));
formatMenu->Append(ID_FORMAT_CONTENT, _("Font and Pa&ragraph...\tShift+Ctrl+F"));
formatMenu->AppendSeparator();
- formatMenu->Append(ID_FORMAT_NUMBER_LIST, _("Number List"));
- formatMenu->Append(ID_FORMAT_ITEMIZE_LIST, _("Itemize List"));
- formatMenu->Append(ID_FORMAT_RENUMBER_LIST, _("Renumber List"));
- formatMenu->Append(ID_FORMAT_PROMOTE_LIST, _("Promote List Items"));
- formatMenu->Append(ID_FORMAT_DEMOTE_LIST, _("Demote List Items"));
- formatMenu->Append(ID_FORMAT_CLEAR_LIST, _("Clear List Formatting"));
- formatMenu->AppendSeparator();
formatMenu->Append(ID_SWITCH_STYLE_SHEETS, _("&Switch Style Sheets"));
+ formatMenu->Append(ID_MANAGE_STYLES, _("&Manage Styles"));
+
+ wxMenu* listsMenu = new wxMenu;
+ listsMenu->Append(ID_FORMAT_BULLETS_AND_NUMBERING, _("Bullets and &Numbering..."));
+ listsMenu->AppendSeparator();
+ listsMenu->Append(ID_FORMAT_NUMBER_LIST, _("Number List"));
+ listsMenu->Append(ID_FORMAT_ITEMIZE_LIST, _("Itemize List"));
+ listsMenu->Append(ID_FORMAT_RENUMBER_LIST, _("Renumber List"));
+ listsMenu->Append(ID_FORMAT_PROMOTE_LIST, _("Promote List Items"));
+ listsMenu->Append(ID_FORMAT_DEMOTE_LIST, _("Demote List Items"));
+ listsMenu->Append(ID_FORMAT_CLEAR_LIST, _("Clear List Formatting"));
wxMenu* insertMenu = new wxMenu;
insertMenu->Append(ID_INSERT_SYMBOL, _("&Symbol...\tCtrl+I"));
menuBar->Append(fileMenu, _T("&File"));
menuBar->Append(editMenu, _T("&Edit"));
menuBar->Append(formatMenu, _T("F&ormat"));
+ menuBar->Append(listsMenu, _T("&Lists"));
menuBar->Append(insertMenu, _T("&Insert"));
menuBar->Append(helpMenu, _T("&Help"));
static wxRichTextStyleSheet* gs_AlternateStyleSheet = NULL;
wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
- wxRichTextStyleListBox* styleList = (wxRichTextStyleListBox*) FindWindow(ID_RICHTEXT_STYLE_LIST);
+ wxRichTextStyleListCtrl *styleList = (wxRichTextStyleListCtrl*) FindWindow(ID_RICHTEXT_STYLE_LIST);
wxRichTextStyleComboCtrl* styleCombo = (wxRichTextStyleComboCtrl*) FindWindow(ID_RICHTEXT_STYLE_COMBO);
wxRichTextStyleSheet* sheet = ctrl->GetStyleSheet();
styleCombo->UpdateStyles();
}
+void MyFrame::OnManageStyles(wxCommandEvent& WXUNUSED(event))
+{
+ wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
+ wxRichTextStyleSheet* sheet = ctrl->GetStyleSheet();
+
+ int flags = wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES;
+
+ wxRichTextStyleOrganiserDialog dlg(flags, sheet, NULL, this, wxID_ANY, _("Style Manager"));
+ dlg.ShowModal();
+}
+
void MyFrame::OnInsertSymbol(wxCommandEvent& WXUNUSED(event))
{
wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
}
}
+void MyFrame::OnBulletsAndNumbering(wxCommandEvent& WXUNUSED(event))
+{
+ wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
+ wxRichTextStyleSheet* sheet = ctrl->GetStyleSheet();
+
+ int flags = wxRICHTEXT_ORGANISER_BROWSE_NUMBERING;
+
+ wxRichTextStyleOrganiserDialog dlg(flags, sheet, ctrl, this, wxID_ANY, _("Bullets and Numbering"));
+ if (dlg.ShowModal() == wxID_OK)
+ {
+ if (dlg.GetSelectedStyleDefinition())
+ dlg.ApplyStyle();
+ }
+}
+
void MyFrame::OnItemizeList(wxCommandEvent& WXUNUSED(event))
{
wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);