Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
WindowProperties Class Reference

A container for the various kinds of properties we might ask to have on a graphics window before we open it. More...

Public Types

enum  MouseMode { M_absolute = 0, M_relative = 1, M_confined = 2 }
 
enum  ZOrder { Z_bottom = 0, Z_normal = 1, Z_top = 2 }
 

Public Member Functions

 __init__ (object args, object kwds)
 
 addProperties (const WindowProperties other)
 Sets any properties that are explicitly specified in other on this object. More...
 
 clear ()
 Unsets all properties that have been specified so far, and resets the WindowProperties structure to its initial empty state. More...
 
 clearCursorFilename ()
 Removes the cursor_filename specification from the properties. More...
 
 clearCursorHidden ()
 Removes the cursor_hidden specification from the properties. More...
 
 clearFixedSize ()
 Removes the fixed_size specification from the properties. More...
 
 clearForeground ()
 Removes the foreground specification from the properties. More...
 
 clearFullscreen ()
 Removes the fullscreen specification from the properties. More...
 
 clearIconFilename ()
 Removes the icon_filename specification from the properties. More...
 
 clearMinimized ()
 Removes the minimized specification from the properties. More...
 
 clearMouseMode ()
 Removes the mouse_mode specification from the properties. More...
 
 clearOpen ()
 Removes the open specification from the properties. More...
 
 clearOrigin ()
 Removes the origin specification from the properties. More...
 
 clearParentWindow ()
 Removes the S_parent_window specification from the properties. More...
 
 clearRawMice ()
 Removes the raw_mice specification from the properties. More...
 
 clearSize ()
 Removes the size specification from the properties. More...
 
 clearTitle ()
 Removes the title specification from the properties. More...
 
 clearUndecorated ()
 Removes the undecorated specification from the properties. More...
 
 clearZOrder ()
 Removes the z_order specification from the properties. More...
 
const Filename getCursorFilename ()
 Returns the icon filename associated with the mouse cursor. More...
 
bool getCursorHidden ()
 Returns true if the mouse cursor is invisible. More...
 
bool getFixedSize ()
 Returns true if the window cannot be resized by the user, false otherwise. More...
 
bool getForeground ()
 Returns true if the window is in the foreground. More...
 
bool getFullscreen ()
 Returns true if the window is in fullscreen mode. More...
 
const Filename getIconFilename ()
 Returns the icon filename associated with the window. More...
 
bool getMinimized ()
 Returns true if the window is minimized. More...
 
WindowProperties::MouseMode getMouseMode ()
 See set_mouse_mode(). More...
 
bool getOpen ()
 Returns true if the window is open. More...
 
const LPoint2i getOrigin ()
 Returns the coordinates of the window's top-left corner, not including decorations. More...
 
WindowHandle getParentWindow ()
 Returns the parent window specification, or NULL if there is no parent window specified. More...
 
bool getRawMice ()
 Returns true if the window reads the raw mice. More...
 
const LVector2i getSize ()
 Returns size in pixels of the useful part of the window, not including decorations. More...
 
str getTitle ()
 Returns the window's title. More...
 
bool getUndecorated ()
 Returns true if the window has no border. More...
 
int getXOrigin ()
 Returns the x coordinate of the window's top-left corner, not including decorations. More...
 
int getXSize ()
 Returns size in pixels in the x dimension of the useful part of the window, not including decorations. More...
 
int getYOrigin ()
 Returns the y coordinate of the window's top-left corner, not including decorations. More...
 
int getYSize ()
 Returns size in pixels in the y dimension of the useful part of the window, not including decorations. More...
 
WindowProperties::ZOrder getZOrder ()
 Returns the window's z_order. More...
 
bool hasCursorFilename ()
 Returns true if set_cursor_filename() has been specified. More...
 
bool hasCursorHidden ()
 Returns true if set_cursor_hidden() has been specified. More...
 
bool hasFixedSize ()
 Returns true if set_fixed_size() has been specified. More...
 
bool hasForeground ()
 Returns true if set_foreground() has been specified. More...
 
bool hasFullscreen ()
 Returns true if set_fullscreen() has been specified. More...
 
bool hasIconFilename ()
 Returns true if set_icon_filename() has been specified. More...
 
bool hasMinimized ()
 Returns true if set_minimized() has been specified. More...
 
bool hasMouseMode ()
 
bool hasOpen ()
 Returns true if set_open() has been specified. More...
 
bool hasOrigin ()
 Returns true if the window origin has been specified, false otherwise. More...
 
bool hasParentWindow ()
 Checks the S_parent_window specification from the properties. More...
 
bool hasRawMice ()
 Returns true if set_raw_mice() has been specified. More...
 
bool hasSize ()
 Returns true if the window size has been specified, false otherwise. More...
 
bool hasTitle ()
 Returns true if the window title has been specified, false otherwise. More...
 
bool hasUndecorated ()
 Returns true if set_undecorated() has been specified. More...
 
bool hasZOrder ()
 Returns true if the window z_order has been specified, false otherwise. More...
 
bool isAnySpecified ()
 Returns true if any properties have been specified, false otherwise. More...
 
bool operator != (const WindowProperties other)
 
WindowProperties operator= (const WindowProperties copy)
 
bool operator== (const WindowProperties other)
 
 output (Ostream out)
 Sets any properties that are explicitly specified in other on this object. More...
 
 setCursorFilename (const Filename cursor_filename)
 Specifies the file that contains the icon to associate with the mouse cursor when it is within the window (and visible). More...
 
 setCursorHidden (bool cursor_hidden)
 Specifies whether the mouse cursor should be visible. More...
 
 setFixedSize (bool fixed_size)
 Specifies whether the window should be resizable by the user. More...
 
 setForeground (bool foreground)
 Specifies whether the window should be opened in the foreground (true), or left in the background (false). More...
 
 setFullscreen (bool fullscreen)
 Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (false, the default). More...
 
 setIconFilename (const Filename icon_filename)
 Specifies the file that contains the icon to associate with the window when it is minimized. More...
 
 setMinimized (bool minimized)
 Specifies whether the window should be created minimized (true), or normal (false). More...
 
 setMouseMode (WindowProperties::MouseMode mode)
 Specifies the mode in which the window is to operate its mouse pointer. More...
 
 setOpen (bool open)
 Specifies whether the window should be open. More...
 
 setOrigin (const LPoint2i origin)
 Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window should appear. More...
 
 setOrigin (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. More...
 
 setParentWindow (WindowHandle parent_window)
 Specifies the window that this window should be attached to. More...
 
 setParentWindow (int parent)
 Specifies the window that this window should be attached to. More...
 
 setRawMice (bool raw_mice)
 Specifies whether the window should read the raw mouse devices. More...
 
 setSize (const LVector2i size)
 Specifies the requested size of the window, in pixels. More...
 
 setSize (int x_size, int y_size)
 Specifies the requested size of the window, in pixels. More...
 
 setTitle (str title)
 Specifies the title that should be assigned to the window. More...
 
 setUndecorated (bool undecorated)
 Specifies whether the window should be created with a visible title and border (false, the default) or not (true). More...
 
 setZOrder (WindowProperties::ZOrder z_order)
 Specifies the relative ordering of the window with respect to other windows. More...
 

Static Public Member Functions

static clearDefault ()
 Returns the "default" WindowProperties to whatever is specified in the user's config file. More...
 
static WindowProperties getConfigProperties ()
 Returns a WindowProperties structure with all of the default values filled in according to the user's config file. More...
 
static WindowProperties getDefault ()
 Returns the "default" WindowProperties. More...
 
static setDefault (const WindowProperties default_properties)
 Replaces the "default" WindowProperties with the specified structure. More...
 
static WindowProperties size (const LVecBase2i size)
 Returns a WindowProperties structure with only the size specified. More...
 
static WindowProperties size (int x_size, int y_size)
 

Public Attributes

WindowProperties config_properties
 Returns a WindowProperties structure with all of the default values filled in according to the user's config file. More...
 
const Filename cursor_filename
 Returns the icon filename associated with the mouse cursor. More...
 
bool cursor_hidden
 Returns true if the mouse cursor is invisible. More...
 
WindowProperties default
 Returns the "default" WindowProperties. More...
 
bool fixed_size
 Returns true if the window cannot be resized by the user, false otherwise. More...
 
bool foreground
 Returns true if the window is in the foreground. More...
 
bool fullscreen
 Returns true if the window is in fullscreen mode. More...
 
const Filename icon_filename
 Returns the icon filename associated with the window. More...
 
bool minimized
 Returns true if the window is minimized. More...
 
WindowProperties::MouseMode mouse_mode
 See set_mouse_mode(). More...
 
bool open
 Returns true if the window is open. More...
 
const LPoint2i origin
 Returns the coordinates of the window's top-left corner, not including decorations. More...
 
WindowHandle parent_window
 Returns the parent window specification, or NULL if there is no parent window specified. More...
 
const LVector2i size
 Returns size in pixels of the useful part of the window, not including decorations. More...
 
const String title
 Returns the window's title. More...
 
bool undecorated
 Returns true if the window has no border. More...
 
WindowProperties::ZOrder z_order
 Returns the window's z_order. More...
 

Detailed Description

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.

Member Enumeration Documentation

◆ MouseMode

enum MouseMode
Enumerator
M_absolute 
M_relative 
M_confined 

◆ ZOrder

enum ZOrder
Enumerator
Z_bottom 
Z_normal 
Z_top 

Member Function Documentation

◆ __init__()

__init__ ( object  args,
object  kwds 
)

◆ addProperties()

addProperties ( const WindowProperties  other)

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

Leaves other properties unchanged.

◆ clear()

clear ( )

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

◆ clearCursorFilename()

clearCursorFilename ( )

Removes the cursor_filename specification from the properties.

◆ clearCursorHidden()

clearCursorHidden ( )

Removes the cursor_hidden specification from the properties.

◆ clearDefault()

static clearDefault ( )
static

Returns the "default" WindowProperties to whatever is specified in the user's config file.

◆ clearFixedSize()

clearFixedSize ( )

Removes the fixed_size specification from the properties.

◆ clearForeground()

clearForeground ( )

Removes the foreground specification from the properties.

◆ clearFullscreen()

clearFullscreen ( )

Removes the fullscreen specification from the properties.

◆ clearIconFilename()

clearIconFilename ( )

Removes the icon_filename specification from the properties.

◆ clearMinimized()

clearMinimized ( )

Removes the minimized specification from the properties.

◆ clearMouseMode()

clearMouseMode ( )

Removes the mouse_mode specification from the properties.

◆ clearOpen()

clearOpen ( )

Removes the open specification from the properties.

◆ clearOrigin()

clearOrigin ( )

Removes the origin specification from the properties.

◆ clearParentWindow()

clearParentWindow ( )

Removes the S_parent_window specification from the properties.

◆ clearRawMice()

clearRawMice ( )

Removes the raw_mice specification from the properties.

◆ clearSize()

clearSize ( )

Removes the size specification from the properties.

◆ clearTitle()

clearTitle ( )

Removes the title specification from the properties.

◆ clearUndecorated()

clearUndecorated ( )

Removes the undecorated specification from the properties.

◆ clearZOrder()

clearZOrder ( )

Removes the z_order specification from the properties.

◆ getConfigProperties()

static WindowProperties getConfigProperties ( )
static

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

◆ getCursorFilename()

const Filename getCursorFilename ( )

Returns the icon filename associated with the mouse cursor.

◆ getCursorHidden()

bool getCursorHidden ( )

Returns true if the mouse cursor is invisible.

◆ getDefault()

static WindowProperties getDefault ( )
static

Returns the "default" WindowProperties.

If set_default() has been called, this returns that WindowProperties structure; otherwise, this returns get_config_properties().

◆ getFixedSize()

bool getFixedSize ( )

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

◆ getForeground()

bool getForeground ( )

Returns true if the window is in the foreground.

◆ getFullscreen()

bool getFullscreen ( )

Returns true if the window is in fullscreen mode.

◆ getIconFilename()

const Filename getIconFilename ( )

Returns the icon filename associated with the window.

◆ getMinimized()

bool getMinimized ( )

Returns true if the window is minimized.

◆ getMouseMode()

WindowProperties::MouseMode getMouseMode ( )

See set_mouse_mode().

◆ getOpen()

bool getOpen ( )

Returns true if the window is open.

◆ getOrigin()

const LPoint2i getOrigin ( )

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

◆ getParentWindow()

WindowHandle getParentWindow ( )

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

◆ getRawMice()

bool getRawMice ( )

Returns true if the window reads the raw mice.

◆ getSize()

const LVector2i getSize ( )

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

◆ getTitle()

str getTitle ( )

Returns the window's title.

◆ getUndecorated()

bool getUndecorated ( )

Returns true if the window has no border.

◆ getXOrigin()

int getXOrigin ( )

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

◆ getXSize()

int getXSize ( )

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.

◆ getYOrigin()

int getYOrigin ( )

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

◆ getYSize()

int getYSize ( )

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.

◆ getZOrder()

WindowProperties::ZOrder getZOrder ( )

Returns the window's z_order.

◆ hasCursorFilename()

bool hasCursorFilename ( )

Returns true if set_cursor_filename() has been specified.

◆ hasCursorHidden()

bool hasCursorHidden ( )

Returns true if set_cursor_hidden() has been specified.

◆ hasFixedSize()

bool hasFixedSize ( )

Returns true if set_fixed_size() has been specified.

◆ hasForeground()

bool hasForeground ( )

Returns true if set_foreground() has been specified.

◆ hasFullscreen()

bool hasFullscreen ( )

Returns true if set_fullscreen() has been specified.

◆ hasIconFilename()

bool hasIconFilename ( )

Returns true if set_icon_filename() has been specified.

◆ hasMinimized()

bool hasMinimized ( )

Returns true if set_minimized() has been specified.

◆ hasMouseMode()

bool hasMouseMode ( )

◆ hasOpen()

bool hasOpen ( )

Returns true if set_open() has been specified.

◆ hasOrigin()

bool hasOrigin ( )

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

◆ hasParentWindow()

bool hasParentWindow ( )

Checks the S_parent_window specification from the properties.

◆ hasRawMice()

bool hasRawMice ( )

Returns true if set_raw_mice() has been specified.

◆ hasSize()

bool hasSize ( )

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

◆ hasTitle()

bool hasTitle ( )

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

◆ hasUndecorated()

bool hasUndecorated ( )

Returns true if set_undecorated() has been specified.

◆ hasZOrder()

bool hasZOrder ( )

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

◆ isAnySpecified()

bool isAnySpecified ( )

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

◆ operator !=()

bool operator != ( const WindowProperties  other)

◆ operator=()

WindowProperties operator= ( const WindowProperties  copy)

◆ operator==()

bool operator== ( const WindowProperties  other)

◆ output()

output ( Ostream  out)

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

Leaves other properties unchanged.

◆ setCursorFilename()

setCursorFilename ( const Filename  cursor_filename)

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

◆ setCursorHidden()

setCursorHidden ( bool  cursor_hidden)

Specifies whether the mouse cursor should be visible.

◆ setDefault()

static setDefault ( const WindowProperties  default_properties)
static

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.

◆ setFixedSize()

setFixedSize ( bool  fixed_size)

Specifies whether the window should be resizable by the user.

◆ setForeground()

setForeground ( bool  foreground)

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

◆ setFullscreen()

setFullscreen ( bool  fullscreen)

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

◆ setIconFilename()

setIconFilename ( const Filename  icon_filename)

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

◆ setMinimized()

setMinimized ( bool  minimized)

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

◆ setMouseMode()

setMouseMode ( 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_relative (OSX or Unix/X11 only): 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.

This has no effect on Windows. On Unix/X11, this requires the Xxf86dga extension to be available.

M_confined: this mode reports absolute mouse positions, but confines the mouse pointer to the window boundary. It can portably replace M_relative for an FPS, but you need to periodically move the pointer to the center of the window and track movement deltas.

◆ setOpen()

setOpen ( 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.

◆ setOrigin() [1/2]

setOrigin ( const LPoint2i  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.

◆ setOrigin() [2/2]

setOrigin ( 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.

◆ setParentWindow() [1/2]

setParentWindow ( WindowHandle  parent_window)

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.

◆ setParentWindow() [2/2]

setParentWindow ( int  parent)

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.

◆ setRawMice()

setRawMice ( bool  raw_mice)

Specifies whether the window should read the raw mouse devices.

◆ setSize() [1/2]

setSize ( const LVector2i  size)

Specifies the requested size of the window, in pixels.

This is the size of the useful part of the window, not including decorations.

◆ setSize() [2/2]

setSize ( 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.

◆ setTitle()

setTitle ( str  title)

Specifies the title that should be assigned to the window.

◆ setUndecorated()

setUndecorated ( bool  undecorated)

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

◆ setZOrder()

setZOrder ( 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.

◆ size() [1/2]

static WindowProperties size ( const LVecBase2i  size)
static

Returns a WindowProperties structure with only the size specified.

The size is the only property that matters to buffers.

◆ size() [2/2]

static WindowProperties size ( int  x_size,
int  y_size 
)
static

Member Data Documentation

◆ config_properties

WindowProperties config_properties

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

◆ cursor_filename

const Filename cursor_filename

Returns the icon filename associated with the mouse cursor.

◆ cursor_hidden

bool cursor_hidden

Returns true if the mouse cursor is invisible.

◆ default

Returns the "default" WindowProperties.

If set_default() has been called, this returns that WindowProperties structure; otherwise, this returns get_config_properties().

◆ fixed_size

bool fixed_size

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

◆ foreground

bool foreground

Returns true if the window is in the foreground.

◆ fullscreen

bool fullscreen

Returns true if the window is in fullscreen mode.

◆ icon_filename

const Filename icon_filename

Returns the icon filename associated with the window.

◆ minimized

bool minimized

Returns true if the window is minimized.

◆ mouse_mode

See set_mouse_mode().

◆ open

bool open

Returns true if the window is open.

◆ origin

const LPoint2i origin

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

◆ parent_window

WindowHandle parent_window

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

◆ size

const LVector2i size

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

◆ title

const String title

Returns the window's title.

◆ undecorated

bool undecorated

Returns true if the window has no border.

◆ z_order

Returns the window's z_order.