foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes | Private Member Functions | Private Attributes
CMyElemWindow
+ Inheritance diagram for CMyElemWindow:

Public Member Functions

 BEGIN_MSG_MAP (ui_element_dummy) MESSAGE_HANDLER(WM_LBUTTONDOWN
 
 DECLARE_WND_CLASS_EX (TEXT("{DC2917D5-1288-4434-A28C-F16CFCE13C4B}"), CS_VREDRAW|CS_HREDRAW,(-1))
 
ui_element_config::ptr get_configuration ()
 
void initialize_window (HWND parent)
 
void notify (const GUID &p_what, t_size p_param1, const void *p_param2, t_size p_param2size)
 
void set_configuration (ui_element_config::ptr config)
 
- Public Member Functions inherited from ui_element_instance
virtual void edit_mode_context_menu_build (const POINT &p_point, bool p_fromkeyboard, HMENU p_menu, unsigned p_id_base)
 
virtual void edit_mode_context_menu_command (const POINT &p_point, bool p_fromkeyboard, unsigned p_id, unsigned p_id_base)
 
virtual bool edit_mode_context_menu_get_description (unsigned p_id, unsigned p_id_base, pfc::string_base &p_out)
 
virtual bool edit_mode_context_menu_get_focus_point (POINT &p_point)
 
virtual bool edit_mode_context_menu_test (const POINT &p_point, bool p_fromkeyboard)
 
 FB2K_MAKE_SERVICE_INTERFACE (ui_element_instance, service_base)
 
virtual double get_focus_priority ()
 
virtual bool get_focus_priority_subclass (double &p_out, const GUID &p_subclass)
 
virtual GUID get_guid ()=0
 
virtual ui_element_min_max_info get_min_max_info ()
 
virtual GUID get_subclass ()=0
 
virtual HWND get_wnd ()=0
 
virtual void set_default_focus ()
 
void set_default_focus_fallback ()
 
virtual bool set_default_focus_subclass (const GUID &p_subclass)
 
- 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 ()
 

Static Public Member Functions

static ui_element_config::ptr g_get_default_configuration ()
 
static const char * g_get_description ()
 
static GUID g_get_guid ()
 
static void g_get_name (pfc::string_base &out)
 
static GUID g_get_subclass ()
 

Data Fields

 OnLButtonDown
 

Protected Attributes

const ui_element_instance_callback_ptr m_callback
 

Private Member Functions

BOOL OnEraseBkgnd (CDCHandle)
 
LRESULT OnLButtonDown (UINT, WPARAM, LPARAM, BOOL &)
 
void OnPaint (CDCHandle)
 

Private Attributes

ui_element_config::ptr m_config
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Definition at line 4 of file ui_element.cpp.

Member Function Documentation

CMyElemWindow::BEGIN_MSG_MAP ( ui_element_dummy  )
CMyElemWindow::DECLARE_WND_CLASS_EX ( TEXT("{DC2917D5-1288-4434-A28C-F16CFCE13C4B}")  ,
CS_VREDRAW|  CS_HREDRAW,
(-1)   
)
static ui_element_config::ptr CMyElemWindow::g_get_default_configuration ( )
inlinestatic

Definition at line 28 of file ui_element.cpp.

static GUID g_get_guid()
Definition: ui_element.cpp:21
static service_ptr_t< ui_element_config > g_create_empty(const GUID &id=pfc::guid_null)
Definition: ui_element.h:20
static const char* CMyElemWindow::g_get_description ( )
inlinestatic

Definition at line 29 of file ui_element.cpp.

29 {return "This is a sample UI Element.";}
static GUID CMyElemWindow::g_get_guid ( )
inlinestatic

Definition at line 21 of file ui_element.cpp.

21  {
22  // This is our GUID. Substitute with your own when reusing code.
23  static const GUID guid_myelem = { 0xb46dc166, 0x88f3, 0x4b45, { 0x9f, 0x77, 0xab, 0x33, 0xf4, 0xc3, 0xf2, 0xe4 } };
24  return guid_myelem;
25  }
Definition: pfc.h:71
static void CMyElemWindow::g_get_name ( pfc::string_base out)
inlinestatic

Definition at line 27 of file ui_element.cpp.

27 {out = "Sample UI Element";}
static GUID CMyElemWindow::g_get_subclass ( )
inlinestatic

Definition at line 26 of file ui_element.cpp.

static const GUID ui_element_subclass_utility
Definition: ui_element.h:569
ui_element_config::ptr CMyElemWindow::get_configuration ( )
inlinevirtual

Retrieves element's current configuration. Returned object's GUID must be set to your element's GUID so your element can be re-instantiated with stored settings.

Implements ui_element_instance.

Definition at line 20 of file ui_element.cpp.

20 {return m_config;}
ui_element_config::ptr m_config
Definition: ui_element.cpp:36
void CMyElemWindow::initialize_window ( HWND  parent)
inline

Definition at line 9 of file ui_element.cpp.

9 {WIN32_OP(Create(parent,0,0,0,WS_EX_STATICEDGE) != NULL);}
void CMyElemWindow::notify ( const GUID p_what,
t_size  p_param1,
const void *  p_param2,
t_size  p_param2size 
)
virtual

Used by host to notify the element about various events. See ui_element_notify_* GUIDs for possible p_what parameter; meaning of other parameters depends on p_what value. Container classes should dispatch all notifications to their children.

Reimplemented from ui_element_instance.

Definition at line 41 of file ui_element.cpp.

41  {
43  // we use global colors and fonts - trigger a repaint whenever these change.
44  Invalidate();
45  }
46 }
static const GUID ui_element_notify_colors_changed
Dispatched through ui_element_instance::notify() when host changes color settings. Other parameters are not used and should be set to zero.
Definition: ui_element.h:533
static const GUID ui_element_notify_font_changed
Definition: ui_element.h:534
BOOL CMyElemWindow::OnEraseBkgnd ( CDCHandle  dc)
private

Definition at line 50 of file ui_element.cpp.

50  {
51  CRect rc; WIN32_OP_D( GetClientRect(&rc) );
52  CBrush brush;
53  WIN32_OP_D( brush.CreateSolidBrush( m_callback->query_std_color(ui_color_background) ) != NULL );
54  WIN32_OP_D( dc.FillRect(&rc, brush) );
55  return TRUE;
56 }
static const GUID ui_color_background
Definition: ui_element.h:87
const ui_element_instance_callback_ptr m_callback
Definition: ui_element.cpp:39
LRESULT CMyElemWindow::OnLButtonDown ( UINT  ,
WPARAM  ,
LPARAM  ,
BOOL  
)
inlineprivate

Definition at line 33 of file ui_element.cpp.

33 {m_callback->request_replace(this);return 0;}
const ui_element_instance_callback_ptr m_callback
Definition: ui_element.cpp:39
void CMyElemWindow::OnPaint ( CDCHandle  )
private

Definition at line 57 of file ui_element.cpp.

57  {
58  CPaintDC dc(*this);
59  dc.SetTextColor( m_callback->query_std_color(ui_color_text) );
60  dc.SetBkMode(TRANSPARENT);
61  SelectObjectScope fontScope(dc, (HGDIOBJ) m_callback->query_font_ex(ui_font_default) );
62  const UINT format = DT_NOPREFIX | DT_CENTER | DT_VCENTER | DT_SINGLELINE;
63  CRect rc;
64  WIN32_OP_D( GetClientRect(&rc) );
65  WIN32_OP_D( dc.DrawText(_T("This is a sample element."), -1, &rc, format) > 0 );
66 }
static const GUID ui_font_default
Definition: ui_element.h:91
static const GUID ui_color_text
Definition: ui_element.h:86
const ui_element_instance_callback_ptr m_callback
Definition: ui_element.cpp:39
void CMyElemWindow::set_configuration ( ui_element_config::ptr  data)
inlinevirtual

Alters element's current configuration. Specified ui_element_config's GUID must be the same as this element's GUID.

Implements ui_element_instance.

Definition at line 19 of file ui_element.cpp.

19 {m_config = config;}
ui_element_config::ptr m_config
Definition: ui_element.cpp:36

Field Documentation

const ui_element_instance_callback_ptr CMyElemWindow::m_callback
protected

Definition at line 39 of file ui_element.cpp.

ui_element_config::ptr CMyElemWindow::m_config
private

Definition at line 36 of file ui_element.cpp.

CMyElemWindow::OnLButtonDown

Definition at line 12 of file ui_element.cpp.


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