WindowProperties

class WindowProperties

A container for the various kinds of properties we might ask to have on a graphics window before we open it. This also serves to hold the current properties for a window after it has been opened.

Inheritance diagram

Inheritance diagram of WindowProperties

enum MouseMode
enumerator M_absolute = 0
enumerator M_relative = 1
enumerator M_confined = 2
enum ZOrder
enumerator Z_bottom = 0
enumerator Z_normal = 1
enumerator Z_top = 2
WindowProperties(PyObject *self, PyObject *args, PyObject *kwds)
void add_properties(WindowProperties const &other)

Sets any properties that are explicitly specified in other on this object. Leaves other properties unchanged.

void clear(void)

Unsets all properties that have been specified so far, and resets the WindowProperties structure to its initial empty state.

void clear_cursor_filename(void)

Removes the cursor_filename specification from the properties.

void clear_cursor_hidden(void)

Removes the cursor_hidden specification from the properties.

static void clear_default(void)

Returns the “default” WindowProperties to whatever is specified in the user’s config file.

void clear_fixed_size(void)

Removes the fixed_size specification from the properties.

void clear_foreground(void)

Removes the foreground specification from the properties.

void clear_fullscreen(void)

Removes the fullscreen specification from the properties.

void clear_icon_filename(void)

Removes the icon_filename specification from the properties.

void clear_maximized(void)

Removes the maximized specification from the properties.

void clear_minimized(void)

Removes the minimized specification from the properties.

void clear_mouse_mode(void)

Removes the mouse_mode specification from the properties.

void clear_open(void)

Removes the open specification from the properties.

void clear_origin(void)

Removes the origin specification from the properties.

void clear_parent_window(void)

Removes the S_parent_window specification from the properties.

void clear_raw_mice(void)

Removes the raw_mice specification from the properties.

void clear_size(void)

Removes the size specification from the properties.

void clear_title(void)

Removes the title specification from the properties.

void clear_undecorated(void)

Removes the undecorated specification from the properties.

void clear_z_order(void)

Removes the z_order specification from the properties.

static WindowProperties get_config_properties(void)

Returns a WindowProperties structure with all of the default values filled in according to the user’s config file.

Filename get_cursor_filename(void) const

Returns the icon filename associated with the mouse cursor.

bool get_cursor_hidden(void) const

Returns true if the mouse cursor is invisible.

static WindowProperties get_default(void)

Returns the “default” WindowProperties. If set_default() has been called, this returns that WindowProperties structure; otherwise, this returns get_config_properties().

bool get_fixed_size(void) const

Returns true if the window cannot be resized by the user, false otherwise.

bool get_foreground(void) const

Returns true if the window is in the foreground.

bool get_fullscreen(void) const

Returns true if the window is in fullscreen mode.

Filename get_icon_filename(void) const

Returns the icon filename associated with the window.

bool get_maximized(void) const

Returns true if the window is maximized.

bool get_minimized(void) const

Returns true if the window is minimized.

MouseMode get_mouse_mode(void) const

See set_mouse_mode().

bool get_open(void) const

Returns true if the window is open.

LPoint2i get_origin(void) const

Returns the coordinates of the window’s top-left corner, not including decorations.

WindowHandle *get_parent_window(void) const

Returns the parent window specification, or NULL if there is no parent window specified.

bool get_raw_mice(void) const

Returns true if the window reads the raw mice.

LVector2i get_size(void) const

Returns size in pixels of the useful part of the window, not including decorations.

std::string get_title(void) const

Returns the window’s title.

bool get_undecorated(void) const

Returns true if the window has no border.

int get_x_origin(void) const

Returns the x coordinate of the window’s top-left corner, not including decorations.

int get_x_size(void) const

Returns size in pixels in the x dimension of the useful part of the window, not including decorations. That is, this is the window’s width.

int get_y_origin(void) const

Returns the y coordinate of the window’s top-left corner, not including decorations.

int get_y_size(void) const

Returns size in pixels in the y dimension of the useful part of the window, not including decorations. That is, this is the window’s height.

ZOrder get_z_order(void) const

Returns the window’s z_order.

bool has_cursor_filename(void) const

Returns true if set_cursor_filename() has been specified.

bool has_cursor_hidden(void) const

Returns true if set_cursor_hidden() has been specified.

bool has_fixed_size(void) const

Returns true if set_fixed_size() has been specified.

bool has_foreground(void) const

Returns true if set_foreground() has been specified.

bool has_fullscreen(void) const

Returns true if set_fullscreen() has been specified.

bool has_icon_filename(void) const

Returns true if set_icon_filename() has been specified.

bool has_maximized(void) const

Returns true if set_maximized() has been specified.

bool has_minimized(void) const

Returns true if set_minimized() has been specified.

bool has_mouse_mode(void) const
bool has_open(void) const

Returns true if set_open() has been specified.

bool has_origin(void) const

Returns true if the window origin has been specified, false otherwise.

bool has_parent_window(void) const

Checks the S_parent_window specification from the properties.

bool has_raw_mice(void) const

Returns true if set_raw_mice() has been specified.

bool has_size(void) const

Returns true if the window size has been specified, false otherwise.

bool has_title(void) const

Returns true if the window title has been specified, false otherwise.

bool has_undecorated(void) const

Returns true if set_undecorated() has been specified.

bool has_z_order(void) const

Returns true if the window z_order has been specified, false otherwise.

bool is_any_specified(void) const

Returns true if any properties have been specified, false otherwise.

void output(std::ostream &out) const

Sets any properties that are explicitly specified in other on this object. Leaves other properties unchanged.

void set_cursor_filename(Filename const &cursor_filename)

Specifies the file that contains the icon to associate with the mouse cursor when it is within the window (and visible).

void set_cursor_hidden(bool cursor_hidden)

Specifies whether the mouse cursor should be visible.

static void set_default(WindowProperties const &default_properties)

Replaces the “default” WindowProperties with the specified structure. The specified WindowProperties will be returned by future calls to get_default(), until clear_default() is called.

Note that this completely replaces the default properties; it is not additive.

void set_fixed_size(bool fixed_size)

Specifies whether the window should be resizable by the user.

void set_foreground(bool foreground)

Specifies whether the window should be opened in the foreground (true), or left in the background (false).

void set_fullscreen(bool fullscreen)

Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (false, the default).

void set_icon_filename(Filename const &icon_filename)

Specifies the file that contains the icon to associate with the window when it is minimized.

void set_maximized(bool maximized)

Specifies whether the window should be created maximized (true), or normal (false).

void set_minimized(bool minimized)

Specifies whether the window should be created minimized (true), or normal (false).

void set_mouse_mode(WindowProperties::MouseMode mode)

Specifies the mode in which the window is to operate its mouse pointer.

M_absolute: the normal mode in which a mouse pointer operates, where the mouse can move outside the window and the mouse coordinates are relative to its position in the window.

M_confined: this mode reports absolute mouse positions, but confines the mouse pointer to the window boundary. The reported mouse positions will never be outside of the window boundary.

M_relative: a mode where only relative movements are reported; particularly useful for FPS-style mouse movements where you have hidden the mouse pointer and are are more interested in how fast the mouse is moving, rather than precisely where the pointer is hovering. The reported positions still appear to be absolute, but they can go toward negative or positive infinity without being constrained by the window (or screen) dimensions. Since the position of the mouse cursor becomes meaningless in this mode, it is recommended to combine this with the cursor_hidden flag.

void set_open(bool open)

Specifies whether the window should be open. It is legal to create a GraphicsWindow in the closed state, and later request it to open by changing this flag.

void set_origin(LPoint2i const &origin)
void set_origin(int x_origin, int y_origin)

Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window should appear. This is the origin of the top- left corner of the useful part of the window, not including decorations.

void set_parent_window(std::size_t parent)
void set_parent_window(WindowHandle *parent_window = nullptr)

Specifies the window that this window should be attached to. If this is NULL or unspecified, the window will be created as a toplevel window on the desktop; if this is non-NULL, the window will be bound as a child window to the indicated parent window.

You should use GraphicsPipe::make_window_handle() to create an instance of a WindowHandle object given an appropriate OS-specific window handle representation. Each OS-specific GraphicsPipe class defines a make_window_handle() method that returns an appropriate WindowHandle object to wrap the particular OS-specific representation.

Specifies the window that this window should be attached to.

This is a deprecated variant on this method, and exists only for backward compatibility. Future code should use the version of set_parent_window() below that receives a WindowHandle object; that interface is much more robust.

In this deprecated variant, the actual value for “parent” is platform- specific. On Windows, it is the HWND of the parent window, cast to an unsigned integer. On X11, it is the Window pointer of the parent window, similarly cast. On OSX, this is the NSWindow pointer, which doesn’t appear to work at all.

void set_raw_mice(bool raw_mice)

Specifies whether the window should read the raw mouse devices.

void set_size(LVector2i const &size)
void set_size(int x_size, int y_size)

Specifies the requested size of the window, in pixels. This is the size of the useful part of the window, not including decorations.

void set_title(std::string const &title)

Specifies the title that should be assigned to the window.

void set_undecorated(bool undecorated)

Specifies whether the window should be created with a visible title and border (false, the default) or not (true).

void set_z_order(WindowProperties::ZOrder z_order)

Specifies the relative ordering of the window with respect to other windows. If the z_order is Z_top, the window will always be on top of other windows; if it is Z_bottom, it will always be below other windows. Most windows will want to be Z_normal, which allows the user to control the order.

static WindowProperties size(LVecBase2i const &size)
static WindowProperties size(int x_size, int y_size)

Returns a WindowProperties structure with only the size specified. The size is the only property that matters to buffers.

Deprecated: in the Python API, use WindowProperties(size=(x, y)) instead.