foobar2000 SDK  2015-01-14
Public Types | Public Member Functions | Static Public Member Functions
mainmenu_commandsabstract

#include <menu.h>

+ Inheritance diagram for mainmenu_commands:

Public Types

enum  {
  flag_disabled = 1<<0, flag_checked = 1<<1, flag_radiochecked = 1<<2, flag_defaulthidden = 1<<3,
  sort_priority_base = 0x10000, sort_priority_dontcare = 0x80000000, sort_priority_last = ~0
}
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

virtual void execute (t_uint32 p_index, service_ptr_t< service_base > p_callback)=0
 
 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (mainmenu_commands)
 
virtual GUID get_command (t_uint32 p_index)=0
 
virtual t_uint32 get_command_count ()=0
 
virtual bool get_description (t_uint32 p_index, pfc::string_base &p_out)=0
 
virtual bool get_display (t_uint32 p_index, pfc::string_base &p_text, t_uint32 &p_flags)
 
virtual void get_name (t_uint32 p_index, pfc::string_base &p_out)=0
 
virtual GUID get_parent ()=0
 
virtual t_uint32 get_sort_priority ()
 
- 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 bool g_execute (const GUID &p_guid, service_ptr_t< service_base > p_callback=NULL)
 
static bool g_execute_dynamic (const GUID &p_guid, const GUID &p_subGuid, service_ptr_t< service_base > p_callback=NULL)
 
static bool g_find_by_name (const char *p_name, GUID &p_guid)
 

Additional Inherited Members

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

Detailed Description

Definition at line 18 of file menu.h.

Member Enumeration Documentation

anonymous enum
Enumerator
flag_disabled 
flag_checked 
flag_radiochecked 
flag_defaulthidden 
Since
1.0 Replaces the old return-false-from-get_display() behavior - use this to make your command hidden by default but accessible when holding shift.
sort_priority_base 
sort_priority_dontcare 
sort_priority_last 

Definition at line 20 of file menu.h.

Member Function Documentation

virtual void mainmenu_commands::execute ( t_uint32  p_index,
service_ptr_t< service_base p_callback 
)
pure virtual

Executes the command. p_callback parameter is reserved for future use and should be ignored / set to null pointer.

Implemented in mainmenu_commands_sample.

mainmenu_commands::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( mainmenu_commands  )
bool mainmenu_commands::g_execute ( const GUID p_guid,
service_ptr_t< service_base p_callback = NULL 
)
static

Definition at line 11 of file mainmenu.cpp.

11  {
12  mainmenu_commands::ptr ptr; t_uint32 index;
13  if (!menu_item_resolver::g_resolve_main_command(p_guid, ptr, index)) return false;
14  ptr->execute(index, p_callback);
15  return true;
16 }
static bool g_resolve_main_command(const GUID &id, service_ptr_t< class mainmenu_commands > &out, t_uint32 &out_index)
uint32_t t_uint32
Definition: int_types.h:5
bool mainmenu_commands::g_execute_dynamic ( const GUID p_guid,
const GUID p_subGuid,
service_ptr_t< service_base p_callback = NULL 
)
static

Definition at line 3 of file mainmenu.cpp.

3  {
4  mainmenu_commands::ptr ptr; t_uint32 index;
5  if (!menu_item_resolver::g_resolve_main_command(p_guid, ptr, index)) return false;
6  mainmenu_commands_v2::ptr v2;
7  if (!ptr->service_query_t(v2)) return false;
8  if (!v2->is_command_dynamic(index)) return false;
9  return v2->dynamic_execute(index, p_subGuid, p_callback);
10 }
static bool g_resolve_main_command(const GUID &id, service_ptr_t< class mainmenu_commands > &out, t_uint32 &out_index)
uint32_t t_uint32
Definition: int_types.h:5
bool mainmenu_commands::g_find_by_name ( const char *  p_name,
GUID p_guid 
)
static

Definition at line 18 of file mainmenu.cpp.

18  {
22  while(e.next(ptr)) {
23  const t_uint32 count = ptr->get_command_count();
24  for(t_uint32 n=0;n<count;n++) {
25  ptr->get_name(n,temp);
26  if (stricmp_utf8(temp,p_name) == 0) {
27  p_guid = ptr->get_command(n);
28  return true;
29  }
30  }
31  }
32  return false;
33 
34 }
int SHARED_EXPORT stricmp_utf8(const char *p1, const char *p2)
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
string8_t< pfc::alloc_fast_aggressive > string8_fastalloc
Definition: string_base.h:435
uint32_t t_uint32
Definition: int_types.h:5
virtual GUID mainmenu_commands::get_command ( t_uint32  p_index)
pure virtual

Retrieves GUID of specified command.

Implemented in mainmenu_commands_sample.

virtual t_uint32 mainmenu_commands::get_command_count ( )
pure virtual

Retrieves number of implemented commands. Index parameter of other methods must be in 0....command_count-1 range.

Implemented in mainmenu_commands_sample.

virtual bool mainmenu_commands::get_description ( t_uint32  p_index,
pfc::string_base p_out 
)
pure virtual

Retrieves item's description for statusbar etc.

Implemented in mainmenu_commands_sample.

virtual bool mainmenu_commands::get_display ( t_uint32  p_index,
pfc::string_base p_text,
t_uint32 p_flags 
)
inlinevirtual

Retrieves display string and display flags to use when menu is about to be displayed. If returns false, menu item won't be displayed. You can create keyboard-shortcut-only commands by always returning false from get_display().

Definition at line 45 of file menu.h.

45 {p_flags = 0;get_name(p_index,p_text);return true;}
virtual void get_name(t_uint32 p_index, pfc::string_base &p_out)=0
Retrieves name of item, for list of commands to assign keyboard shortcuts to etc. ...
virtual void mainmenu_commands::get_name ( t_uint32  p_index,
pfc::string_base p_out 
)
pure virtual

Retrieves name of item, for list of commands to assign keyboard shortcuts to etc.

Implemented in mainmenu_commands_sample.

virtual GUID mainmenu_commands::get_parent ( )
pure virtual

Retrieves GUID of owning menu group.

Implemented in mainmenu_commands_sample.

virtual t_uint32 mainmenu_commands::get_sort_priority ( )
inlinevirtual

Retrieves sorting priority of the command; the lower the number, the upper in the menu your commands will appear. Third party components should use sorting_priority_base and up (values below are reserved for internal use). In case of equal priority, order is undefined.

Definition at line 43 of file menu.h.


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