diff --git a/include/wx/richtext/richtextformatdlg.h b/include/wx/richtext/richtextformatdlg.h index 68ccf2437b..b48e4953eb 100644 --- a/include/wx/richtext/richtextformatdlg.h +++ b/include/wx/richtext/richtextformatdlg.h @@ -22,6 +22,7 @@ #include "wx/propdlg.h" #include "wx/bookctrl.h" #include "wx/withimages.h" +#include "wx/colourdata.h" #if wxUSE_HTML #include "wx/htmllbox.h" @@ -241,14 +242,20 @@ public: /// Find a page by class wxWindow* FindPage(wxClassInfo* info) const; - /// Whether to restore the last-selected page - static bool GetRestoreLastPage() { return sm_restoreLastPage; } + /// Whether to restore the last-selected page. + static bool GetRestoreLastPage() { return sm_restoreLastPage; } static void SetRestoreLastPage(bool b) { sm_restoreLastPage = b; } /// The page identifier of the last page selected (not the control id) static int GetLastPage() { return sm_lastPage; } static void SetLastPage(int lastPage) { sm_lastPage = lastPage; } + /// Sets the custom colour data for use by the colour dialog. + static void SetColourData(const wxColourData& colourData) { sm_colourData = colourData; } + + /// Returns the custom colour data for use by the colour dialog. + static wxColourData GetColourData() { return sm_colourData; } + protected: wxRichTextAttr m_attributes; @@ -258,6 +265,7 @@ protected: wxArrayInt m_pageIds; // mapping of book control indexes to page ids int m_options; // UI options bool m_ignoreUpdates; + static wxColourData sm_colourData; static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory; static bool sm_showToolTips; diff --git a/interface/wx/richtext/richtextformatdlg.h b/interface/wx/richtext/richtextformatdlg.h index 6eed33888d..43a7a3cb75 100644 --- a/interface/wx/richtext/richtextformatdlg.h +++ b/interface/wx/richtext/richtextformatdlg.h @@ -275,5 +275,35 @@ public: Updates the display. */ virtual bool UpdateDisplay(); + + /** + Returns @true if the dialog will restore the last-selected page. + */ + static bool GetRestoreLastPage(); + + /** + Pass @true if the dialog should restore the last-selected page. + */ + static void SetRestoreLastPage(bool b); + + /** + Returns the page identifier of the last page selected (not the control id). + */ + static int GetLastPage(); + + /** + Sets the page identifier of the last page selected (not the control id). + */ + static void SetLastPage(int lastPage); + + /** + Sets the custom colour data for use by the colour dialog. + */ + static void SetColourData(const wxColourData& colourData); + + /** + Returns the custom colour data for use by the colour dialog. + */ + static wxColourData GetColourData(); }; diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index 4aa190aa48..8a3fffe72e 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -92,6 +92,7 @@ END_EVENT_TABLE() IMPLEMENT_HELP_PROVISION(wxRichTextFormattingDialog) wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDialogFactory = NULL; +wxColourData wxRichTextFormattingDialog::sm_colourData; void wxRichTextFormattingDialog::Init() { @@ -762,7 +763,11 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) while (parent != NULL && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame)) parent = parent->GetParent(); + wxRichTextFormattingDialog* dlg = wxDynamicCast(parent, wxRichTextFormattingDialog); wxColourData data; + if (dlg) + data = dlg->GetColourData(); + data.SetChooseFull(true); data.SetColour(m_colour); #if wxUSE_COLOURDLG @@ -774,6 +779,8 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) if (dialog->ShowModal() == wxID_OK) { wxColourData retData = dialog->GetColourData(); + if (dlg) + dlg->SetColourData(retData); m_colour = retData.GetColour(); SetBackgroundColour(m_colour); }