35 void WindowProperties::
37 _specified = copy._specified;
38 _origin = copy._origin;
41 _icon_filename = copy._icon_filename;
42 _cursor_filename = copy._cursor_filename;
43 _z_order = copy._z_order;
45 _mouse_mode = copy._mouse_mode;
46 _parent_window = copy._parent_window;
54 get_config_properties() {
60 props.
set_size(win_size[0], win_size[0]);
62 props.
set_size(win_size[0], win_size[1]);
66 props.
set_origin(win_origin[0], win_origin[1]);
73 if (!icon_filename.empty()) {
76 if (!cursor_filename.empty()) {
79 if (z_order.has_value()) {
83 if (parent_window_handle.
get_value() != 0) {
85 }
else if (!subprocess_window.empty()) {
100 if (_default_properties !=
nullptr) {
101 return *_default_properties;
117 if (_default_properties ==
nullptr) {
120 (*_default_properties) = default_properties;
129 if (_default_properties !=
nullptr) {
130 delete _default_properties;
131 _default_properties =
nullptr;
148 size(
int x_size,
int y_size) {
157 bool WindowProperties::
159 return (_specified == other._specified &&
160 _flags == other._flags &&
161 _origin == other._origin &&
162 _size == other._size &&
163 _z_order == other._z_order &&
164 _title == other._title &&
165 _icon_filename == other._icon_filename &&
166 _cursor_filename == other._cursor_filename &&
167 _mouse_mode == other._mouse_mode &&
168 _parent_window == other._parent_window);
178 _origin = LPoint2i::zero();
179 _size = LVector2i::zero();
185 _mouse_mode = M_absolute;
186 _parent_window =
nullptr;
208 PT(
WindowHandle) handle = NativeWindowHandle::make_int(parent);
261 if (other.has_mouse_mode()) {
282 out <<
"title=\"" <<
get_title() <<
"\"" <<
" ";
303 out << (
get_open() ?
"open " :
"!open ");
317 if (has_mouse_mode()) {
322 out <<
"parent:none ";
330 operator << (ostream &out, WindowProperties::ZOrder z_order) {
332 case WindowProperties::Z_bottom:
333 return out <<
"bottom";
335 case WindowProperties::Z_normal:
336 return out <<
"normal";
338 case WindowProperties::Z_top:
342 return out <<
"**invalid WindowProperties::ZOrder(" << (int)z_order <<
")**";
346 operator >> (istream &in, WindowProperties::ZOrder &z_order) {
350 if (word ==
"bottom") {
351 z_order = WindowProperties::Z_bottom;
353 }
else if (word ==
"top") {
354 z_order = WindowProperties::Z_top;
356 }
else if (word ==
"normal") {
357 z_order = WindowProperties::Z_normal;
360 display_cat.warning()
361 <<
"Unknown z-order: " << word <<
"\n";
362 z_order = WindowProperties::Z_normal;
371 operator << (ostream &out, WindowProperties::MouseMode mode) {
373 case WindowProperties::M_absolute:
374 return out <<
"absolute";
375 case WindowProperties::M_relative:
376 return out <<
"relative";
377 case WindowProperties::M_confined:
378 return out <<
"confined";
380 return out <<
"**invalid WindowProperties::MouseMode(" << (int)mode <<
")**";
384 operator >> (istream &in, WindowProperties::MouseMode &mode) {
388 if (word ==
"absolute") {
389 mode = WindowProperties::M_absolute;
390 }
else if (word ==
"relative") {
391 mode = WindowProperties::M_relative;
392 }
else if (word ==
"confined") {
393 mode = WindowProperties::M_confined;
395 display_cat.warning()
396 <<
"Unknown mouse mode: " << word <<
"\n";
397 mode = WindowProperties::M_absolute;
has_cursor_filename
Returns true if set_cursor_filename() has been specified.
set_mouse_mode
Specifies the mode in which the window is to operate its mouse pointer.
get_mouse_mode
See set_mouse_mode().
has_icon_filename
Returns true if set_icon_filename() has been specified.
has_minimized
Returns true if set_minimized() has been specified.
void clear()
Unsets all properties that have been specified so far, and resets the WindowProperties structure to i...
set_cursor_hidden
Specifies whether the mouse cursor should be visible.
set_parent_window
Specifies the window that this window should be attached to.
get_open
Returns true if the window is open.
This object represents a window on the desktop, not necessarily a Panda window.
get_fixed_size
Returns true if the window cannot be resized by the user, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_size
Specifies the requested size of the window, in pixels.
get_cursor_hidden
Returns true if the mouse cursor is invisible.
get_parent_window
Returns the parent window specification, or NULL if there is no parent window specified.
get_foreground
Returns true if the window is in the foreground.
set_fullscreen
Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (fals...
set_z_order
Specifies the relative ordering of the window with respect to other windows.
void set_raw_mice(bool raw_mice)
Specifies whether the window should read the raw mouse devices.
get_origin
Returns the coordinates of the window's top-left corner, not including decorations.
set_minimized
Specifies whether the window should be created minimized (true), or normal (false).
set_fixed_size
Specifies whether the window should be resizable by the user.
get_cursor_filename
Returns the icon filename associated with the mouse cursor.
has_parent_window
Checks the S_parent_window specification from the properties.
int get_y_origin() const
Returns the y coordinate of the window's top-left corner, not including decorations.
static WindowProperties size(const LVecBase2i &size)
Returns a WindowProperties structure with only the size specified.
get_title
Returns the window's title.
set_undecorated
Specifies whether the window should be created with a visible title and border (false,...
has_fullscreen
Returns true if set_fullscreen() has been specified.
get_value
Returns the variable's value.
size_t get_num_words() const
Returns the number of words in the variable's value.
set_cursor_filename
Specifies the file that contains the icon to associate with the mouse cursor when it is within the wi...
static void clear_default()
Returns the "default" WindowProperties to whatever is specified in the user's config file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
has_z_order
Returns true if the window z_order has been specified, false otherwise.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
has_open
Returns true if set_open() has been specified.
get_undecorated
Returns true if the window has no border.
has_origin
Returns true if the window origin has been specified, false otherwise.
has_fixed_size
Returns true if set_fixed_size() has been specified.
The name of a file, such as a texture file or an Egg file.
set_origin
Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window s...
get_icon_filename
Returns the icon filename associated with the window.
set_icon_filename
Specifies the file that contains the icon to associate with the window when it is minimized.
get_config_properties
Returns a WindowProperties structure with all of the default values filled in according to the user's...
get_minimized
Returns true if the window is minimized.
get_size
Returns size in pixels of the useful part of the window, not including decorations.
bool get_raw_mice() const
Returns true if the window reads the raw mice.
void output(std::ostream &out) const
Sets any properties that are explicitly specified in other on this object.
has_cursor_hidden
Returns true if set_cursor_hidden() has been specified.
void add_properties(const WindowProperties &other)
Sets any properties that are explicitly specified in other on this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_raw_mice() const
Returns true if set_raw_mice() has been specified.
has_undecorated
Returns true if set_undecorated() has been specified.
has_title
Returns true if the window title has been specified, false otherwise.
set_default
Replaces the "default" WindowProperties with the specified structure.
int get_y_size() const
Returns size in pixels in the y dimension of the useful part of the window, not including decorations...
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
get_fullscreen
Returns true if the window is in fullscreen mode.
set_open
Specifies whether the window should be open.
int get_x_origin() const
Returns the x coordinate of the window's top-left corner, not including decorations.
get_z_order
Returns the window's z_order.
has_size
Returns true if the window size has been specified, false otherwise.
has_foreground
Returns true if set_foreground() has been specified.
set_title
Specifies the title that should be assigned to the window.
set_foreground
Specifies whether the window should be opened in the foreground (true), or left in the background (fa...