From d33dd9ef43c2f46638b305b9098b29957be57c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 4 Jun 2004 15:57:12 +0000 Subject: [PATCH] remember custom palette changes done in wxColourDialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/dialogs/dialogs.cpp | 24 ++++++++++-------------- samples/dialogs/dialogs.h | 2 ++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index a2fd69d7ac..7eb014a3a8 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -224,30 +224,26 @@ MyFrame::MyFrame(wxWindow *parent, m_dlgFind = m_dlgReplace = NULL; #endif + + m_clrData.SetChooseFull(true); + for (int i = 0; i < 16; i++) + { + m_clrData.SetCustomColour(i, wxColour(i*16, i*16, i*16)); + } CreateStatusBar(); } void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) ) { - wxColour col = myCanvas->GetBackgroundColour(); + m_clrData.SetColour(myCanvas->GetBackgroundColour()); - wxColourData data; - data.SetColour(col); - data.SetChooseFull(TRUE); - for (int i = 0; i < 16; i++) - { - wxColour colour(i*16, i*16, i*16); - data.SetCustomColour(i, colour); - } - - wxColourDialog dialog(this, &data); + wxColourDialog dialog(this, &m_clrData); dialog.SetTitle(_T("Choose the background colour")); if (dialog.ShowModal() == wxID_OK) { - wxColourData retData = dialog.GetColourData(); - col = retData.GetColour(); - myCanvas->SetBackgroundColour(col); + m_clrData = dialog.GetColourData(); + myCanvas->SetBackgroundColour(m_clrData.GetColour()); myCanvas->ClearBackground(); myCanvas->Refresh(); } diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index dda293bf16..8b734dcacf 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -109,6 +109,8 @@ private: *m_dlgReplace; #endif // wxUSE_FINDREPLDLG + wxColourData m_clrData; + DECLARE_EVENT_TABLE() };