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

#include <threaded_process.h>

+ Inheritance diagram for threaded_process:

Public Types

enum  {
  flag_show_abort = 1, flag_show_minimize = 1 << 1, flag_show_progress = 1 << 2, flag_show_progress_dual = 1 << 3,
  flag_show_item = 1 << 4, flag_show_pause = 1 << 5, flag_high_priority = 1 << 6, flag_show_delayed = 1 << 7,
  flag_no_focus = 1 << 8
}
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (threaded_process)
 
virtual bool run_modal (service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)=0
 
virtual bool run_modeless (service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)=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_query_preventStandby ()
 
static bool g_run_modal (service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)
 
static bool g_run_modeless (service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)
 

Additional Inherited Members

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

Detailed Description

The threaded_process API allows you to easily put timeconsuming tasks in worker threads, with progress dialog giving nice feedback to the user.
Thanks to this API you can perform such tasks with no user interface related programming at all.

Definition at line 58 of file threaded_process.h.

Member Enumeration Documentation

anonymous enum
Enumerator
flag_show_abort 

Shows the "abort" button.

flag_show_minimize 

Obsolete, do not use.

flag_show_progress 

Shows a progress bar.

flag_show_progress_dual 

Shows dual progress bars; implies flag_show_progress.

flag_show_item 

Shows the item being currently processed.

flag_show_pause 

Shows the "pause" button.

flag_high_priority 

Obsolete, do not use.

flag_show_delayed 

Make the dialog hidden by default and show it only if the operation could not be completed after 500ms. Implies flag_no_focus. Relevant only to modeless dialogs.

flag_no_focus 

Do not focus the dialog by default.

Definition at line 60 of file threaded_process.h.

60  {
62  flag_show_abort = 1,
64  flag_show_minimize = 1 << 1,
66  flag_show_progress = 1 << 2,
68  flag_show_progress_dual = 1 << 3,
70  flag_show_item = 1 << 4,
72  flag_show_pause = 1 << 5,
74  flag_high_priority = 1 << 6,
76  flag_show_delayed = 1 << 7,
78  flag_no_focus = 1 << 8,
79  };
Shows the item being currently processed.
Shows the "pause" button.
Shows dual progress bars; implies flag_show_progress.
Do not focus the dialog by default.
Shows the "abort" button.
Make the dialog hidden by default and show it only if the operation could not be completed after 500m...

Member Function Documentation

threaded_process::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( threaded_process  )
bool threaded_process::g_query_preventStandby ( )
static

Queries user settings; returns whether various timeconsuming tasks should be blocking machine standby.

Definition at line 38 of file threaded_process.cpp.

38  {
39  static const GUID guid_preventStandby = { 0x7aafeffb, 0x5f11, 0x483f, { 0xac, 0x65, 0x61, 0xec, 0x9c, 0x70, 0x37, 0x4e } };
40  advconfig_entry_checkbox::ptr obj;
41  if (advconfig_entry::g_find_t(obj, guid_preventStandby)) {
42  return obj->get_state();
43  } else {
44  return false;
45  }
46 }
Definition: pfc.h:71
static bool g_find_t(outptr &out, const GUID &id)
Definition: advconfig.h:18
bool threaded_process::g_run_modal ( service_ptr_t< threaded_process_callback p_callback,
unsigned  p_flags,
HWND  p_parent,
const char *  p_title,
t_size  p_title_len = ~0 
)
static

Helper invoking run_modal().

Definition at line 28 of file threaded_process.cpp.

29 {
30  return static_api_ptr_t<threaded_process>()->run_modal(p_callback,p_flags,p_parent,p_title,p_title_len);
31 }
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition: service.h:533
virtual bool run_modal(service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)=0
Runs a synchronous threaded_process operation - the function does not return until the operation has ...
bool threaded_process::g_run_modeless ( service_ptr_t< threaded_process_callback p_callback,
unsigned  p_flags,
HWND  p_parent,
const char *  p_title,
t_size  p_title_len = ~0 
)
static

Helper invoking run_modeless().

Definition at line 33 of file threaded_process.cpp.

34 {
35  return static_api_ptr_t<threaded_process>()->run_modeless(p_callback,p_flags,p_parent,p_title,p_title_len);
36 }
virtual bool run_modeless(service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)=0
Runs an asynchronous threaded_process operation.
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition: service.h:533
virtual bool threaded_process::run_modal ( service_ptr_t< threaded_process_callback p_callback,
unsigned  p_flags,
HWND  p_parent,
const char *  p_title,
t_size  p_title_len = ~0 
)
pure virtual

Runs a synchronous threaded_process operation - the function does not return until the operation has completed, though the app UI is not frozen and the operation is abortable.
This API is obsolete and should not be used. Please use run_modeless() instead if possible.

Parameters
p_callbackInterface to your threaded_process client.
p_flagsFlags describing requested dialog functionality. See threaded_process::flag_* constants.
p_parentParent window for the progress dialog - typically core_api::get_main_window().
p_titleInitial title of the dialog.
Returns
True if the operation has completed normally, false if the user has aborted the operation. In case of a catastrophic failure such as dialog creation failure, exceptions will be thrown.
virtual bool threaded_process::run_modeless ( service_ptr_t< threaded_process_callback p_callback,
unsigned  p_flags,
HWND  p_parent,
const char *  p_title,
t_size  p_title_len = ~0 
)
pure virtual

Runs an asynchronous threaded_process operation.

Parameters
p_callbackInterface to your threaded_process client.
p_flagsFlags describing requested dialog functionality. See threaded_process::flag_* constants.
p_parentParent window for the progress dialog - typically core_api::get_main_window().
p_titleInitial title of the dialog.
Returns
True, always; the return value should be ignored. In case of a catastrophic failure such as dialog creation failure, exceptions will be thrown.

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