xtd 1.0.0
Loading...
Searching...
No Matches
application.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.hpp"
12#include "form_collection.hpp"
13#include "imessage_filter.hpp"
14#include "message.hpp"
16#include <xtd/delegate>
17#include <xtd/event_handler>
18#include <xtd/static>
19#include <cstdint>
20#include <memory>
21#include <vector>
22
24namespace xtd {
26 namespace forms {
28 class input_dialog;
29 class message_box;
31
55 public:
57
62 [[nodiscard]] static auto allow_quit() noexcept -> bool;
63
77 [[nodiscard]] static auto application_appearance() noexcept -> xtd::forms::application_appearance;
78
82 [[nodiscard]] static auto application_context() noexcept -> xtd::forms::application_context&;
83
88 [[nodiscard]] static auto button_images() noexcept -> bool;
94 static auto button_images(bool value) -> void;
95
101 [[nodiscard]] static auto common_app_data_path() noexcept -> xtd::string;
102
103 /*
107 [[nodiscard]] static auto common_app_data_registry() -> microsoft::win32::registry_key;
108 */
109
119 [[nodiscard]] static auto company_name() noexcept -> xtd::string;
120
133
136 [[nodiscard]] static auto executable_name() noexcept -> xtd::string;
137
140 [[nodiscard]] static auto executable_path() noexcept -> xtd::string;
141
148 [[nodiscard]] static auto font_size_correction() -> bool;
155 static auto font_size_correction(bool value) -> void;
156
159 [[nodiscard]] static auto is_dark_appearance() noexcept -> bool;
160
163 [[nodiscard]] static auto is_light_appearance() noexcept -> bool;
164
168 [[nodiscard]] static auto main_form() -> std::optional<form_ref>;
169
174 [[nodiscard]] static auto menu_images() noexcept -> bool;
180 static auto menu_images(bool value) -> void;
181
184 [[nodiscard]] static auto message_loop() noexcept -> bool;
185
189 [[nodiscard]] static auto open_forms() noexcept -> const form_collection;
190
193 [[nodiscard]] static auto product_name() noexcept -> xtd::string;
194
197 [[nodiscard]] static auto product_version() noexcept -> xtd::string;
198
201 [[nodiscard]] static auto startup_path() noexcept -> xtd::string;
202
206 [[nodiscard]] static auto style_sheet() noexcept -> const xtd::forms::style_sheets::style_sheet&;
210 static auto style_sheet(const xtd::forms::style_sheets::style_sheet& value) -> void;
211
215 [[nodiscard]] static auto style_sheets() noexcept -> const xtd::forms::style_sheets::style_sheet::style_sheets_t&;
216
220 [[nodiscard]] static auto style_sheet_names() noexcept -> const xtd::forms::style_sheets::style_sheet::style_sheet_names_t&;
221
228 [[nodiscard]] static auto system_font_size() noexcept -> bool;
235 static auto system_font_size(bool value) -> void;
236
241 [[nodiscard]] static auto system_style_sheet() noexcept -> const xtd::forms::style_sheets::style_sheet&;
242
248 [[nodiscard]] static auto user_app_data_path() noexcept -> xtd::string;
249
250 /*
255 [[nodiscard]] static auto user_app_data_registry() -> microsoft::win32::registry_key;
256 */
257
264 [[nodiscard]] static auto use_wait_cursor() noexcept -> bool;
272
277 [[nodiscard]] static auto visual_styles() noexcept -> bool;
283 static auto visual_styles(bool value) -> void;
285
287
293
297
305
309
318 static event<application, threading::thread_exception_event_handler> thread_exception;
319
325
327
332 static auto add_message_filter(const imessage_filter& value) -> void;
333
339 static auto do_events() -> void;
340
345 static auto enable_visual_styles() -> void;
346
352 static auto exit() -> void;
353
360 static auto exit(cancel_event_args& e) -> void;
361
364 static auto exit_thread() -> void;
365
371 [[nodiscard]] static auto get_style_sheet_from_name(const xtd::string& name) -> xtd::forms::style_sheets::style_sheet;
372
375 static auto raise_idle(const event_args& e) -> void;
376
381
385 static auto remove_message_filter(const imessage_filter& value) -> void;
386
393 static auto restart() -> void;
394
401 static auto run() -> void;
402
409 static auto run(xtd::forms::application_context& context) -> void;
410
418 static auto run(const form& main_form) -> void;
419
420 /*
426 static auto set_unhandled_exception_mode (unhandled_exception_mode mode) -> void;
427 */
428
429 /*
438 static auto set_unhandled_exception_mode (unhandled_exception_mode mode, bool thread_scope);
439 */
441
443 [[nodiscard]] static auto __opaque_crt_prv_msg__(intptr, int32, intptr, intptr, intptr, intptr) noexcept;
445
447
452 [[deprecated("Replaced by xtd::application::is_dark_appearance - Will be removed in version 1.2.0.")]]
453 [[nodiscard]] static auto dark_mode_enabled() noexcept -> bool;
454
458 [[deprecated("Replaced by xtd::application::is_light_appearance - Will be removed in version 1.2.0.")]]
459 [[nodiscard]] static auto light_mode_enabled() noexcept -> bool;
460
465 [[deprecated("Replaced by xtd::application::visual_styles - Will be removed in version 1.2.0.")]]
466 [[nodiscard]] static auto use_visual_styles() noexcept -> bool;
468
470
476 [[deprecated("Replaced by xtd::application::button_images - Will be removed in version 1.2.0.")]]
477 static auto enable_button_images() -> void;
478
484 [[deprecated("Replaced by xtd::application::application_appearance - Will be removed in version 1.2.0.")]]
485 static auto enable_dark_mode() -> void;
486
492 [[deprecated("Replaced by xtd::application::application_appearance - Will be removed in version 1.2.0.")]]
493 static auto enable_light_mode() -> void;
494
499 [[deprecated("Replaced by xtd::application::menu_images - Will be removed in version 1.2.0.")]]
500 static auto enable_menu_images() -> void;
502
503 private:
504 friend class control;
505 friend class form;
506 friend class input_dialog;
507 friend class message_box;
508
509 [[nodiscard]] static auto close_open_forms() -> bool;
510 static auto on_app_thread_exit(object& sender, const event_args& e) -> void;
511 [[nodiscard]] static auto on_app_thread_exception() -> bool;
512 [[nodiscard]] static auto on_thread_exception(const threading::thread_exception_event_args& e) -> bool;
513 static auto raise_enter_thread_modal(const event_args& e) -> void;
514 static auto raise_leave_thread_modal(const event_args& e) -> void;
515 [[nodiscard]] static auto wnd_proc_(xtd::intptr hwnd, xtd::uint32 msg, xtd::intptr wparam, xtd::intptr lparam, xtd::intptr handle) -> xtd::intptr;
516 static auto wnd_proc(message& message) -> void;
517 static auto wm_activate_app(message& message) -> void;
518 static auto wm_app_idle(message& message) -> void;
519 static auto wm_quit(message& message) -> void;
520
521 static xtd::forms::application_appearance application_appearance_;
522 static bool button_images_;
523 static xtd::forms::application_context internal_context_;
524 static xtd::forms::application_context* context_;
525 static xtd::forms::control_appearance control_appearance_;
526 static bool font_size_correction_;
527 static bool menu_images_;
528 static bool message_loop_;
529 static bool raise_idle_;
530 static bool system_font_size_;
531 static bool use_wait_cursor_;
532 static bool visual_styles_;
533 };
534 }
535}
Contains xtd::forms::application_appearance enum class.
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:23
Provides static methods and properties to manage an application, such as methods to start and stop an...
Definition application.hpp:54
friend class form
The form data allows you to specify the box of a form control.
Definition application.hpp:505
static event< application, event_handler > application_exit
Occurs when the application is about to shut down.
Definition application.hpp:292
static auto enable_visual_styles() -> void
Enables visual styles for the application.
static auto executable_name() noexcept -> xtd::string
Gets the executable name for the executable file that started the application, including the executab...
static auto system_style_sheet() noexcept -> const xtd::forms::style_sheets::style_sheet &
Gets system xtd::forms::style_sheets::style_sheet style sheet.
static auto open_forms() noexcept -> const form_collection
Gets a collection of open forms owned by the application.
static auto executable_path() noexcept -> xtd::string
Gets the path for the executable file that started the application, including the executable name.
static auto style_sheet_names() noexcept -> const xtd::forms::style_sheets::style_sheet::style_sheet_names_t &
Gets the installed xtd::forms::style_sheets::style_sheet style sheet names.
static auto register_message_loop_callback(message_loop_callback callback) -> void
Registers a callback for checking whether the message loop is running in hosted environments.
static auto raise_idle(const event_args &e) -> void
Raises the Idle event.
static event< application, event_handler > enter_thread_modal
Occurs when the application is about to enter a modal state.
Definition application.hpp:296
static auto company_name() noexcept -> xtd::string
Gets the company name associated with the application.
static auto exit_thread() -> void
Exits the message loop on the current thread and closes all windows on the thread.
static auto visual_styles() noexcept -> bool
Gets a value that indicates whether visual styles are enabled for the application.
static auto exit() -> void
Informs all message pumps that they must terminate, and then closes all application windows after the...
static auto add_message_filter(const imessage_filter &value) -> void
Adds a message filter to monitor Windows messages as they are routed to their destinations.
static auto allow_quit() noexcept -> bool
Gets a value indicating whether the caller can quit this application.
static auto enable_menu_images() -> void
Enables menu images for the application.
static auto style_sheets() noexcept -> const xtd::forms::style_sheets::style_sheet::style_sheets_t &
Gets the installed xtd::forms::style_sheets::style_sheet style sheets.
static auto button_images() noexcept -> bool
Gets button images are enabled.
static event< application, threading::thread_exception_event_handler > thread_exception
Occurs when an untrapped thread exception is thrown.
Definition application.hpp:318
static auto main_form() -> std::optional< form_ref >
Gets the optional main form owned by the application.
static auto run() -> void
Begins running a standard application message loop on the current thread, without a form.
static auto style_sheet() noexcept -> const xtd::forms::style_sheets::style_sheet &
Gets current xtd::forms::style_sheets::style_sheet style sheet.
static auto dark_mode_enabled() noexcept -> bool
Return true if dark mode is enabled for the application; otherwise return false.
static auto product_version() noexcept -> xtd::string
Gets the product version associated with this application.
static auto do_events() -> void
Processes all Windows messages currently in the message queue.
static auto enable_dark_mode() -> void
Enables dark mode for the application.
static event< application, event_handler > idle
Occurs when the application finishes processing and is about to enter the idle state.
Definition application.hpp:304
static auto is_light_appearance() noexcept -> bool
Gets a value indicating whether application appearance is light.
static auto enable_light_mode() -> void
Enables light mode for the application.
static auto startup_path() noexcept -> xtd::string
Gets the path for the executable file that started the application, not including the executable name...
static auto common_app_data_path() noexcept -> xtd::string
Gets the path for the application data that is shared among all users.
static auto control_appearance(xtd::forms::control_appearance value) -> void
Sets control appearance by default.
static auto remove_message_filter(const imessage_filter &value) -> void
Removes a message filter from the message pump of the application.
static event< application, event_handler > leave_thread_modal
Occurs when the application is about to leave a modal state.
Definition application.hpp:308
static auto get_style_sheet_from_name(const xtd::string &name) -> xtd::forms::style_sheets::style_sheet
Gets the installed xtd::forms::style_sheets::style_sheet style sheet from specified name.
static auto light_mode_enabled() noexcept -> bool
Return true if dark mode is enabled for the application; otherwise return false.
static auto system_font_size() noexcept -> bool
Gets a value indicating whether the system font size is enabled.
static auto enable_button_images() -> void
Enables button images for the application.
static auto application_appearance(xtd::forms::application_appearance value) -> void
Sets application appearance.
static auto font_size_correction() -> bool
Gets a value indicating whether font size correction is enabled.
static auto user_app_data_path() noexcept -> xtd::string
Gets the path for the application data of a user.
static auto application_context() noexcept -> xtd::forms::application_context &
Gets the application context associate to 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:323
static auto use_wait_cursor() noexcept -> bool
Gets whether the wait cursor is used for all open forms of the application.
static auto menu_images() noexcept -> bool
Gets menu images are enabled.
static auto message_loop() noexcept -> bool
Gets a value indicating whether a message loop exists on this thread.
static auto use_visual_styles() noexcept -> bool
Gets a value that indicates whether visual styles are enabled for the application.
static auto restart() -> void
Shuts down the application and starts a new instance immediately.
static auto is_dark_appearance() noexcept -> bool
Gets a value indicating whether application appearance is dark.
static auto product_name() noexcept -> xtd::string
Gets the product name associated with this application.
Provides data for a cancelable event.
Definition cancel_event_args.hpp:22
Represents a collection of form objects.
Definition form_collection.hpp:24
Defines a message filter interface.
Definition imessage_filter.hpp:23
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::control_appearance enum class.
auto() -> void
Signals a breakpoint to an attached debugger.
Definition debugger.hpp:75
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:38
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
std::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:25
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
xtd::ref< xtd::forms::form > form_ref
Represent an xtd::forms::form reference.
Definition form_ref.hpp:25
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.