- Page (wxSize panel_size, int border)
- : _border (border)
- , _panel (0)
- , _panel_size (panel_size)
- , _window_exists (false)
- {
- _config_connection = Config::instance()->Changed.connect (boost::bind (&Page::config_changed_wrapper, this));
- }
-
- virtual ~Page () {}
-
-protected:
- wxWindow* create_window (wxWindow* parent)
- {
- _panel = new wxPanel (parent, wxID_ANY, wxDefaultPosition, _panel_size);
- wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
- _panel->SetSizer (s);
-
- setup ();
- _window_exists = true;
- config_changed ();
-
- _panel->Bind (wxEVT_DESTROY, boost::bind (&Page::window_destroyed, this));
-
- return _panel;
- }
-
- int _border;
- wxPanel* _panel;
-
-private:
- virtual void config_changed () = 0;
- virtual void setup () = 0;
-
- void config_changed_wrapper ()
- {
- if (_window_exists) {
- config_changed ();
- }
- }
-
- void window_destroyed ()
- {
- _window_exists = false;
- }
-
- wxSize _panel_size;
- boost::signals2::scoped_connection _config_connection;
- bool _window_exists;
-};
-
-class StockPage : public wxStockPreferencesPage, public Page
-{
-public:
- StockPage (Kind kind, wxSize panel_size, int border)
- : wxStockPreferencesPage (kind)
- , Page (panel_size, border)
- {}
-
- wxWindow* CreateWindow (wxWindow* parent)
- {
- return create_window (parent);
- }
-};
-
-class StandardPage : public wxPreferencesPage, public Page
-{
-public:
- StandardPage (wxSize panel_size, int border)
- : Page (panel_size, border)
- {}
-
- wxWindow* CreateWindow (wxWindow* parent)
- {
- return create_window (parent);
- }
-};
-
-class GeneralPage : public StockPage
-{
-public:
- GeneralPage (wxSize panel_size, int border)
- : StockPage (Kind_General, panel_size, border)