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

Public Types

enum  { cmd_test = 0, cmd_playbackstate, cmd_total }
 
- Public Types inherited from mainmenu_commands
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

void execute (t_uint32 p_index, service_ptr_t< service_base > p_callback)
 
GUID get_command (t_uint32 p_index)
 
t_uint32 get_command_count ()
 
bool get_description (t_uint32 p_index, pfc::string_base &p_out)
 
void get_name (t_uint32 p_index, pfc::string_base &p_out)
 
GUID get_parent ()
 
- Public Member Functions inherited from mainmenu_commands
 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (mainmenu_commands)
 
virtual bool get_display (t_uint32 p_index, pfc::string_base &p_text, t_uint32 &p_flags)
 
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 ()
 

Additional Inherited Members

- Static Public Member Functions inherited from mainmenu_commands
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)
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Definition at line 9 of file mainmenu.cpp.

Member Enumeration Documentation

anonymous enum
Enumerator
cmd_test 
cmd_playbackstate 
cmd_total 

Definition at line 11 of file mainmenu.cpp.

Member Function Documentation

void mainmenu_commands_sample::execute ( t_uint32  p_index,
service_ptr_t< service_base p_callback 
)
inlinevirtual

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

Implements mainmenu_commands.

Definition at line 45 of file mainmenu.cpp.

45  {
46  switch(p_index) {
47  case cmd_test:
48  popup_message::g_show("This is a sample menu command.", "Blah");
49  break;
50  case cmd_playbackstate:
52  break;
53  default:
54  uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
55  }
56  }
void RunPlaybackStateDemo()
static void g_show(const char *p_msg, const char *p_title, t_icon p_icon=icon_information)
Static helper function instantiating the service and activating the message dialog. See show() for description of parameters.
Definition: popup_message.h:26
PFC_NORETURN void SHARED_EXPORT uBugCheck()
GUID mainmenu_commands_sample::get_command ( t_uint32  p_index)
inlinevirtual

Retrieves GUID of specified command.

Implements mainmenu_commands.

Definition at line 19 of file mainmenu.cpp.

19  {
20  static const GUID guid_test = { 0x7c4726df, 0x3b2d, 0x4c7c, { 0xad, 0xe8, 0x43, 0xd8, 0x46, 0xbe, 0xce, 0xa8 } };
21  static const GUID guid_playbackstate = { 0xbd880c51, 0xf0cc, 0x473f, { 0x9d, 0x14, 0xa6, 0x6e, 0x8c, 0xed, 0x25, 0xae } };
22  switch(p_index) {
23  case cmd_test: return guid_test;
24  case cmd_playbackstate: return guid_playbackstate;
25  default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
26  }
27  }
Definition: pfc.h:71
PFC_NORETURN void SHARED_EXPORT uBugCheck()
t_uint32 mainmenu_commands_sample::get_command_count ( )
inlinevirtual

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

Implements mainmenu_commands.

Definition at line 16 of file mainmenu.cpp.

16  {
17  return cmd_total;
18  }
bool mainmenu_commands_sample::get_description ( t_uint32  p_index,
pfc::string_base p_out 
)
inlinevirtual

Retrieves item's description for statusbar etc.

Implements mainmenu_commands.

Definition at line 35 of file mainmenu.cpp.

35  {
36  switch(p_index) {
37  case cmd_test: p_out = "This is a sample menu command."; return true;
38  case cmd_playbackstate: p_out = "Opens the playback state demo dialog."; return true;
39  default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
40  }
41  }
PFC_NORETURN void SHARED_EXPORT uBugCheck()
void mainmenu_commands_sample::get_name ( t_uint32  p_index,
pfc::string_base p_out 
)
inlinevirtual

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

Implements mainmenu_commands.

Definition at line 28 of file mainmenu.cpp.

28  {
29  switch(p_index) {
30  case cmd_test: p_out = "Test command"; break;
31  case cmd_playbackstate: p_out = "Playback state demo"; break;
32  default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
33  }
34  }
PFC_NORETURN void SHARED_EXPORT uBugCheck()
GUID mainmenu_commands_sample::get_parent ( )
inlinevirtual

Retrieves GUID of owning menu group.

Implements mainmenu_commands.

Definition at line 42 of file mainmenu.cpp.

42  {
43  return g_mainmenu_group_id;
44  }
static const GUID g_mainmenu_group_id
Definition: mainmenu.cpp:3

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