2010-07-19 19:53:29 +02:00
|
|
|
// Copyright (c) 2010, Amar Takhar <verm@aegisub.org>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
/// @file preferences_base.h
|
|
|
|
/// @brief Base preferences dialogue classes
|
|
|
|
/// @see preferences_base.cpp
|
|
|
|
/// @ingroup configuration_ui
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/scrolwin.h>
|
|
|
|
|
2010-08-26 20:38:20 +02:00
|
|
|
class Preferences;
|
2013-01-04 16:01:50 +01:00
|
|
|
class wxControl;
|
|
|
|
class wxFlexGridSizer;
|
|
|
|
class wxSizer;
|
|
|
|
class wxString;
|
|
|
|
class wxTreebook;
|
2010-08-26 20:38:20 +02:00
|
|
|
|
2012-04-11 05:43:08 +02:00
|
|
|
class OptionPage : public wxScrolled<wxPanel> {
|
2011-10-11 02:06:44 +02:00
|
|
|
template<class T>
|
|
|
|
void Add(wxSizer *sizer, wxString const& label, T *control);
|
2014-05-31 05:32:07 +02:00
|
|
|
public:
|
2010-07-19 19:53:29 +02:00
|
|
|
enum Style {
|
|
|
|
PAGE_DEFAULT = 0x00000000,
|
|
|
|
PAGE_SCROLL = 0x00000001,
|
|
|
|
PAGE_SUB = 0x00000002
|
|
|
|
};
|
|
|
|
|
|
|
|
wxSizer *sizer;
|
2010-08-26 20:38:20 +02:00
|
|
|
Preferences *parent;
|
2014-05-31 05:32:07 +02:00
|
|
|
wxFlexGridSizer *PageSizer(wxString name);
|
2012-02-28 02:22:40 +01:00
|
|
|
|
2011-10-11 02:06:44 +02:00
|
|
|
void CellSkip(wxFlexGridSizer *flex);
|
2013-08-18 00:06:07 +02:00
|
|
|
wxControl *OptionAdd(wxFlexGridSizer *flex, const wxString &name, const char *opt_name, double min=0, double max=INT_MAX, double inc=1);
|
2011-10-11 02:06:44 +02:00
|
|
|
void OptionChoice(wxFlexGridSizer *flex, const wxString &name, const wxArrayString &choices, const char *opt_name);
|
2013-11-21 18:13:36 +01:00
|
|
|
void OptionBrowse(wxFlexGridSizer *flex, const wxString &name, const char *opt_name, wxControl *enabler = nullptr, bool do_enable = false);
|
2011-10-11 02:06:44 +02:00
|
|
|
void OptionFont(wxSizer *sizer, std::string opt_prefix);
|
2012-02-28 02:22:40 +01:00
|
|
|
|
|
|
|
/// Enable ctrl only when cbx is checked
|
|
|
|
void EnableIfChecked(wxControl *cbx, wxControl *ctrl);
|
|
|
|
/// Enable ctrl only when cbx is not checked
|
|
|
|
void DisableIfChecked(wxControl *cbx, wxControl *ctrl);
|
2012-04-11 05:43:08 +02:00
|
|
|
|
|
|
|
OptionPage(wxTreebook *book, Preferences *parent, wxString name, int style = PAGE_DEFAULT);
|
2010-07-19 19:53:29 +02:00
|
|
|
};
|