xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
application.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <memory>
7 #include <vector>
8 #include "../forms_export.h"
9 #include "../forms_namespace_aliases.h"
10 #include "application_context.h"
12 #include "imessage_filter.h"
13 #include "message.h"
14 #include "message_loop_callback.h"
15 #include "theme.h"
16 #include <xtd/delegate.h>
17 #include <xtd/event_args.h>
18 #include <xtd/static.h>
19 
21 namespace xtd {
23  namespace forms {
25  class input_dialog;
26  class message_box;
28 
36  using form_collection = std::vector<std::reference_wrapper<form>>;
37 
54  class forms_export_ application final static_ {
55  public:
59  static bool allow_quit();
60 
66  static xtd::ustring common_app_data_path();
67 
68  /*
72  static microsoft::win32::registry_key common_app_data_registry();
73  */
74 
85  static xtd::ustring company_name();
86 
89  static xtd::ustring executable_name();
90 
93  static xtd::ustring executable_path();
94 
97  static bool message_loop();
98 
102  static const form_collection open_forms();
103 
107  static xtd::ustring product_name();
108 
112  static xtd::ustring product_version();
113 
116  static xtd::ustring startup_path();
117 
123  static xtd::ustring user_app_data_path();
124 
125  /*
130  static microsoft::win32::registry_key user_app_data_registry();
131  */
132 
136  static bool use_visual_styles();
137 
144  static bool use_wait_cursor();
145 
152  static void use_wait_cursor(bool use_wait_cursor);
153 
157  static void add_message_filter(const imessage_filter& value);
158 
160  static bool dark_mode_enabled();
161 
163  static bool light_mode_enabled();
164 
170  static void do_events();
171 
174  static void enable_button_images();
175 
177  static void enable_dark_mode();
178 
180  static void enable_light_mode();
181 
184  static void enable_menu_images();
185 
188  static void enable_visual_styles();
189 
195  static void exit();
196 
203  static void exit(cancel_event_args& e);
204 
207  static void exit_thread();
208 
211  static void raise_idle(const event_args& e);
212 
216  static void register_message_loop_callback(message_loop_callback callback);
217 
221  static void remove_message_filter(const imessage_filter& value);
222 
229  static void restart();
230 
237  static void run();
238 
245  static void run(application_context& context);
246 
254  static void run(const form& main_form);
255 
256  static void theme(const xtd::ustring& theme_name);
257  static void theme(const xtd::forms::theme& theme);
258  static const xtd::forms::theme& theme();
259  static const std::vector<xtd::ustring>& theme_names();
260 
261  /*
267  static void set_unhandled_exception_mode (unhandled_exception_mode mode);
268  */
269 
270  /*
279  static void set_unhandled_exception_mode (unhandled_exception_mode mode, bool thread_scope);
280  */
281 
286 
290 
298 
302 
303  /*
309  static event<threading::thread_exception_event_handler> thread_exception;
310  */
311 
316 
317  private:
318  friend class form;
319  friend class input_dialog;
320  friend class message_box;
321 
322  static void on_app_thread_exit(object& sender, const event_args& e);
323  static bool on_app_thread_exception();
324  static void raise_enter_thread_modal(const event_args& e);
325  static void raise_leave_thread_modal(const event_args& e);
326  static intptr_t wnd_proc_(intptr_t hwnd, int32_t msg, intptr_t wparam, intptr_t lparam, intptr_t handle);
327  static void wnd_proc(message& message);
328  static void wm_activate_app(message& message);
329  static void wm_enter_idle(message& message);
330  static void wm_quit(message& message);
331 
332  static bool use_visual_styles_;
333  static bool use_wait_cursor_;
334  static bool message_loop_;
335  };
336  }
337 }
static event< application, delegate< void(const event_args &)> > application_exit
Occurs when the application is about to shut down.
Definition: application.h:285
Specifies the contextual information about an application thread.
Definition: application_context.h:26
Contains xtd::static_object class.
Contains xtd::delegate delegate.
Contains xtd::event_args event args.
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
static event< application, delegate< void(const event_args &)> > enter_thread_modal
Occurs when the application is about to enter a modal state.
Definition: application.h:289
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Displays a message window, also known as a dialog box, which presents a message to the user...
Definition: message_box.h:30
Defines a message filter interface.
Definition: imessage_filter.h:20
static event< application, delegate< void(const event_args &)> > thread_exit
Occurs when a thread is about to shut down. When the main thread for an application is about to be sh...
Definition: application.h:315
delegate< bool()> message_loop_callback
Represents a method that will check whether the hosting environment is still sending messages...
Definition: message_loop_callback.h:19
Contains xtd::forms::application_informations class.
Contains xtd::forms::message_loop_callback callback.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::forms::theme class.
static event< application, delegate< void(const event_args &)> > leave_thread_modal
Occurs when the application is about to leave a modal state.
Definition: application.h:301
Contains xtd::forms::application_context class.
Contains xtd::forms::message class.
static event< application, delegate< void(const event_args &)> > idle
Occurs when the application finishes processing and is about to enter the idle state.
Definition: application.h:297
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Definition: theme.h:14
Represents a window or dialog box that makes up an application&#39;s user interface.
Definition: form.h:40
Represents an event.
Definition: event.h:21
std::vector< std::reference_wrapper< form > > form_collection
Represents a collection of form objects.
Definition: application.h:36
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition: application.h:54
Represents a common dialog box that displays input dialog.
Definition: input_dialog.h:30
Implements a Windows message.
Definition: message.h:25
Contains xtd::forms::imessage_filter interface.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Creates a use wait cursor class.
Definition: use_wait_cursor.h:22
Provides data for a cancelable event.
Definition: cancel_event_args.h:19