foobar2000 SDK  2015-08-03
Public Member Functions | Private Member Functions
ui_element_instance_callbackabstract

#include <ui_element.h>

+ Inheritance diagram for ui_element_instance_callback:

Public Member Functions

t_uint32 get_dialog_texture (ui_element_instance *source)
 
bool is_border_needed (ui_element_instance *source)
 
virtual bool is_edit_mode_enabled ()=0
 
bool is_elem_visible_ (service_ptr_t< class ui_element_instance > elem)
 
t_size notify_ (ui_element_instance *source, const GUID &what, t_size param1, const void *param2, t_size param2size)
 
virtual void on_alt_pressed (bool p_state)=0
 
virtual void on_min_max_info_change ()=0
 
virtual bool query_color (const GUID &p_what, t_ui_color &p_out)=0
 
t_ui_font query_font ()
 
virtual t_ui_font query_font_ex (const GUID &p_what)=0
 
t_ui_color query_std_color (const GUID &p_what)
 
virtual bool request_activation (service_ptr_t< class ui_element_instance > p_item)=0
 
virtual void request_replace (service_ptr_t< class ui_element_instance > p_item)=0
 
bool set_elem_label (ui_element_instance *source, const char *label)
 
- 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 ()
 

Private Member Functions

 FB2K_MAKE_SERVICE_INTERFACE (ui_element_instance_callback, service_base)
 

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

Callback class passed by a UI element host to a UI element instance, allowing each UI element instance to communicate with its host.
Each ui_element_instance_callback implementation must also implement ui_element_instance_callback_v2.

Definition at line 138 of file ui_element.h.

Member Function Documentation

ui_element_instance_callback::FB2K_MAKE_SERVICE_INTERFACE ( ui_element_instance_callback  ,
service_base   
)
private
t_uint32 ui_element_instance_callback::get_dialog_texture ( ui_element_instance source)

Definition at line 112 of file ui_element.cpp.

112  {
113  return (t_uint32) notify_(source, ui_element_host_notify_get_dialog_texture, 0, NULL, 0);
114 }
static const GUID ui_element_host_notify_get_dialog_texture
Definition: ui_element.h:546
t_size notify_(ui_element_instance *source, const GUID &what, t_size param1, const void *param2, t_size param2size)
Definition: ui_element.cpp:120
uint32_t t_uint32
Definition: int_types.h:5
bool ui_element_instance_callback::is_border_needed ( ui_element_instance source)

Definition at line 116 of file ui_element.cpp.

116  {
117  return notify_(source, ui_element_host_notify_is_border_needed, 0, NULL, 0) != 0;
118 }
static const GUID ui_element_host_notify_is_border_needed
Definition: ui_element.h:547
t_size notify_(ui_element_instance *source, const GUID &what, t_size param1, const void *param2, t_size param2size)
Definition: ui_element.cpp:120
virtual bool ui_element_instance_callback::is_edit_mode_enabled ( )
pure virtual

Queries whether "edit mode" is enabled. Most of UI element editing functionality should be locked when it's not.

Implemented in ui_element_instance_callback_impl< t_receiver >.

bool ui_element_instance_callback::is_elem_visible_ ( service_ptr_t< class ui_element_instance elem)

Definition at line 99 of file ui_element.cpp.

99  {
100  ui_element_instance_callback_v2::ptr v2;
101  if (!this->service_query_t(v2)) {
102  PFC_ASSERT(!"Should not get here - somebody implemented ui_element_instance_callback but not ui_element_instance_callback_v2.");
103  return true;
104  }
105  return v2->is_elem_visible(elem);
106 }
bool service_query_t(service_ptr_t< T > &p_out)
Queries whether the object supports specific interface and retrieves a pointer to that interface...
Definition: service.h:350
t_size ui_element_instance_callback::notify_ ( ui_element_instance source,
const GUID what,
t_size  param1,
const void *  param2,
t_size  param2size 
)

Definition at line 120 of file ui_element.cpp.

120  {
121  ui_element_instance_callback_v3::ptr v3;
122  if (!this->service_query_t(v3)) { PFC_ASSERT(!"Outdated UI Element host implementation"); return 0; }
123  return v3->notify(source, what, param1, param2, param2size);
124 }
bool service_query_t(service_ptr_t< T > &p_out)
Queries whether the object supports specific interface and retrieves a pointer to that interface...
Definition: service.h:350
virtual void ui_element_instance_callback::on_alt_pressed ( bool  p_state)
pure virtual

Deprecated, does nothing.

Implemented in ui_element_instance_callback_impl< t_receiver >.

virtual void ui_element_instance_callback::on_min_max_info_change ( )
pure virtual
virtual bool ui_element_instance_callback::query_color ( const GUID p_what,
t_ui_color p_out 
)
pure virtual

Returns true on success, false when the color is undefined and defaults such as global windows settings should be used.

Implemented in ui_element_instance_callback_impl< t_receiver >.

t_ui_font ui_element_instance_callback::query_font ( )
inline

Deprecated - use query_font_ex. Equivalent to query_font_ex(ui_font_default).

Definition at line 158 of file ui_element.h.

static const GUID ui_font_default
Definition: ui_element.h:91
virtual t_ui_font query_font_ex(const GUID &p_what)=0
Retrieves an user-configurable font to use for specified kind of display. See ui_font_* constant for ...
virtual t_ui_font ui_element_instance_callback::query_font_ex ( const GUID p_what)
pure virtual

Retrieves an user-configurable font to use for specified kind of display. See ui_font_* constant for possible parameters.

Implemented in ui_element_instance_callback_impl< t_receiver >.

t_ui_color ui_element_instance_callback::query_std_color ( const GUID p_what)

Helper - a wrapper around query_color(), if the color is not user-overridden, returns relevant system color.

Definition at line 78 of file ui_element.cpp.

78  {
79 #ifdef _WIN32
80  t_ui_color ret;
81  if (query_color(p_what,ret)) return ret;
82  int idx = ui_color_to_sys_color_index(p_what);
83  if (idx < 0) return 0;//should not be triggerable
84  return GetSysColor(idx);
85 #else
86 #error portme
87 #endif
88 }
virtual bool query_color(const GUID &p_what, t_ui_color &p_out)=0
Returns true on success, false when the color is undefined and defaults such as global windows settin...
COLORREF t_ui_color
Definition: ui_element.h:82
static int ui_color_to_sys_color_index(const GUID &p_guid)
Definition: ui_element.h:102
virtual bool ui_element_instance_callback::request_activation ( service_ptr_t< class ui_element_instance p_item)
pure virtual

Tells the host that specified element wants to activate itself as a result of some kind of external user command (eg. menu command). Host should ensure that requesting child element's window is visible.
.

Returns
True when relevant child element window has been properly made visible and requesting code should proceed to SetFocus their window etc, false when denied.

Implemented in ui_element_instance_callback_impl< t_receiver >.

virtual void ui_element_instance_callback::request_replace ( service_ptr_t< class ui_element_instance p_item)
pure virtual

Tells the host that the user has requested the element to be replaced with another one. Note: this is generally used only when "edit mode" is enabled, but legal to call when it's not (eg. dummy element calls it regardless of settings when clicked).

Implemented in ui_element_instance_callback_impl< t_receiver >.

bool ui_element_instance_callback::set_elem_label ( ui_element_instance source,
const char *  label 
)

Definition at line 108 of file ui_element.cpp.

108  {
109  return notify_(source, ui_element_host_notify_set_elem_label, 0, label, strlen(label)) != 0;
110 }
static const GUID ui_element_host_notify_set_elem_label
Set to ui_element_instance_callback_v3 to set our element&#39;s label. Param1 is ignored, param2 is a pointer to a UTF-8 string containing the new label. Return value is 1 if the label is user-visible, 0 if the host does not support displaying overridden labels.
Definition: ui_element.h:545
t_size notify_(ui_element_instance *source, const GUID &what, t_size param1, const void *param2, t_size param2size)
Definition: ui_element.cpp:120

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