foobar2000 SDK  2015-08-03
preferences_page.h
Go to the documentation of this file.
1 class NOVTABLE preferences_page : public service_base {
4 public:
6  virtual HWND create(HWND p_parent) = 0;
8  virtual const char * get_name() = 0;
10  virtual GUID get_guid() = 0;
12  virtual GUID get_parent_guid() = 0;
14  virtual bool reset_query() = 0;
16  virtual void reset() = 0;
18  virtual bool get_help_url(pfc::string_base & p_out);
19 
20  static void get_help_url_helper(pfc::string_base & out, const char * category, const GUID & id, const char * name);
21 
22  static const GUID guid_root, guid_hidden, guid_tools,guid_core,guid_display,guid_playback,guid_visualisations,guid_input,guid_tag_writing,guid_media_library, guid_tagging;
23 
24  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(preferences_page);
25 };
26 
27 class NOVTABLE preferences_page_v2 : public preferences_page {
28 public:
30  virtual double get_sort_priority() {return 0;}
31 
32  FB2K_MAKE_SERVICE_INTERFACE(preferences_page_v2,preferences_page);
33 };
34 
35 template<class T>
37 
39 class NOVTABLE preferences_branch : public service_base {
40 public:
42  virtual const char * get_name() = 0;
44  virtual GUID get_guid() = 0;
46  virtual GUID get_parent_guid() = 0;
47 
48 
49  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(preferences_branch);
50 };
51 
53 public:
55  virtual double get_sort_priority() {return 0;}
56 
57  FB2K_MAKE_SERVICE_INTERFACE(preferences_branch_v2,preferences_branch);
58 };
59 
61 public:
62  preferences_branch_impl(const GUID & p_guid,const GUID & p_parent,const char * p_name,double p_sort_priority = 0) : m_guid(p_guid), m_parent(p_parent), m_name(p_name), m_sort_priority(p_sort_priority) {}
63  const char * get_name() {return m_name;}
64  GUID get_guid() {return m_guid;}
65  GUID get_parent_guid() {return m_parent;}
66  double get_sort_priority() {return m_sort_priority;}
67 private:
68  const GUID m_guid,m_parent;
70  const double m_sort_priority;
71 };
72 
74 
78 public:
79  preferences_branch_factory(const GUID & p_guid,const GUID & p_parent,const char * p_name,double p_sort_priority = 0) : _preferences_branch_factory(p_guid,p_parent,p_name,p_sort_priority) {}
80 };
81 
82 
83 
84 
86 public:
87  enum {
88  changed = 1,
89  needs_restart = 2,
90  needs_restart_playback = 4,
91  resettable = 8,
92 
97  busy = 16,
98  };
99 };
100 
102  FB2K_MAKE_SERVICE_INTERFACE(preferences_page_callback, service_base)
103 public:
104  virtual void on_state_changed() = 0;
105 };
106 
114  FB2K_MAKE_SERVICE_INTERFACE(preferences_page_instance, service_base)
115 public:
117  virtual t_uint32 get_state() = 0;
119  virtual HWND get_wnd() = 0;
121  virtual void apply() = 0;
123  virtual void reset() = 0;
124 };
125 
129  FB2K_MAKE_SERVICE_INTERFACE(preferences_page_v3, preferences_page_v2)
130 public:
131  virtual preferences_page_instance::ptr instantiate(HWND parent, preferences_page_callback::ptr callback) = 0;
132 private:
133  HWND create(HWND p_parent) {throw pfc::exception_not_implemented();} //stub
134  bool reset_query() {return false;} //stub - the new apply-friendly reset should be used instead.
135  void reset() {} //stub
136 };
Creates a preferences branch - an empty page that only serves as a parent for other pages and is hidd...
service_factory_single_t< preferences_branch_impl > _preferences_branch_factory
GUID get_guid()
Retrieves GUID of the preferences branch. Use this GUID as parent GUID for pages/branches nested in t...
preferences_branch_impl(const GUID &p_guid, const GUID &p_parent, const char *p_name, double p_sort_priority=0)
Definition: pfc.h:71
GUID get_parent_guid()
Retrieves GUID of parent page/branch of this branch. See preferences_page::guid_* constants for list ...
virtual double get_sort_priority()
Allows custom sorting order of preferences pages. Return lower value for higher priority (lower resul...
virtual double get_sort_priority()
Allows custom sorting order of preferences pages. Return lower value for higher priority (lower resul...
HWND create(HWND p_parent)
Obsolete.
preferences_branch_factory(const GUID &p_guid, const GUID &p_parent, const char *p_name, double p_sort_priority=0)
static const GUID guid_visualisations
bool reset_query()
Obsolete.
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
void reset()
Obsolete.
Implementing this service will generate a page in preferences dialog. Use preferences_page_factory_t ...
const pfc::string8 m_name
void create(pfc::string_formatter &p_out, const t_entry_list &p_data)
Definition: cue_creator.cpp:44
Instantiating this class declares a preferences branch with specified parameters. Usage: static prefe...
const char * get_name()
Retrieves name of the preferences branch.
double get_sort_priority()
Allows custom sorting order of preferences pages. Return lower value for higher priority (lower resul...
uint32_t t_uint32
Definition: int_types.h:5