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"
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 [[nodiscard]] static auto allow_quit() noexcept -> bool;
61
65 [[nodiscard]] static auto application_context() -> xtd::forms::application_context&;
66
71 [[nodiscard]] static auto button_images() noexcept -> bool;
77 static auto button_images(bool value) -> void;
78
84 [[nodiscard]] static auto common_app_data_path() noexcept -> xtd::string;
85
86 /*
90 [[nodiscard]] static auto common_app_data_registry() -> microsoft::win32::registry_key;
91 */
92
102 [[nodiscard]] static auto company_name() noexcept -> xtd::string;
103
106 [[nodiscard]] static auto dark_mode() noexcept -> bool;
110 static auto dark_mode(bool value) -> void;
111
114 [[nodiscard]] static auto executable_name() noexcept -> xtd::string;
115
118 [[nodiscard]] static auto executable_path() noexcept -> xtd::string;
119
126 [[nodiscard]] static auto font_size_correction() -> bool;
133 static auto font_size_correction(bool value) -> void;
134
137 [[nodiscard]] static auto light_mode() noexcept -> bool;
141 static auto light_mode(bool value) -> void;
142
146 [[nodiscard]] static auto main_form() -> std::optional<form_ref>;
147
152 [[nodiscard]] static auto menu_images() noexcept -> bool;
158 static auto menu_images(bool value) -> void;
159
162 [[nodiscard]] static auto message_loop() noexcept -> bool;
163
167 [[nodiscard]] static auto open_forms() noexcept -> const form_collection;
168
171 [[nodiscard]] static auto product_name() noexcept -> xtd::string;
172
175 [[nodiscard]] static auto product_version() noexcept -> xtd::string;
176
179 [[nodiscard]] static auto startup_path() noexcept -> xtd::string;
180
184 [[nodiscard]] static auto style_sheet() noexcept -> const xtd::forms::style_sheets::style_sheet&;
188 static auto style_sheet(const xtd::forms::style_sheets::style_sheet& value) -> void;
189
193 [[nodiscard]] static auto style_sheets() noexcept -> const xtd::forms::style_sheets::style_sheet::style_sheets_t&;
194
198 [[nodiscard]] static auto style_sheet_names() noexcept -> const xtd::forms::style_sheets::style_sheet::style_sheet_names_t&;
199
204 [[nodiscard]] static auto system_controls() noexcept -> bool;
210 static auto system_controls(bool value) -> void;
211
218 [[nodiscard]] static auto system_font_size() noexcept -> bool;
225 static auto system_font_size(bool value) -> void;
226
231 [[nodiscard]] static auto system_style_sheet() noexcept -> const xtd::forms::style_sheets::style_sheet&;
232
238 [[nodiscard]] static auto user_app_data_path() noexcept -> xtd::string;
239
240 /*
245 [[nodiscard]] static auto user_app_data_registry() -> microsoft::win32::registry_key;
246 */
247
254 [[nodiscard]] static auto use_wait_cursor() noexcept -> bool;
261 static auto use_wait_cursor(bool use_wait_cursor) -> void;
262
267 [[nodiscard]] static auto visual_styles() noexcept -> bool;
273 static auto visual_styles(bool value) -> void;
275
277
283
287
295
299
308 static event<application, threading::thread_exception_event_handler> thread_exception;
309
315
317
322 static auto add_message_filter(const imessage_filter& value) -> void;
323
329 static auto do_events() -> void;
330
335 static auto enable_visual_styles() -> void;
336
342 static auto exit() -> void;
343
350 static auto exit(cancel_event_args& e) -> void;
351
354 static auto exit_thread() -> void;
355
361 [[nodiscard]] static auto get_style_sheet_from_name(const xtd::string& name) -> xtd::forms::style_sheets::style_sheet;
362
365 static auto raise_idle(const event_args& e) -> void;
366
371
375 static auto remove_message_filter(const imessage_filter& value) -> void;
376
383 static auto restart() -> void;
384
391 static auto run() -> void;
392
399 static auto run(xtd::forms::application_context& context) -> void;
400
408 static auto run(const form& main_form) -> void;
409
410 /*
416 static auto set_unhandled_exception_mode (unhandled_exception_mode mode) -> void;
417 */
418
419 /*
428 static auto set_unhandled_exception_mode (unhandled_exception_mode mode, bool thread_scope);
429 */
431
433 [[nodiscard]] static auto __opaque_crt_prv_msg__(intptr, int32, intptr, intptr, intptr, intptr) noexcept;
435
437
442 [[deprecated("Replaced by xtd::application::dark_mode - Will be removed in version 1.2.0.")]]
443 [[nodiscard]] static auto dark_mode_enabled() noexcept -> bool;
444
448 [[deprecated("Replaced by xtd::application::light_mode - Will be removed in version 1.2.0.")]]
449 [[nodiscard]] static auto light_mode_enabled() noexcept -> bool;
450
455 [[deprecated("Replaced by xtd::application::visual_styles - Will be removed in version 1.2.0.")]]
456 [[nodiscard]] static auto use_visual_styles() noexcept -> bool;
458
460
466 [[deprecated("Replaced by xtd::application::button_images - Will be removed in version 1.2.0.")]]
467 static auto enable_button_images() -> void;
468
474 [[deprecated("Replaced by xtd::application::dark_mode - Will be removed in version 1.2.0.")]]
475 static auto enable_dark_mode() -> void;
476
482 [[deprecated("Replaced by xtd::application::light_mode - Will be removed in version 1.2.0.")]]
483 static auto enable_light_mode() -> void;
484
489 [[deprecated("Replaced by xtd::application::menu_images - Will be removed in version 1.2.0.")]]
490 static auto enable_menu_images() -> void;
492
493 private:
494 friend class control;
495 friend class form;
496 friend class input_dialog;
497 friend class message_box;
498
499 [[nodiscard]] static auto close_open_forms() -> bool;
500 static auto on_app_thread_exit(object& sender, const event_args& e) -> void;
501 [[nodiscard]] static auto on_app_thread_exception() -> bool;
502 [[nodiscard]] static auto on_thread_exception(const threading::thread_exception_event_args& e) -> bool;
503 static auto raise_enter_thread_modal(const event_args& e) -> void;
504 static auto raise_leave_thread_modal(const event_args& e) -> void;
505 [[nodiscard]] static auto wnd_proc_(xtd::intptr hwnd, xtd::uint32 msg, xtd::intptr wparam, xtd::intptr lparam, xtd::intptr handle) -> xtd::intptr;
506 static auto wnd_proc(message& message) -> void;
507 static auto wm_activate_app(message& message) -> void;
508 static auto wm_app_idle(message& message) -> void;
509 static auto wm_quit(message& message) -> void;
510
511 static xtd::forms::application_context internal_context_;
512 static xtd::forms::application_context* context_;
513 static bool button_images_;
514 static bool light_mode_;
515 static bool font_size_correction_;
516 static bool menu_images_;
517 static bool message_loop_;
518 static bool raise_idle_;
519 static bool system_controls_;
520 static bool system_font_size_;
521 static bool use_wait_cursor_;
522 static bool visual_styles_;
523 };
524 }
525}
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:52
friend class form
The form data allows you to specify the box of a form control.
Definition application.hpp:495
static event< application, event_handler > application_exit
Occurs when the application is about to shut down.
Definition application.hpp:282
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:286
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 system_controls() noexcept -> bool
Gets a value indicating whether the system control is enabled.
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:308
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:294
static auto dark_mode() noexcept -> bool
Gets a value indicating whether dark mode is enabled for the application.
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 light_mode() noexcept -> bool
Gets a value indicating whether light mode is enabled for the application.
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:298
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 application_context() -> xtd::forms::application_context &
Gets the application context associate to the application.
static auto enable_button_images() -> void
Enables button images for the application.
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 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:313
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 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::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.