foobar2000 SDK  2015-08-03
Public Types | Public Member Functions | Data Fields
CMyPreferences
+ Inheritance diagram for CMyPreferences:

Public Types

enum  { IDD = IDD_MYPREFERENCES }
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

 CMyPreferences (preferences_page_callback::ptr callback)
 
void apply ()
 
 BEGIN_MSG_MAP (CMyPreferences) MSG_WM_INITDIALOG(OnInitDialog) COMMAND_HANDLER_EX(IDC_BOGO1
 
t_uint32 get_state ()
 
bool HasChanged ()
 
void OnChanged ()
 
OnEditChange COMMAND_HANDLER_EX(IDC_BOGO2, EN_CHANGE, OnEditChange) END_MSG_MAP() private void OnEditChange (UINT, int, CWindow)
 
void reset ()
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 

Data Fields

 EN_CHANGE
 
const preferences_page_callback::ptr m_callback
 

Additional Inherited Members

- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Definition at line 28 of file preferences.cpp.

Member Enumeration Documentation

anonymous enum
Enumerator
IDD 

Definition at line 38 of file preferences.cpp.

38 {IDD = IDD_MYPREFERENCES};

Constructor & Destructor Documentation

CMyPreferences::CMyPreferences ( preferences_page_callback::ptr  callback)
inline

Definition at line 31 of file preferences.cpp.

31 : m_callback(callback) {}
const preferences_page_callback::ptr m_callback
Definition: preferences.cpp:56

Member Function Documentation

void CMyPreferences::apply ( )
virtual

Applies preferences changes.

Implements preferences_page_instance.

Definition at line 82 of file preferences.cpp.

82  {
83  cfg_bogoSetting1 = GetDlgItemInt(IDC_BOGO1, NULL, FALSE);
84  cfg_bogoSetting2 = GetDlgItemInt(IDC_BOGO2, NULL, FALSE);
85 
86  OnChanged(); //our dialog content has not changed but the flags have - our currently shown values now match the settings so the apply button can be disabled
87 }
static cfg_uint cfg_bogoSetting2(guid_cfg_bogoSetting2, default_cfg_bogoSetting2)
static cfg_uint cfg_bogoSetting1(guid_cfg_bogoSetting1, default_cfg_bogoSetting1)
CMyPreferences::BEGIN_MSG_MAP ( CMyPreferences  )
t_uint32 CMyPreferences::get_state ( )

Definition at line 70 of file preferences.cpp.

70  {
72  if (HasChanged()) state |= preferences_state::changed;
73  return state;
74 }
uint32_t t_uint32
Definition: int_types.h:5
bool CMyPreferences::HasChanged ( )

Definition at line 89 of file preferences.cpp.

89  {
90  //returns whether our dialog content is different from the current configuration (whether the apply button should be enabled or not)
91  return GetDlgItemInt(IDC_BOGO1, NULL, FALSE) != cfg_bogoSetting1 || GetDlgItemInt(IDC_BOGO2, NULL, FALSE) != cfg_bogoSetting2;
92 }
static cfg_uint cfg_bogoSetting2(guid_cfg_bogoSetting2, default_cfg_bogoSetting2)
static cfg_uint cfg_bogoSetting1(guid_cfg_bogoSetting1, default_cfg_bogoSetting1)
void CMyPreferences::OnChanged ( )

Definition at line 93 of file preferences.cpp.

93  {
94  //tell the host that our state has changed to enable/disable the apply button appropriately.
95  m_callback->on_state_changed();
96 }
const preferences_page_callback::ptr m_callback
Definition: preferences.cpp:56
void CMyPreferences::OnEditChange ( UINT  ,
int  ,
CWindow   
)

Definition at line 65 of file preferences.cpp.

65  {
66  // not much to do here
67  OnChanged();
68 }
void CMyPreferences::reset ( )
virtual

Resets this page's content to the default values. Does not apply any changes - lets user preview the changes before hitting "apply".

Implements preferences_page_instance.

Definition at line 76 of file preferences.cpp.

76  {
77  SetDlgItemInt(IDC_BOGO1, default_cfg_bogoSetting1, FALSE);
78  SetDlgItemInt(IDC_BOGO2, default_cfg_bogoSetting2, FALSE);
79  OnChanged();
80 }

Field Documentation

CMyPreferences::EN_CHANGE

Definition at line 47 of file preferences.cpp.

const preferences_page_callback::ptr CMyPreferences::m_callback

Definition at line 56 of file preferences.cpp.


The documentation for this class was generated from the following file: