Visual Computing Library
Loading...
Searching...
No Matches
vcl::WindowManagerConcept Concept Reference

The WindowManagerConcept concept is used to check if a class satisfies the requirements of the WindowManager concept. More...

#include <vclib/render/concepts/window_manager.h>

Concept definition

template<typename T>
concept vcl::WindowManagerConcept = requires (
T&& obj,
typename RemoveRef<T>::ParentType* pPtr,
std::string s,
uint u) {
typename RemoveRef<T>::ParentType;
{ RemoveRef<T>::WINDOW_MANAGER_ID } -> std::same_as<const uint&>;
RemoveRef<T>(s, u, u);
RemoveRef<T>(s, u, u, pPtr);
{ obj.windowTitle() } -> std::same_as<const std::string&>;
{ obj.width() } -> std::convertible_to<uint>;
{ obj.height() } -> std::convertible_to<uint>;
{ obj.isMinimized() } -> std::convertible_to<bool>;
{ obj.dpiScale() } -> Point2Concept;
obj.winId();
{ obj.displayId() } -> std::same_as<void*>;
requires IsConst<T> || requires {
{ obj.setWindowTitle(std::string()) } -> std::same_as<void>;
{ obj.update() } -> std::same_as<void>;
};
}
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The WindowManagerConcept concept is used to check if a class satisfies the requirements of the Window...
Definition window_manager.h:95

Detailed Description

The WindowManagerConcept concept is used to check if a class satisfies the requirements of the WindowManager concept.

Each class that satisfies this concept can be used as a window manager in the vcl::RenderApp class (first template parameter). The WindowManager class is responsible for managing the window and the window events.

It is a class that is templated on the RenderApp class (using the CRTP pattern). The class is then allowed to access the member functions of the public members of the vcl::RenderApp class and all the members of the vcl::RenderApp::WM inner class.

Moreoever, to work correctly with the RenderApp class, the Canvas class and the Drawer classes, the WindowManager class should call for each event (e.g. init, resize, mouseMove, ...) the corresponding member function of the vcl::RenderApp::WM inner class. This is necessary to propagate the event to the Canvas and to the Drawer objects. This requirement is not modeled in this concept definition because any platform can have different event handling.

Constructors

The class must have the following constructors:

  • WindowManagerType(ParentType* parent = nullptr): Default constructor that initializes the window manager with a parent object (if available).
  • WindowManagerType(const std::string& windowTitle, uint width, uint height, ParentType* parent = nullptr): Constructor that initializes the window manager with the window title, the initial width and height of the window, and a parent object (if available).
Inner types

The class must have the following inner types:

  • ParentType: The type of the parent object of the window manager. This object is used to propagate events from the window manager to the parent object, if available. The parent object is necessary only on some platforms (e.g. Qt). If the parent object is not available, the type should be set to void.
Static constants

The class must have the following static constants:

  • WINDOW_MANAGER_ID: The ID of the window manager. It is used to identify the window manager implementation (if necessary) by the DerivedRenderApp class. It must be a static constant of type uint. The value of the constant must be equal to one of the values of the vcl::WindowManagerId struct.
Member functions

The class must have the following member functions:

  • windowTitle() -> const std::string&: Returns the title of the window.
  • setWindowTitle(const std::string&) -> void: Sets the title of the window.
  • width() -> uint: Returns the width of the window.
  • height() -> uint: Returns the height of the window.
  • dpiScale() -> Point2Concept: Returns the DPI scale of the window.
  • winId() -> void*: Returns the platform dependent identifier of the window.
  • displayId() -> void*: Returns the platform dependent identifier of the display where the window is placed. This parameter is required only on linux platforms, it can be left nullptr in other platforms.
  • update() -> void: Updates the window.