User Tools

Site Tools


developer_center:recipe_book:extensions_and_core:playlist_buttons_aka_playlist_commands:playlist_command_cplusplus_callback_templates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer_center:recipe_book:extensions_and_core:playlist_buttons_aka_playlist_commands:playlist_command_cplusplus_callback_templates [2013/12/28 09:48] (current)
geekshadow created
Line 1: Line 1:
 +====== Playlist Command C++ Callback Templates ======
 +
 +
 +This page provides starter templates for most of the C++ callback objects used by sbIPlaylistCommands. ​ Only sbIPlaylistCommandsBuilderInstantiationCallback and sbIPlaylistCommandsBuilderRefreshCallback,​ both used only for "​custom"​ type playlist commands, are not covered here.
 +
 +The callbacks covered are:
 +
 +  * sbIPlaylistCommandsBuilderSimpleCallback
 +    * trigger callbacks used by "​action",​ "​flag",​ and "​choice menu item" type commands
 +  * sbIPlaylistCommandsBuilderPCCallback
 +    * init callbacks
 +    * visibility callbacks
 +    * shutdown callbacks
 +  * sbIPlaylistCommandsBuilderGetBoolCallback
 +    * command enabled/​disabled callbacks
 +    * "​flag"​ type commands'​ value callbacks to determine if the flag should be displayed as "​on"​
 +  * sbIPlaylistCommandsBuilderGetStringCallback
 +    * "​choice menu" type commands'​ item selected callback to determine which "​choice menu item" is selected
 +    * "​value"​ type commands'​ get value callback that populates the text input'​s value
 +  * sbIPlaylistCommandsBuilderSetValueCallback
 +    * "​value"​ type commands'​ set value callback that is called whenever the text input'​s value changes
 +
 + 
 +===== sbIPlaylistCommandsBuilderSimpleCallback =====
 +
 +<​code>​
 +class sbPlaylistCommandsBuilderSimpleCallbackTemplate : public sbIPlaylistCommandsBuilderSimpleCallback
 +{
 +  public:
 +    NS_DECL_ISUPPORTS;​
 +    NS_DECL_SBIPLAYLISTCOMMANDSBUILDERSIMPLECALLBACK;​
 +    sbPlaylistCommandsBuilderSimpleCallbackTemplate();​
 +    virtual ~sbPlaylistCommandsBuilderSimpleCallbackTemplate();​
 +};
 +
 +sbPlaylistCommandsBuilderSimpleCallbackTemplate::​sbPlaylistCommandsBuilderSimpleCallbackTemplate()
 +{
 +}
 +
 +/* virtual */ sbPlaylistCommandsBuilderSimpleCallbackTemplate::​~sbPlaylistCommandsBuilderSimpleCallbackTemplate()
 +{
 +}
 +
 +NS_IMETHODIMP
 +sbPlaylistCommandsBuilderSimpleCallbackTemplate::​HandleCallback
 +                                               ​(sbIPlaylistCommandsBuilderContext *aContext,
 +                                                const nsAString &​aSubMenuId,​
 +                                                const nsAString &​aCommandId,​
 +                                                const nsAString &aHost)
 +{
 +  NS_ENSURE_ARG_POINTER(aContext);​
 +
 +  // perform the action to be triggered ​
 +
 +  return NS_OK;
 +}
 +
 +NS_IMPL_THREADSAFE_ISUPPORTS1(sbPlaylistCommandsBuilderSimpleCallbackTemplate,​
 +                              sbIPlaylistCommandsBuilderSimpleCallback);​
 +</​code>​
 +===== sbIPlaylistCommandsBuilderPCCallback =====
 +
 +<​code>​
 +class sbPlaylistCommandsBuilderPCCallbackTemplate : public sbIPlaylistCommandsBuilderPCCallback
 +{
 +  public:
 +    NS_DECL_ISUPPORTS;​
 +    NS_DECL_SBIPLAYLISTCOMMANDSBUILDERPCCALLBACK;​
 +    sbPlaylistCommandsBuilderPCCallbackTemplate();​
 +    virtual ~sbPlaylistCommandsBuilderPCCallbackTemplate();​
 +};
 +
 +sbPlaylistCommandsBuilderPCCallbackTemplate::​sbPlaylistCommandsBuilderPCCallbackTemplate()
 +{
 +}
 +
 +/* virtual */ sbPlaylistCommandsBuilderPCCallbackTemplate::​~sbPlaylistCommandsBuilderPCCallbackTemplate()
 +{
 +}
 +
 +NS_IMETHODIMP
 +sbPlaylistCommandsBuilderPCCallbackTemplate::​HandleCallback
 +                                            (sbIPlaylistCommandsBuilderContext *aContext,
 +                                             const nsAString &aHost,
 +                                             const nsAString &aData,
 +                                             ​PRBool ​         *_retval)
 +{
 +  NS_ENSURE_ARG_POINTER(aContext);​
 +  NS_ENSURE_ARG_POINTER(_retval);​
 +  ​
 +
 +  // set *_retval accordingly;​
 +
 +
 +  return NS_OK;
 +}
 +
 +NS_IMPL_THREADSAFE_ISUPPORTS1(sbPlaylistCommandsBuilderPCCallbackTemplate,​
 +                              sbIPlaylistCommandsBuilderPCCallback);​
 +</​code>​
 +
 +===== sbIPlaylistCommandsGetBoolCallback =====
 +
 +<​code>​
 +class sbPlaylistCommandsGetBoolCallbackTemplate : public sbIPlaylistCommandsGetBoolCallback
 +{
 +  public:
 +    NS_DECL_ISUPPORTS;​
 +    NS_DECL_SBIPLAYLISTCOMMANDSGETBOOLCALLBACK;​
 +    sbPlaylistCommandsGetBoolCallbackTemplate();​
 +    virtual ~sbPlaylistCommandsGetBoolCallbackTemplate();​
 +};
 +
 +sbPlaylistCommandsGetBoolCallbackTemplate::​sbPlaylistCommandsGetBoolCallbackTemplate()
 +{
 +}
 +
 +/* virtual */ sbPlaylistCommandsGetBoolCallbackTemplate::​~sbPlaylistCommandsGetBoolCallbackTemplate()
 +{
 +}
 +
 +NS_IMETHODIMP
 +sbPlaylistCommandsGetBoolCallbackTemplate::​HandleCallback
 +                                          (sbIPlaylistCommandsBuilderContext *aContext,
 +                                           const nsAString &​aSubMenuId,​
 +                                           const nsAString &​aCommandId,​
 +                                           const nsAString &aHost,
 +                                           const nsAString &aData
 +                                           ​PRBool ​         *_retval)
 +{
 +  NS_ENSURE_ARG_POINTER(aContext);​
 +
 +  // set *_retval accordingly
 +
 +  return NS_OK;
 +}
 +
 +NS_IMPL_THREADSAFE_ISUPPORTS1(sbPlaylistCommandsGetBoolCallbackTemplate,​
 +                              sbIPlaylistCommandsGetBoolCallback);​
 +</​code>​
 +===== sbIPlaylistCommandsGetStringCallback =====
 +
 +<​code>​
 +class sbPlaylistCommandsGetStringCallbackTemplate : public sbIPlaylistCommandsGetStringCallback
 +{
 +  public:
 +    NS_DECL_ISUPPORTS;​
 +    NS_DECL_SBIPLAYLISTCOMMANDSGETSTRINGCALLBACK;​
 +    sbPlaylistCommandsGetStringCallbackTemplate();​
 +    virtual ~sbPlaylistCommandsGetStringCallbackTemplate();​
 +};
 +
 +sbPlaylistCommandsGetStringCallbackTemplate::​sbPlaylistCommandsGetStringCallbackTemplate()
 +{
 +}
 +
 +/* virtual */ sbPlaylistCommandsGetStringCallbackTemplate::​~sbPlaylistCommandsGetStringCallbackTemplate()
 +{
 +}
 +
 +NS_IMETHODIMP
 +sbPlaylistCommandsGetStringCallbackTemplate::​HandleCallback
 +                                            (sbIPlaylistCommandsBuilderContext *aContext,
 +                                             const nsAString &​aSubMenuId,​
 +                                             const nsAString &​aCommandId,​
 +                                             const nsAString &aHost,
 +                                             const nsAString &aData
 +                                             ​nsAString ​      &​_retval)
 +{
 +  NS_ENSURE_ARG_POINTER(aContext);​
 +
 +  // set _retval accordingly ​
 +
 +  return NS_OK;
 +}
 +
 +NS_IMPL_THREADSAFE_ISUPPORTS1(sbPlaylistCommandsGetStringCallbackTemplate,​
 +                              sbIPlaylistCommandsGetStringCallback);​
 +</​code>​
 +===== sbIPlaylistCommandsSetValueCallback =====
 +
 +<​code>​
 +class sbPlaylistCommandsSetValueCallbackTemplate : public sbIPlaylistCommandsSetValueCallback
 +{
 +  public:
 +    NS_DECL_ISUPPORTS;​
 +    NS_DECL_SBIPLAYLISTCOMMANDSSETVALUECALLBACK;​
 +    sbPlaylistCommandsSetValueCallbackTemplate();​
 +    virtual ~sbPlaylistCommandsSetValueCallbackTemplate();​
 +};
 +
 +sbPlaylistCommandsSetValueCallbackTemplate::​sbPlaylistCommandsSetValueCallbackTemplate()
 +{
 +}
 +
 +/* virtual */ sbPlaylistCommandsSetValueCallbackTemplate::​~sbPlaylistCommandsSetValueCallbackTemplate()
 +{
 +}
 +
 +NS_IMETHODIMP
 +sbPlaylistCommandsSetValueCallbackTemplate::​HandleCallback
 +                                               ​(sbIPlaylistCommandsBuilderContext *aContext,
 +                                                const nsAString &​aSubMenuId,​
 +                                                const nsAString &​aCommandId,​
 +                                                const nsAString &aHost,
 +                                                const nsAString &​aValue)
 +{
 +  NS_ENSURE_ARG_POINTER(aContext);​
 +
 +  // perform some action
 +
 +  return NS_OK;
 +}
 +
 +NS_IMPL_THREADSAFE_ISUPPORTS1(sbPlaylistCommandsSetValueCallbackTemplate,​
 +                              sbIPlaylistCommandsSetValueCallback);​
 +</​code>​
  
developer_center/recipe_book/extensions_and_core/playlist_buttons_aka_playlist_commands/playlist_command_cplusplus_callback_templates.txt ยท Last modified: 2013/12/28 09:48 by geekshadow