foobar2000 SDK  2015-08-03
Data Structures | Public Types | Public Member Functions | Private Member Functions
contextmenu_item_simpleabstract

#include <contextmenu.h>

+ Inheritance diagram for contextmenu_item_simple:

Data Structures

class  contextmenu_item_node_impl
 

Public Types

enum  t_flags {
  FLAG_CHECKED = 1, FLAG_DISABLED = 2, FLAG_GRAYED = 4, FLAG_DISABLED_GRAYED = FLAG_DISABLED|FLAG_GRAYED,
  FLAG_RADIOCHECKED = 8
}
 
- Public Types inherited from contextmenu_item
enum  t_enabled_state { FORCE_OFF, DEFAULT_OFF, DEFAULT_ON }
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

virtual void context_command (unsigned p_index, metadb_handle_list_cref p_data, const GUID &p_caller)=0
 
virtual bool context_get_display (unsigned p_index, metadb_handle_list_cref p_data, pfc::string_base &p_out, unsigned &p_displayflags, const GUID &p_caller)
 
virtual t_enabled_state get_enabled_state (unsigned p_index)
 
virtual bool get_item_description (unsigned p_index, pfc::string_base &p_out)=0
 
virtual GUID get_item_guid (unsigned p_index)=0
 
virtual void get_item_name (unsigned p_index, pfc::string_base &p_out)=0
 
virtual unsigned get_num_items ()=0
 
- Public Member Functions inherited from contextmenu_item
 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (contextmenu_item)
 
virtual void get_item_default_path (unsigned p_index, pfc::string_base &p_out)
 
GUID get_parent_ ()
 
GUID get_parent_fallback ()
 
bool item_get_display_data (pfc::string_base &p_out, unsigned &displayflags, unsigned p_index, const GUID &p_node, metadb_handle_list_cref p_data, const GUID &p_caller)
 
bool item_get_display_data_root (pfc::string_base &p_out, unsigned &displayflags, unsigned p_index, metadb_handle_list_cref p_data, const GUID &p_caller)
 
- 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

virtual bool get_display_data (unsigned n, metadb_handle_list_cref data, pfc::string_base &p_out, unsigned &displayflags, const GUID &caller)
 
contextmenu_item_node_rootinstantiate_item (unsigned p_index, metadb_handle_list_cref p_data, const GUID &p_caller)
 
void item_execute_simple (unsigned p_index, const GUID &p_node, metadb_handle_list_cref p_data, const GUID &p_caller)
 
virtual bool item_is_mappable_shortcut (unsigned p_index)
 

Additional Inherited Members

- Static Public Attributes inherited from contextmenu_item
static const GUID caller_active_playlist
 
static const GUID caller_active_playlist_selection
 
static const GUID caller_keyboard_shortcut_list
 
static const GUID caller_media_library_viewer
 
static const GUID caller_now_playing
 
static const GUID caller_playlist = caller_active_playlist_selection
 
static const GUID caller_playlist_manager
 
static const GUID caller_undefined
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

contextmenu_item implementation helper for implementing non-dynamically-generated context menu items; derive from this instead of from contextmenu_item directly if your menu items are static.

Definition at line 153 of file contextmenu.h.

Member Enumeration Documentation

Same as contextmenu_item_node::t_flags.

Enumerator
FLAG_CHECKED 
FLAG_DISABLED 
FLAG_GRAYED 
FLAG_DISABLED_GRAYED 
FLAG_RADIOCHECKED 

Definition at line 157 of file contextmenu.h.

Member Function Documentation

virtual void contextmenu_item_simple::context_command ( unsigned  p_index,
metadb_handle_list_cref  p_data,
const GUID p_caller 
)
pure virtual

Implemented in myitem.

virtual bool contextmenu_item_simple::context_get_display ( unsigned  p_index,
metadb_handle_list_cref  p_data,
pfc::string_base p_out,
unsigned &  p_displayflags,
const GUID p_caller 
)
inlinevirtual

Reimplemented in myitem.

Definition at line 172 of file contextmenu.h.

172  {
173  PFC_ASSERT(p_index>=0 && p_index<get_num_items());
174  get_item_name(p_index,p_out);
175  return true;
176  }
virtual unsigned get_num_items()=0
Retrieves number of menu items provided by this contextmenu_item implementation.
virtual void get_item_name(unsigned p_index, pfc::string_base &p_out)=0
Retrieves human-readable name of the context menu item.
virtual bool contextmenu_item_simple::get_display_data ( unsigned  n,
metadb_handle_list_cref  data,
pfc::string_base p_out,
unsigned &  displayflags,
const GUID caller 
)
inlineprivatevirtual

Definition at line 213 of file contextmenu.h.

214  {
215  bool rv = false;
216  assert(n>=0 && n<get_num_items());
217  if (data.get_count()>0)
218  {
219  rv = context_get_display(n,data,p_out,displayflags,caller);
220  }
221  return rv;
222  }
virtual unsigned get_num_items()=0
Retrieves number of menu items provided by this contextmenu_item implementation.
virtual bool context_get_display(unsigned p_index, metadb_handle_list_cref p_data, pfc::string_base &p_out, unsigned &p_displayflags, const GUID &p_caller)
Definition: contextmenu.h:172
virtual t_size get_count() const =0
virtual t_enabled_state contextmenu_item_simple::get_enabled_state ( unsigned  p_index)
inlinevirtual

Controls default state of context menu preferences for this item:
Return DEFAULT_ON to show this item in the context menu by default - useful for most cases.
Return DEFAULT_OFF to hide this item in the context menu by default - useful for rarely used utility commands.
Return FORCE_OFF to hide this item by default and prevent the user from making it visible (very rarely used).
Values returned by this method should be constant for this context menu item and not change later. Do not use this to conditionally hide the item - return false from get_display_data() instead.

Implements contextmenu_item.

Definition at line 168 of file contextmenu.h.

virtual bool contextmenu_item_simple::get_item_description ( unsigned  p_index,
pfc::string_base p_out 
)
pure virtual

Retrieves item's description to show in the status bar. Set p_out to the string to be displayed and return true if you provide a description, return false otherwise.

Implements contextmenu_item.

Implemented in myitem.

virtual GUID contextmenu_item_simple::get_item_guid ( unsigned  p_index)
pure virtual

Retrieves GUID of the context menu item.

Implements contextmenu_item.

Implemented in myitem.

virtual void contextmenu_item_simple::get_item_name ( unsigned  p_index,
pfc::string_base p_out 
)
pure virtual

Retrieves human-readable name of the context menu item.

Implements contextmenu_item.

Implemented in myitem.

virtual unsigned contextmenu_item_simple::get_num_items ( )
pure virtual

Retrieves number of menu items provided by this contextmenu_item implementation.

Implements contextmenu_item.

Implemented in myitem.

contextmenu_item_node_root* contextmenu_item_simple::instantiate_item ( unsigned  p_index,
metadb_handle_list_cref  p_data,
const GUID p_caller 
)
inlineprivatevirtual

Instantiates a context menu item (including sub-node tree for items that contain dynamically-generated sub-items).

Implements contextmenu_item.

Definition at line 195 of file contextmenu.h.

196  {
197  return new contextmenu_item_node_impl(this,p_index);
198  }
void contextmenu_item_simple::item_execute_simple ( unsigned  p_index,
const GUID p_node,
metadb_handle_list_cref  p_data,
const GUID p_caller 
)
inlineprivatevirtual

Executes the menu item command without going thru the instantiate_item path. For items with dynamically-generated sub-items, p_node is identifies of the sub-item command to execute.

Implements contextmenu_item.

Definition at line 201 of file contextmenu.h.

202  {
203  if (p_node == pfc::guid_null)
204  context_command(p_index,p_data,p_caller);
205  }
virtual void context_command(unsigned p_index, metadb_handle_list_cref p_data, const GUID &p_caller)=0
const GUID guid_null
Definition: guid.cpp:175
virtual bool contextmenu_item_simple::item_is_mappable_shortcut ( unsigned  p_index)
inlineprivatevirtual

Definition at line 207 of file contextmenu.h.

208  {
209  return true;
210  }

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