Panda3D
windowProperties.I
1 // Filename: windowProperties.I
2 // Created by: drose (13Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: WindowProperties::Copy Constructor
18 // Access: Published
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE WindowProperties::
22 WindowProperties(const WindowProperties &copy) {
23  (*this) = copy;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: WindowProperties::Destructor
28 // Access: Published
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE WindowProperties::
32 ~WindowProperties() {
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function: WindowProperties::operator !=
37 // Access: Published
38 // Description:
39 ////////////////////////////////////////////////////////////////////
40 INLINE bool WindowProperties::
41 operator != (const WindowProperties &other) const {
42  return !operator == (other);
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: WindowProperties::is_any_specified
47 // Access: Published
48 // Description: Returns true if any properties have been specified,
49 // false otherwise.
50 ////////////////////////////////////////////////////////////////////
51 INLINE bool WindowProperties::
53  return (_specified != 0);
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: WindowProperties::set_origin
58 // Access: Published
59 // Description: Specifies the origin on the screen (in pixels,
60 // relative to the top-left corner) at which the window
61 // should appear. This is the origin of the top-left
62 // corner of the useful part of the window, not
63 // including decorations.
64 ////////////////////////////////////////////////////////////////////
65 INLINE void WindowProperties::
66 set_origin(const LPoint2i &origin) {
67  _origin = origin;
68  _specified |= S_origin;
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: WindowProperties::set_origin
73 // Access: Published
74 // Description: Specifies the origin on the screen (in pixels,
75 // relative to the top-left corner) at which the window
76 // should appear. This is the origin of the top-left
77 // corner of the useful part of the window, not
78 // including decorations.
79 ////////////////////////////////////////////////////////////////////
80 INLINE void WindowProperties::
81 set_origin(int x_origin, int y_origin) {
82  _origin.set(x_origin, y_origin);
83  _specified |= S_origin;
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function: WindowProperties::get_origin
88 // Access: Published
89 // Description: Returns the coordinates of the window's top-left
90 // corner, not including decorations.
91 ////////////////////////////////////////////////////////////////////
92 INLINE const LPoint2i &WindowProperties::
93 get_origin() const {
94  nassertr(has_origin(), LPoint2i::zero());
95  return _origin;
96 }
97 
98 ////////////////////////////////////////////////////////////////////
99 // Function: WindowProperties::get_x_origin
100 // Access: Published
101 // Description: Returns the x coordinate of the window's top-left
102 // corner, not including decorations.
103 ////////////////////////////////////////////////////////////////////
104 INLINE int WindowProperties::
105 get_x_origin() const {
106  nassertr(has_origin(), 0);
107  return _origin.get_x();
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: WindowProperties::get_y_origin
112 // Access: Published
113 // Description: Returns the y coordinate of the window's top-left
114 // corner, not including decorations.
115 ////////////////////////////////////////////////////////////////////
116 INLINE int WindowProperties::
117 get_y_origin() const {
118  nassertr(has_origin(), 0);
119  return _origin.get_y();
120 }
121 
122 ////////////////////////////////////////////////////////////////////
123 // Function: WindowProperties::has_origin
124 // Access: Published
125 // Description: Returns true if the window origin has been specified,
126 // false otherwise.
127 ////////////////////////////////////////////////////////////////////
128 INLINE bool WindowProperties::
129 has_origin() const {
130  return ((_specified & S_origin) != 0);
131 }
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: WindowProperties::clear_origin
135 // Access: Published
136 // Description: Removes the origin specification from the properties.
137 ////////////////////////////////////////////////////////////////////
138 INLINE void WindowProperties::
140  _specified &= ~S_origin;
141  _origin = LPoint2i::zero();
142 }
143 
144 ////////////////////////////////////////////////////////////////////
145 // Function: WindowProperties::set_size
146 // Access: Published
147 // Description: Specifies the requested size of the window, in
148 // pixels. This is the size of the useful part of the
149 // window, not including decorations.
150 ////////////////////////////////////////////////////////////////////
151 INLINE void WindowProperties::
153  _size = size;
154  _specified |= S_size;
155 }
156 
157 ////////////////////////////////////////////////////////////////////
158 // Function: WindowProperties::set_size
159 // Access: Published
160 // Description: Specifies the requested size of the window, in
161 // pixels. This is the size of the useful part of the
162 // window, not including decorations.
163 ////////////////////////////////////////////////////////////////////
164 INLINE void WindowProperties::
165 set_size(int x_size, int y_size) {
166  _size.set(x_size, y_size);
167  _specified |= S_size;
168 }
169 
170 ////////////////////////////////////////////////////////////////////
171 // Function: WindowProperties::get_origin
172 // Access: Published
173 // Description: Returns size in pixels of the useful part of the
174 // window, not including decorations.
175 ////////////////////////////////////////////////////////////////////
176 INLINE const LVector2i &WindowProperties::
177 get_size() const {
178  nassertr(has_size(), LVector2i::zero());
179  return _size;
180 }
181 
182 ////////////////////////////////////////////////////////////////////
183 // Function: WindowProperties::get_x_size
184 // Access: Published
185 // Description: Returns size in pixels in the x dimension of the
186 // useful part of the window, not including decorations.
187 // That is, this is the window's width.
188 ////////////////////////////////////////////////////////////////////
189 INLINE int WindowProperties::
190 get_x_size() const {
191  nassertr(has_size(), 0);
192  return _size.get_x();
193 }
194 
195 ////////////////////////////////////////////////////////////////////
196 // Function: WindowProperties::get_y_size
197 // Access: Published
198 // Description: Returns size in pixels in the y dimension of the
199 // useful part of the window, not including decorations.
200 // That is, this is the window's height.
201 ////////////////////////////////////////////////////////////////////
202 INLINE int WindowProperties::
203 get_y_size() const {
204  nassertr(has_size(), 0);
205  return _size.get_y();
206 }
207 
208 ////////////////////////////////////////////////////////////////////
209 // Function: WindowProperties::has_size
210 // Access: Published
211 // Description: Returns true if the window size has been specified,
212 // false otherwise.
213 ////////////////////////////////////////////////////////////////////
214 INLINE bool WindowProperties::
215 has_size() const {
216  return ((_specified & S_size) != 0);
217 }
218 
219 ////////////////////////////////////////////////////////////////////
220 // Function: WindowProperties::clear_size
221 // Access: Published
222 // Description: Removes the size specification from the properties.
223 ////////////////////////////////////////////////////////////////////
224 INLINE void WindowProperties::
226  _specified &= ~S_size;
227  _size = LVector2i::zero();
228 }
229 
230 ////////////////////////////////////////////////////////////////////
231 // Function: WindowProperties::set_title
232 // Access: Published
233 // Description: Specifies the title that should be assigned to the
234 // window.
235 ////////////////////////////////////////////////////////////////////
236 INLINE void WindowProperties::
237 set_title(const string &title) {
238  _title = title;
239  _specified |= S_title;
240 }
241 
242 ////////////////////////////////////////////////////////////////////
243 // Function: WindowProperties::get_title
244 // Access: Published
245 // Description: Returns the window's title.
246 ////////////////////////////////////////////////////////////////////
247 INLINE const string &WindowProperties::
248 get_title() const {
249  nassertr(has_title(), _title);
250  return _title;
251 }
252 
253 ////////////////////////////////////////////////////////////////////
254 // Function: WindowProperties::has_title
255 // Access: Published
256 // Description: Returns true if the window title has been specified,
257 // false otherwise.
258 ////////////////////////////////////////////////////////////////////
259 INLINE bool WindowProperties::
260 has_title() const {
261  return ((_specified & S_title) != 0);
262 }
263 
264 ////////////////////////////////////////////////////////////////////
265 // Function: WindowProperties::clear_title
266 // Access: Published
267 // Description: Removes the title specification from the properties.
268 ////////////////////////////////////////////////////////////////////
269 INLINE void WindowProperties::
271  _specified &= ~S_title;
272  _title = string();
273 }
274 
275 ////////////////////////////////////////////////////////////////////
276 // Function: WindowProperties::set_undecorated
277 // Access: Published
278 // Description: Specifies whether the window should be created with a
279 // visible title and border (false, the default) or not
280 // (true).
281 ////////////////////////////////////////////////////////////////////
282 INLINE void WindowProperties::
283 set_undecorated(bool undecorated) {
284  if (undecorated) {
285  _flags |= F_undecorated;
286  } else {
287  _flags &= ~F_undecorated;
288  }
289  _specified |= S_undecorated;
290 }
291 
292 ////////////////////////////////////////////////////////////////////
293 // Function: WindowProperties::get_undecorated
294 // Access: Published
295 // Description: Returns true if the window has no border.
296 ////////////////////////////////////////////////////////////////////
297 INLINE bool WindowProperties::
299  return (_flags & F_undecorated) != 0;
300 }
301 
302 ////////////////////////////////////////////////////////////////////
303 // Function: WindowProperties::has_undecorated
304 // Access: Published
305 // Description: Returns true if set_undecorated() has been specified.
306 ////////////////////////////////////////////////////////////////////
307 INLINE bool WindowProperties::
309  return ((_specified & S_undecorated) != 0);
310 }
311 
312 ////////////////////////////////////////////////////////////////////
313 // Function: WindowProperties::clear_undecorated
314 // Access: Published
315 // Description: Removes the undecorated specification from the properties.
316 ////////////////////////////////////////////////////////////////////
317 INLINE void WindowProperties::
319  _specified &= ~S_undecorated;
320  _flags &= ~F_undecorated;
321 }
322 
323 ////////////////////////////////////////////////////////////////////
324 // Function: WindowProperties::set_fixed_size
325 // Access: Published
326 // Description: Specifies whether the window should be resizable by
327 // the user.
328 ////////////////////////////////////////////////////////////////////
329 INLINE void WindowProperties::
330 set_fixed_size(bool fixed_size) {
331  if (fixed_size) {
332  _flags |= F_fixed_size;
333  } else {
334  _flags &= ~F_fixed_size;
335  }
336  _specified |= S_fixed_size;
337 }
338 
339 ////////////////////////////////////////////////////////////////////
340 // Function: WindowProperties::get_fixed_size
341 // Access: Published
342 // Description: Returns true if the window cannot be resized by the
343 // user, false otherwise.
344 ////////////////////////////////////////////////////////////////////
345 INLINE bool WindowProperties::
346 get_fixed_size() const {
347  return (_flags & F_fixed_size) != 0;
348 }
349 
350 ////////////////////////////////////////////////////////////////////
351 // Function: WindowProperties::has_fixed_size
352 // Access: Published
353 // Description: Returns true if set_fixed_size() has been specified.
354 ////////////////////////////////////////////////////////////////////
355 INLINE bool WindowProperties::
356 has_fixed_size() const {
357  return ((_specified & S_fixed_size) != 0);
358 }
359 
360 ////////////////////////////////////////////////////////////////////
361 // Function: WindowProperties::clear_fixed_size
362 // Access: Published
363 // Description: Removes the fixed_size specification from the properties.
364 ////////////////////////////////////////////////////////////////////
365 INLINE void WindowProperties::
367  _specified &= ~S_fixed_size;
368  _flags &= ~F_fixed_size;
369 }
370 
371 ////////////////////////////////////////////////////////////////////
372 // Function: WindowProperties::set_fullscreen
373 // Access: Published
374 // Description: Specifies whether the window should be opened in
375 // fullscreen mode (true) or normal windowed mode
376 // (false, the default).
377 ////////////////////////////////////////////////////////////////////
378 INLINE void WindowProperties::
379 set_fullscreen(bool fullscreen) {
380  if (fullscreen) {
381  _flags |= F_fullscreen;
382  } else {
383  _flags &= ~F_fullscreen;
384  }
385  _specified |= S_fullscreen;
386 }
387 
388 ////////////////////////////////////////////////////////////////////
389 // Function: WindowProperties::get_fullscreen
390 // Access: Published
391 // Description: Returns true if the window is in fullscreen mode.
392 ////////////////////////////////////////////////////////////////////
393 INLINE bool WindowProperties::
394 get_fullscreen() const {
395  return (_flags & F_fullscreen) != 0;
396 }
397 
398 ////////////////////////////////////////////////////////////////////
399 // Function: WindowProperties::has_fullscreen
400 // Access: Published
401 // Description: Returns true if set_fullscreen() has been specified.
402 ////////////////////////////////////////////////////////////////////
403 INLINE bool WindowProperties::
404 has_fullscreen() const {
405  return ((_specified & S_fullscreen) != 0);
406 }
407 
408 ////////////////////////////////////////////////////////////////////
409 // Function: WindowProperties::clear_fullscreen
410 // Access: Published
411 // Description: Removes the fullscreen specification from the properties.
412 ////////////////////////////////////////////////////////////////////
413 INLINE void WindowProperties::
415  _specified &= ~S_fullscreen;
416  _flags &= ~F_fullscreen;
417 }
418 
419 ////////////////////////////////////////////////////////////////////
420 // Function: WindowProperties::set_foreground
421 // Access: Published
422 // Description: Specifies whether the window should be opened in
423 // the foreground (true), or left in the background
424 // (false).
425 ////////////////////////////////////////////////////////////////////
426 INLINE void WindowProperties::
427 set_foreground(bool foreground) {
428  if (foreground) {
429  _flags |= F_foreground;
430  } else {
431  _flags &= ~F_foreground;
432  }
433  _specified |= S_foreground;
434 }
435 
436 ////////////////////////////////////////////////////////////////////
437 // Function: WindowProperties::get_foreground
438 // Access: Published
439 // Description: Returns true if the window is in the foreground.
440 ////////////////////////////////////////////////////////////////////
441 INLINE bool WindowProperties::
442 get_foreground() const {
443  return (_flags & F_foreground) != 0;
444 }
445 
446 ////////////////////////////////////////////////////////////////////
447 // Function: WindowProperties::has_foreground
448 // Access: Published
449 // Description: Returns true if set_foreground() has been specified.
450 ////////////////////////////////////////////////////////////////////
451 INLINE bool WindowProperties::
452 has_foreground() const {
453  return ((_specified & S_foreground) != 0);
454 }
455 
456 ////////////////////////////////////////////////////////////////////
457 // Function: WindowProperties::clear_foreground
458 // Access: Published
459 // Description: Removes the foreground specification from the properties.
460 ////////////////////////////////////////////////////////////////////
461 INLINE void WindowProperties::
463  _specified &= ~S_foreground;
464  _flags &= ~F_foreground;
465 }
466 
467 ////////////////////////////////////////////////////////////////////
468 // Function: WindowProperties::set_minimized
469 // Access: Published
470 // Description: Specifies whether the window should be created
471 // minimized (true), or normal (false).
472 ////////////////////////////////////////////////////////////////////
473 INLINE void WindowProperties::
474 set_minimized(bool minimized) {
475  if (minimized) {
476  _flags |= F_minimized;
477  } else {
478  _flags &= ~F_minimized;
479  }
480  _specified |= S_minimized;
481 }
482 
483 ////////////////////////////////////////////////////////////////////
484 // Function: WindowProperties::get_minimized
485 // Access: Published
486 // Description: Returns true if the window is minimized.
487 ////////////////////////////////////////////////////////////////////
488 INLINE bool WindowProperties::
489 get_minimized() const {
490  return (_flags & F_minimized) != 0;
491 }
492 
493 ////////////////////////////////////////////////////////////////////
494 // Function: WindowProperties::has_minimized
495 // Access: Published
496 // Description: Returns true if set_minimized() has been specified.
497 ////////////////////////////////////////////////////////////////////
498 INLINE bool WindowProperties::
499 has_minimized() const {
500  return ((_specified & S_minimized) != 0);
501 }
502 
503 ////////////////////////////////////////////////////////////////////
504 // Function: WindowProperties::clear_minimized
505 // Access: Published
506 // Description: Removes the minimized specification from the properties.
507 ////////////////////////////////////////////////////////////////////
508 INLINE void WindowProperties::
510  _specified &= ~S_minimized;
511  _flags &= ~F_minimized;
512 }
513 
514 ////////////////////////////////////////////////////////////////////
515 // Function: WindowProperties::set_raw_mice
516 // Access: Published
517 // Description: Specifies whether the window should read the raw
518 // mouse devices.
519 ////////////////////////////////////////////////////////////////////
520 INLINE void WindowProperties::
521 set_raw_mice(bool raw_mice) {
522  if (raw_mice) {
523  _flags |= F_raw_mice;
524  } else {
525  _flags &= ~F_raw_mice;
526  }
527  _specified |= S_raw_mice;
528 }
529 
530 ////////////////////////////////////////////////////////////////////
531 // Function: WindowProperties::get_raw_mice
532 // Access: Published
533 // Description: Returns true if the window reads the raw mice.
534 ////////////////////////////////////////////////////////////////////
535 INLINE bool WindowProperties::
536 get_raw_mice() const {
537  return (_flags & F_raw_mice) != 0;
538 }
539 
540 ////////////////////////////////////////////////////////////////////
541 // Function: WindowProperties::has_raw_mice
542 // Access: Published
543 // Description: Returns true if set_raw_mice() has been specified.
544 ////////////////////////////////////////////////////////////////////
545 INLINE bool WindowProperties::
546 has_raw_mice() const {
547  return ((_specified & S_raw_mice) != 0);
548 }
549 
550 ////////////////////////////////////////////////////////////////////
551 // Function: WindowProperties::clear_raw_mice
552 // Access: Published
553 // Description: Removes the raw_mice specification from the properties.
554 ////////////////////////////////////////////////////////////////////
555 INLINE void WindowProperties::
557  _specified &= ~S_raw_mice;
558  _flags &= ~F_raw_mice;
559 }
560 
561 ////////////////////////////////////////////////////////////////////
562 // Function: WindowProperties::set_open
563 // Access: Published
564 // Description: Specifies whether the window should be open. It is
565 // legal to create a GraphicsWindow in the closed state,
566 // and later request it to open by changing this flag.
567 ////////////////////////////////////////////////////////////////////
568 INLINE void WindowProperties::
569 set_open(bool open) {
570  if (open) {
571  _flags |= F_open;
572  } else {
573  _flags &= ~F_open;
574  }
575  _specified |= S_open;
576 }
577 
578 ////////////////////////////////////////////////////////////////////
579 // Function: WindowProperties::get_open
580 // Access: Published
581 // Description: Returns true if the window is open.
582 ////////////////////////////////////////////////////////////////////
583 INLINE bool WindowProperties::
584 get_open() const {
585  return (_flags & F_open) != 0;
586 }
587 
588 ////////////////////////////////////////////////////////////////////
589 // Function: WindowProperties::has_open
590 // Access: Published
591 // Description: Returns true if set_open() has been specified.
592 ////////////////////////////////////////////////////////////////////
593 INLINE bool WindowProperties::
594 has_open() const {
595  return ((_specified & S_open) != 0);
596 }
597 
598 ////////////////////////////////////////////////////////////////////
599 // Function: WindowProperties::clear_open
600 // Access: Published
601 // Description: Removes the open specification from the properties.
602 ////////////////////////////////////////////////////////////////////
603 INLINE void WindowProperties::
605  _specified &= ~S_open;
606  _flags &= ~F_open;
607 }
608 
609 ////////////////////////////////////////////////////////////////////
610 // Function: WindowProperties::set_cursor_hidden
611 // Access: Published
612 // Description: Specifies whether the mouse cursor should be visible.
613 ////////////////////////////////////////////////////////////////////
614 INLINE void WindowProperties::
615 set_cursor_hidden(bool cursor_hidden) {
616  if (cursor_hidden) {
617  _flags |= F_cursor_hidden;
618  } else {
619  _flags &= ~F_cursor_hidden;
620  }
621  _specified |= S_cursor_hidden;
622 }
623 
624 ////////////////////////////////////////////////////////////////////
625 // Function: WindowProperties::get_cursor_hidden
626 // Access: Published
627 // Description: Returns true if the mouse cursor is invisible.
628 ////////////////////////////////////////////////////////////////////
629 INLINE bool WindowProperties::
631  return (_flags & F_cursor_hidden) != 0;
632 }
633 
634 ////////////////////////////////////////////////////////////////////
635 // Function: WindowProperties::has_cursor_hidden
636 // Access: Published
637 // Description: Returns true if set_cursor_hidden() has been specified.
638 ////////////////////////////////////////////////////////////////////
639 INLINE bool WindowProperties::
641  return ((_specified & S_cursor_hidden) != 0);
642 }
643 
644 ////////////////////////////////////////////////////////////////////
645 // Function: WindowProperties::clear_cursor_hidden
646 // Access: Published
647 // Description: Removes the cursor_hidden specification from the properties.
648 ////////////////////////////////////////////////////////////////////
649 INLINE void WindowProperties::
651  _specified &= ~S_cursor_hidden;
652  _flags &= ~F_cursor_hidden;
653 }
654 
655 ////////////////////////////////////////////////////////////////////
656 // Function: WindowProperties::set_icon_filename
657 // Access: Published
658 // Description: Specifies the file that contains the icon to
659 // associate with the window when it is minimized.
660 ////////////////////////////////////////////////////////////////////
661 INLINE void WindowProperties::
662 set_icon_filename(const Filename &icon_filename) {
663  _icon_filename = icon_filename;
664  _specified |= S_icon_filename;
665 }
666 
667 
668 ////////////////////////////////////////////////////////////////////
669 // Function: WindowProperties::get_icon_filename
670 // Access: Published
671 // Description: Returns the icon filename associated with the window.
672 ////////////////////////////////////////////////////////////////////
673 INLINE const Filename &WindowProperties::
675  return _icon_filename;
676 }
677 
678 ////////////////////////////////////////////////////////////////////
679 // Function: WindowProperties::has_icon_filename
680 // Access: Published
681 // Description: Returns true if set_icon_filename() has been
682 // specified.
683 ////////////////////////////////////////////////////////////////////
684 INLINE bool WindowProperties::
686  return ((_specified & S_icon_filename) != 0);
687 }
688 
689 ////////////////////////////////////////////////////////////////////
690 // Function: WindowProperties::clear_icon_filename
691 // Access: Published
692 // Description: Removes the icon_filename specification from the
693 // properties.
694 ////////////////////////////////////////////////////////////////////
695 INLINE void WindowProperties::
697  _specified &= ~S_icon_filename;
698  _icon_filename = Filename();
699 }
700 
701 ////////////////////////////////////////////////////////////////////
702 // Function: WindowProperties::set_cursor_filename
703 // Access: Published
704 // Description: Specifies the file that contains the icon to
705 // associate with the mouse cursor when it is within the
706 // window (and visible).
707 ////////////////////////////////////////////////////////////////////
708 INLINE void WindowProperties::
709 set_cursor_filename(const Filename &cursor_filename) {
710  _cursor_filename = cursor_filename;
711  _specified |= S_cursor_filename;
712 }
713 
714 ////////////////////////////////////////////////////////////////////
715 // Function: WindowProperties::get_cursor_filename
716 // Access: Published
717 // Description: Returns the icon filename associated with the mouse
718 // cursor.
719 ////////////////////////////////////////////////////////////////////
720 INLINE const Filename &WindowProperties::
722  return _cursor_filename;
723 }
724 
725 ////////////////////////////////////////////////////////////////////
726 // Function: WindowProperties::has_cursor_filename
727 // Access: Published
728 // Description: Returns true if set_cursor_filename() has been
729 // specified.
730 ////////////////////////////////////////////////////////////////////
731 INLINE bool WindowProperties::
733  return ((_specified & S_cursor_filename) != 0);
734 }
735 
736 ////////////////////////////////////////////////////////////////////
737 // Function: WindowProperties::clear_cursor_filename
738 // Access: Published
739 // Description: Removes the cursor_filename specification from the
740 // properties.
741 ////////////////////////////////////////////////////////////////////
742 INLINE void WindowProperties::
744  _specified &= ~S_cursor_filename;
745  _cursor_filename = Filename();
746 }
747 
748 ////////////////////////////////////////////////////////////////////
749 // Function: WindowProperties::set_z_order
750 // Access: Published
751 // Description: Specifies the relative ordering of the window with
752 // respect to other windows. If the z_order is Z_top,
753 // the window will always be on top of other windows; if
754 // it is Z_bottom, it will always be below other
755 // windows. Most windows will want to be Z_normal,
756 // which allows the user to control the order.
757 ////////////////////////////////////////////////////////////////////
758 INLINE void WindowProperties::
759 set_z_order(WindowProperties::ZOrder z_order) {
760  _z_order = z_order;
761  _specified |= S_z_order;
762 }
763 
764 ////////////////////////////////////////////////////////////////////
765 // Function: WindowProperties::get_z_order
766 // Access: Published
767 // Description: Returns the window's z_order.
768 ////////////////////////////////////////////////////////////////////
769 INLINE WindowProperties::ZOrder WindowProperties::
770 get_z_order() const {
771  return _z_order;
772 }
773 
774 ////////////////////////////////////////////////////////////////////
775 // Function: WindowProperties::has_z_order
776 // Access: Published
777 // Description: Returns true if the window z_order has been specified,
778 // false otherwise.
779 ////////////////////////////////////////////////////////////////////
780 INLINE bool WindowProperties::
781 has_z_order() const {
782  return ((_specified & S_z_order) != 0);
783 }
784 
785 ////////////////////////////////////////////////////////////////////
786 // Function: WindowProperties::clear_z_order
787 // Access: Published
788 // Description: Removes the z_order specification from the properties.
789 ////////////////////////////////////////////////////////////////////
790 INLINE void WindowProperties::
792  _specified &= ~S_z_order;
793  _z_order = Z_normal;
794 }
795 
796 
797 ////////////////////////////////////////////////////////////////////
798 // Function: WindowProperties::set_mouse_mode
799 // Access: Published
800 // Description: Specifies the mode in which the window is to operate
801 // its mouse pointer.
802 //
803 // M_absolute: the normal mode in which a mouse pointer
804 // operates, where the mouse can move outside the window
805 // and the mouse coordinates are relative to its
806 // position in the window.
807 //
808 // M_relative (OSX or Unix/X11 only): a mode where only
809 // relative movements are reported; particularly useful
810 // for FPS-style mouse movements where you have hidden
811 // the mouse pointer and are are more interested in how
812 // fast the mouse is moving, rather than precisely where
813 // the pointer is hovering.
814 //
815 // This has no effect on Windows. On Unix/X11, this
816 // requires the Xxf86dga extension to be available.
817 //
818 // M_confined: this mode reports absolute mouse
819 // positions, but confines the mouse pointer to
820 // the window boundary. It can portably replace
821 // M_relative for an FPS, but you need to periodically
822 // move the pointer to the center of the window
823 // and track movement deltas.
824 //
825 ////////////////////////////////////////////////////////////////////
826 INLINE void WindowProperties::
827 set_mouse_mode(MouseMode mode) {
828  _mouse_mode=mode;
829  _specified |= S_mouse_mode;
830 }
831 
832 ////////////////////////////////////////////////////////////////////
833 // Function: WindowProperties::get_mouse_mode
834 // Access: Published
835 // Description: See set_mouse_mode().
836 ////////////////////////////////////////////////////////////////////
837 INLINE WindowProperties::MouseMode WindowProperties::
838 get_mouse_mode() const {
839  return _mouse_mode;
840 }
841 
842 ////////////////////////////////////////////////////////////////////
843 // Function: WindowProperties::has_mouse_mode
844 // Access: Published
845 // Description:
846 ////////////////////////////////////////////////////////////////////
847 INLINE bool WindowProperties::
848 has_mouse_mode() const {
849  return ((_specified & S_mouse_mode)!=0);
850 }
851 
852 ////////////////////////////////////////////////////////////////////
853 // Function: WindowProperties::clear_mouse_mode
854 // Access: Published
855 // Description: Removes the mouse_mode specification from the properties.
856 ////////////////////////////////////////////////////////////////////
857 INLINE void WindowProperties::
859  _specified &= ~S_mouse_mode;
860  _mouse_mode = M_absolute;
861 }
862 
863 ////////////////////////////////////////////////////////////////////
864 // Function: WindowProperties::set_parent_window
865 // Access: Published
866 // Description: Specifies the window that this window should be
867 // attached to. If this is NULL or unspecified, the
868 // window will be created as a toplevel window on the
869 // desktop; if this is non-NULL, the window will be
870 // bound as a child window to the indicated parent
871 // window.
872 //
873 // You should use GraphicsPipe::make_window_handle() to
874 // create an instance of a WindowHandle object given an
875 // appropriate OS-specific window handle representation.
876 // Each OS-specific GraphicsPipe class defines a
877 // make_window_handle() method that returns an
878 // appropriate WindowHandle object to wrap the
879 // particular OS-specific representation.
880 ////////////////////////////////////////////////////////////////////
881 INLINE void WindowProperties::
883  _parent_window = parent_window;
884  _specified |= S_parent_window;
885 }
886 
887 ////////////////////////////////////////////////////////////////////
888 // Function: WindowProperties::get_parent_window
889 // Access: Published
890 // Description: Returns the parent window specification, or NULL if
891 // there is no parent window specified.
892 ////////////////////////////////////////////////////////////////////
895  return _parent_window;
896 }
897 
898 ////////////////////////////////////////////////////////////////////
899 // Function: WindowProperties::has_parent_window
900 // Access: Published
901 // Description: Checks the S_parent_window specification from the properties.
902 ////////////////////////////////////////////////////////////////////
903 INLINE bool WindowProperties::
905  return ((_specified & S_parent_window)!=0);
906 }
907 
908 ////////////////////////////////////////////////////////////////////
909 // Function: WindowProperties::clear_parent_window
910 // Access: Published
911 // Description: Removes the S_parent_window specification from the properties.
912 ////////////////////////////////////////////////////////////////////
913 INLINE void WindowProperties::
915  _specified &= ~S_parent_window;
916  _parent_window = NULL;
917 }
918 
919 
920 INLINE ostream &
921 operator << (ostream &out, const WindowProperties &properties) {
922  properties.output(out);
923  return out;
924 }
925 
926 
bool is_any_specified() const
Returns true if any properties have been specified, false otherwise.
MouseMode get_mouse_mode() const
See set_mouse_mode().
void set_cursor_hidden(bool cursor_hidden)
Specifies whether the mouse cursor should be visible.
This object represents a window on the desktop, not necessarily a Panda window.
Definition: windowHandle.h:40
bool has_open() const
Returns true if set_open() has been specified.
bool get_foreground() const
Returns true if the window is in the foreground.
static WindowProperties size(int x_size, int y_size)
Returns a WindowProperties structure with only the size specified.
void clear_foreground()
Removes the foreground specification from the properties.
bool get_fixed_size() const
Returns true if the window cannot be resized by the user, false otherwise.
void set_parent_window(size_t parent)
Specifies the window that this window should be attached to.
void clear_origin()
Removes the origin specification from the properties.
void set_raw_mice(bool raw_mice)
Specifies whether the window should read the raw mouse devices.
ZOrder get_z_order() const
Returns the window&#39;s z_order.
bool get_undecorated() const
Returns true if the window has no border.
bool has_icon_filename() const
Returns true if set_icon_filename() has been specified.
static const LPoint2i & zero()
Returns a zero-length point.
Definition: lpoint2.h:840
bool get_minimized() const
Returns true if the window is minimized.
void set_fixed_size(bool fixed_size)
Specifies whether the window should be resizable by the user.
void set_mouse_mode(MouseMode mode)
Specifies the mode in which the window is to operate its mouse pointer.
void clear_undecorated()
Removes the undecorated specification from the properties.
bool has_parent_window() const
Checks the S_parent_window specification from the properties.
void set_size(const LVector2i &size)
Specifies the requested size of the window, in pixels.
bool has_origin() const
Returns true if the window origin has been specified, false otherwise.
bool has_fixed_size() const
Returns true if set_fixed_size() has been specified.
void clear_title()
Removes the title specification from the properties.
const string & get_title() const
Returns the window&#39;s title.
void set_fullscreen(bool fullscreen)
Specifies whether the window should be opened in fullscreen mode (true) or normal windowed mode (fals...
void clear_parent_window()
Removes the S_parent_window specification from the properties.
int get_y_origin() const
Returns the y coordinate of the window&#39;s top-left corner, not including decorations.
void clear_minimized()
Removes the minimized specification from the properties.
void set_icon_filename(const Filename &icon_filename)
Specifies the file that contains the icon to associate with the window when it is minimized...
bool has_fullscreen() const
Returns true if set_fullscreen() has been specified.
void set_undecorated(bool undecorated)
Specifies whether the window should be created with a visible title and border (false, the default) or not (true).
A container for the various kinds of properties we might ask to have on a graphics window before we o...
This is a two-component point in space.
Definition: lpoint2.h:707
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
bool get_open() const
Returns true if the window is open.
void clear_icon_filename()
Removes the icon_filename specification from the properties.
bool get_fullscreen() const
Returns true if the window is in fullscreen mode.
void clear_mouse_mode()
Removes the mouse_mode specification from the properties.
void set_z_order(ZOrder z_order)
Specifies the relative ordering of the window with respect to other windows.
void clear_raw_mice()
Removes the raw_mice specification from the properties.
void clear_size()
Removes the size specification from the properties.
const Filename & get_icon_filename() const
Returns the icon filename associated with the window.
const Filename & get_cursor_filename() const
Returns the icon filename associated with the mouse cursor.
void set_origin(const LPoint2i &origin)
Specifies the origin on the screen (in pixels, relative to the top-left corner) at which the window s...
bool has_foreground() const
Returns true if set_foreground() has been specified.
void clear_open()
Removes the open specification from the properties.
const LVector2i & get_size() const
Returns size in pixels of the useful part of the window, not including decorations.
static const LVector2i & zero()
Returns a zero-length vector.
Definition: lvector2.h:846
void clear_fixed_size()
Removes the fixed_size specification from the properties.
bool has_cursor_hidden() const
Returns true if set_cursor_hidden() has been specified.
This is a two-component vector offset.
Definition: lvector2.h:718
bool has_z_order() const
Returns true if the window z_order has been specified, false otherwise.
void set_cursor_filename(const Filename &cursor_filename)
Specifies the file that contains the icon to associate with the mouse cursor when it is within the wi...
bool get_cursor_hidden() const
Returns true if the mouse cursor is invisible.
bool get_raw_mice() const
Returns true if the window reads the raw mice.
void set_foreground(bool foreground)
Specifies whether the window should be opened in the foreground (true), or left in the background (fa...
void clear_z_order()
Removes the z_order specification from the properties.
bool has_cursor_filename() const
Returns true if set_cursor_filename() has been specified.
void clear_cursor_hidden()
Removes the cursor_hidden specification from the properties.
bool has_raw_mice() const
Returns true if set_raw_mice() has been specified.
void set_minimized(bool minimized)
Specifies whether the window should be created minimized (true), or normal (false).
bool has_minimized() const
Returns true if set_minimized() has been specified.
void set_title(const string &title)
Specifies the title that should be assigned to the window.
bool has_undecorated() const
Returns true if set_undecorated() has been specified.
const LPoint2i & get_origin() const
Returns the coordinates of the window&#39;s top-left corner, not including decorations.
int get_y_size() const
Returns size in pixels in the y dimension of the useful part of the window, not including decorations...
WindowHandle * get_parent_window() const
Returns the parent window specification, or NULL if there is no parent window specified.
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
bool has_title() const
Returns true if the window title has been specified, false otherwise.
void clear_cursor_filename()
Removes the cursor_filename specification from the properties.
bool has_size() const
Returns true if the window size has been specified, false otherwise.
void set_open(bool open)
Specifies whether the window should be open.
int get_x_origin() const
Returns the x coordinate of the window&#39;s top-left corner, not including decorations.
void output(ostream &out) const
Sets any properties that are explicitly specified in other on this object.
void clear_fullscreen()
Removes the fullscreen specification from the properties.