00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef WINDOWPROPERTIES_H
00016 #define WINDOWPROPERTIES_H
00017
00018 #include "pandabase.h"
00019 #include "filename.h"
00020 #include "pnotify.h"
00021 #include "windowHandle.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030 class EXPCL_PANDA_DISPLAY WindowProperties {
00031 PUBLISHED:
00032 enum ZOrder {
00033 Z_bottom,
00034 Z_normal,
00035 Z_top,
00036 };
00037
00038 enum MouseMode {
00039 M_absolute,
00040 M_relative,
00041 };
00042
00043 WindowProperties();
00044 INLINE WindowProperties(const WindowProperties ©);
00045 void operator = (const WindowProperties ©);
00046 INLINE ~WindowProperties();
00047
00048 static WindowProperties get_config_properties();
00049 static WindowProperties get_default();
00050 static void set_default(const WindowProperties &default_properties);
00051 static void clear_default();
00052
00053 static WindowProperties size(int x_size, int y_size);
00054
00055 bool operator == (const WindowProperties &other) const;
00056 INLINE bool operator != (const WindowProperties &other) const;
00057
00058 void clear();
00059 INLINE bool is_any_specified() const;
00060
00061 INLINE void set_origin(int x_origin, int y_origin);
00062 INLINE int get_x_origin() const;
00063 INLINE int get_y_origin() const;
00064 INLINE bool has_origin() const;
00065 INLINE void clear_origin();
00066
00067 INLINE void set_size(int x_size, int y_size);
00068 INLINE int get_x_size() const;
00069 INLINE int get_y_size() const;
00070 INLINE bool has_size() const;
00071 INLINE void clear_size();
00072
00073 INLINE bool has_mouse_mode() const;
00074 INLINE void set_mouse_mode(MouseMode mode);
00075 INLINE MouseMode get_mouse_mode() const;
00076 INLINE void clear_mouse_mode();
00077
00078 INLINE void set_title(const string &title);
00079 INLINE const string &get_title() const;
00080 INLINE bool has_title() const;
00081 INLINE void clear_title();
00082
00083 INLINE void set_undecorated(bool undecorated);
00084 INLINE bool get_undecorated() const;
00085 INLINE bool has_undecorated() const;
00086 INLINE void clear_undecorated();
00087
00088 INLINE void set_fixed_size(bool fixed_size);
00089 INLINE bool get_fixed_size() const;
00090 INLINE bool has_fixed_size() const;
00091 INLINE void clear_fixed_size();
00092
00093 INLINE void set_fullscreen(bool fullscreen);
00094 INLINE bool get_fullscreen() const;
00095 INLINE bool has_fullscreen() const;
00096 INLINE void clear_fullscreen();
00097
00098 INLINE void set_foreground(bool foreground);
00099 INLINE bool get_foreground() const;
00100 INLINE bool has_foreground() const;
00101 INLINE void clear_foreground();
00102
00103 INLINE void set_minimized(bool minimized);
00104 INLINE bool get_minimized() const;
00105 INLINE bool has_minimized() const;
00106 INLINE void clear_minimized();
00107
00108 INLINE void set_raw_mice(bool raw_mice);
00109 INLINE bool get_raw_mice() const;
00110 INLINE bool has_raw_mice() const;
00111 INLINE void clear_raw_mice();
00112
00113 INLINE void set_open(bool open);
00114 INLINE bool get_open() const;
00115 INLINE bool has_open() const;
00116 INLINE void clear_open();
00117
00118 INLINE void set_cursor_hidden(bool cursor_hidden);
00119 INLINE bool get_cursor_hidden() const;
00120 INLINE bool has_cursor_hidden() const;
00121 INLINE void clear_cursor_hidden();
00122
00123 INLINE void set_icon_filename(const Filename &icon_filename);
00124 INLINE const Filename &get_icon_filename() const;
00125 INLINE bool has_icon_filename() const;
00126 INLINE void clear_icon_filename();
00127
00128 INLINE void set_cursor_filename(const Filename &cursor_filename);
00129 INLINE const Filename &get_cursor_filename() const;
00130 INLINE bool has_cursor_filename() const;
00131 INLINE void clear_cursor_filename();
00132
00133 INLINE void set_z_order(ZOrder z_order);
00134 INLINE ZOrder get_z_order() const;
00135 INLINE bool has_z_order() const;
00136 INLINE void clear_z_order();
00137
00138 void set_parent_window(size_t parent);
00139 INLINE void set_parent_window(WindowHandle *parent_window = NULL);
00140 INLINE WindowHandle *get_parent_window() const;
00141 INLINE bool has_parent_window() const;
00142 INLINE void clear_parent_window();
00143
00144 void add_properties(const WindowProperties &other);
00145
00146 void output(ostream &out) const;
00147
00148 private:
00149
00150
00151
00152 enum Specified {
00153 S_origin = 0x00001,
00154 S_size = 0x00002,
00155 S_title = 0x00004,
00156 S_undecorated = 0x00008,
00157 S_fullscreen = 0x00010,
00158 S_foreground = 0x00020,
00159 S_minimized = 0x00040,
00160 S_open = 0x00080,
00161 S_cursor_hidden = 0x00100,
00162 S_fixed_size = 0x00200,
00163 S_z_order = 0x00400,
00164 S_icon_filename = 0x00800,
00165 S_cursor_filename = 0x01000,
00166 S_mouse_mode = 0x02000,
00167 S_parent_window = 0x04000,
00168 S_raw_mice = 0x08000,
00169 };
00170
00171
00172
00173
00174 enum Flags {
00175 F_undecorated = S_undecorated,
00176 F_fullscreen = S_fullscreen,
00177 F_foreground = S_foreground,
00178 F_minimized = S_minimized,
00179 F_open = S_open,
00180 F_cursor_hidden = S_cursor_hidden,
00181 F_fixed_size = S_fixed_size,
00182 F_raw_mice = S_raw_mice,
00183 };
00184
00185 int _specified;
00186 int _x_origin;
00187 int _y_origin;
00188 int _x_size;
00189 int _y_size;
00190 MouseMode _mouse_mode;
00191 string _title;
00192 Filename _cursor_filename;
00193 Filename _icon_filename;
00194 ZOrder _z_order;
00195 unsigned int _flags;
00196 PT(WindowHandle) _parent_window;
00197
00198 static WindowProperties *_default_properties;
00199 };
00200
00201 EXPCL_PANDA_DISPLAY ostream &
00202 operator << (ostream &out, WindowProperties::ZOrder z_order);
00203 EXPCL_PANDA_DISPLAY istream &
00204 operator >> (istream &in, WindowProperties::ZOrder &z_order);
00205
00206 EXPCL_PANDA_DISPLAY ostream &
00207 operator << (ostream &out, WindowProperties::MouseMode mode);
00208 EXPCL_PANDA_DISPLAY istream &
00209 operator >> (istream &in, WindowProperties::MouseMode &mode);
00210
00211
00212 INLINE ostream &operator << (ostream &out, const WindowProperties &properties);
00213
00214 #include "windowProperties.I"
00215
00216 #endif