foobar2000 SDK  2015-08-03
app_close_blocker.h
Go to the documentation of this file.
1 class NOVTABLE app_close_blocker : public service_base
3 {
4 public:
6  virtual bool query() = 0;
7 
9  static bool g_query();
10 
11  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(app_close_blocker);
12 };
13 
16 class NOVTABLE app_close_blocking_task {
17 public:
18  virtual void query_task_name(pfc::string_base & out) = 0;
19 
20 protected:
23 
24  PFC_CLASS_NOT_COPYABLE_EX(app_close_blocking_task);
25 };
26 
30 public:
31  virtual void register_task(app_close_blocking_task * task) = 0;
32  virtual void unregister_task(app_close_blocking_task * task) = 0;
33 
34 
35  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(app_close_blocking_task_manager);
36 };
37 
40 public:
43 
44  void query_task_name(pfc::string_base & out) { out = "<unnamed task>"; }
45 };
46 
48 public:
50  ~app_close_blocking_task_impl_dynamic() { toggle_blocking(false); }
51 
52  void query_task_name(pfc::string_base & out) { out = "<unnamed task>"; }
53 
54 protected:
55  void toggle_blocking(bool state) {
56  if (state != m_taskActive) {
58  if (state) api->register_task(this);
59  else api->unregister_task(this);
60  m_taskActive = state;
61  }
62  }
63 private:
65 };
void query_task_name(pfc::string_base &out)
Helper; implements standard functionality required by app_close_blocking_task implementations - regis...
Entrypoint class for registering app_close_blocking_task instances. Introduced in 0...
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition: service.h:533
An interface encapsulating a task preventing the foobar2000 application from being closed...
(DEPRECATED) This service is used to signal whether something is currently preventing main window fro...
void query_task_name(pfc::string_base &out)