Managing Top-Level Windows

The VkApp object maintains a list of all windows created in an application. The VkApp object uses this list to manage the application's top-level windows. So that VkApp can properly manage windows, you should always use the VkSimpleWindow and VkWindow classes to create top-level windows in your application. These classes are described in Chapter 4--ViewKit Windows.

Main windows

Every application has a main window, and by default, the first window you create is considered the main window. Use the VkApp::setMainWindow() function to specify a different window to treat as the main window:

void setMainWindow(VkSimpleWindow *window)

Access function

The access function VkApp::mainWindow() returns a pointer to the VkSimpleWindow (or subclass) object installed as the application's main window:

VkSimpleWindow *mainWindow() const

Functions supported by VkApp class

Additionally, the VkApp class supports several operations that can be performed on all top-level windows in a multi-window application. The following functions take no arguments, have a void return value, and are declared virtual:

show() Displays all of the application's hidden, non-iconified windows.

hide() Removes all of the application's windows from the screen.

iconify() Iconifies all visible windows in the application.

open() Opens all iconified windows in the application.

raise() Raises all visible windows in the application to the top of the window manager's window stack.

lower() Lowers all visible windows in the application to the bottom of the window manager's window stack.

Specifying iconified state upon startup

You can also specify whether or not your application's windows start in an iconified state using VkApp::startupIconified():

void startupIconified(const Boolean flag)

If flag is TRUE, then the application starts all windows in the iconified state.


Note: You must call startupIconified() before calling run(), otherwise it will not have any effect.