00001 // Filename: windowProperties.cxx 00002 // Created by: drose (13Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "windowProperties.h" 00020 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: WindowProperties::Constructor 00024 // Access: Published 00025 // Description: 00026 //////////////////////////////////////////////////////////////////// 00027 WindowProperties:: 00028 WindowProperties() { 00029 clear(); 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: WindowProperties::Copy Assignment Operator 00034 // Access: Published 00035 // Description: 00036 //////////////////////////////////////////////////////////////////// 00037 void WindowProperties:: 00038 operator = (const WindowProperties ©) { 00039 _specified = copy._specified; 00040 _x_origin = copy._x_origin; 00041 _y_origin = copy._y_origin; 00042 _x_size = copy._x_size; 00043 _y_size = copy._y_size; 00044 _title = copy._title; 00045 _flags = copy._flags; 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: WindowProperties::operator == 00050 // Access: Published 00051 // Description: 00052 //////////////////////////////////////////////////////////////////// 00053 bool WindowProperties:: 00054 operator == (const WindowProperties &other) const { 00055 return (_specified == other._specified && 00056 _flags == other._flags && 00057 _x_origin == other._x_origin && 00058 _y_origin == other._y_origin && 00059 _x_size == other._x_size && 00060 _y_size == other._y_size && 00061 _title == other._title); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: WindowProperties::clear 00066 // Access: Published 00067 // Description: Unsets all properties that have been specified so 00068 // far, and resets the WindowProperties structure to its 00069 // initial empty state. 00070 //////////////////////////////////////////////////////////////////// 00071 void WindowProperties:: 00072 clear() { 00073 _specified = 0; 00074 _x_origin = 0; 00075 _y_origin = 0; 00076 _x_size = 0; 00077 _y_size = 0; 00078 _title = string(); 00079 _flags = 0; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: WindowProperties::add_properties 00084 // Access: Published 00085 // Description: Sets any properties that are explicitly specified in 00086 // other on this object. Leaves other properties 00087 // unchanged. 00088 //////////////////////////////////////////////////////////////////// 00089 void WindowProperties:: 00090 add_properties(const WindowProperties &other) { 00091 if (other.has_origin()) { 00092 set_origin(other.get_x_origin(), other.get_y_origin()); 00093 } 00094 if (other.has_size()) { 00095 set_size(other.get_x_size(), other.get_y_size()); 00096 } 00097 if (other.has_title()) { 00098 set_title(other.get_title()); 00099 } 00100 if (other.has_undecorated()) { 00101 set_undecorated(other.get_undecorated()); 00102 } 00103 if (other.has_fullscreen()) { 00104 set_fullscreen(other.get_fullscreen()); 00105 } 00106 if (other.has_foreground()) { 00107 set_foreground(other.get_foreground()); 00108 } 00109 if (other.has_minimized()) { 00110 set_minimized(other.get_minimized()); 00111 } 00112 if (other.has_open()) { 00113 set_open(other.get_open()); 00114 } 00115 if (other.has_cursor_hidden()) { 00116 set_cursor_hidden(other.get_cursor_hidden()); 00117 } 00118 } 00119 00120 //////////////////////////////////////////////////////////////////// 00121 // Function: WindowProperties::output 00122 // Access: Published 00123 // Description: Sets any properties that are explicitly specified in 00124 // other on this object. Leaves other properties 00125 // unchanged. 00126 //////////////////////////////////////////////////////////////////// 00127 void WindowProperties:: 00128 output(ostream &out) const { 00129 if (has_origin()) { 00130 out << "origin=(" << get_x_origin() << ", " << get_y_origin() << ") "; 00131 } 00132 if (has_size()) { 00133 out << "size=(" << get_x_size() << ", " << get_y_size() << ") "; 00134 } 00135 if (has_title()) { 00136 out << "title=\"" << get_title() << "\"" << " "; 00137 } 00138 if (has_undecorated()) { 00139 out << (get_undecorated() ? "undecorated " : "!undecorated "); 00140 } 00141 if (has_fullscreen()) { 00142 out << (get_fullscreen() ? "fullscreen " : "!fullscreen "); 00143 } 00144 if (has_foreground()) { 00145 out << (get_foreground() ? "foreground " : "!foreground "); 00146 } 00147 if (has_minimized()) { 00148 out << (get_minimized() ? "minimized " : "!minimized "); 00149 } 00150 if (has_open()) { 00151 out << (get_open() ? "open " : "!open "); 00152 } 00153 if (has_cursor_hidden()) { 00154 out << (get_cursor_hidden() ? "cursor_hidden " : "!cursor_hidden "); 00155 } 00156 }