#include <application_context.h>
Specifies the contextual information about an application thread.
- Namespace
- xtd::forms
- Library
- xtd.forms
- Examples
- The following code example demonstrate the use of application and application_context classes.
#include <xtd/xtd>
int main() {
form form1;
form1.click += [&] {
context.main_form(form1);
};
form1.text("Form 1 (Click the client area to set form as the main form)");
form1.show();
form form2;
form2.click += [&] {
context.main_form(form2);
};
form2.text("Form 2 (Click the client area to set form as the main form)");
form2.show();
form form3;
form3.click += [&] {
context.main_form(form3);
};
form3.text("Form 3 (Click the client area to set form as the main form)");
form3.show();
}
application_context()=default
Initializes a new instance of the application_context class with no context.
Inherits xtd::object.
|
static bool | equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are considered equal. More...
|
|
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are the same instance. More...
|
|
◆ application_context() [1/2]
xtd::forms::application_context::application_context |
( |
| ) |
|
|
default |
◆ application_context() [2/2]
xtd::forms::application_context::application_context |
( |
const form & |
main_form | ) |
|
|
inlineexplicit |
Initializes a new instance of the application_context class with the specified Form.
- Parameters
-
main_form | The main form of the application to use for context. |
◆ exit_thread()
void xtd::forms::application_context::exit_thread |
( |
| ) |
|
|
inline |
Terminates the message loop of the thread.
- Note
- exit_thread and exit_thread_core do not actually cause the thread to terminate. These methods raise the thread_exit event to which the Application object listens. The Application object then terminates the thread.
◆ exit_thread_core()
virtual void xtd::forms::application_context::exit_thread_core |
( |
| ) |
|
|
inlineprotectedvirtual |
Terminates the message loop of the thread.
- Note
- exit_thread and exit_thread_core do not actually cause the thread to terminate. These methods raise the thread_exit event to which the Application object listens. The Application object then terminates the thread.
◆ main_form() [1/3]
form& xtd::forms::application_context::main_form |
( |
| ) |
|
|
inline |
Gets or sets the Form to use as context.
- Returns
- The form to use as context.
◆ main_form() [2/3]
const form& xtd::forms::application_context::main_form |
( |
| ) |
const |
|
inline |
Gets the form to use as context.
- Returns
- The form to use as context.
◆ main_form() [3/3]
void xtd::forms::application_context::main_form |
( |
const form & |
main_form | ) |
|
|
inline |
Sets the Form to use as context.
- Parameters
-
main_form | The form to use as context. |
◆ on_main_form_closed()
virtual void xtd::forms::application_context::on_main_form_closed |
( |
object & |
sender, |
|
|
const event_args & |
e |
|
) |
| |
|
inlineprotectedvirtual |
Calls ExitThreadCore(), which raises the ThreadExit event.
- Parameters
-
sender | The object that raised the event. |
e | The event_args that contains the event data. |
◆ tag() [1/2]
std::any xtd::forms::application_context::tag |
( |
| ) |
const |
|
inline |
Gets an object that contains data about the control.
- Returns
- A std::any that contains data about the control. The default is empty.
◆ tag() [2/2]
void xtd::forms::application_context::tag |
( |
std::any |
tag | ) |
|
|
inline |
Sets an object that contains data about the control.
- Parameters
-
tag | A std::any that contains data about the control. The default is empty. |
The documentation for this class was generated from the following file: