xtd 1.0.0
Loading...
Searching...
No Matches
application_context.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "form.hpp"
6#include <xtd/any_object>
7#include <xtd/object>
8
10namespace xtd {
12 namespace forms {
28 struct data;
29
30 public:
32
39 explicit application_context(const form& main_form) noexcept;
41
45 application_context& operator =(application_context&&) = default;
46 application_context& operator =(const application_context&) = delete;
49
51
56 [[nodiscard]] auto main_form() const noexcept -> std::optional<const_form_ref>;
60 [[nodiscard]] auto main_form() noexcept -> std::optional<form_ref>;
64 auto main_form(const form& main_form) -> void;
68 auto main_form(std::nullptr_t) -> void;
69
74 [[nodiscard]] auto tag() const noexcept -> xtd::any_object;
79 auto tag(const xtd::any_object& tag) -> void;
81
83
88 auto exit_thread() -> void;
90
92
98
99 protected:
103 virtual auto exit_thread_core() -> void;
104
109 virtual auto on_main_form_closed(object& sender, const event_args& e) -> void;
110
111 private:
112 xtd::sptr<data> data_;
113 };
114 }
115}
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
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
virtual auto exit_thread_core() -> void
Terminates the message loop of the thread.
event< application_context, event_handler > thread_exit
Occurs when the message loop of the thread should be terminated, by calling exit_thread().
Definition application_context.hpp:96
application_context()
Initializes a new instance of the application_context class with no context.
auto tag() const noexcept -> xtd::any_object
Gets an object that contains data about the control.
application_context(const form &main_form) noexcept
Initializes a new instance of the application_context class with the specified Form.
auto main_form() const noexcept -> std::optional< const_form_ref >
Gets the form to use as context.
virtual auto on_main_form_closed(object &sender, const event_args &e) -> void
Calls ExitThreadCore(), which raises the ThreadExit event.
auto exit_thread() -> void
Terminates the message loop of the thread.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains xtd::forms::form container.
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
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
xtd::ref< const xtd::forms::form > const_form_ref
Represents a const xtd::forms::form reference.
Definition const_form_ref.hpp:25
xtd::ref< xtd::forms::form > form_ref
Represent an xtd::forms::form reference.
Definition form_ref.hpp:25
@ e
The E key.
Definition keys.hpp:207
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197