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 Crazy Eddie's GUI System (http://www.cegui.org.uk) 00010 Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk) 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 *************************************************************************/ 00026 #ifndef _CEGUITitlebar_h_ 00027 #define _CEGUITitlebar_h_ 00028 00029 #include "CEGUIWindow.h" 00030 #include "elements/CEGUITitlebarProperties.h" 00031 00032 00033 #if defined(_MSC_VER) 00034 # pragma warning(push) 00035 # pragma warning(disable : 4251) 00036 #endif 00037 00038 00039 // Start of CEGUI namespace section 00040 namespace CEGUI 00041 { 00042 00048 class CEGUIEXPORT Titlebar : public Window 00049 { 00050 public: 00051 static const String EventNamespace; 00052 00053 00061 bool isDraggingEnabled(void) const; 00062 00063 00074 void setDraggingEnabled(bool setting); 00075 00076 00084 colour getCaptionColour(void) const; 00085 00086 00097 void setCaptionColour(const colour& col); 00098 00099 00100 /************************************************************************* 00101 Construction / Destruction 00102 *************************************************************************/ 00107 Titlebar(const String& type, const String& name); 00108 00109 00114 virtual ~Titlebar(void); 00115 00116 00117 protected: 00118 /************************************************************************* 00119 Overridden event handler functions 00120 *************************************************************************/ 00121 virtual void onMouseMove(MouseEventArgs& e); 00122 virtual void onMouseButtonDown(MouseEventArgs& e); 00123 virtual void onMouseButtonUp(MouseEventArgs& e); 00124 virtual void onMouseDoubleClicked(MouseEventArgs& e); 00125 virtual void onCaptureLost(WindowEventArgs& e); 00126 virtual void onFontChanged(WindowEventArgs &e); 00127 00128 00129 /************************************************************************* 00130 New event handlers for title bar 00131 *************************************************************************/ 00139 virtual void onDraggingModeChanged(WindowEventArgs& e) {} 00140 00141 00142 /************************************************************************* 00143 Implementation Functions 00144 *************************************************************************/ 00155 virtual bool testClassName_impl(const String& class_name) const 00156 { 00157 if (class_name==(const utf8*)"Titlebar") return true; 00158 return Window::testClassName_impl(class_name); 00159 } 00160 00161 00162 /************************************************************************* 00163 Implementation Data 00164 *************************************************************************/ 00165 bool d_dragging; 00166 Point d_dragPoint; 00167 bool d_dragEnabled; 00168 00169 Rect d_oldCursorArea; 00170 00171 colour d_captionColour; 00172 00173 00174 private: 00175 /************************************************************************* 00176 Static Properties for this class 00177 *************************************************************************/ 00178 static TitlebarProperties::DraggingEnabled d_dragEnabledProperty; 00179 static TitlebarProperties::CaptionColour d_captionColourProperty; 00180 00181 00182 /************************************************************************* 00183 Private methods 00184 *************************************************************************/ 00185 void addTitlebarProperties(void); 00186 }; 00187 00188 } // End of CEGUI namespace section 00189 00190 #if defined(_MSC_VER) 00191 # pragma warning(pop) 00192 #endif 00193 00194 #endif // end of guard _CEGUITitlebar_h_