xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
application.h
Go to the documentation of this file.
1
4#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"
15#include "theme.h"
16#include <xtd/delegate.h>
17#include <xtd/event_args.h>
18#include <xtd/static.h>
19
21namespace xtd {
23 namespace forms {
25 class input_dialog;
26 class message_box;
28
36 using form_collection = std::vector<std::reference_wrapper<form>>;
37
55 public:
59 static bool allow_quit();
60
67
68 /*
72 static microsoft::win32::registry_key common_app_data_registry();
73 */
74
86
90
94
97 static bool message_loop();
98
103
108
113
117
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
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
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
285 static event<application, delegate<void(const event_args&)>> application_exit;
286
289 static event<application, delegate<void(const event_args&)>> enter_thread_modal;
290
297 static event<application, delegate<void(const event_args&)>> idle;
298
301 static event<application, delegate<void(const event_args&)>> leave_thread_modal;
302
303 /*
309 static event<threading::thread_exception_event_handler> thread_exception;
310 */
311
315 static event<application, delegate<void(const event_args&)>> thread_exit;
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}
Contains xtd::forms::application_context class.
Contains xtd::forms::application_informations class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Specifies the contextual information about an application thread.
Definition: application_context.h:26
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition: application.h:54
static void enable_dark_mode()
Enables dark mode for the application.
static void do_events()
Processes all Windows messages currently in the message queue.
static xtd::ustring executable_name()
Gets the executable name for the executable file that started the application, including the executab...
static void exit()
Informs all message pumps that they must terminate, and then closes all application windows after the...
static xtd::ustring product_version()
Gets the product version associated with this application.
static xtd::ustring executable_path()
Gets the path for the executable file that started the application, including the executable name.
static void enable_menu_images()
Enables menu images for the application.
static xtd::ustring startup_path()
Gets the path for the executable file that started the application, not including the executable name...
static const form_collection open_forms()
Gets a collection of open forms owned by the application.
static void run()
Begins running a standard application message loop on the current thread, without a form.
static void add_message_filter(const imessage_filter &value)
Adds a message filter to monitor Windows messages as they are routed to their destinations.
static void exit(cancel_event_args &e)
Informs all message pumps that they must terminate, and then closes all application windows after the...
static void raise_idle(const event_args &e)
Raises the Idle event.
static void enable_visual_styles()
Enables visual styles for the application.
static void use_wait_cursor(bool use_wait_cursor)
Sets whether the wait cursor is used for all open forms of the application.
static xtd::ustring user_app_data_path()
Gets the path for the application data of a user.
static bool use_wait_cursor()
Gets whether the wait cursor is used for all open forms of the application.
static bool use_visual_styles()
Gets a value that indicates whether visual styles are enabled for the application.
static xtd::ustring company_name()
Gets the company name associated with the application.
static void exit_thread()
Exits the message loop on the current thread and closes all windows on the thread.
static bool allow_quit()
Gets a value indicating whether the caller can quit this application.
static xtd::ustring product_name()
Gets the product name associated with this application.
static bool message_loop()
Gets a value indicating whether a message loop exists on this thread.
static void restart()
Shuts down the application and starts a new instance immediately.
static void run(application_context &context)
Begins running a standard application message loop on the current thread, with an application_context...
static void enable_light_mode()
Enables light mode for the application.
static void enable_button_images()
Enables button images for the application.
static void run(const form &main_form)
Begins running a standard application message loop on the current thread, and makes the specified for...
static bool light_mode_enabled()
Return true if dark mode is enabled for the application; otherwise return false.
static void remove_message_filter(const imessage_filter &value)
Removes a message filter from the message pump of the application.
static bool dark_mode_enabled()
Return true if dark mode is enabled for the application; otherwise return false.
static void register_message_loop_callback(message_loop_callback callback)
Registers a callback for checking whether the message loop is running in hosted environments.
static xtd::ustring common_app_data_path()
Gets the path for the application data that is shared among all users.
Provides data for a cancelable event.
Definition: cancel_event_args.h:19
Represents a window or dialog box that makes up an application's user interface.
Definition: form.h:40
Defines a message filter interface.
Definition: imessage_filter.h:20
Represents a common dialog box that displays input dialog.
Definition: input_dialog.h:30
Displays a message window, also known as a dialog box, which presents a message to the user....
Definition: message_box.h:30
Implements a Windows message.
Definition: message.h:25
Definition: theme.h:14
Creates a use wait cursor class.
Definition: use_wait_cursor.h:22
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::delegate delegate.
Contains xtd::event_args event args.
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
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
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
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
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
static event< application, delegate< void(const event_args &)> > application_exit
Occurs when the application is about to shut down.
Definition: application.h:285
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
std::vector< std::reference_wrapper< form > > form_collection
Represents a collection of form objects.
Definition: application.h:36
Contains xtd::forms::imessage_filter interface.
Contains xtd::forms::message class.
Contains xtd::forms::message_loop_callback callback.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::static_object class.
Contains xtd::forms::theme class.