00001 /*********************************************************************** 00002 filename: CEGUITitlebar.h 00003 created: 25/4/2004 00004 author: Paul D Turner 00005 00006 purpose: Interface for a Titlebar Widget 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #ifndef _CEGUITitlebar_h_ 00031 #define _CEGUITitlebar_h_ 00032 00033 #include "CEGUIWindow.h" 00034 #include "elements/CEGUITitlebarProperties.h" 00035 00036 00037 #if defined(_MSC_VER) 00038 # pragma warning(push) 00039 # pragma warning(disable : 4251) 00040 #endif 00041 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00046 00052 class CEGUIEXPORT Titlebar : public Window 00053 { 00054 public: 00055 static const String EventNamespace; 00056 static const String WidgetTypeName; 00057 00065 bool isDraggingEnabled(void) const; 00066 00067 00078 void setDraggingEnabled(bool setting); 00079 00080 00081 /************************************************************************* 00082 Construction / Destruction 00083 *************************************************************************/ 00088 Titlebar(const String& type, const String& name); 00089 00090 00095 virtual ~Titlebar(void); 00096 00097 00098 protected: 00099 /************************************************************************* 00100 Overridden event handler functions 00101 *************************************************************************/ 00102 virtual void onMouseMove(MouseEventArgs& e); 00103 virtual void onMouseButtonDown(MouseEventArgs& e); 00104 virtual void onMouseButtonUp(MouseEventArgs& e); 00105 virtual void onMouseDoubleClicked(MouseEventArgs& e); 00106 virtual void onCaptureLost(WindowEventArgs& e); 00107 virtual void onFontChanged(WindowEventArgs &e); 00108 00109 00110 /************************************************************************* 00111 New event handlers for title bar 00112 *************************************************************************/ 00120 virtual void onDraggingModeChanged(WindowEventArgs& e) {} 00121 00122 00123 /************************************************************************* 00124 Implementation Functions 00125 *************************************************************************/ 00136 virtual bool testClassName_impl(const String& class_name) const 00137 { 00138 if (class_name=="Titlebar") return true; 00139 return Window::testClassName_impl(class_name); 00140 } 00141 00142 00143 /************************************************************************* 00144 Implementation Data 00145 *************************************************************************/ 00146 bool d_dragging; 00147 Point d_dragPoint; 00148 bool d_dragEnabled; 00149 00150 Rect d_oldCursorArea; 00151 00152 private: 00153 /************************************************************************* 00154 Static Properties for this class 00155 *************************************************************************/ 00156 static TitlebarProperties::DraggingEnabled d_dragEnabledProperty; 00157 00158 00159 /************************************************************************* 00160 Private methods 00161 *************************************************************************/ 00162 void addTitlebarProperties(void); 00163 }; 00164 00165 } // End of CEGUI namespace section 00166 00167 #if defined(_MSC_VER) 00168 # pragma warning(pop) 00169 #endif 00170 00171 #endif // end of guard _CEGUITitlebar_h_