#include "wx/datetime.h"
#include "wx/image.h"
#include "wx/bookctrl.h"
+#include "wx/artprov.h"
+#include "wx/imaglist.h"
#if wxUSE_COLOURDLG
#include "wx/colordlg.h"
#if wxUSE_PROGRESSDLG
#if wxUSE_STOPWATCH && wxUSE_LONGLONG
- #include <wx/datetime.h> // wxDateTime
+ #include "wx/datetime.h" // wxDateTime
#endif
#include "wx/progdlg.h"
#if USE_SETTINGS_DIALOG
EVT_MENU(DIALOGS_PROPERTY_SHEET, MyFrame::OnPropertySheet)
+ EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK, MyFrame::OnPropertySheetToolBook)
#endif
EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention)
#if USE_SETTINGS_DIALOG
file_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Property Sheet Dialog\tCtrl-P"));
+ file_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, _T("Property Sheet Dialog using &ToolBook"));
#endif
file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
SettingsDialog dialog(this);
dialog.ShowModal();
}
+
+void MyFrame::OnPropertySheetToolBook(wxCommandEvent& WXUNUSED(event))
+{
+ SettingsDialog dialog(this, true);
+ dialog.ShowModal();
+}
#endif // USE_SETTINGS_DIALOG
void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
BEGIN_EVENT_TABLE(SettingsDialog, wxPropertySheetDialog)
END_EVENT_TABLE()
-SettingsDialog::SettingsDialog(wxWindow* win)
+SettingsDialog::SettingsDialog(wxWindow* win, bool useToolBook)
{
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
+ int tabImage1 = -1;
+ int tabImage2 = -1;
+
+ if (useToolBook)
+ {
+ tabImage1 = 0;
+ tabImage2 = 1;
+ SetSheetStyle(wxPROPSHEET_TOOLBOOK|wxPROPSHEET_SHRINKTOFIT);
+
+ // create a dummy image list with a few icons
+ const wxSize imageSize(32, 32);
+
+ m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
+ m_imageList->
+ Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize));
+ m_imageList->
+ Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize));
+ m_imageList->
+ Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize));
+ m_imageList->
+ Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize));
+ }
+ else
+ m_imageList = NULL;
+
Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE
#ifndef __WXWINCE__
|wxRESIZE_BORDER
#endif
);
- CreateButtons(wxOK|wxCANCEL
+
+ // If using a toolbook, also follow Mac style and don't create buttons
+ if (!useToolBook)
+ CreateButtons(wxOK|wxCANCEL
#ifndef __POCKETPC__
- |wxHELP
+ |wxHELP
#endif
);
wxBookCtrlBase* notebook = GetBookCtrl();
+ notebook->SetImageList(m_imageList);
wxPanel* generalSettings = CreateGeneralSettingsPage(notebook);
wxPanel* aestheticSettings = CreateAestheticSettingsPage(notebook);
- notebook->AddPage(generalSettings, _("General"));
- notebook->AddPage(aestheticSettings, _("Aesthetics"));
+ notebook->AddPage(generalSettings, _("General"), true, tabImage1);
+ notebook->AddPage(aestheticSettings, _("Aesthetics"), false, tabImage2);
LayoutDialog();
}
+SettingsDialog::~SettingsDialog()
+{
+ delete m_imageList;
+}
+
wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent)
{
wxPanel* panel = new wxPanel(parent, wxID_ANY);