class window


class window

Description

This class represents a window. After constructing a window, call the show function on it to display it.

Public Member Functions

window (
    int initial_width,
    int initial_height,
    const std::u8string& initial_title,
    window_mode initial_mode
)

Constructs a window object with the given size, title and mode.

Parameters:
  • initial_width:

    The width of the window.

  • initial_height:

    The height of the window.

  • initial_title:

    The text that should be displayed in the title bar.

  • initial_mode:

    The mode the window should be in.

window (
    const window& other
)
= delete
window&
operator = (
    const window& other
)
= delete
window (
    window&& other
)
noexcept

Move-constructs a window from an existing one.

Parameters:
  • other:

    The window to move from.

window&
operator = (
    window&& other
)
noexcept

Move-assigns a window into this one.

Parameters:
  • other:

    The window to move from.

window_native_handle&
grab_native_handle ()
noexcept

Returns a non-constant reference to the native handle of this window.

const window_native_handle&
grab_native_handle ()
const noexcept

Returns a constant reference to the native handle of this window.

std::u8string
get_title ()
const

Returns the title of this window.

void
set_title (
    const std::u8string& new_title
)

Sets the title of this window to the given string.

Parameters:
  • new_title:

    The new text to display in the title bar of the window.

bool
open (
    int width,
    int height,
    const std::u8string& title,
    window_mode mode
)

Initializes this window, after which you can call show to display it.

Parameters:
  • width:

    The width of the window.

  • height:

    The height of the window.

  • title:

    The text that should be displayed in the title bar.

  • mode:

    The mode the window should be in.

void
show ()

Shows this window.

void
hide ()

Hides this window.

void
close ()

Releases this window, after which you must call open if you wish to reinitialize it.

virtual
void
update (
    double delta_seconds,
    double total_seconds
)

This function is called automatically by the desktop GUI application every time the event queue is empty. Override this function in a subclass if you wish to perform window-related computation continuously.

Parameters:
  • delta_seconds:

    The number of seconds that have elapsed since the last call to this function.

  • total_seconds:

    The number of seconds that have elapsed since this window was opened.

virtual
void
handle_key_down_event (
    key_event& ev
)

Handles the key down event.

Parameters:
  • ev:

    The event object for this key down event.

virtual
void
handle_key_up_event (
    key_event& ev
)

Handles the key up event.

Parameters:
  • ev:

    The event object for this key up event.

virtual
void
handle_resize_event ()

Handles the window resize event.

virtual
void
handle_close_event (
    close_event& ev
)

Handles the window close event.

Parameters:
  • ev:

    The event object for this close event.



Copyright © 2022-2025 Daniel T. McGinnis

CCL was first published in 2022, and is still actively maintained.

This website was first published in 2022, and is still actively maintained.

This specific web page was first published in 2023.