foobar2000 SDK  2015-08-03
mainmenu.cpp
Go to the documentation of this file.
1 #include "stdafx.h"
2 
3 static const GUID g_mainmenu_group_id = { 0x44963e7a, 0x4b2a, 0x4588, { 0xb0, 0x17, 0xa8, 0x69, 0x18, 0xcb, 0x8a, 0xa5 } };
4 
6 
7 void RunPlaybackStateDemo(); //playback_state.cpp
8 
10 public:
11  enum {
12  cmd_test = 0,
15  };
17  return cmd_total;
18  }
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  }
28  void get_name(t_uint32 p_index,pfc::string_base & p_out) {
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  }
35  bool get_description(t_uint32 p_index,pfc::string_base & p_out) {
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  }
43  return g_mainmenu_group_id;
44  }
45  void execute(t_uint32 p_index,service_ptr_t<service_base> p_callback) {
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  }
57 };
58 
void get_name(t_uint32 p_index, pfc::string_base &p_out)
Retrieves name of item, for list of commands to assign keyboard shortcuts to etc. ...
Definition: mainmenu.cpp:28
static const GUID file
Definition: menu.h:87
Definition: pfc.h:71
static mainmenu_commands_factory_t< mainmenu_commands_sample > g_mainmenu_commands_sample_factory
Definition: mainmenu.cpp:59
t_uint32 get_command_count()
Retrieves number of implemented commands. Index parameter of other methods must be in 0...
Definition: mainmenu.cpp:16
bool get_description(t_uint32 p_index, pfc::string_base &p_out)
Retrieves item&#39;s description for statusbar etc.
Definition: mainmenu.cpp:35
void RunPlaybackStateDemo()
GUID get_parent()
Retrieves GUID of owning menu group.
Definition: mainmenu.cpp:42
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
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
static const GUID g_mainmenu_group_id
Definition: mainmenu.cpp:3
PFC_NORETURN void SHARED_EXPORT uBugCheck()
void execute(t_uint32 p_index, service_ptr_t< service_base > p_callback)
Executes the command. p_callback parameter is reserved for future use and should be ignored / set to ...
Definition: mainmenu.cpp:45
static mainmenu_group_popup_factory g_mainmenu_group(g_mainmenu_group_id, mainmenu_groups::file, mainmenu_commands::sort_priority_dontcare,"Sample component")
uint32_t t_uint32
Definition: int_types.h:5
GUID get_command(t_uint32 p_index)
Retrieves GUID of specified command.
Definition: mainmenu.cpp:19