nCine::AuxiliaryWindow class

Window of the application besides the main one, as a panel dragged out of it.

Made by IGfxDevice::CreateAuxiliaryWindow(), it has no border or title bar of the system, whatever it shows is drawn by the application into a texture, which is shown in the window every frame, see SetContents(). It stays in front of the main window, and is shown on the taskbar unless it's a popup.

Input over it goes to the input handler of the application as input over the main window would, with the position relative to the main window and MouseState::WindowId set to GetId(). Keys typed while it has the focus go there too, and the application doesn't count as having lost the focus.

The platform backend makes the window, AuxiliaryWindowPresenter shows the contents with the graphics backend.

Derived classes

class GlfwAuxiliaryWindow
Window besides the main one made with GLFW, see AuxiliaryWindow.
class SdlAuxiliaryWindow
Window besides the main one made with SDL, see AuxiliaryWindow.

Public static functions

static auto GetAll() -> Death::Containers::ArrayView<AuxiliaryWindow* const>
Returns all windows besides the main one.
static auto FindById(std::uint32_t id) -> AuxiliaryWindow*
Returns the window of an identifier, nullptr if there's none.
static auto IsAnyFocused() -> bool
Returns true if any window besides the main one has the keyboard focus.

Constructors, destructors, conversion operators

~AuxiliaryWindow() virtual
AuxiliaryWindow(const AuxiliaryWindow&) deleted
AuxiliaryWindow() protected

Public functions

auto operator=(const AuxiliaryWindow&) -> AuxiliaryWindow& deleted
auto GetId() const -> std::uint32_t
Returns its identifier in input events, never 0.
void SetBounds(const Recti& bounds) pure virtual
Moves and resizes it, in units of the desktop.
auto GetBounds() const -> Recti pure virtual
Returns where it is and its size, in units of the desktop, which may be larger than pixels on a scaled display.
auto GetPixelSize() const -> Vector2i pure virtual
Returns the size of what is drawn into it in pixels.
auto IsFocused() const -> bool pure virtual
Returns true if it has the keyboard focus.
void Raise() pure virtual
Brings it in front of other windows and gives it the focus.
void SetTitle(Death::Containers::StringView title) pure virtual
Sets its title, the system shows it on the taskbar.
auto GetContentScale() const -> float virtual
Returns the scale of the display it's on, 1 for 100 %.
void SetInputScale(float scale)
Sets how many units of the main window a unit of this window takes, 1 by default.
auto GetInputScale() const -> float
Returns how many units of the main window a unit of this window takes, see SetInputScale().
auto HasRoundedCorners() const -> bool
Returns true if the system rounds its corners, what is drawn into it should have the same corners.
void Show(bool activate)
Shows it, activate gives it the focus too.
void Hide()
Hides it.
auto IsShown() const -> bool
Returns true if it's shown or will be once its contents are, see Show().
void SetContents(Texture* texture)
Sets the texture with what it shows, it's shown after the frame is drawn.
auto GetContents() const -> Texture*
Returns the texture with what it shows.
void Present()
Shows the contents in the window, called once a frame after it's drawn, see IGfxDevice::PresentAuxiliaryWindows().

Protected functions

void SetVisible(bool visible, bool activate) pure virtual
Makes the window seen, or hides it.

Protected variables

std::uint32_t _id
Texture* _contents
bool _roundedCorners
Whether the system rounds its corners, see HasRoundedCorners().
float _inputScale
std::unique_ptr<AuxiliaryWindowPresenter> _presenter
Shows the contents with the graphics backend, set by the platform backend once the window is made.

Function documentation

float nCine::AuxiliaryWindow::GetContentScale() const virtual

Returns the scale of the display it's on, 1 for 100 %.

The ratio to the scale of the main window (see IGfxDevice::GetWindowContentScale()) is how much larger what is shown in it has to be drawn on another display. By default it's how many pixels it has for a unit of the desktop, which is the scale of the display where the system scales the units of windows by it.

void nCine::AuxiliaryWindow::SetInputScale(float scale)

Sets how many units of the main window a unit of this window takes, 1 by default.

Positions of the pointer over it are made relative to the main window with it, what it shows may be drawn at another scale than the main window, on a display with another scale.

void nCine::AuxiliaryWindow::Show(bool activate)

Shows it, activate gives it the focus too.

It's shown once its contents were shown in it the first time, see Present(), so it never shows something that wasn't drawn for it.

void nCine::AuxiliaryWindow::SetContents(Texture* texture)

Sets the texture with what it shows, it's shown after the frame is drawn.

The texture has to stay until the next call or until the window is destroyed, and should be as large as the window in pixels, a larger one is cut and a smaller one leaves the rest black. Nothing is shown with nullptr.