Panda3D
 All Classes Functions Variables Enumerations
windowProperties.h
1 // Filename: windowProperties.h
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 #ifndef WINDOWPROPERTIES_H
16 #define WINDOWPROPERTIES_H
17 
18 #include "pandabase.h"
19 #include "filename.h"
20 #include "pnotify.h"
21 #include "windowHandle.h"
22 #include "lpoint2.h"
23 #include "lvector2.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : WindowProperties
27 // Description : A container for the various kinds of properties we
28 // might ask to have on a graphics window before we open
29 // it. This also serves to hold the current properties
30 // for a window after it has been opened.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_DISPLAY WindowProperties {
33 PUBLISHED:
34  enum ZOrder {
35  Z_bottom,
36  Z_normal,
37  Z_top,
38  };
39 
40  enum MouseMode {
41  M_absolute,
42  M_relative,
43  M_confined,
44  };
45 
47  INLINE WindowProperties(const WindowProperties &copy);
48  void operator = (const WindowProperties &copy);
49  INLINE ~WindowProperties();
50 
51  static WindowProperties get_config_properties();
52  static WindowProperties get_default();
53  static void set_default(const WindowProperties &default_properties);
54  static void clear_default();
55 
56  static WindowProperties size(int x_size, int y_size);
57 
58  bool operator == (const WindowProperties &other) const;
59  INLINE bool operator != (const WindowProperties &other) const;
60 
61  void clear();
62  INLINE bool is_any_specified() const;
63 
64  INLINE void set_origin(const LPoint2i &origin);
65  INLINE void set_origin(int x_origin, int y_origin);
66  INLINE const LPoint2i &get_origin() const;
67  INLINE int get_x_origin() const;
68  INLINE int get_y_origin() const;
69  INLINE bool has_origin() const;
70  INLINE void clear_origin();
71 
72  INLINE void set_size(const LVector2i &size);
73  INLINE void set_size(int x_size, int y_size);
74  INLINE const LVector2i &get_size() const;
75  INLINE int get_x_size() const;
76  INLINE int get_y_size() const;
77  INLINE bool has_size() const;
78  INLINE void clear_size();
79 
80  INLINE bool has_mouse_mode() const;
81  INLINE void set_mouse_mode(MouseMode mode);
82  INLINE MouseMode get_mouse_mode() const;
83  INLINE void clear_mouse_mode();
84 
85  INLINE void set_title(const string &title);
86  INLINE const string &get_title() const;
87  INLINE bool has_title() const;
88  INLINE void clear_title();
89 
90  INLINE void set_undecorated(bool undecorated);
91  INLINE bool get_undecorated() const;
92  INLINE bool has_undecorated() const;
93  INLINE void clear_undecorated();
94 
95  INLINE void set_fixed_size(bool fixed_size);
96  INLINE bool get_fixed_size() const;
97  INLINE bool has_fixed_size() const;
98  INLINE void clear_fixed_size();
99 
100  INLINE void set_fullscreen(bool fullscreen);
101  INLINE bool get_fullscreen() const;
102  INLINE bool has_fullscreen() const;
103  INLINE void clear_fullscreen();
104 
105  INLINE void set_foreground(bool foreground);
106  INLINE bool get_foreground() const;
107  INLINE bool has_foreground() const;
108  INLINE void clear_foreground();
109 
110  INLINE void set_minimized(bool minimized);
111  INLINE bool get_minimized() const;
112  INLINE bool has_minimized() const;
113  INLINE void clear_minimized();
114 
115  INLINE void set_raw_mice(bool raw_mice);
116  INLINE bool get_raw_mice() const;
117  INLINE bool has_raw_mice() const;
118  INLINE void clear_raw_mice();
119 
120  INLINE void set_open(bool open);
121  INLINE bool get_open() const;
122  INLINE bool has_open() const;
123  INLINE void clear_open();
124 
125  INLINE void set_cursor_hidden(bool cursor_hidden);
126  INLINE bool get_cursor_hidden() const;
127  INLINE bool has_cursor_hidden() const;
128  INLINE void clear_cursor_hidden();
129 
130  INLINE void set_icon_filename(const Filename &icon_filename);
131  INLINE const Filename &get_icon_filename() const;
132  INLINE bool has_icon_filename() const;
133  INLINE void clear_icon_filename();
134 
135  INLINE void set_cursor_filename(const Filename &cursor_filename);
136  INLINE const Filename &get_cursor_filename() const;
137  INLINE bool has_cursor_filename() const;
138  INLINE void clear_cursor_filename();
139 
140  INLINE void set_z_order(ZOrder z_order);
141  INLINE ZOrder get_z_order() const;
142  INLINE bool has_z_order() const;
143  INLINE void clear_z_order();
144 
145  void set_parent_window(size_t parent);
146  INLINE void set_parent_window(WindowHandle *parent_window = NULL);
147  INLINE WindowHandle *get_parent_window() const;
148  INLINE bool has_parent_window() const;
149  INLINE void clear_parent_window();
150 
151  void add_properties(const WindowProperties &other);
152 
153  void output(ostream &out) const;
154 
155 private:
156  // This bitmask indicates which of the parameters in the properties
157  // structure have been filled in by the user, and which remain
158  // unspecified.
159  enum Specified {
160  S_origin = 0x00001,
161  S_size = 0x00002,
162  S_title = 0x00004,
163  S_undecorated = 0x00008,
164  S_fullscreen = 0x00010,
165  S_foreground = 0x00020,
166  S_minimized = 0x00040,
167  S_open = 0x00080,
168  S_cursor_hidden = 0x00100,
169  S_fixed_size = 0x00200,
170  S_z_order = 0x00400,
171  S_icon_filename = 0x00800,
172  S_cursor_filename = 0x01000,
173  S_mouse_mode = 0x02000,
174  S_parent_window = 0x04000,
175  S_raw_mice = 0x08000,
176  };
177 
178  // This bitmask represents the true/false settings for various
179  // boolean flags (assuming the corresponding S_* bit has been set,
180  // above).
181  enum Flags {
182  F_undecorated = S_undecorated,
183  F_fullscreen = S_fullscreen,
184  F_foreground = S_foreground,
185  F_minimized = S_minimized,
186  F_open = S_open,
187  F_cursor_hidden = S_cursor_hidden,
188  F_fixed_size = S_fixed_size,
189  F_raw_mice = S_raw_mice,
190  };
191 
192  int _specified;
193  LPoint2i _origin;
194  LVector2i _size;
195  MouseMode _mouse_mode;
196  string _title;
197  Filename _cursor_filename;
198  Filename _icon_filename;
199  ZOrder _z_order;
200  unsigned int _flags;
201  PT(WindowHandle) _parent_window;
202 
203  static WindowProperties *_default_properties;
204 };
205 
206 EXPCL_PANDA_DISPLAY ostream &
207 operator << (ostream &out, WindowProperties::ZOrder z_order);
208 EXPCL_PANDA_DISPLAY istream &
209 operator >> (istream &in, WindowProperties::ZOrder &z_order);
210 
211 EXPCL_PANDA_DISPLAY ostream &
212 operator << (ostream &out, WindowProperties::MouseMode mode);
213 EXPCL_PANDA_DISPLAY istream &
214 operator >> (istream &in, WindowProperties::MouseMode &mode);
215 
216 
217 INLINE ostream &operator << (ostream &out, const WindowProperties &properties);
218 
219 #include "windowProperties.I"
220 
221 #endif
This object represents a window on the desktop, not necessarily a Panda window.
Definition: windowHandle.h:40
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:681
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
This is a two-component vector offset.
Definition: lvector2.h:692