X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/99404ab05fa5b5a81df1120cb871b0a645b5e3fc..7da00c46e1f16b97c3d49e5d992b7f859f81d032:/samples/richtext/richtext.cpp diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index 94b224cff4..d41e8e90f9 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -181,6 +181,8 @@ public: void OnPreview(wxCommandEvent& event); void OnPageSetup(wxCommandEvent& event); +protected: + // Forward command events to the current rich text control, if any bool ProcessEvent(wxEvent& event); @@ -435,7 +437,7 @@ void MyApp::CreateStyles() wxRichTextAttr indentedAttr2; indentedAttr2.SetFontFaceName(romanFont.GetFaceName()); indentedAttr2.SetFontSize(12); - indentedAttr2.SetFontWeight(wxBOLD); + indentedAttr2.SetFontWeight(wxFONTWEIGHT_BOLD); indentedAttr2.SetTextColour(*wxRED); indentedAttr2.SetFontSize(12); indentedAttr2.SetLeftIndent(100, 0); @@ -462,7 +464,7 @@ void MyApp::CreateStyles() wxRichTextAttr boldAttr; boldAttr.SetFontFaceName(romanFont.GetFaceName()); boldAttr.SetFontSize(12); - boldAttr.SetFontWeight(wxBOLD); + boldAttr.SetFontWeight(wxFONTWEIGHT_BOLD); // We only want to affect boldness boldAttr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); boldDef->SetStyle(boldAttr); @@ -473,7 +475,7 @@ void MyApp::CreateStyles() wxRichTextAttr italicAttr; italicAttr.SetFontFaceName(romanFont.GetFaceName()); italicAttr.SetFontSize(12); - italicAttr.SetFontStyle(wxITALIC); + italicAttr.SetFontStyle(wxFONTSTYLE_ITALIC); // We only want to affect italics italicAttr.SetFlags(wxTEXT_ATTR_FONT_ITALIC); italicDef->SetStyle(italicAttr); @@ -484,7 +486,7 @@ void MyApp::CreateStyles() wxRichTextAttr redAttr; redAttr.SetFontFaceName(romanFont.GetFaceName()); redAttr.SetFontSize(12); - redAttr.SetFontWeight(wxBOLD); + redAttr.SetFontWeight(wxFONTWEIGHT_BOLD); redAttr.SetTextColour(*wxRED); // We only want to affect colour, weight and face redAttr.SetFlags(wxTEXT_ATTR_FONT_FACE|wxTEXT_ATTR_FONT_WEIGHT|wxTEXT_ATTR_TEXT_COLOUR); @@ -665,28 +667,28 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos, wxToolBar* toolBar = CreateToolBar(); - toolBar->AddTool(wxID_OPEN, wxBitmap(open_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Open")); - toolBar->AddTool(wxID_SAVEAS, wxBitmap(save_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Save")); + toolBar->AddTool(wxID_OPEN, wxEmptyString, wxBitmap(open_xpm), _("Open")); + toolBar->AddTool(wxID_SAVEAS, wxEmptyString, wxBitmap(save_xpm), _("Save")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_CUT, wxBitmap(cut_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Cut")); - toolBar->AddTool(wxID_COPY, wxBitmap(copy_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Copy")); - toolBar->AddTool(wxID_PASTE, wxBitmap(paste_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Paste")); + toolBar->AddTool(wxID_CUT, wxEmptyString, wxBitmap(cut_xpm), _("Cut")); + toolBar->AddTool(wxID_COPY, wxEmptyString, wxBitmap(copy_xpm), _("Copy")); + toolBar->AddTool(wxID_PASTE, wxEmptyString, wxBitmap(paste_xpm), _("Paste")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_UNDO, wxBitmap(undo_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Undo")); - toolBar->AddTool(wxID_REDO, wxBitmap(redo_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Redo")); + toolBar->AddTool(wxID_UNDO, wxEmptyString, wxBitmap(undo_xpm), _("Undo")); + toolBar->AddTool(wxID_REDO, wxEmptyString, wxBitmap(redo_xpm), _("Redo")); toolBar->AddSeparator(); - toolBar->AddTool(ID_FORMAT_BOLD, wxBitmap(bold_xpm), wxNullBitmap, true, -1, -1, (wxObject *) NULL, _("Bold")); - toolBar->AddTool(ID_FORMAT_ITALIC, wxBitmap(italic_xpm), wxNullBitmap, true, -1, -1, (wxObject *) NULL, _("Italic")); - toolBar->AddTool(ID_FORMAT_UNDERLINE, wxBitmap(underline_xpm), wxNullBitmap, true, -1, -1, (wxObject *) NULL, _("Underline")); + toolBar->AddCheckTool(ID_FORMAT_BOLD, wxEmptyString, wxBitmap(bold_xpm), wxNullBitmap, _("Bold")); + toolBar->AddCheckTool(ID_FORMAT_ITALIC, wxEmptyString, wxBitmap(italic_xpm), wxNullBitmap, _("Italic")); + toolBar->AddCheckTool(ID_FORMAT_UNDERLINE, wxEmptyString, wxBitmap(underline_xpm), wxNullBitmap, _("Underline")); toolBar->AddSeparator(); - toolBar->AddTool(ID_FORMAT_ALIGN_LEFT, wxBitmap(alignleft_xpm), wxNullBitmap, true, -1, -1, (wxObject *) NULL, _("Align Left")); - toolBar->AddTool(ID_FORMAT_ALIGN_CENTRE, wxBitmap(centre_xpm), wxNullBitmap, true, -1, -1, (wxObject *) NULL, _("Centre")); - toolBar->AddTool(ID_FORMAT_ALIGN_RIGHT, wxBitmap(alignright_xpm), wxNullBitmap, true, -1, -1, (wxObject *) NULL, _("Align Right")); + toolBar->AddCheckTool(ID_FORMAT_ALIGN_LEFT, wxEmptyString, wxBitmap(alignleft_xpm), wxNullBitmap, _("Align Left")); + toolBar->AddCheckTool(ID_FORMAT_ALIGN_CENTRE, wxEmptyString, wxBitmap(centre_xpm), wxNullBitmap, _("Centre")); + toolBar->AddCheckTool(ID_FORMAT_ALIGN_RIGHT, wxEmptyString, wxBitmap(alignright_xpm), wxNullBitmap, _("Align Right")); toolBar->AddSeparator(); - toolBar->AddTool(ID_FORMAT_INDENT_LESS, wxBitmap(indentless_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Indent Less")); - toolBar->AddTool(ID_FORMAT_INDENT_MORE, wxBitmap(indentmore_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Indent More")); + toolBar->AddTool(ID_FORMAT_INDENT_LESS, wxEmptyString, wxBitmap(indentless_xpm), _("Indent Less")); + toolBar->AddTool(ID_FORMAT_INDENT_MORE, wxEmptyString, wxBitmap(indentmore_xpm), _("Indent More")); toolBar->AddSeparator(); - toolBar->AddTool(ID_FORMAT_FONT, wxBitmap(font_xpm), wxNullBitmap, false, -1, -1, (wxObject *) NULL, _("Font")); + toolBar->AddTool(ID_FORMAT_FONT, wxEmptyString, wxBitmap(font_xpm), _("Font")); wxRichTextStyleComboCtrl* combo = new wxRichTextStyleComboCtrl(toolBar, ID_RICHTEXT_STYLE_COMBO, wxDefaultPosition, wxSize(200, -1)); toolBar->AddControl(combo); @@ -958,7 +960,7 @@ bool MyFrame::ProcessEvent(wxEvent& event) s_id = event.GetId(); wxWindow* focusWin = wxFindFocusDescendant(this); - if (focusWin && focusWin->ProcessEvent(event)) + if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) { //s_command = NULL; s_eventType = 0;