fix dialogs sample to remember last color with generic color dialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton 2004-11-18 16:20:04 +00:00
parent 40210d8a0a
commit 1e72e3cc53

View File

@ -421,6 +421,36 @@ void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
}
#endif // wxUSE_COLOURDLG
#if USE_COLOURDLG_GENERIC
void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
{
m_clrData.SetColour(myCanvas->GetBackgroundColour());
//FIXME:TODO:This has no effect...
m_clrData.SetChooseFull(true);
for (int i = 0; i < 16; i++)
{
wxColour colour(
(unsigned char)(i*16),
(unsigned char)(i*16),
(unsigned char)(i*16)
);
m_clrData.SetCustomColour(i, colour);
}
wxGenericColourDialog *dialog = new wxGenericColourDialog(this, &m_clrData);
if (dialog->ShowModal() == wxID_OK)
{
m_clrData = dialog->GetColourData();
myCanvas->SetBackgroundColour(m_clrData.GetColour());
myCanvas->ClearBackground();
myCanvas->Refresh();
}
dialog->Destroy();
}
#endif // USE_COLOURDLG_GENERIC
#if wxUSE_FONTDLG
void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
{
@ -446,35 +476,6 @@ void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
}
#endif // wxUSE_FONTDLG
#if USE_COLOURDLG_GENERIC
void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
{
wxColourData data;
data.SetChooseFull(true);
for (int i = 0; i < 16; i++)
{
wxColour colour(
(unsigned char)(i*16),
(unsigned char)(i*16),
(unsigned char)(i*16)
);
data.SetCustomColour(i, colour);
}
wxGenericColourDialog *dialog = new wxGenericColourDialog(this, &data);
if (dialog->ShowModal() == wxID_OK)
{
wxColourData retData = dialog->GetColourData();
wxColour col = retData.GetColour();
// wxBrush *brush = wxTheBrushList->FindOrCreateBrush(&col, wxSOLID);
myCanvas->SetBackgroundColour(col);
myCanvas->ClearBackground();
myCanvas->Refresh();
}
dialog->Destroy();
}
#endif // USE_COLOURDLG_GENERIC
#if USE_FONTDLG_GENERIC
void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) )
{