Unigine::EngineWindow Class
Header: | #include <UnigineWindowManager.h> |
This base class operates with engine windows: their components, relations with other windows, size, position, visual representation and other features.
When you create a window viewport or a window group, the engine window is created.
The image below demonstrates the window components that can be controlled by the EngineWindow class methods.
To create the engine window, use one of the EngineWindowViewportor EngineWindowGroupclass constructors. For example:
// create an engine window of the specified size with the specified name
EngineWindowViewportPtr window = EngineWindowViewport::create("New window", 580, 300);
Then, by using methods of the EngineWindow class, you can specify the window appearance (for example, set a title, an icon, change opacity, add borders, and so on), and properties (whether the window can be nested, or whether it can become a group), define its style (system or engine), change the window state (whether it is shown/hidden, minimized/maximized, focused, etc.), manage window intersections and events.
Setting Up Position and Size#
In UNIGINE, the window size and position coordinates are measured in both units and pixels:
- The size and position in units don't depend on the DPI scale and always remain the same. You can change the window and client area size via setSize and setClientSize , adjust the minimum and maximum size and set the window and client position via the corresponding methods. All of them work with units.
-
The size and position in pixels are calculated by multiplying the size in units by the current DPI scale. You can get it using one of the RenderSize-related methods/properties (e.g., getRenderSize , and so on). When the DPI scale is 100%, 1 unit corresponds to 1 pixel.
DPI scaling is applied only when the auto_dpi_scalingflag is enabled. You can check the current flag value via the console or by using WindowManager::isAutoDpiScaling .
To determine how the OS handles the DPI scale, specify the DPI awareness mode.
You should consider this information when resizing textures, calculating mouse intersections, etc. The window size and position should be set individually, depending on the situation.
- Use one of the toRenderSize or toUnitSize to convert the size.
- Use globalToLocalUnitPosition to transform the coordinates in pixels into units or localUnitToGlobalPosition to do the opposite.
In the following example, the positions of the window and client area (in units) change to the mouse cursor when you press the P or C respectively:
#include <UnigineEngine.h>
#include <UnigineLogic.h>
#include <UnigineWindowManager.h>
using namespace Unigine;
using namespace Math;
EngineWindowViewportPtr system_viewport;
int AppSystemLogic::init()
{
// create a separate window viewport
system_viewport = EngineWindowViewport::create("Separate System Viewport", 400, 350);
// specify an intial position
system_viewport->setPosition(ivec2(30, 30));
// render the window viewport
system_viewport->show();
return 1;
}
int AppSystemLogic::update()
{
// get the current mouse position
ivec2 mouse_pos = Input::getMousePosition();
// change the window position to the mouse cursor when pressing 'P'
if (Input::isKeyDown(Input::KEY_P))
{
if (system_viewport.isDeleted() == false)
system_viewport->setPosition(mouse_pos);
}
// change the client area position to the mouse cursor when pressing 'C'
if (Input::isKeyDown(Input::KEY_C))
{
if (system_viewport.isDeleted() == false)
system_viewport->setClientPosition(mouse_pos);
}
return 1;
}
Check also the WindowSandbox and WindowSize samples — they print the full information on the window size and DPI.
Adjusting Visual Representation#
The window visual representation includes all available window parameters such as title and title bar, icon, borders, opacity, and window style (the engine or system one).
Here are some window examples:
#include <UnigineEngine.h>
#include <UnigineLogic.h>
#include <UnigineWindowManager.h>
EngineWindowViewportPtr system_viewport;
EngineWindowViewportPtr system_viewport_borderless;
EngineWindowViewportPtr engine_viewport_borderless;
EngineWindowViewportPtr engine_viewport;
int AppSystemLogic::init()
{
// create a separate system viewport
system_viewport = EngineWindowViewport::create("Window", 200, 200);
// specify an intial position
system_viewport->setPosition(ivec2(30, 30));
// specify an intial size
system_viewport->setSize(ivec2(400, 350));
// render the window viewport
system_viewport->show();
// create a separate system viewport with borders and title bar disabled
system_viewport_borderless = EngineWindowViewport::create(400, 350);
system_viewport_borderless->setPosition(ivec2(460, 30));
system_viewport_borderless->setSize(ivec2(400, 350));
// disable borders
system_viewport_borderless->setBordersEnabled(false);
// disable a title bar
system_viewport_borderless->setTitleBarEnabled(false);
system_viewport_borderless->show();
// create a separate engine viewport with no borders
engine_viewport_borderless = EngineWindowViewport::create("Window", 400, 350);
engine_viewport_borderless->setPosition(ivec2(460, 30));
engine_viewport_borderless->setEngineStyle(true);
engine_viewport_borderless->setSize(ivec2(400, 350));
// disable borders
engine_viewport_borderless->setBordersEnabled(false);
engine_viewport_borderless->show();
// create a separate engine viewport with borders
engine_viewport = EngineWindowViewport::create("Window", 400, 350);
engine_viewport->setPosition(ivec2(460, 30));
engine_viewport->setEngineStyle(true);
engine_viewport->setSize(ivec2(400, 350));
engine_viewport->show();
return 1;
}
A system-style window
|
A window (either system or engine style),
borders and title bar disabled |
An engine-style window, borders disabled
|
An engine-style window, borders enabled
|
The system and engine style windows have the same component layout except the sizing border: in the engine style, it is in the visual part of the window.
The ability to customize the window style makes it possible to create a standard set of window settings for different systems and frameworks.
Check the WindowVisual sample in UNIGINE SDK for more details.
Setting Up Order#
In the following example, the order of the window under the cursor changes when you press the specific button: T to make the window appear on top of all other windows, A to always render the window above the other windows.
#include <UnigineEngine.h>
#include <UnigineLogic.h>
#include <UnigineWindowManager.h>
EngineWindowPtr current_window;
EngineWindowViewportPtr system_viewport;
EngineWindowViewportPtr system_viewport_borderless;
EngineWindowViewportPtr engine_viewport_borderless;
EngineWindowViewportPtr engine_viewport;
int AppSystemLogic::init()
{
// create a separate system viewport
system_viewport = EngineWindowViewport::create("Window", 200, 200);
// specify an intial position
system_viewport->setPosition(ivec2(30, 30));
// specify an intial size
system_viewport->setSize(ivec2(400, 350));
// render the window viewport
system_viewport->show();
// create a separate system viewport with borders and title bar disabled
system_viewport_borderless = EngineWindowViewport::create(400, 350);
system_viewport_borderless->setPosition(ivec2(460, 30));
system_viewport_borderless->setSize(ivec2(400, 350));
// disable borders
system_viewport_borderless->setBordersEnabled(false);
system_viewport_borderless->show();
// create a separate engine viewport with no borders
engine_viewport_borderless = EngineWindowViewport::create("Window", 400, 350);
engine_viewport_borderless->setPosition(ivec2(460, 30));
engine_viewport_borderless->setEngineStyle(true);
engine_viewport_borderless->setSize(ivec2(400, 350));
// disable borders
engine_viewport_borderless->setBordersEnabled(false);
engine_viewport_borderless->show();
// create a separate engine viewport with borders
engine_viewport = EngineWindowViewport::create("Window", 400, 350);
engine_viewport->setPosition(ivec2(460, 30));
engine_viewport->setEngineStyle(true);
engine_viewport->setSize(ivec2(400, 350));
engine_viewport->show();
return 1;
}
int AppSystemLogic::update()
{
// get the current mouse position
ivec2 mouse_pos = Input::getMousePosition();
// make the window under the cursor appear on top when pressing 'T'
if (Input::isKeyDown(Input::KEY_T))
{
current_window = WindowManager::getUnderCursorWindow();
if (current_window.isDeleted() == false)
current_window->toTop();
}
// set the window under the cursor to be always on top when pressing 'A'
if (Input::isKeyDown(Input::KEY_A))
{
current_window = WindowManager::getUnderCursorWindow();
if (current_window.isDeleted() == false)
current_window->setAlwaysOnTop(true);
}
return 1;
}
Check the WindowOrder sample in UNIGINE SDK for more details.
Changing Behavior#
With the set of behavior-related functions, you can do the following:
- Force the engine to stop operating while the engine window is opened.
- Ignore or allow using the OS methods for windows closing.
- Specify whether the window is resizable.
- Specify the sizing border size.
- Control rendering of the engine window - show, hide, focus, minimize, maximize, restore, or close.
Check the WindowBehavior and WindowSandbox samples in UNIGINE SDK for more details.
Working with Modal Windows#
The following example demonstrates how to create modal windows and add modal children to the main window. Additionally, the main window includes a message that informs the user whether they can close the window or not.
#include "AppSystemLogic.h"
#include <UnigineEngine.h>
#include <UnigineLogic.h>
#include <UnigineWindowManager.h>
using namespace Unigine;
using namespace Math;
WidgetLabelPtr label;
EngineWindowViewportPtr main_window;
int AppSystemLogic::init()
{
// main window
main_window = WindowManager::getMainWindow();
main_window->setSize(ivec2(1600, 900));
main_window->setPosition(ivec2(30, 30));
main_window->setCanBeNested(false);
main_window->setCanCreateGroup(false);
// add an info label to the main window
label = WidgetLabel::create("");
label->setFontOutline(1);
label->setLifetime(Widget::LIFETIME_WINDOW);
label->setFontColor(vec4_red);
main_window->addChild(label, Gui::ALIGN_LEFT);
// first modal window of the main window
EngineWindowViewportPtr main_modal_0 = EngineWindowViewport::create("Modal for Main 0", 600, 650);
main_modal_0->setPosition(ivec2(50, 250));
main_modal_0->setCanBeNested(false);
main_modal_0->setCanCreateGroup(false);
main_modal_0->show();
main_modal_0->setModal(main_window);
// second modal window of the main window
EngineWindowViewportPtr main_modal_1 = EngineWindowViewport::create("Modal for Main 1", 900, 650);
main_modal_1->setPosition(ivec2(700, 250));
main_modal_1->setCanBeNested(false);
main_modal_1->setCanCreateGroup(false);
main_modal_1->show();
main_modal_1->setModal(main_window);
return 1;
}
int AppSystemLogic::update()
{
String text;
// check if the modal children of the main window are still opened
if (main_window->isModalParent())
text += "You CANNOT close this window. Please close modal children first.\n";
else
text += "You CAN close this window.\n";
// render the info label
label->setText(text);
return 1;
}
Check the WindowModal sample in UNIGINE SDK for more details.
See Also#
- A set of SDK samples (samples/Api/WindowManager) demonstrating various usage aspects.
EngineWindow Class
Enums
HITTEST#
FLAGS#
AREA#
TYPE#
Name | 说明/描 述 |
---|---|
ENGINE_WINDOW = 0 | Engine window. |
ENGINE_WINDOW_VIEWPORT = 1 | Engine viewport window. |
ENGINE_WINDOW_GROUP = 2 | Engine window group. |
NUM_ENGINE_WINDOWS = 3 | Total number of engine windows. |
Members
getGui() const#
Return value
Current Gui instance.getDisplayIndex() const#
Return value
CurrentisNested() const#
Return value
CurrentisSeparate() const#
Return value
CurrentgetSelfGui() const#
Return value
Current Gui instance.getClientLocalPosition() const#
Return value
Currentvoid setClientSize ( ) #
Arguments
- size - The
getClientSize() const#
Return value
CurrentisShown() const#
Return value
CurrentisHidden() const#
Return value
CurrentisFocused() const#
Return value
CurrentisMinimized() const#
Return value
CurrentisMaximized() const#
Return value
CurrentgetOrder() const#
Return value
CurrentgetParentGroup() const#
Return value
CurrentgetGlobalParentGroup() const#
Return value
CurrentgetNumDroppedItems() const#
Return value
Currentint getNumModalWindows() const#
Return value
CurrentPtr<EngineWindow> getModalParent() const#
Return value
Currentbool isModalParent() const#
Return value
true if is enabled; otherwise false.bool isModal() const#
Return value
true if is enabled; otherwise false.unsigned long long getID() const#
Return value
Currentbool isHiddenByTab() const#
Return value
true if is enabled; otherwise false.bool isSystemFocused() const#
Return value
true if is enabled; otherwise false.const char * getTypeName() const#
Return value
CurrentEngineWindow::TYPE getType() const#
Return value
Currentfloat getDpiScale() const#
Return value
Currentint getDpi() const#
Return value
CurrentMath::ivec2 getMaxRenderSize() const#
Return value
CurrentMath::ivec2 getMinRenderSize() const#
Return value
CurrentMath::ivec2 getClientRenderSize() const#
Return value
CurrentMath::ivec2 getRenderSize() const#
Return value
CurrentEvent<> getEventUnstack() const#
Usage Example
// implement the Unstack event handler
void unstack_event_handler()
{
Log::message("\Handling Unstack event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections unstack_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventUnstack().connect(unstack_event_connections, unstack_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventUnstack().connect(unstack_event_connections, []() {
Log::message("\Handling Unstack event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
unstack_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection unstack_event_connection;
// subscribe to the Unstack event with a handler function keeping the connection
publisher->getEventUnstack().connect(unstack_event_connection, unstack_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
unstack_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
unstack_event_connection.setEnabled(true);
// ...
// remove subscription to the Unstack event via the connection
unstack_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Unstack event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Unstack event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventUnstack().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Unstack event with a handler function
publisher->getEventUnstack().connect(unstack_event_handler);
// remove subscription to the Unstack event later by the handler function
publisher->getEventUnstack().disconnect(unstack_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId unstack_handler_id;
// subscribe to the Unstack event with a lambda handler function and keeping connection ID
unstack_handler_id = publisher->getEventUnstack().connect([]() {
Log::message("\Handling Unstack event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventUnstack().disconnect(unstack_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Unstack events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventUnstack().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventUnstack().setEnabled(true);
Return value
Event reference.Event<> getEventStack() const#
Usage Example
// implement the Stack event handler
void stack_event_handler()
{
Log::message("\Handling Stack event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections stack_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventStack().connect(stack_event_connections, stack_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventStack().connect(stack_event_connections, []() {
Log::message("\Handling Stack event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
stack_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection stack_event_connection;
// subscribe to the Stack event with a handler function keeping the connection
publisher->getEventStack().connect(stack_event_connection, stack_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
stack_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
stack_event_connection.setEnabled(true);
// ...
// remove subscription to the Stack event via the connection
stack_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Stack event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Stack event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventStack().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Stack event with a handler function
publisher->getEventStack().connect(stack_event_handler);
// remove subscription to the Stack event later by the handler function
publisher->getEventStack().disconnect(stack_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId stack_handler_id;
// subscribe to the Stack event with a lambda handler function and keeping connection ID
stack_handler_id = publisher->getEventStack().connect([]() {
Log::message("\Handling Stack event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventStack().disconnect(stack_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Stack events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventStack().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventStack().setEnabled(true);
Return value
Event reference.Event<const Ptr<EngineWindow> &> getEventUnstackMove() const#
Usage Example
// implement the UnstackMove event handler
void unstackmove_event_handler(const Ptr<EngineWindow> & window)
{
Log::message("\Handling UnstackMove event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections unstackmove_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventUnstackMove().connect(unstackmove_event_connections, unstackmove_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventUnstackMove().connect(unstackmove_event_connections, [](const Ptr<EngineWindow> & window) {
Log::message("\Handling UnstackMove event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
unstackmove_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection unstackmove_event_connection;
// subscribe to the UnstackMove event with a handler function keeping the connection
publisher->getEventUnstackMove().connect(unstackmove_event_connection, unstackmove_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
unstackmove_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
unstackmove_event_connection.setEnabled(true);
// ...
// remove subscription to the UnstackMove event via the connection
unstackmove_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A UnstackMove event handler implemented as a class member
void event_handler(const Ptr<EngineWindow> & window)
{
Log::message("\Handling UnstackMove event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventUnstackMove().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the UnstackMove event with a handler function
publisher->getEventUnstackMove().connect(unstackmove_event_handler);
// remove subscription to the UnstackMove event later by the handler function
publisher->getEventUnstackMove().disconnect(unstackmove_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId unstackmove_handler_id;
// subscribe to the UnstackMove event with a lambda handler function and keeping connection ID
unstackmove_handler_id = publisher->getEventUnstackMove().connect([](const Ptr<EngineWindow> & window) {
Log::message("\Handling UnstackMove event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventUnstackMove().disconnect(unstackmove_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all UnstackMove events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventUnstackMove().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventUnstackMove().setEnabled(true);
Return value
Event reference.Event<const char *> getEventItemDrop() const#
Usage Example
// implement the ItemDrop event handler
void itemdrop_event_handler(const char * item)
{
Log::message("\Handling ItemDrop event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections itemdrop_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventItemDrop().connect(itemdrop_event_connections, itemdrop_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventItemDrop().connect(itemdrop_event_connections, [](const char * item) {
Log::message("\Handling ItemDrop event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
itemdrop_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection itemdrop_event_connection;
// subscribe to the ItemDrop event with a handler function keeping the connection
publisher->getEventItemDrop().connect(itemdrop_event_connection, itemdrop_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
itemdrop_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
itemdrop_event_connection.setEnabled(true);
// ...
// remove subscription to the ItemDrop event via the connection
itemdrop_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A ItemDrop event handler implemented as a class member
void event_handler(const char * item)
{
Log::message("\Handling ItemDrop event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventItemDrop().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the ItemDrop event with a handler function
publisher->getEventItemDrop().connect(itemdrop_event_handler);
// remove subscription to the ItemDrop event later by the handler function
publisher->getEventItemDrop().disconnect(itemdrop_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId itemdrop_handler_id;
// subscribe to the ItemDrop event with a lambda handler function and keeping connection ID
itemdrop_handler_id = publisher->getEventItemDrop().connect([](const char * item) {
Log::message("\Handling ItemDrop event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventItemDrop().disconnect(itemdrop_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all ItemDrop events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventItemDrop().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventItemDrop().setEnabled(true);
Return value
Event reference.Event<> getEventClose() const#
Usage Example
// implement the Close event handler
void close_event_handler()
{
Log::message("\Handling Close event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections close_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventClose().connect(close_event_connections, close_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventClose().connect(close_event_connections, []() {
Log::message("\Handling Close event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
close_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection close_event_connection;
// subscribe to the Close event with a handler function keeping the connection
publisher->getEventClose().connect(close_event_connection, close_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
close_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
close_event_connection.setEnabled(true);
// ...
// remove subscription to the Close event via the connection
close_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Close event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Close event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventClose().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Close event with a handler function
publisher->getEventClose().connect(close_event_handler);
// remove subscription to the Close event later by the handler function
publisher->getEventClose().disconnect(close_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId close_handler_id;
// subscribe to the Close event with a lambda handler function and keeping connection ID
close_handler_id = publisher->getEventClose().connect([]() {
Log::message("\Handling Close event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventClose().disconnect(close_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Close events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventClose().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventClose().setEnabled(true);
Return value
Event reference.Event<> getEventRestored() const#
Usage Example
// implement the Restored event handler
void restored_event_handler()
{
Log::message("\Handling Restored event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections restored_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventRestored().connect(restored_event_connections, restored_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventRestored().connect(restored_event_connections, []() {
Log::message("\Handling Restored event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
restored_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection restored_event_connection;
// subscribe to the Restored event with a handler function keeping the connection
publisher->getEventRestored().connect(restored_event_connection, restored_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
restored_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
restored_event_connection.setEnabled(true);
// ...
// remove subscription to the Restored event via the connection
restored_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Restored event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Restored event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventRestored().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Restored event with a handler function
publisher->getEventRestored().connect(restored_event_handler);
// remove subscription to the Restored event later by the handler function
publisher->getEventRestored().disconnect(restored_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId restored_handler_id;
// subscribe to the Restored event with a lambda handler function and keeping connection ID
restored_handler_id = publisher->getEventRestored().connect([]() {
Log::message("\Handling Restored event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventRestored().disconnect(restored_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Restored events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventRestored().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventRestored().setEnabled(true);
Return value
Event reference.Event<> getEventMaximized() const#
Usage Example
// implement the Maximized event handler
void maximized_event_handler()
{
Log::message("\Handling Maximized event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections maximized_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventMaximized().connect(maximized_event_connections, maximized_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventMaximized().connect(maximized_event_connections, []() {
Log::message("\Handling Maximized event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
maximized_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection maximized_event_connection;
// subscribe to the Maximized event with a handler function keeping the connection
publisher->getEventMaximized().connect(maximized_event_connection, maximized_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
maximized_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
maximized_event_connection.setEnabled(true);
// ...
// remove subscription to the Maximized event via the connection
maximized_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Maximized event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Maximized event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventMaximized().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Maximized event with a handler function
publisher->getEventMaximized().connect(maximized_event_handler);
// remove subscription to the Maximized event later by the handler function
publisher->getEventMaximized().disconnect(maximized_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId maximized_handler_id;
// subscribe to the Maximized event with a lambda handler function and keeping connection ID
maximized_handler_id = publisher->getEventMaximized().connect([]() {
Log::message("\Handling Maximized event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventMaximized().disconnect(maximized_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Maximized events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventMaximized().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventMaximized().setEnabled(true);
Return value
Event reference.Event<> getEventMinimized() const#
Usage Example
// implement the Minimized event handler
void minimized_event_handler()
{
Log::message("\Handling Minimized event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections minimized_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventMinimized().connect(minimized_event_connections, minimized_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventMinimized().connect(minimized_event_connections, []() {
Log::message("\Handling Minimized event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
minimized_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection minimized_event_connection;
// subscribe to the Minimized event with a handler function keeping the connection
publisher->getEventMinimized().connect(minimized_event_connection, minimized_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
minimized_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
minimized_event_connection.setEnabled(true);
// ...
// remove subscription to the Minimized event via the connection
minimized_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Minimized event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Minimized event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventMinimized().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Minimized event with a handler function
publisher->getEventMinimized().connect(minimized_event_handler);
// remove subscription to the Minimized event later by the handler function
publisher->getEventMinimized().disconnect(minimized_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId minimized_handler_id;
// subscribe to the Minimized event with a lambda handler function and keeping connection ID
minimized_handler_id = publisher->getEventMinimized().connect([]() {
Log::message("\Handling Minimized event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventMinimized().disconnect(minimized_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Minimized events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventMinimized().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventMinimized().setEnabled(true);
Return value
Event reference.Event<> getEventHidden() const#
Usage Example
// implement the Hidden event handler
void hidden_event_handler()
{
Log::message("\Handling Hidden event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections hidden_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventHidden().connect(hidden_event_connections, hidden_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventHidden().connect(hidden_event_connections, []() {
Log::message("\Handling Hidden event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
hidden_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection hidden_event_connection;
// subscribe to the Hidden event with a handler function keeping the connection
publisher->getEventHidden().connect(hidden_event_connection, hidden_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
hidden_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
hidden_event_connection.setEnabled(true);
// ...
// remove subscription to the Hidden event via the connection
hidden_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Hidden event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Hidden event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventHidden().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Hidden event with a handler function
publisher->getEventHidden().connect(hidden_event_handler);
// remove subscription to the Hidden event later by the handler function
publisher->getEventHidden().disconnect(hidden_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId hidden_handler_id;
// subscribe to the Hidden event with a lambda handler function and keeping connection ID
hidden_handler_id = publisher->getEventHidden().connect([]() {
Log::message("\Handling Hidden event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventHidden().disconnect(hidden_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Hidden events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventHidden().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventHidden().setEnabled(true);
Return value
Event reference.Event<> getEventShown() const#
Usage Example
// implement the Shown event handler
void shown_event_handler()
{
Log::message("\Handling Shown event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections shown_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventShown().connect(shown_event_connections, shown_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventShown().connect(shown_event_connections, []() {
Log::message("\Handling Shown event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
shown_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection shown_event_connection;
// subscribe to the Shown event with a handler function keeping the connection
publisher->getEventShown().connect(shown_event_connection, shown_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
shown_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
shown_event_connection.setEnabled(true);
// ...
// remove subscription to the Shown event via the connection
shown_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Shown event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Shown event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventShown().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Shown event with a handler function
publisher->getEventShown().connect(shown_event_handler);
// remove subscription to the Shown event later by the handler function
publisher->getEventShown().disconnect(shown_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId shown_handler_id;
// subscribe to the Shown event with a lambda handler function and keeping connection ID
shown_handler_id = publisher->getEventShown().connect([]() {
Log::message("\Handling Shown event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventShown().disconnect(shown_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Shown events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventShown().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventShown().setEnabled(true);
Return value
Event reference.Event<> getEventMouseLeave() const#
Usage Example
// implement the MouseLeave event handler
void mouseleave_event_handler()
{
Log::message("\Handling MouseLeave event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mouseleave_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventMouseLeave().connect(mouseleave_event_connections, mouseleave_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventMouseLeave().connect(mouseleave_event_connections, []() {
Log::message("\Handling MouseLeave event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
mouseleave_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection mouseleave_event_connection;
// subscribe to the MouseLeave event with a handler function keeping the connection
publisher->getEventMouseLeave().connect(mouseleave_event_connection, mouseleave_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
mouseleave_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
mouseleave_event_connection.setEnabled(true);
// ...
// remove subscription to the MouseLeave event via the connection
mouseleave_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A MouseLeave event handler implemented as a class member
void event_handler()
{
Log::message("\Handling MouseLeave event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventMouseLeave().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseLeave event with a handler function
publisher->getEventMouseLeave().connect(mouseleave_event_handler);
// remove subscription to the MouseLeave event later by the handler function
publisher->getEventMouseLeave().disconnect(mouseleave_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId mouseleave_handler_id;
// subscribe to the MouseLeave event with a lambda handler function and keeping connection ID
mouseleave_handler_id = publisher->getEventMouseLeave().connect([]() {
Log::message("\Handling MouseLeave event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventMouseLeave().disconnect(mouseleave_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all MouseLeave events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventMouseLeave().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventMouseLeave().setEnabled(true);
Return value
Event reference.Event<> getEventMouseEnter() const#
Usage Example
// implement the MouseEnter event handler
void mouseenter_event_handler()
{
Log::message("\Handling MouseEnter event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections mouseenter_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventMouseEnter().connect(mouseenter_event_connections, mouseenter_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventMouseEnter().connect(mouseenter_event_connections, []() {
Log::message("\Handling MouseEnter event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
mouseenter_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection mouseenter_event_connection;
// subscribe to the MouseEnter event with a handler function keeping the connection
publisher->getEventMouseEnter().connect(mouseenter_event_connection, mouseenter_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
mouseenter_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
mouseenter_event_connection.setEnabled(true);
// ...
// remove subscription to the MouseEnter event via the connection
mouseenter_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A MouseEnter event handler implemented as a class member
void event_handler()
{
Log::message("\Handling MouseEnter event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventMouseEnter().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the MouseEnter event with a handler function
publisher->getEventMouseEnter().connect(mouseenter_event_handler);
// remove subscription to the MouseEnter event later by the handler function
publisher->getEventMouseEnter().disconnect(mouseenter_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId mouseenter_handler_id;
// subscribe to the MouseEnter event with a lambda handler function and keeping connection ID
mouseenter_handler_id = publisher->getEventMouseEnter().connect([]() {
Log::message("\Handling MouseEnter event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventMouseEnter().disconnect(mouseenter_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all MouseEnter events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventMouseEnter().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventMouseEnter().setEnabled(true);
Return value
Event reference.Event<> getEventUnfocused() const#
Usage Example
// implement the Unfocused event handler
void unfocused_event_handler()
{
Log::message("\Handling Unfocused event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections unfocused_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventUnfocused().connect(unfocused_event_connections, unfocused_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventUnfocused().connect(unfocused_event_connections, []() {
Log::message("\Handling Unfocused event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
unfocused_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection unfocused_event_connection;
// subscribe to the Unfocused event with a handler function keeping the connection
publisher->getEventUnfocused().connect(unfocused_event_connection, unfocused_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
unfocused_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
unfocused_event_connection.setEnabled(true);
// ...
// remove subscription to the Unfocused event via the connection
unfocused_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Unfocused event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Unfocused event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventUnfocused().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Unfocused event with a handler function
publisher->getEventUnfocused().connect(unfocused_event_handler);
// remove subscription to the Unfocused event later by the handler function
publisher->getEventUnfocused().disconnect(unfocused_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId unfocused_handler_id;
// subscribe to the Unfocused event with a lambda handler function and keeping connection ID
unfocused_handler_id = publisher->getEventUnfocused().connect([]() {
Log::message("\Handling Unfocused event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventUnfocused().disconnect(unfocused_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Unfocused events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventUnfocused().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventUnfocused().setEnabled(true);
Return value
Event reference.Event<> getEventFocused() const#
Usage Example
// implement the Focused event handler
void focused_event_handler()
{
Log::message("\Handling Focused event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections focused_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFocused().connect(focused_event_connections, focused_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFocused().connect(focused_event_connections, []() {
Log::message("\Handling Focused event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
focused_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection focused_event_connection;
// subscribe to the Focused event with a handler function keeping the connection
publisher->getEventFocused().connect(focused_event_connection, focused_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
focused_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
focused_event_connection.setEnabled(true);
// ...
// remove subscription to the Focused event via the connection
focused_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Focused event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Focused event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFocused().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Focused event with a handler function
publisher->getEventFocused().connect(focused_event_handler);
// remove subscription to the Focused event later by the handler function
publisher->getEventFocused().disconnect(focused_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId focused_handler_id;
// subscribe to the Focused event with a lambda handler function and keeping connection ID
focused_handler_id = publisher->getEventFocused().connect([]() {
Log::message("\Handling Focused event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFocused().disconnect(focused_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Focused events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFocused().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFocused().setEnabled(true);
Return value
Event reference.Event<const Math::ivec2 &> getEventResized() const#
Usage Example
// implement the Resized event handler
void resized_event_handler(const Math::ivec2 & new_size)
{
Log::message("\Handling Resized event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections resized_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventResized().connect(resized_event_connections, resized_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventResized().connect(resized_event_connections, [](const Math::ivec2 & new_size) {
Log::message("\Handling Resized event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
resized_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection resized_event_connection;
// subscribe to the Resized event with a handler function keeping the connection
publisher->getEventResized().connect(resized_event_connection, resized_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
resized_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
resized_event_connection.setEnabled(true);
// ...
// remove subscription to the Resized event via the connection
resized_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Resized event handler implemented as a class member
void event_handler(const Math::ivec2 & new_size)
{
Log::message("\Handling Resized event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventResized().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Resized event with a handler function
publisher->getEventResized().connect(resized_event_handler);
// remove subscription to the Resized event later by the handler function
publisher->getEventResized().disconnect(resized_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId resized_handler_id;
// subscribe to the Resized event with a lambda handler function and keeping connection ID
resized_handler_id = publisher->getEventResized().connect([](const Math::ivec2 & new_size) {
Log::message("\Handling Resized event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventResized().disconnect(resized_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Resized events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventResized().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventResized().setEnabled(true);
Return value
Event reference.Event<const Math::ivec2 &> getEventMoved() const#
Usage Example
// implement the Moved event handler
void moved_event_handler(const Math::ivec2 & new_coords)
{
Log::message("\Handling Moved event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections moved_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventMoved().connect(moved_event_connections, moved_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventMoved().connect(moved_event_connections, [](const Math::ivec2 & new_coords) {
Log::message("\Handling Moved event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
moved_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection moved_event_connection;
// subscribe to the Moved event with a handler function keeping the connection
publisher->getEventMoved().connect(moved_event_connection, moved_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
moved_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
moved_event_connection.setEnabled(true);
// ...
// remove subscription to the Moved event via the connection
moved_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Moved event handler implemented as a class member
void event_handler(const Math::ivec2 & new_coords)
{
Log::message("\Handling Moved event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventMoved().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Moved event with a handler function
publisher->getEventMoved().connect(moved_event_handler);
// remove subscription to the Moved event later by the handler function
publisher->getEventMoved().disconnect(moved_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId moved_handler_id;
// subscribe to the Moved event with a lambda handler function and keeping connection ID
moved_handler_id = publisher->getEventMoved().connect([](const Math::ivec2 & new_coords) {
Log::message("\Handling Moved event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventMoved().disconnect(moved_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Moved events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventMoved().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventMoved().setEnabled(true);
Return value
Event reference.Event<> getEventFuncSwap() const#
Usage Example
// implement the FuncSwap event handler
void funcswap_event_handler()
{
Log::message("\Handling FuncSwap event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcswap_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncSwap().connect(funcswap_event_connections, funcswap_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncSwap().connect(funcswap_event_connections, []() {
Log::message("\Handling FuncSwap event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcswap_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcswap_event_connection;
// subscribe to the FuncSwap event with a handler function keeping the connection
publisher->getEventFuncSwap().connect(funcswap_event_connection, funcswap_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcswap_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcswap_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncSwap event via the connection
funcswap_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncSwap event handler implemented as a class member
void event_handler()
{
Log::message("\Handling FuncSwap event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncSwap().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncSwap event with a handler function
publisher->getEventFuncSwap().connect(funcswap_event_handler);
// remove subscription to the FuncSwap event later by the handler function
publisher->getEventFuncSwap().disconnect(funcswap_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcswap_handler_id;
// subscribe to the FuncSwap event with a lambda handler function and keeping connection ID
funcswap_handler_id = publisher->getEventFuncSwap().connect([]() {
Log::message("\Handling FuncSwap event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncSwap().disconnect(funcswap_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncSwap events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncSwap().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncSwap().setEnabled(true);
Return value
Event reference.Event<> getEventFuncEndRender() const#
Usage Example
// implement the FuncEndRender event handler
void funcendrender_event_handler()
{
Log::message("\Handling FuncEndRender event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcendrender_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncEndRender().connect(funcendrender_event_connections, funcendrender_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncEndRender().connect(funcendrender_event_connections, []() {
Log::message("\Handling FuncEndRender event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcendrender_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcendrender_event_connection;
// subscribe to the FuncEndRender event with a handler function keeping the connection
publisher->getEventFuncEndRender().connect(funcendrender_event_connection, funcendrender_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcendrender_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcendrender_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncEndRender event via the connection
funcendrender_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncEndRender event handler implemented as a class member
void event_handler()
{
Log::message("\Handling FuncEndRender event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncEndRender().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncEndRender event with a handler function
publisher->getEventFuncEndRender().connect(funcendrender_event_handler);
// remove subscription to the FuncEndRender event later by the handler function
publisher->getEventFuncEndRender().disconnect(funcendrender_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcendrender_handler_id;
// subscribe to the FuncEndRender event with a lambda handler function and keeping connection ID
funcendrender_handler_id = publisher->getEventFuncEndRender().connect([]() {
Log::message("\Handling FuncEndRender event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncEndRender().disconnect(funcendrender_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncEndRender events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncEndRender().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncEndRender().setEnabled(true);
Return value
Event reference.Event<const Ptr<Gui> &> getEventFuncEndRenderGui() const#
Usage Example
// implement the FuncEndRenderGui event handler
void funcendrendergui_event_handler(const Ptr<Gui> & gui)
{
Log::message("\Handling FuncEndRenderGui event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcendrendergui_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncEndRenderGui().connect(funcendrendergui_event_connections, funcendrendergui_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncEndRenderGui().connect(funcendrendergui_event_connections, [](const Ptr<Gui> & gui) {
Log::message("\Handling FuncEndRenderGui event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcendrendergui_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcendrendergui_event_connection;
// subscribe to the FuncEndRenderGui event with a handler function keeping the connection
publisher->getEventFuncEndRenderGui().connect(funcendrendergui_event_connection, funcendrendergui_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcendrendergui_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcendrendergui_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncEndRenderGui event via the connection
funcendrendergui_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncEndRenderGui event handler implemented as a class member
void event_handler(const Ptr<Gui> & gui)
{
Log::message("\Handling FuncEndRenderGui event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncEndRenderGui().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncEndRenderGui event with a handler function
publisher->getEventFuncEndRenderGui().connect(funcendrendergui_event_handler);
// remove subscription to the FuncEndRenderGui event later by the handler function
publisher->getEventFuncEndRenderGui().disconnect(funcendrendergui_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcendrendergui_handler_id;
// subscribe to the FuncEndRenderGui event with a lambda handler function and keeping connection ID
funcendrendergui_handler_id = publisher->getEventFuncEndRenderGui().connect([](const Ptr<Gui> & gui) {
Log::message("\Handling FuncEndRenderGui event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncEndRenderGui().disconnect(funcendrendergui_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncEndRenderGui events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncEndRenderGui().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncEndRenderGui().setEnabled(true);
Return value
Event reference.Event<const Ptr<Gui> &> getEventFuncBeginRenderGui() const#
Usage Example
// implement the FuncBeginRenderGui event handler
void funcbeginrendergui_event_handler(const Ptr<Gui> & gui)
{
Log::message("\Handling FuncBeginRenderGui event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcbeginrendergui_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncBeginRenderGui().connect(funcbeginrendergui_event_connections, funcbeginrendergui_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncBeginRenderGui().connect(funcbeginrendergui_event_connections, [](const Ptr<Gui> & gui) {
Log::message("\Handling FuncBeginRenderGui event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcbeginrendergui_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcbeginrendergui_event_connection;
// subscribe to the FuncBeginRenderGui event with a handler function keeping the connection
publisher->getEventFuncBeginRenderGui().connect(funcbeginrendergui_event_connection, funcbeginrendergui_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcbeginrendergui_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcbeginrendergui_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncBeginRenderGui event via the connection
funcbeginrendergui_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncBeginRenderGui event handler implemented as a class member
void event_handler(const Ptr<Gui> & gui)
{
Log::message("\Handling FuncBeginRenderGui event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncBeginRenderGui().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncBeginRenderGui event with a handler function
publisher->getEventFuncBeginRenderGui().connect(funcbeginrendergui_event_handler);
// remove subscription to the FuncBeginRenderGui event later by the handler function
publisher->getEventFuncBeginRenderGui().disconnect(funcbeginrendergui_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcbeginrendergui_handler_id;
// subscribe to the FuncBeginRenderGui event with a lambda handler function and keeping connection ID
funcbeginrendergui_handler_id = publisher->getEventFuncBeginRenderGui().connect([](const Ptr<Gui> & gui) {
Log::message("\Handling FuncBeginRenderGui event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncBeginRenderGui().disconnect(funcbeginrendergui_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncBeginRenderGui events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncBeginRenderGui().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncBeginRenderGui().setEnabled(true);
Return value
Event reference.Event<> getEventFuncRender() const#
Usage Example
// implement the FuncRender event handler
void funcrender_event_handler()
{
Log::message("\Handling FuncRender event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcrender_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncRender().connect(funcrender_event_connections, funcrender_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncRender().connect(funcrender_event_connections, []() {
Log::message("\Handling FuncRender event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcrender_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcrender_event_connection;
// subscribe to the FuncRender event with a handler function keeping the connection
publisher->getEventFuncRender().connect(funcrender_event_connection, funcrender_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcrender_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcrender_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncRender event via the connection
funcrender_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncRender event handler implemented as a class member
void event_handler()
{
Log::message("\Handling FuncRender event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncRender().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncRender event with a handler function
publisher->getEventFuncRender().connect(funcrender_event_handler);
// remove subscription to the FuncRender event later by the handler function
publisher->getEventFuncRender().disconnect(funcrender_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcrender_handler_id;
// subscribe to the FuncRender event with a lambda handler function and keeping connection ID
funcrender_handler_id = publisher->getEventFuncRender().connect([]() {
Log::message("\Handling FuncRender event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncRender().disconnect(funcrender_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncRender events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncRender().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncRender().setEnabled(true);
Return value
Event reference.Event<> getEventFuncBeginRender() const#
Usage Example
// implement the FuncBeginRender event handler
void funcbeginrender_event_handler()
{
Log::message("\Handling FuncBeginRender event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcbeginrender_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncBeginRender().connect(funcbeginrender_event_connections, funcbeginrender_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncBeginRender().connect(funcbeginrender_event_connections, []() {
Log::message("\Handling FuncBeginRender event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcbeginrender_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcbeginrender_event_connection;
// subscribe to the FuncBeginRender event with a handler function keeping the connection
publisher->getEventFuncBeginRender().connect(funcbeginrender_event_connection, funcbeginrender_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcbeginrender_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcbeginrender_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncBeginRender event via the connection
funcbeginrender_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncBeginRender event handler implemented as a class member
void event_handler()
{
Log::message("\Handling FuncBeginRender event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncBeginRender().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncBeginRender event with a handler function
publisher->getEventFuncBeginRender().connect(funcbeginrender_event_handler);
// remove subscription to the FuncBeginRender event later by the handler function
publisher->getEventFuncBeginRender().disconnect(funcbeginrender_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcbeginrender_handler_id;
// subscribe to the FuncBeginRender event with a lambda handler function and keeping connection ID
funcbeginrender_handler_id = publisher->getEventFuncBeginRender().connect([]() {
Log::message("\Handling FuncBeginRender event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncBeginRender().disconnect(funcbeginrender_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncBeginRender events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncBeginRender().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncBeginRender().setEnabled(true);
Return value
Event reference.Event<> getEventFuncUpdate() const#
Usage Example
// implement the FuncUpdate event handler
void funcupdate_event_handler()
{
Log::message("\Handling FuncUpdate event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections funcupdate_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventFuncUpdate().connect(funcupdate_event_connections, funcupdate_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventFuncUpdate().connect(funcupdate_event_connections, []() {
Log::message("\Handling FuncUpdate event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
funcupdate_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection funcupdate_event_connection;
// subscribe to the FuncUpdate event with a handler function keeping the connection
publisher->getEventFuncUpdate().connect(funcupdate_event_connection, funcupdate_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
funcupdate_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
funcupdate_event_connection.setEnabled(true);
// ...
// remove subscription to the FuncUpdate event via the connection
funcupdate_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A FuncUpdate event handler implemented as a class member
void event_handler()
{
Log::message("\Handling FuncUpdate event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventFuncUpdate().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the FuncUpdate event with a handler function
publisher->getEventFuncUpdate().connect(funcupdate_event_handler);
// remove subscription to the FuncUpdate event later by the handler function
publisher->getEventFuncUpdate().disconnect(funcupdate_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId funcupdate_handler_id;
// subscribe to the FuncUpdate event with a lambda handler function and keeping connection ID
funcupdate_handler_id = publisher->getEventFuncUpdate().connect([]() {
Log::message("\Handling FuncUpdate event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventFuncUpdate().disconnect(funcupdate_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all FuncUpdate events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventFuncUpdate().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventFuncUpdate().setEnabled(true);
Return value
Event reference.Event<const Ptr<WindowEvent> &> getEventWindowEvent() const#
Usage Example
// implement the WindowEvent event handler
void windowevent_event_handler(const Ptr<WindowEvent> & event)
{
Log::message("\Handling WindowEvent event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections windowevent_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
publisher->getEventWindowEvent().connect(windowevent_event_connections, windowevent_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
publisher->getEventWindowEvent().connect(windowevent_event_connections, [](const Ptr<WindowEvent> & event) {
Log::message("\Handling WindowEvent event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
windowevent_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection windowevent_event_connection;
// subscribe to the WindowEvent event with a handler function keeping the connection
publisher->getEventWindowEvent().connect(windowevent_event_connection, windowevent_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
windowevent_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
windowevent_event_connection.setEnabled(true);
// ...
// remove subscription to the WindowEvent event via the connection
windowevent_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A WindowEvent event handler implemented as a class member
void event_handler(const Ptr<WindowEvent> & event)
{
Log::message("\Handling WindowEvent event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
publisher->getEventWindowEvent().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the WindowEvent event with a handler function
publisher->getEventWindowEvent().connect(windowevent_event_handler);
// remove subscription to the WindowEvent event later by the handler function
publisher->getEventWindowEvent().disconnect(windowevent_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId windowevent_handler_id;
// subscribe to the WindowEvent event with a lambda handler function and keeping connection ID
windowevent_handler_id = publisher->getEventWindowEvent().connect([](const Ptr<WindowEvent> & event) {
Log::message("\Handling WindowEvent event (lambda).\n");
}
);
// remove the subscription later using the ID
publisher->getEventWindowEvent().disconnect(windowevent_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all WindowEvent events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
publisher->getEventWindowEvent().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
publisher->getEventWindowEvent().setEnabled(true);
Return value
Event reference.bool isNested ( ) const#
Returns a value indicating if the object is a nested window or group of windows.Return value
true for a nested window or group of windows, otherwise false.bool isSeparate ( ) const#
Returns a value indicating if the object is a separate window or group of windows.Return value
true for a separate window or group of windows, otherwise false.void setPosition ( const Math::ivec2 & position ) #
Sets the position of the top left corner of the window in the screen coordinates. In case of several displays, the position is relative to the main display.Arguments
- const Math::ivec2 & position - The window screen position (coordinates of the top left corner).
Math::ivec2 getPosition ( ) const#
Returns the position of the top left corner of the window in the screen coordinates. In case of several displays, the position is relative to the main display.Return value
The window screen position (coordinates of the top left corner).void setClientPosition ( const Math::ivec2 & position ) #
Sets the position of the top left corner of the client (the window content area without the top bar and borders) in the screen coordinates. In case of several displays, the position is relative to the main display.Arguments
- const Math::ivec2 & position - The screen position of the client (coordinates of the top left corner).
Math::ivec2 getClientPosition ( ) const#
Returns the position of the top left corner of the client (the window content area without the top bar and borders) in the screen coordinates. In case of several displays, the position is relative to the main display. For a nested window, the window position is returned.Return value
The screen position of the client (coordinates of the top left corner).Math::ivec2 getClientLocalPosition ( ) const#
Returns the position of the top left corner of the client (the window content area without the top bar and borders) relative to the window position.Return value
The screen position of the client (coordinates of the top left corner) relative to the window position.void moveToCenter ( ) #
Positions the window so that the client center coincides with the center of the current display.void setSize ( const Math::ivec2 & size ) #
Sets the engine window size in units (i.e. including the sizing border).Arguments
- const Math::ivec2 & size - The engine window size.
Math::ivec2 getSize ( ) const#
Returns the engine window size in units (i.e. including the sizing border).Return value
The engine window size.Math::ivec2 getClientSize ( ) const#
Returns the size of the window client (content) area in units.Return value
The size of the client area.void setMinSize ( const Math::ivec2 & size ) #
Sets the minimum possible window size in units when resizing the window. If the value is more than the current maximum size, use the setMinAndMaxSize() method, to change both values at once. Otherwise the value will be clamped to the current maximum size.Arguments
- const Math::ivec2 & size - The minimum possible size of the window.
Math::ivec2 getMinSize ( ) const#
Returns the minimum possible window size in units when resizing the window.Return value
The minimum possible size of the window.void setMaxSize ( const Math::ivec2 & size ) #
Sets the maximum possible window size in units when resizing the window. If the value is less than the current minimum size, use the setMinAndMaxSize() method, to change both values at once. Otherwise the value will be clamped to the current minimum size.Arguments
- const Math::ivec2 & size - The maximum possible size of the window.
Math::ivec2 getMaxSize ( ) const#
Returns the maximum possible window size in units when resizing the window.Return value
The maximum possible size of the window.void setMinAndMaxSize ( const Math::ivec2 & min_size, const Math::ivec2 & max_size ) #
Sets the minimum and maximum possible window size when resizing the window.Arguments
- const Math::ivec2 & min_size - The minimum possible size of the window.
- const Math::ivec2 & max_size - The maximum possible size of the window.
void setTitle ( const char * title ) #
Sets the text of the title for the window. For a separate window, the title is set via system proxy in the title bar only; for a nested window, it is also set in the tab of the parent group.Arguments
- const char * title - The title of the window.
const char * getTitle ( ) const#
Returns the text of the title for the window. For a separate window, the icon is set via system proxy in the title bar only; for a nested window, it is also set in the tab of the parent group.Return value
The title for the engine window.int setIcon ( const Ptr<Image> & image ) #
Sets the icon for the window.Arguments
Return value
1 if the specified icon is successfully set for the window, otherwise 0.int getIcon ( ) const#
Returns the icon for the engine window.Return value
The icon for the window.1 if the icon for the window is returned successfully, otherwise 0.void setOpacity ( float opacity ) #
Sets the opacity for the window.Arguments
- float opacity - Opacity for the window.
float getOpacity ( ) const#
Returns the current opacity for the window.Return value
The opacity for the window.void setBordersEnabled ( bool enabled ) #
Enables and disables the borders for the window.Arguments
- bool enabled - true to enable the borders for the window, otherwise false.
bool isBordersEnabled ( ) const#
Returns the value indicating if the borders are enabled for the window.Return value
true if the borders are enabled for the window, otherwise false.void setBorderSize ( int size ) #
Sets the engine window border size.- This value is applied to the windows in the engine style only. For system-style windows system settings are applied.
- This method should be applied to a separate or parent window, using this method for a nested window is not allowed.
Arguments
- int size - The engine window border size.
int getBorderSize ( ) const#
Returns the engine window border size.- This value is applied to the windows in the engine style only. For system-style windows system settings are applied.
- This method should be applied to a separate or parent window, for a nested window it will return 0.
Return value
The engine window border size.void setResizable ( bool resizable ) #
Enables and disables the possibility to resize the engine window by the mouse.Arguments
- bool resizable - true to make the engine window resizable by the mouse, otherwise false.
bool isResizable ( ) const#
Returns the value indicating if the engine window is resizable by the mouse.Return value
true if the engine window is resizable by the mouse, otherwise false.void show ( ) #
Enables rendering of the engine window.bool isShown ( ) const#
Returns a value indicating if a widget is rendered.Return value
true if the engine window is rendered, otherwise false.void hide ( ) #
Disables rendering of the engine window.bool isHidden ( ) const#
Returns a value indicating if a widget is hidden.Return value
true if the engine window isn't rendered, otherwise false.void setFocus ( ) #
Sets the focus to the window.bool isFocused ( ) const#
Returns the value indicating if the window is currently in focus. For a separate or parent window, the returned value coinsides with the value returned by isSystemFocused().Return value
true if the engine window is in focus, otherwise false.void setSystemFocus ( ) #
Sets the focus to the engine window.bool isSystemFocused ( ) const#
Returns the value indicating if the engine window is currently in focus.Return value
true if the engine window is in focus, otherwise false.void minimize ( ) #
Minimizes the engine window to an iconic representation.bool isMinimized ( ) const#
Returns the value indicating if the engine window is minimized to tray.Return value
true if the engine window is minimized, otherwise false.void maximize ( ) #
Makes the engine window as large as possible.bool isMaximized ( ) const#
Returns the value indicating if the engine window is maximized.Return value
true if the engine window is maximized, otherwise false.void restore ( ) #
Restores the size and position of the minimized or maximized engine window via the system proxy.EngineWindow::HITTEST getHitTestResult ( const Math::ivec2 & global_pos ) #
Returns a value indicating in which area of the engine window the mouse is located.Arguments
- const Math::ivec2 & global_pos - Global coordinates of the hit-test point.
Return value
Value indicating the window area, one of the HITTEST_* values.const char * getHitTestResultName ( EngineWindow::HITTEST hit_test ) const#
Returns the string representation of the hit test result value.Arguments
- EngineWindow::HITTEST hit_test - Value indicating the window area, one of the HITTEST_* values.
Return value
The string representation of the hit test result value (e.g., HITTEST_RESIZE_RIGHT is RESIZE RIGHT).int getOrder ( ) const#
Returns the order of the window. This value allows comparing which window is closer to the viewer (a relatively smaller value).Return value
The order of the window.void toTop ( ) #
Makes the window appear on top of all other windows.void setAlwaysOnTop ( bool top ) #
Sets the window to always be rendered above the other windows.Arguments
- bool top - true to render the window always on top; otherwise, false.
bool isAlwaysOnTop ( ) const#
Returns the value indicating if the window is always rendered above the other windows.Return value
true if the window is always on top; otherwise, false.Ptr<EngineWindowGroup> getParentGroup ( ) const#
Returns the group into which the current window is nested, or nullptr if it is a separate window.Return value
The group into which the current window is nested, or nullptr if it is a separate window.Ptr<EngineWindowGroup> getGlobalParentGroup ( ) const#
Returns the top group of the hierarchy into which the current window is nested, or nullptr if it is a separate window.Return value
The top group of the hierarchy into which the current window is nested, or nullptr if it is a separate window.bool isGlobalChildOf ( const Ptr<EngineWindowGroup> & group ) #
Returns the value specifying if the current window is a part of a hierarchy of the specified window.Arguments
- const Ptr<EngineWindowGroup> & group - Window to be checked.
Return value
true if the current window is globally a child of the specified one, otherwise false.void updateGuiHierarchy ( ) #
Updates the hierarchy for all widgets — the widgets are arranged, expanded to the required sizes and then their positions are updated. Updating the hierarchy may be required, for example, for getting the screen position immediately after the widget has been added to the hierarchy. For a separate window, the hierarchy in self gui is updated; for a nested window, the hierarchy in self gui of the global parent group is updated.int getNumDroppedItems ( ) const#
Returns the total number of files and/or folders dropped to the window.Return value
The number of dropped files and/or folders.const char * getDroppedItem ( int index ) const#
Returns the absolute path to the file or folder dropped to the window.Arguments
- int index - Index of the dropped file or folder.
Return value
Absolute path to the dropped file or folder.unsigned long long getID ( ) const#
Returns the ID of the engine window, which is unchanged during the whole lifecycle of the window.Return value
ID of the engine window, if the window is external.void screenshot ( const char * path ) #
Creates a screenshot after the rendering stage is completed.Arguments
- const char * path - Path to save the screenshot.
void setHoldEngine ( bool engine ) #
Sets the value indicating if the engine can stop operating (quit automatically) while this window is open.Arguments
- bool engine - true if the engine can't stop operating while this window is open, otherwise false.
bool isHoldEngine ( ) const#
Sets the value indicating if the engine can stop operating (quit automatically) while this window is open.Return value
true if the engine can't stop operating while this window is open, otherwise false.void setIgnoreSystemClose ( bool close ) #
Sets the value indicating if this window can be closed using the OS methods ( ALT+F4 or cross in the top-right corner of the window).Arguments
- bool close - If true, the window can't be closed using the OS methods.
bool isIgnoreSystemClose ( ) const#
Returns the value indicating if this window can be closed using the OS methods ( ALT+F4 or cross in the top-right corner of the window).Return value
If true, the window can't be closed using the OS methods.void setModal ( const Ptr<EngineWindow> & parent_window ) #
Sets the current window modal to the specified parent window. Both the parent and the child windows must be separate. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Arguments
- const Ptr<EngineWindow> & parent_window - Parent window.
bool isModal ( ) const#
Checks if the window is modal. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Return value
true if the window is modal; otherwise, false.bool isModalParent ( ) const#
Checks if this window is parent for any modal window. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Return value
true if the window is parent for any modal window; otherwise, false.Ptr<EngineWindow> getModalParent ( ) const#
Returns the modal parent of the window. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Return value
The modal parent of the window.void addModalWindow ( const Ptr<EngineWindow> & window ) #
Adds the argument window as modal to the current window. Both the parent and the child windows must be separate. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Arguments
- const Ptr<EngineWindow> & window - Window to be added as modal.
void removeModalWindow ( const Ptr<EngineWindow> & window ) #
Removes the argument modal window from this window. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Arguments
- const Ptr<EngineWindow> & window - Engine window.
int getNumModalWindows ( ) const#
Returns the total number of modal windows for this window. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Return value
The total number of modal windows.Ptr<EngineWindow> getModalWindow ( int index ) const#
Returns the modal window for this window by its index. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.Arguments
- int index - Index of the modal window.
Return value
Modal window.void unstack ( ) #
Removes the current window from a parent group.EngineWindow::TYPE getType ( ) const#
Returns the type of the engine window.Return value
The type of the engine window.const char * getTypeName ( ) const#
Returns the name of the engine window type as a string.Return value
The string representation of the engine window type.void setTitleBarEnabled ( bool enabled ) #
Enables and disables the title bar for the window.- This value is applied to the windows in the engine style only. For system-style windows system settings are applied.
- This method should be applied to a separate or parent window, using this method for a nested window is not allowed.
Arguments
- bool enabled - true to enable the title bar for the engine window, otherwise false.
bool isTitleBarEnabled ( ) const#
Returns the value indicating if the title bar is enabled for the window.- This value is applied to the windows in the engine style only. For system-style windows system settings are applied.
- This method should be applied to a separate or parent window, for a nested window it will return false.
Return value
true if the title bar is enabled for the engine window, otherwise false.void setTitleBarHeight ( int height ) #
Sets the height of the window title bar.- This value is applied to the windows in the engine style only. For system-style windows system settings are applied.
- This method can be applied to a separate or parent window, using this method for a nested window is not allowed.
Arguments
- int height - The engine window title bar height.
int getTitleBarHeight ( ) const#
Returns the height of the window title bar.- This value is applied to the windows in the engine style only. For system-style windows system settings are applied.
- This method should be applied to a separate or parent window, for a nested window it will return 0.
Return value
The engine window title bar height.void setSystemStyle ( bool style ) #
Sets the system style for the engine window.Arguments
- bool style - true to set the default system style for the engine window, false to set the engine-style window.
bool isSystemStyle ( ) const#
Returns the value indicating if the default system style is set for the engine window.Return value
true if the default system style is set for the engine window; false if the engine style is set for the window.void setEngineStyle ( bool style ) #
Sets the engine style for the engine window.Arguments
- bool style - true to set the engine style for the engine window, false to set the default system style.
bool isEngineStyle ( ) const#
Returns the value indicating if the engine style is set for the engine window.Return value
true if the engine style is set for the engine window; false if the default system style is set for the window.void setSizingBorderSize ( int size ) #
Sets the size of the border in the widget that is manipulated to resize the window.- This method should not be applied to a system-style window with enabled borders, as the system settings cannot be changed.
- This method should not be applied to nested windows.
Arguments
- int size - The size of the border that is manipulated to resize the window, in pixels.
int getSizingBorderSize ( ) const#
Returns the size of the border in the widget that is manipulated to resize the window.- This method should be applied to an engine-style window, for an unmodified system-style window (i.e. with the enabled border size), the system value is applied.
- This method should be applied to a separate or parent window, for a nested window it will return 0.
Return value
The size of the border in the widget that is manipulated to resize the window, in pixels.void close ( ) #
Deletes the window if this window is not a modal parent or a member of a fixed group. If a window is a member of a fixed group, it cannot be closed (i.e. deleted).void setCanBeNested ( bool nested ) #
Sets the value indicating if the engine window can be used as a nested window.Arguments
- bool nested - true to enable usage of the engine window as a nested window, otherwise false.
bool isCanBeNested ( ) const#
Returns the value indicating if the engine window can be used as a nested window.Return value
true if usage of the engine window as a nested window is enabled, otherwise false.void setCanCreateGroup ( bool group ) #
Sets the value indicating if the engine window can become a group.Arguments
- bool group - true to enable usage of the engine window as a group, otherwise false.
bool isCanCreateGroup ( ) const#
Returns the value indicating if the engine window can become a group.Return value
true if usage of the engine window as a group is enabled, otherwise false.bool isHiddenByTab ( ) const#
Returns the value indicating if the window is overlapped by any other tab (either by switching to another tab or resizing this window to have zero client area).Return value
true if the window is overlapped by any other tab, otherwise false.bool getIntersection ( const Math::ivec2 & global_mouse_pos ) const#
Returns the value indicating if the mouse is hovering over the window.Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
Return value
true if the mouse hovers over the current window, otherwise false.bool getClientIntersection ( const Math::ivec2 & global_mouse_pos ) const#
Returns the value indicating if the mouse is hovering over the client area of the window.//checks if the mouse is hovering over the main window
WindowManager::getMainWindow()->getClientIntersection(Input::getMousePosition());
Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
Return value
true if the mouse hovers over the client area of the window, otherwise false.EngineWindow::AREA getClient9Area ( const Math::ivec2 & global_mouse_pos ) const#
Returns the area over which the mouse hovers, one of the nine areas into which the window is segmented.Arguments
- const Math::ivec2 & global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
Return value
One of the nine segments the screen area is split into.const char * get9AreaName ( EngineWindow::AREA area ) const#
Returns the name of the screen segment as a string.Arguments
- EngineWindow::AREA area - One of the nine segments the screen area is split into.
Return value
The string representation of the segment value (e.g., AREA_TOP_LEFT is TOP LEFT).Math::ivec2 globalToLocalUnitPosition ( const Math::ivec2 & global_pos ) const#
Transforms the global screen coordinates in pixels into units relative to the window client area.Arguments
- const Math::ivec2 & global_pos - The position in global coordinates.
Return value
The coordinates in units relative to the window client area.Math::ivec2 localUnitToGlobalPosition ( const Math::ivec2 & unit_pos ) const#
Transforms the position in units relative to the window client area into the global screen coordinates in pixels.Arguments
- const Math::ivec2 & unit_pos - The coordinates in units relative to the window client area.
Return value
The position in global coordinates.Math::ivec2 getRenderSize ( ) const#
Returns the engine window frame size in pixels.Return value
The engine window frame size in pixels.Math::ivec2 getClientRenderSize ( ) const#
Returns the client area size in pixels.Return value
The client area size in pixels.Math::ivec2 getMinRenderSize ( ) const#
Returns the minimum window size in pixels.Return value
The minimum window size in pixels.Math::ivec2 getMaxRenderSize ( ) const#
Returns the maximum window size in pixels.Return value
The maximum window size in pixels.int getDpi ( ) const#
Returns the current DPI level for the window.Return value
The current DPI level for the window.float getDpiScale ( ) const#
Returns the current DPI scale applied to the elements inside the window.Return value
The current DPI scale applied to the elements inside the window.int toRenderSize ( int unit_size ) #
Transforms the unit value to the pixel value.Arguments
- int unit_size - Size in units.
Return value
Size in pixels.int toUnitSize ( int render_size ) #
Transforms the pixel value to the unit value.Arguments
- int render_size - Size in pixels.
Return value
Size in units.Math::ivec2 toRenderSize ( const Math::ivec2 & unit_size ) #
Transforms the unit value to the pixel value.Arguments
- const Math::ivec2 & unit_size - Size in units.
Return value
Size in pixels.Math::ivec2 toUnitSize ( const Math::ivec2 & render_size ) #
Transforms the pixel value to the unit value.Arguments
- const Math::ivec2 & render_size - Size in pixels.