xtd 0.2.0
Loading...
Searching...
No Matches
application.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.hpp"
10#include "form_collection.hpp"
11#include "imessage_filter.hpp"
12#include "message.hpp"
14#include <xtd/delegate>
15#include <xtd/event_handler>
16#include <xtd/static>
17#include <cstdint>
18#include <memory>
19#include <vector>
20
22namespace xtd {
24 namespace forms {
26 class input_dialog;
27 class message_box;
29
53 public:
55
60 static bool allow_quit() noexcept;
61
66
71 static bool button_images() noexcept;
72
78 static void button_images(bool value);
79
85 static xtd::string common_app_data_path() noexcept;
86
87 /*
91 static microsoft::win32::registry_key common_app_data_registry();
92 */
93
103 static xtd::string company_name() noexcept;
104
107 static bool dark_mode() noexcept;
108
112 static void dark_mode(bool value);
113
116 static xtd::string executable_name() noexcept;
117
120 static xtd::string executable_path() noexcept;
121
128 static bool font_size_correction();
129
136 static void font_size_correction(bool value);
137
141 static bool keep_cloned_controls() noexcept;
142
147 static void keep_cloned_controls(bool value);
148
151 static bool light_mode() noexcept;
152
156 static void light_mode(bool value);
157
162
167 static bool menu_images() noexcept;
168
174 static void menu_images(bool value);
175
178 static bool message_loop() noexcept;
179
183 static const form_collection open_forms() noexcept;
184
187 static xtd::string product_name() noexcept;
188
191 static xtd::string product_version() noexcept;
192
195 static xtd::string startup_path() noexcept;
196
200 static const xtd::forms::style_sheets::style_sheet& style_sheet() noexcept;
204 static void style_sheet(const xtd::forms::style_sheets::style_sheet& value);
208 static const xtd::forms::style_sheets::style_sheet::style_sheets_t& style_sheets() noexcept;
209
213 static const xtd::forms::style_sheets::style_sheet::style_sheet_names_t& style_sheet_names() noexcept;
214
219 static bool system_controls() noexcept;
220
226 static void system_controls(bool value);
227
234 static bool system_font_size() noexcept;
235
242 static void system_font_size(bool value);
243
249
255 static xtd::string user_app_data_path() noexcept;
256
257 /*
262 static microsoft::win32::registry_key user_app_data_registry();
263 */
264
271 static bool use_wait_cursor() noexcept;
279
284 static bool visual_styles() noexcept;
285
291 static void visual_styles(bool value);
293
295
301
305
313
317
326 static event<application, threading::thread_exception_event_handler> thread_exception;
327
333
335
340 static void add_message_filter(const imessage_filter& value);
341
347 static void do_events();
348
353 static void enable_visual_styles();
354
360 static void exit();
361
368 static void exit(cancel_event_args& e);
369
372 static void exit_thread();
373
380
383 static void raise_idle(const event_args& e);
384
389
393 static void remove_message_filter(const imessage_filter& value);
394
401 static void restart();
402
409 static void run();
410
417 static void run(xtd::forms::application_context& context);
418
426 static void run(const form& main_form);
427
428 /*
434 static void set_unhandled_exception_mode (unhandled_exception_mode mode);
435 */
436
437 /*
446 static void set_unhandled_exception_mode (unhandled_exception_mode mode, bool thread_scope);
447 */
449
451 static auto __opaque_crt_prv_msg__(intptr, int32, intptr, intptr, intptr, intptr) noexcept;
453
455
460 [[deprecated("Replaced by xtd::application::dark_mode - Will be removed in version 0.4.0.")]]
461 static bool dark_mode_enabled() noexcept;
462
466 [[deprecated("Replaced by xtd::application::light_mode - Will be removed in version 0.4.0.")]]
467 static bool light_mode_enabled() noexcept;
468
473 [[deprecated("Replaced by xtd::application::visual_styles - Will be removed in version 0.4.0.")]]
474 static bool use_visual_styles() noexcept;
476
478
484 [[deprecated("Replaced by xtd::application::button_images - Will be removed in version 0.4.0.")]]
485 static void enable_button_images();
486
492 [[deprecated("Replaced by xtd::application::dark_mode - Will be removed in version 0.4.0.")]]
493 static void enable_dark_mode();
494
500 [[deprecated("Replaced by xtd::application::light_mode - Will be removed in version 0.4.0.")]]
501 static void enable_light_mode();
502
507 [[deprecated("Replaced by xtd::application::menu_images - Will be removed in version 0.4.0.")]]
508 static void enable_menu_images();
510
511 private:
512 friend class form;
513 friend class input_dialog;
514 friend class message_box;
515
516 static bool close_open_forms();
517 static void on_app_thread_exit(object& sender, const event_args& e);
518 static bool on_app_thread_exception();
519 static bool on_thread_exception(const threading::thread_exception_event_args& e);
520 static void raise_enter_thread_modal(const event_args& e);
521 static void raise_leave_thread_modal(const event_args& e);
522 static intptr wnd_proc_(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr handle);
523 static void wnd_proc(message& message);
524 static void wm_activate_app(message& message);
525 static void wm_app_idle(message& message);
526 static void wm_quit(message& message);
527
528 static xtd::forms::application_context internal_context_;
529 static xtd::forms::application_context* context_;
530 static bool button_images_;
531 static bool keep_cloned_controls_;
532 static bool light_mode_;
533 static bool font_size_correction_;
534 static bool menu_images_;
535 static bool message_loop_;
536 static bool raise_idle_;
537 static bool system_controls_;
538 static bool system_font_size_;
539 static bool use_wait_cursor_;
540 static bool visual_styles_;
541 };
542 }
543}
Contains xtd::forms::application_context class.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition application.hpp:52
static void enable_dark_mode()
Enables dark mode for the application.
static bool menu_images() noexcept
Gets menu images are enabled.
friend class form
The form data allows you to specify the box of a form control.
Definition application.hpp:512
static event< application, event_handler > application_exit
Occurs when the application is about to shut down.
Definition application.hpp:300
static xtd::string executable_name() noexcept
Gets the executable name for the executable file that started the application, including the executab...
static void do_events()
Processes all Windows messages currently in the message queue.
static const xtd::forms::style_sheets::style_sheet & style_sheet() noexcept
Gets current xtd::forms::style_sheets::style_sheet style sheet.
static void exit()
Informs all message pumps that they must terminate, and then closes all application windows after the...
static const xtd::forms::style_sheets::style_sheet::style_sheets_t & style_sheets() noexcept
Gets the installed xtd::forms::style_sheets::style_sheet style sheets.
static xtd::string executable_path() noexcept
Gets the path for the executable file that started the application, including the executable name.
static bool dark_mode_enabled() noexcept
Return true if dark mode is enabled for the application; otherwise return false.
static bool system_font_size() noexcept
Gets a value indicating whether the system font size is enabled.
static std::optional< form_ref > main_form()
Gets the optional main form owned by the application.
static bool light_mode_enabled() noexcept
Return true if dark mode is enabled for the application; otherwise return false.
static xtd::string common_app_data_path() noexcept
Gets the path for the application data that is shared among all users.
static bool system_controls() noexcept
Gets a value indicating whether the system control is enabled.
static event< application, event_handler > enter_thread_modal
Occurs when the application is about to enter a modal state.
Definition application.hpp:304
static bool visual_styles() noexcept
Gets a value that indicates whether visual styles are enabled for the application.
static void enable_menu_images()
Enables menu images for the application.
static xtd::string user_app_data_path() noexcept
Gets the path for the application data of a user.
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 xtd::forms::application_context & application_context()
Gets the application context associate to the application.
static event< application, threading::thread_exception_event_handler > thread_exception
Occurs when an untrapped thread exception is thrown.
Definition application.hpp:326
static xtd::string product_version() noexcept
Gets the product version associated with this application.
static void raise_idle(const event_args &e)
Raises the Idle event.
static bool use_wait_cursor() noexcept
Gets whether the wait cursor is used for all open forms of the application.
static void enable_visual_styles()
Enables visual styles for the application.
static xtd::string company_name() noexcept
Gets the company name associated with the application.
static xtd::forms::style_sheets::style_sheet get_style_sheet_from_name(const xtd::string &name)
Gets the installed xtd::forms::style_sheets::style_sheet style sheet from specified name.
static bool light_mode() noexcept
Gets a value indicating whether light mode is enabled for the application.
static bool button_images() noexcept
Gets button images are enabled.
static void exit_thread()
Exits the message loop on the current thread and closes all windows on the thread.
static event< application, event_handler > idle
Occurs when the application finishes processing and is about to enter the idle state.
Definition application.hpp:312
static xtd::string startup_path() noexcept
Gets the path for the executable file that started the application, not including the executable name...
static xtd::string product_name() noexcept
Gets the product name associated with this application.
static bool keep_cloned_controls() noexcept
Gets a value indicating whether the xtd framework keep cloned control is enabled.
static void restart()
Shuts down the application and starts a new instance immediately.
static event< application, event_handler > leave_thread_modal
Occurs when the application is about to leave a modal state.
Definition application.hpp:316
static bool allow_quit() noexcept
Gets a value indicating whether the caller can quit this application.
static const xtd::forms::style_sheets::style_sheet & system_style_sheet() noexcept
Gets system xtd::forms::style_sheets::style_sheet style sheet.
static bool use_visual_styles() noexcept
Gets a value that indicates whether visual styles are enabled for the application.
static bool dark_mode() noexcept
Gets a value indicating whether dark mode is enabled for the application.
static const form_collection open_forms() noexcept
Gets a collection of open forms owned by the application.
static void enable_light_mode()
Enables light mode for the application.
static void enable_button_images()
Enables button images for the application.
static event< application, event_handler > 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.hpp:331
static bool font_size_correction()
Gets a value indicating whether font size correction is enabled.
static void remove_message_filter(const imessage_filter &value)
Removes a message filter from the message pump of the application.
static bool message_loop() noexcept
Gets a value indicating whether a message loop exists on this thread.
static const xtd::forms::style_sheets::style_sheet::style_sheet_names_t & style_sheet_names() noexcept
Gets the installed xtd::forms::style_sheets::style_sheet style sheet names.
static void register_message_loop_callback(message_loop_callback callback)
Registers a callback for checking whether the message loop is running in hosted environments.
Provides data for a cancelable event.
Definition cancel_event_args.hpp:22
Defines a message filter interface.
Definition imessage_filter.hpp:24
Represents a common dialog box that displays input dialog.
Definition input_dialog.hpp:38
Displays a message window, also known as a dialog box, which presents a message to the user....
Definition message_box.hpp:40
Contains xtd::forms::form_collection alias.
Contains forms_export_ keyword.
Contains namespace aliases.
xtd::delegate< bool()> message_loop_callback
Represents a method that will check whether the hosting environment is still sending messages.
Definition message_loop_callback.hpp:26
generic_event_handler< const xtd::event_args & > event_handler
Represents the method that will handle an event that has no event data.
Definition event_handler.hpp:24
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:25
std::vector< xtd::ref< form > > form_collection
Represents a collection of form objects.
Definition form_collection.hpp:24
xtd::ref< form > form_ref
Represent an xtd::forms::form reference.
Definition form_ref.hpp:25
@ e
The E key.
Definition keys.hpp:207
Contains xtd::forms::imessage_filter interface.
Contains xtd::forms::message class.
Contains xtd::forms::message_loop_callback delegate.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Implements a Windows message.
Definition message.hpp:33
Contains xtd::forms::style_sheets::style_sheet class.
Contains xtd::forms::thread_exception_event_handler event handler.