+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
+ */
+
+void wxRichTextStyleOrganiserDialog::OnNewBoxClick( wxCommandEvent& WXUNUSED(event) )
+{
+ wxString styleName = wxGetTextFromUser(_("Enter a box style name"), _("New Style"));
+ if (!styleName.IsEmpty())
+ {
+ if (GetStyleSheet()->FindBoxStyle(styleName))
+ {
+ wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
+ return;
+ }
+
+ wxRichTextBoxStyleDefinition* style = new wxRichTextBoxStyleDefinition(styleName);
+
+ int pages = wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
+ wxRichTextFormattingDialog formatDlg;
+ formatDlg.SetStyleDefinition(*style, GetStyleSheet());
+ formatDlg.Create(pages, this);
+
+ if (formatDlg.ShowModal() == wxID_OK)
+ {
+ wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextBoxStyleDefinition);
+
+ (*((wxRichTextBoxStyleDefinition* ) style)) = (*boxDef);
+
+ GetStyleSheet()->AddBoxStyle(style);
+
+ m_stylesListBox->UpdateStyles();
+ ShowPreview();
+ }
+ else
+ delete style;
+ }
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
+ */
+
+void wxRichTextStyleOrganiserDialog::OnNewBoxUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
+}
+