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

#include <popup_message.h>

+ Inheritance diagram for popup_message:

Public Types

enum  t_icon { icon_information, icon_error, icon_query }
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (popup_message)
 
void show (const char *p_msg, const char *p_title, t_icon p_icon=icon_information)
 
virtual void show_ex (const char *p_msg, unsigned p_msg_length, const char *p_title, unsigned p_title_length, t_icon p_icon=icon_information)=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 void g_complain (const char *what)
 
static void g_complain (const char *p_whatFailed, const std::exception &p_exception)
 
static void g_complain (const char *p_whatFailed, const char *msg)
 
static void g_show (const char *p_msg, const char *p_title, t_icon p_icon=icon_information)
 
static void g_show_ex (const char *p_msg, unsigned p_msg_length, const char *p_title, unsigned p_title_length, t_icon p_icon=icon_information)
 

Additional Inherited Members

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

Detailed Description

This interface allows you to show generic nonmodal noninteractive dialog with a text message. This should be used instead of MessageBox where possible.
Usage: use popup_message::g_show / popup_message::g_show_ex static helpers, or static_api_ptr_t<popup_message>.
Note that all strings are UTF-8.

Definition at line 6 of file popup_message.h.

Member Enumeration Documentation

Enumerator
icon_information 
icon_error 
icon_query 

Definition at line 8 of file popup_message.h.

Member Function Documentation

popup_message::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( popup_message  )
void popup_message::g_complain ( const char *  what)
static

Definition at line 14 of file popup_message.cpp.

14  {
15  g_show(what, "Information", icon_error);
16 }
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
void popup_message::g_complain ( const char *  p_whatFailed,
const std::exception &  p_exception 
)
static

Definition at line 18 of file popup_message.cpp.

18  {
19  g_complain(p_whatFailed,p_exception.what());
20 }
static void g_complain(const char *what)
void popup_message::g_complain ( const char *  p_whatFailed,
const char *  msg 
)
static

Definition at line 21 of file popup_message.cpp.

21  {
22  g_complain( PFC_string_formatter() << p_whatFailed << ": " << msg );
23 }
static void g_complain(const char *what)
static void popup_message::g_show ( const char *  p_msg,
const char *  p_title,
t_icon  p_icon = icon_information 
)
inlinestatic

Static helper function instantiating the service and activating the message dialog. See show() for description of parameters.

Definition at line 26 of file popup_message.h.

26 {g_show_ex(p_msg,~0,p_title,~0,p_icon);}
static void g_show_ex(const char *p_msg, unsigned p_msg_length, const char *p_title, unsigned p_title_length, t_icon p_icon=icon_information)
Static helper function instantiating the service and activating the message dialog. See show_ex() for description of parameters.
void popup_message::g_show_ex ( const char *  p_msg,
unsigned  p_msg_length,
const char *  p_title,
unsigned  p_title_length,
t_icon  p_icon = icon_information 
)
static

Static helper function instantiating the service and activating the message dialog. See show_ex() for description of parameters.

Definition at line 3 of file popup_message.cpp.

4 {
5  // Do not force instantiate, not all platforms have this
8  if (e.first( m ) ) {
9  m->show_ex( p_msg, p_msg_length, p_title, p_title_length, p_icon );
10  }
11 }
bool first(service_ptr_t< t_query > &p_out)
Definition: service.h:581
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
void popup_message::show ( const char *  p_msg,
const char *  p_title,
t_icon  p_icon = icon_information 
)
inline

Activates the popup dialog; returns immediately (the dialog remains visible); helper function built around show_ex(), takes null terminated strings with no length limit parameters.

Parameters
p_msgMessage to show (UTF-8 encoded string).
p_titleTitle of dialog to show (UTF-8 encoded string).
p_iconIcon of the dialog - can be set to icon_information, icon_error or icon_query.

Definition at line 21 of file popup_message.h.

21 {show_ex(p_msg,~0,p_title,~0,p_icon);}
virtual void show_ex(const char *p_msg, unsigned p_msg_length, const char *p_title, unsigned p_title_length, t_icon p_icon=icon_information)=0
Activates the popup dialog; returns immediately (the dialog remains visible).
virtual void popup_message::show_ex ( const char *  p_msg,
unsigned  p_msg_length,
const char *  p_title,
unsigned  p_title_length,
t_icon  p_icon = icon_information 
)
pure virtual

Activates the popup dialog; returns immediately (the dialog remains visible).

Parameters
p_msgMessage to show (UTF-8 encoded string).
p_msg_lengthLength limit of message string to show, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
p_titleTitle of dialog to show (UTF-8 encoded string).
p_title_lengthLength limit of the title string, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
p_iconIcon of the dialog - can be set to icon_information, icon_error or icon_query.

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