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

Public Types

enum  { cmd_test1 = 0, cmd_test2, cmd_total }
 
- Public Types inherited from contextmenu_item_simple
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

void context_command (unsigned p_index, metadb_handle_list_cref p_data, const GUID &p_caller)
 
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)
 
bool get_item_description (unsigned p_index, pfc::string_base &p_out)
 
GUID get_item_guid (unsigned p_index)
 
void get_item_name (unsigned p_index, pfc::string_base &p_out)
 
unsigned get_num_items ()
 
GUID get_parent ()
 
- Public Member Functions inherited from contextmenu_item_simple
virtual t_enabled_state get_enabled_state (unsigned p_index)
 
- 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 ()
 

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

Definition at line 17 of file contextmenu.cpp.

Member Enumeration Documentation

anonymous enum
Enumerator
cmd_test1 
cmd_test2 
cmd_total 

Definition at line 19 of file contextmenu.cpp.

Member Function Documentation

void myitem::context_command ( unsigned  p_index,
metadb_handle_list_cref  p_data,
const GUID p_caller 
)
inlinevirtual

Implements contextmenu_item_simple.

Definition at line 33 of file contextmenu.cpp.

33  {
34  switch(p_index) {
35  case cmd_test1:
36  RunTestCommand(p_data);
37  break;
38  case cmd_test2:
39  RunCalculatePeak(p_data);
40  break;
41  default:
42  uBugCheck();
43  }
44  }
void RunCalculatePeak(metadb_handle_list_cref data)
Definition: decode.cpp:64
PFC_NORETURN void SHARED_EXPORT uBugCheck()
static void RunTestCommand(metadb_handle_list_cref data)
Definition: contextmenu.cpp:88
bool myitem::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 from contextmenu_item_simple.

Definition at line 46 of file contextmenu.cpp.

46  {
47  switch(p_index) {
48  case cmd_test1:
49  if (!__super::context_get_display(p_index, p_data, p_out, p_displayflags, p_caller)) return false;
50  // Example context sensitive label: append the count of selected items to the label.
51  p_out << " : " << p_data.get_count() << " item";
52  if (p_data.get_count() != 1) p_out << "s";
53  p_out << " selected";
54  return true;
55  case cmd_test2:
56  return __super::context_get_display(p_index, p_data, p_out, p_displayflags, p_caller);
57  default: uBugCheck();
58  }
59  }
virtual t_size get_count() const =0
PFC_NORETURN void SHARED_EXPORT uBugCheck()
bool myitem::get_item_description ( unsigned  p_index,
pfc::string_base p_out 
)
inlinevirtual

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_simple.

Definition at line 71 of file contextmenu.cpp.

71  {
72  switch(p_index) {
73  case cmd_test1:
74  p_out = "This is a sample command.";
75  return true;
76  case cmd_test2:
77  p_out = "This is a sample command that decodes the selected tracks and reports the peak sample value.";
78  return true;
79  default:
80  uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
81  }
82  }
PFC_NORETURN void SHARED_EXPORT uBugCheck()
GUID myitem::get_item_guid ( unsigned  p_index)
inlinevirtual

Retrieves GUID of the context menu item.

Implements contextmenu_item_simple.

Definition at line 60 of file contextmenu.cpp.

60  {
61  // These GUIDs identify our context menu items. Substitute with your own GUIDs when reusing code.
62  static const GUID guid_test1 = { 0x4021c80d, 0x9340, 0x423b, { 0xa3, 0xe2, 0x8e, 0x1e, 0xda, 0x87, 0x13, 0x7f } };
63  static const GUID guid_test2 = { 0xe629b5c3, 0x5af3, 0x4a1e, { 0xa0, 0xcd, 0x2d, 0x5b, 0xff, 0xa6, 0x4, 0x58 } };
64  switch(p_index) {
65  case cmd_test1: return guid_test1;
66  case cmd_test2: return guid_test2;
67  default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
68  }
69 
70  }
Definition: pfc.h:71
PFC_NORETURN void SHARED_EXPORT uBugCheck()
void myitem::get_item_name ( unsigned  p_index,
pfc::string_base p_out 
)
inlinevirtual

Retrieves human-readable name of the context menu item.

Implements contextmenu_item_simple.

Definition at line 26 of file contextmenu.cpp.

26  {
27  switch(p_index) {
28  case cmd_test1: p_out = "Test command"; break;
29  case cmd_test2: p_out = "Calculate peak"; break;
30  default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
31  }
32  }
PFC_NORETURN void SHARED_EXPORT uBugCheck()
unsigned myitem::get_num_items ( )
inlinevirtual

Retrieves number of menu items provided by this contextmenu_item implementation.

Implements contextmenu_item_simple.

Definition at line 25 of file contextmenu.cpp.

GUID myitem::get_parent ( )
inlinevirtual

Reimplemented from contextmenu_item_v2.

Definition at line 24 of file contextmenu.cpp.

24 {return guid_mygroup;}
static const GUID guid_mygroup
Definition: contextmenu.cpp:5

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