foobar2000 SDK  2015-08-03
Public Types | Public Member Functions | Static Public Member Functions
keyboard_shortcut_managerabstract

#include <contextmenu_manager.h>

+ Inheritance diagram for keyboard_shortcut_manager:

Public Types

enum  shortcut_type { TYPE_MAIN, TYPE_CONTEXT, TYPE_CONTEXT_PLAYLIST, TYPE_CONTEXT_NOW_PLAYING }
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (keyboard_shortcut_manager)
 
virtual bool get_key_description_for_action (const GUID &p_command, const GUID &p_subcommand, pfc::string_base &out, shortcut_type type, bool is_global)=0
 
bool on_keydown (shortcut_type type, WPARAM wp)
 
bool on_keydown_auto (WPARAM wp)
 
bool on_keydown_auto_context (const pfc::list_base_const_t< metadb_handle_ptr > &data, WPARAM wp, const GUID &caller)
 
bool on_keydown_auto_playlist (WPARAM wp)
 
bool on_keydown_context (const pfc::list_base_const_t< metadb_handle_ptr > &data, WPARAM wp, const GUID &caller)
 
bool on_keydown_restricted_auto (WPARAM wp)
 
bool on_keydown_restricted_auto_context (const pfc::list_base_const_t< metadb_handle_ptr > &data, WPARAM wp, const GUID &caller)
 
bool on_keydown_restricted_auto_playlist (WPARAM wp)
 
virtual bool process_keydown (shortcut_type type, const pfc::list_base_const_t< metadb_handle_ptr > &data, unsigned keycode)=0
 
virtual bool process_keydown_ex (shortcut_type type, const pfc::list_base_const_t< metadb_handle_ptr > &data, unsigned keycode, const GUID &caller)=0
 
- 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_get (service_ptr_t< keyboard_shortcut_manager > &p_out)
 
static bool is_text_key (t_uint32 vkCode)
 
static bool is_typing_key (t_uint32 vkCode)
 
static bool is_typing_key_combo (t_uint32 vkCode, t_uint32 modifiers)
 
static bool is_typing_message (HWND editbox, const MSG *msg)
 
static bool is_typing_message (const MSG *msg)
 
static bool is_typing_modifier (t_uint32 flags)
 

Additional Inherited Members

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

Detailed Description

Definition at line 1 of file contextmenu_manager.h.

Member Enumeration Documentation

Member Function Documentation

keyboard_shortcut_manager::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( keyboard_shortcut_manager  )
static bool keyboard_shortcut_manager::g_get ( service_ptr_t< keyboard_shortcut_manager > &  p_out)
inlinestatic

Definition at line 4 of file contextmenu_manager.h.

4 {return service_enum_create_t(p_out,0);}
static bool service_enum_create_t(service_ptr_t< T > &p_out, t_size p_index)
Definition: service.h:433
virtual bool keyboard_shortcut_manager::get_key_description_for_action ( const GUID p_command,
const GUID p_subcommand,
pfc::string_base out,
shortcut_type  type,
bool  is_global 
)
pure virtual
bool keyboard_shortcut_manager::is_text_key ( t_uint32  vkCode)
static

Definition at line 375 of file menu_manager.cpp.

375  {
376  return vkCode == VK_SPACE
377  || (vkCode >= '0' && vkCode < 0x40)
378  || (vkCode > 0x40 && vkCode < VK_LWIN)
379  || (vkCode >= VK_NUMPAD0 && vkCode <= VK_DIVIDE)
380  || (vkCode >= VK_OEM_1 && vkCode <= VK_OEM_3)
381  || (vkCode >= VK_OEM_4 && vkCode <= VK_OEM_8)
382  ;
383 }
bool keyboard_shortcut_manager::is_typing_key ( t_uint32  vkCode)
static

Definition at line 385 of file menu_manager.cpp.

385  {
386  return is_text_key(vkCode)
387  || vkCode == VK_BACK
388  || vkCode == VK_RETURN
389  || vkCode == VK_INSERT
390  || (vkCode > VK_SPACE && vkCode < '0');
391 }
static bool is_text_key(t_uint32 vkCode)
bool keyboard_shortcut_manager::is_typing_key_combo ( t_uint32  vkCode,
t_uint32  modifiers 
)
static

Definition at line 393 of file menu_manager.cpp.

393  {
394  if (!is_typing_modifier(modifiers)) return false;
395  return is_typing_key(vkCode);
396 }
static bool is_typing_modifier(t_uint32 flags)
static bool is_typing_key(t_uint32 vkCode)
bool keyboard_shortcut_manager::is_typing_message ( HWND  editbox,
const MSG *  msg 
)
static

Definition at line 403 of file menu_manager.cpp.

403  {
404  if (msg->hwnd != editbox) return false;
405  return is_typing_message(msg);
406 }
static bool is_typing_message(HWND editbox, const MSG *msg)
bool keyboard_shortcut_manager::is_typing_message ( const MSG *  msg)
static

Definition at line 407 of file menu_manager.cpp.

407  {
408  if (msg->message != WM_KEYDOWN && msg->message != WM_SYSKEYDOWN) return false;
409  return is_typing_key_combo(msg->wParam, GetHotkeyModifierFlags());
410 }
static bool is_typing_key_combo(t_uint32 vkCode, t_uint32 modifiers)
unsigned GetHotkeyModifierFlags()
Returns current modifier keys pressed, using win32 MOD_* flags.
bool keyboard_shortcut_manager::is_typing_modifier ( t_uint32  flags)
static

Definition at line 398 of file menu_manager.cpp.

398  {
399  flags &= ~MOD_SHIFT;
400  return flags == 0 || flags == (MOD_ALT | MOD_CONTROL);
401 }
bool keyboard_shortcut_manager::on_keydown ( shortcut_type  type,
WPARAM  wp 
)

Definition at line 290 of file menu_manager.cpp.

291 {
292  if (type==TYPE_CONTEXT) return false;
293  metadb_handle_list dummy;
294  return process_keydown(type,dummy,get_key_code(wp));
295 }
virtual bool process_keydown(shortcut_type type, const pfc::list_base_const_t< metadb_handle_ptr > &data, unsigned keycode)=0
bool keyboard_shortcut_manager::on_keydown_auto ( WPARAM  wp)

Definition at line 303 of file menu_manager.cpp.

bool keyboard_shortcut_manager::on_keydown_auto_context ( const pfc::list_base_const_t< metadb_handle_ptr > &  data,
WPARAM  wp,
const GUID caller 
)

Definition at line 319 of file menu_manager.cpp.

320 {
321  if (on_keydown_context(data,wp,caller)) return true;
322  else return on_keydown_auto(wp);
323 }
bool on_keydown_context(const pfc::list_base_const_t< metadb_handle_ptr > &data, WPARAM wp, const GUID &caller)
bool on_keydown_auto(WPARAM wp)
bool keyboard_shortcut_manager::on_keydown_auto_playlist ( WPARAM  wp)

Definition at line 311 of file menu_manager.cpp.

312 {
313  metadb_handle_list data;
315  api->activeplaylist_get_selected_items(data);
317 }
static const GUID caller_playlist
Deprecated - use caller_active_playlist_selection instead.
Definition: contextmenu.h:136
bool on_keydown_auto_context(const pfc::list_base_const_t< metadb_handle_ptr > &data, WPARAM wp, const GUID &caller)
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition: service.h:533
bool keyboard_shortcut_manager::on_keydown_context ( const pfc::list_base_const_t< metadb_handle_ptr > &  data,
WPARAM  wp,
const GUID caller 
)

Definition at line 297 of file menu_manager.cpp.

298 {
299  if (data.get_count()==0) return false;
300  return process_keydown_ex(TYPE_CONTEXT,data,get_key_code(wp),caller);
301 }
virtual bool process_keydown_ex(shortcut_type type, const pfc::list_base_const_t< metadb_handle_ptr > &data, unsigned keycode, const GUID &caller)=0
virtual t_size get_count() const =0
bool keyboard_shortcut_manager::on_keydown_restricted_auto ( WPARAM  wp)

Definition at line 337 of file menu_manager.cpp.

337  {
338  if (!should_relay_key_restricted(wp)) return false;
339  return on_keydown_auto(wp);
340 }
bool on_keydown_auto(WPARAM wp)
bool keyboard_shortcut_manager::on_keydown_restricted_auto_context ( const pfc::list_base_const_t< metadb_handle_ptr > &  data,
WPARAM  wp,
const GUID caller 
)

Definition at line 345 of file menu_manager.cpp.

345  {
346  if (!should_relay_key_restricted(wp)) return false;
347  return on_keydown_auto_context(data,wp,caller);
348 }
bool on_keydown_auto_context(const pfc::list_base_const_t< metadb_handle_ptr > &data, WPARAM wp, const GUID &caller)
bool keyboard_shortcut_manager::on_keydown_restricted_auto_playlist ( WPARAM  wp)

Definition at line 341 of file menu_manager.cpp.

341  {
342  if (!should_relay_key_restricted(wp)) return false;
343  return on_keydown_auto_playlist(wp);
344 }
bool on_keydown_auto_playlist(WPARAM wp)
virtual bool keyboard_shortcut_manager::process_keydown ( shortcut_type  type,
const pfc::list_base_const_t< metadb_handle_ptr > &  data,
unsigned  keycode 
)
pure virtual
virtual bool keyboard_shortcut_manager::process_keydown_ex ( shortcut_type  type,
const pfc::list_base_const_t< metadb_handle_ptr > &  data,
unsigned  keycode,
const GUID caller 
)
pure virtual

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