class desktop_gui_application


class desktop_gui_application
    : public application

Description

This class performs all initialization necessary to make desktop GUI applications work, and also provides an event loop. You instantiate this class in your application's main function, then you set up your windows, and finally you return the result of calling the run function, which will initiate the event loop and return 0 when all windows have been closed.

Public Member Functions

desktop_gui_application (
    int argc,
    char** argv
)

Constructs a desktop_gui_application with the given command line arguments.

Parameters:
  • argc:

    The number of arguments given on the command line.

  • argv:

    The array of pointers to the arguments given on the command line.

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

Move-constructs a desktop_gui_application from an existing one.

Parameters:
  • other:

    The desktop_gui_application to move from.

desktop_gui_application&
operator = (
    desktop_gui_application&& other
)
noexcept

Move-assigns a desktop_gui_application into this one.

Parameters:
  • other:

    The desktop_gui_application to move from.

static
desktop_gui_application*
get_instance_ptr ()
noexcept

Returns a pointer to the desktop GUI application object. This pointer is only valid if the application object you instantiated in your program's main function is actually a desktop_gui_application.

native_handle&
grab_native_handle ()
noexcept

Returns a non-constant reference to the native handle of this desktop GUI application.

const native_handle&
grab_native_handle ()
const noexcept

Returns a constant reference to the native handle of this desktop GUI application.

int
run ()
override

Spins up an event loop so that previously configured windows can be notified of events, and returns 0 when all windows have been closed. This function's return value is intended to be returned by the main function.



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.