1 | /************************************************************************
|
---|
2 | filename: CEGUITitlebar.h
|
---|
3 | created: 25/4/2004
|
---|
4 | author: Paul D Turner
|
---|
5 |
|
---|
6 | purpose: Interface for a Titlebar Widget
|
---|
7 | *************************************************************************/
|
---|
8 | /*************************************************************************
|
---|
9 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
10 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
11 |
|
---|
12 | This library is free software; you can redistribute it and/or
|
---|
13 | modify it under the terms of the GNU Lesser General Public
|
---|
14 | License as published by the Free Software Foundation; either
|
---|
15 | version 2.1 of the License, or (at your option) any later version.
|
---|
16 |
|
---|
17 | This library is distributed in the hope that it will be useful,
|
---|
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | Lesser General Public License for more details.
|
---|
21 |
|
---|
22 | You should have received a copy of the GNU Lesser General Public
|
---|
23 | License along with this library; if not, write to the Free Software
|
---|
24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
25 | *************************************************************************/
|
---|
26 | #ifndef _CEGUITitlebar_h_
|
---|
27 | #define _CEGUITitlebar_h_
|
---|
28 |
|
---|
29 | #include "CEGUIWindow.h"
|
---|
30 | #include "elements/CEGUITitlebarProperties.h"
|
---|
31 |
|
---|
32 |
|
---|
33 | #if defined(_MSC_VER)
|
---|
34 | # pragma warning(push)
|
---|
35 | # pragma warning(disable : 4251)
|
---|
36 | #endif
|
---|
37 |
|
---|
38 |
|
---|
39 | // Start of CEGUI namespace section
|
---|
40 | namespace CEGUI
|
---|
41 | {
|
---|
42 |
|
---|
43 | /*!
|
---|
44 | \brief
|
---|
45 | Class representing the title bar for Frame Windows.
|
---|
46 |
|
---|
47 | */
|
---|
48 | class CEGUIEXPORT Titlebar : public Window
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | static const String EventNamespace; //!< Namespace for global events
|
---|
52 |
|
---|
53 |
|
---|
54 | /*!
|
---|
55 | \brief
|
---|
56 | Return whether this title bar will respond to dragging.
|
---|
57 |
|
---|
58 | \return
|
---|
59 | true if the title bar will respond to dragging, false if the title bar will not respond.
|
---|
60 | */
|
---|
61 | bool isDraggingEnabled(void) const;
|
---|
62 |
|
---|
63 |
|
---|
64 | /*!
|
---|
65 | \brief
|
---|
66 | Set whether this title bar widget will respond to dragging.
|
---|
67 |
|
---|
68 | \param setting
|
---|
69 | true if the title bar should respond to being dragged, false if it should not respond.
|
---|
70 |
|
---|
71 | \return
|
---|
72 | Nothing.
|
---|
73 | */
|
---|
74 | void setDraggingEnabled(bool setting);
|
---|
75 |
|
---|
76 |
|
---|
77 | /*!
|
---|
78 | \brief
|
---|
79 | Return the current colour used for rendering the caption text
|
---|
80 |
|
---|
81 | \return
|
---|
82 | colour value that specifies the colour used when rendering the title bar caption text.
|
---|
83 | */
|
---|
84 | colour getCaptionColour(void) const;
|
---|
85 |
|
---|
86 |
|
---|
87 | /*!
|
---|
88 | \brief
|
---|
89 | Sets the colour to be used for rendering the caption text.
|
---|
90 |
|
---|
91 | \param col
|
---|
92 | colour value that specifies the colour to be used when rendering the title bar caption text.
|
---|
93 |
|
---|
94 | \return
|
---|
95 | Nothing.
|
---|
96 | */
|
---|
97 | void setCaptionColour(const colour& col);
|
---|
98 |
|
---|
99 |
|
---|
100 | /*************************************************************************
|
---|
101 | Construction / Destruction
|
---|
102 | *************************************************************************/
|
---|
103 | /*!
|
---|
104 | \brief
|
---|
105 | Constructor for Titlebar base class.
|
---|
106 | */
|
---|
107 | Titlebar(const String& type, const String& name);
|
---|
108 |
|
---|
109 |
|
---|
110 | /*!
|
---|
111 | \brief
|
---|
112 | Destructor for Titlebar base class.
|
---|
113 | */
|
---|
114 | virtual ~Titlebar(void);
|
---|
115 |
|
---|
116 |
|
---|
117 | protected:
|
---|
118 | /*************************************************************************
|
---|
119 | Overridden event handler functions
|
---|
120 | *************************************************************************/
|
---|
121 | virtual void onMouseMove(MouseEventArgs& e);
|
---|
122 | virtual void onMouseButtonDown(MouseEventArgs& e);
|
---|
123 | virtual void onMouseButtonUp(MouseEventArgs& e);
|
---|
124 | virtual void onMouseDoubleClicked(MouseEventArgs& e);
|
---|
125 | virtual void onCaptureLost(WindowEventArgs& e);
|
---|
126 | virtual void onFontChanged(WindowEventArgs &e);
|
---|
127 |
|
---|
128 |
|
---|
129 | /*************************************************************************
|
---|
130 | New event handlers for title bar
|
---|
131 | *************************************************************************/
|
---|
132 | /*!
|
---|
133 | \brief
|
---|
134 | Event handler called when the 'draggable' state for the title bar is changed.
|
---|
135 |
|
---|
136 | Note that this is for 'internal' use at the moment and as such does not add or
|
---|
137 | fire a public Event that can be subscribed to.
|
---|
138 | */
|
---|
139 | virtual void onDraggingModeChanged(WindowEventArgs& e) {}
|
---|
140 |
|
---|
141 |
|
---|
142 | /*************************************************************************
|
---|
143 | Implementation Functions
|
---|
144 | *************************************************************************/
|
---|
145 | /*!
|
---|
146 | \brief
|
---|
147 | Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
|
---|
148 |
|
---|
149 | \param class_name
|
---|
150 | The class name that is to be checked.
|
---|
151 |
|
---|
152 | \return
|
---|
153 | true if this window was inherited from \a class_name. false if not.
|
---|
154 | */
|
---|
155 | virtual bool testClassName_impl(const String& class_name) const
|
---|
156 | {
|
---|
157 | if (class_name==(const utf8*)"Titlebar") return true;
|
---|
158 | return Window::testClassName_impl(class_name);
|
---|
159 | }
|
---|
160 |
|
---|
161 |
|
---|
162 | /*************************************************************************
|
---|
163 | Implementation Data
|
---|
164 | *************************************************************************/
|
---|
165 | bool d_dragging; //!< set to true when the window is being dragged.
|
---|
166 | Point d_dragPoint; //!< Point at which we are being dragged.
|
---|
167 | bool d_dragEnabled; //!< true when dragging for the widget is enabled.
|
---|
168 |
|
---|
169 | Rect d_oldCursorArea; //!< Used to backup cursor restraint area.
|
---|
170 |
|
---|
171 | colour d_captionColour; //!< Colour used when rendering the title caption.
|
---|
172 |
|
---|
173 |
|
---|
174 | private:
|
---|
175 | /*************************************************************************
|
---|
176 | Static Properties for this class
|
---|
177 | *************************************************************************/
|
---|
178 | static TitlebarProperties::DraggingEnabled d_dragEnabledProperty;
|
---|
179 | static TitlebarProperties::CaptionColour d_captionColourProperty;
|
---|
180 |
|
---|
181 |
|
---|
182 | /*************************************************************************
|
---|
183 | Private methods
|
---|
184 | *************************************************************************/
|
---|
185 | void addTitlebarProperties(void);
|
---|
186 | };
|
---|
187 |
|
---|
188 | } // End of CEGUI namespace section
|
---|
189 |
|
---|
190 | #if defined(_MSC_VER)
|
---|
191 | # pragma warning(pop)
|
---|
192 | #endif
|
---|
193 |
|
---|
194 | #endif // end of guard _CEGUITitlebar_h_
|
---|