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 |
|
---|
127 |
|
---|
128 | /*************************************************************************
|
---|
129 | New event handlers for title bar
|
---|
130 | *************************************************************************/
|
---|
131 | /*!
|
---|
132 | \brief
|
---|
133 | Event handler called when the 'draggable' state for the title bar is changed.
|
---|
134 |
|
---|
135 | Note that this is for 'internal' use at the moment and as such does not add or
|
---|
136 | fire a public Event that can be subscribed to.
|
---|
137 | */
|
---|
138 | virtual void onDraggingModeChanged(WindowEventArgs& e) {}
|
---|
139 |
|
---|
140 |
|
---|
141 | /*************************************************************************
|
---|
142 | Implementation Functions
|
---|
143 | *************************************************************************/
|
---|
144 | /*!
|
---|
145 | \brief
|
---|
146 | Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
|
---|
147 |
|
---|
148 | \param class_name
|
---|
149 | The class name that is to be checked.
|
---|
150 |
|
---|
151 | \return
|
---|
152 | true if this window was inherited from \a class_name. false if not.
|
---|
153 | */
|
---|
154 | virtual bool testClassName_impl(const String& class_name) const
|
---|
155 | {
|
---|
156 | if (class_name==(const utf8*)"Titlebar") return true;
|
---|
157 | return Window::testClassName_impl(class_name);
|
---|
158 | }
|
---|
159 |
|
---|
160 |
|
---|
161 | /*************************************************************************
|
---|
162 | Implementation Data
|
---|
163 | *************************************************************************/
|
---|
164 | bool d_dragging; //!< set to true when the window is being dragged.
|
---|
165 | Point d_dragPoint; //!< Point at which we are being dragged.
|
---|
166 | bool d_dragEnabled; //!< true when dragging for the widget is enabled.
|
---|
167 |
|
---|
168 | Rect d_oldCursorArea; //!< Used to backup cursor restraint area.
|
---|
169 |
|
---|
170 | colour d_captionColour; //!< Colour used when rendering the title caption.
|
---|
171 |
|
---|
172 |
|
---|
173 | private:
|
---|
174 | /*************************************************************************
|
---|
175 | Static Properties for this class
|
---|
176 | *************************************************************************/
|
---|
177 | static TitlebarProperties::DraggingEnabled d_dragEnabledProperty;
|
---|
178 | static TitlebarProperties::CaptionColour d_captionColourProperty;
|
---|
179 |
|
---|
180 |
|
---|
181 | /*************************************************************************
|
---|
182 | Private methods
|
---|
183 | *************************************************************************/
|
---|
184 | void addTitlebarProperties(void);
|
---|
185 | };
|
---|
186 |
|
---|
187 | } // End of CEGUI namespace section
|
---|
188 |
|
---|
189 | #if defined(_MSC_VER)
|
---|
190 | # pragma warning(pop)
|
---|
191 | #endif
|
---|
192 |
|
---|
193 | #endif // end of guard _CEGUITitlebar_h_
|
---|