1 #ifndef oxygenanimations_h 2 #define oxygenanimations_h 3 4 /* 5 * this file is part of the oxygen gtk engine 6 * Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or(at your option ) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free 20 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 21 * MA 02110-1301, USA. 22 */ 23 24 #include "oxygenarrowstateengine.h" 25 #include "oxygenbackgroundhintengine.h" 26 #include "oxygenbaseengine.h" 27 #include "oxygencomboengine.h" 28 #include "oxygencomboboxengine.h" 29 #include "oxygencomboboxentryengine.h" 30 #include "oxygendialogengine.h" 31 #include "oxygenflatwidgetengine.h" 32 #include "oxygengroupboxengine.h" 33 #include "oxygengroupboxlabelengine.h" 34 #include "oxygenhook.h" 35 #include "oxygenhoverengine.h" 36 #include "oxygenmainwindowengine.h" 37 #include "oxygenmenubarstateengine.h" 38 #include "oxygenmenuitemengine.h" 39 #include "oxygenmenustateengine.h" 40 #include "oxygenpanedengine.h" 41 #include "oxygenscrollbarengine.h" 42 #include "oxygenscrollbarstateengine.h" 43 #include "oxygenscrolledwindowengine.h" 44 #include "oxygeninnershadowengine.h" 45 #include "oxygensignal.h" 46 #include "oxygentabwidgetengine.h" 47 #include "oxygentabwidgetstateengine.h" 48 #include "oxygentoolbarstateengine.h" 49 #include "oxygentreeviewengine.h" 50 #include "oxygentreeviewstateengine.h" 51 #include "oxygenwidgetsizeengine.h" 52 #include "oxygenwidgetstateengine.h" 53 54 #include <gtk/gtk.h> 55 #include <vector> 56 #include <map> 57 58 namespace Oxygen 59 { 60 61 //! forward declaration 62 class QtSettings; 63 64 //! keeps track of all animation engines 65 class Animations 66 { 67 68 public: 69 70 //! constructor 71 Animations( void ); 72 73 //! destructor 74 virtual ~Animations( void ); 75 76 //! initialize settings 77 void initialize( const QtSettings& ); 78 79 //! initialize hooks 80 void initializeHooks( void ); 81 82 //! unregister widget 83 bool registerWidget( GtkWidget* ); 84 85 //! unregister widget 86 void unregisterWidget( GtkWidget* ); 87 88 //! enabled state 89 void setEnabled( bool value ); 90 91 //! inner shadow enabled state setInnerShadowsEnabled(bool value)92 void setInnerShadowsEnabled( bool value ) 93 { _innerShadowsEnabled = value; } 94 95 //! inner shadow enabled state innerShadowsEnabled(void)96 bool innerShadowsEnabled( void ) const 97 { return _innerShadowsEnabled; } 98 99 //! combo engine comboEngine(void)100 ComboEngine& comboEngine( void ) const 101 { return *_comboEngine; } 102 103 //! combobox engine comboBoxEngine(void)104 ComboBoxEngine& comboBoxEngine( void ) const 105 { return *_comboBoxEngine; } 106 107 //! comboboxentry engine comboBoxEntryEngine(void)108 ComboBoxEntryEngine& comboBoxEntryEngine( void ) const 109 { return *_comboBoxEntryEngine; } 110 111 //! dialog engine dialogEngine(void)112 DialogEngine& dialogEngine( void ) const 113 { return *_dialogEngine; } 114 115 //! flat widget flatWidgetEngine(void)116 FlatWidgetEngine& flatWidgetEngine( void ) const 117 { return *_flatWidgetEngine; } 118 119 //! groupbox engine groupBoxEngine(void)120 GroupBoxEngine& groupBoxEngine( void ) const 121 { return *_groupBoxEngine; } 122 123 //! background hint backgroundHintEngine(void)124 BackgroundHintEngine& backgroundHintEngine( void ) const 125 { return *_backgroundHintEngine; } 126 127 //! main window engine mainWindowEngine(void)128 MainWindowEngine& mainWindowEngine( void ) const 129 { return *_mainWindowEngine; } 130 131 //! menu item engine menuItemEngine(void)132 MenuItemEngine& menuItemEngine( void ) const 133 { return *_menuItemEngine; } 134 135 //! hover engine hoverEngine(void)136 HoverEngine& hoverEngine( void ) const 137 { return *_hoverEngine; } 138 139 //! paned (splitter) engine panedEngine(void)140 PanedEngine& panedEngine( void ) const 141 { return *_panedEngine; } 142 143 //! scrollbar engine scrollBarEngine(void)144 ScrollBarEngine& scrollBarEngine( void ) const 145 { return *_scrollBarEngine; } 146 147 //! scrolled window engine scrolledWindowEngine(void)148 ScrolledWindowEngine& scrolledWindowEngine( void ) const 149 { return *_scrolledWindowEngine; } 150 151 //! inner shadow engine innerShadowEngine(void)152 InnerShadowEngine& innerShadowEngine( void ) const 153 { return *_innerShadowEngine; } 154 155 //! tab widget engine tabWidgetEngine(void)156 TabWidgetEngine& tabWidgetEngine( void ) const 157 { return *_tabWidgetEngine; } 158 159 //! tree view engine treeViewEngine(void)160 TreeViewEngine& treeViewEngine( void ) const 161 { return *_treeViewEngine; } 162 163 //! window size engine widgetSizeEngine(void)164 WidgetSizeEngine& widgetSizeEngine( void ) const 165 { return *_widgetSizeEngine; } 166 167 //!@name animations specific engines 168 //@{ 169 170 //! widget mouse-over and focus animations engine widgetStateEngine(void)171 WidgetStateEngine& widgetStateEngine( void ) const 172 { return *_widgetStateEngine; } 173 174 //! arrow mouse-over animations engine arrowStateEngine(void)175 ArrowStateEngine& arrowStateEngine( void ) const 176 { return *_arrowStateEngine; } 177 178 //! scrollbar arrow mouse-over animations engine scrollBarStateEngine(void)179 ScrollBarStateEngine& scrollBarStateEngine( void ) const 180 { return *_scrollBarStateEngine; } 181 182 //! notebook tabs mouse-over animations engine tabWidgetStateEngine(void)183 TabWidgetStateEngine& tabWidgetStateEngine( void ) const 184 { return *_tabWidgetStateEngine; } 185 186 //! tree view mouse-over animation engine treeViewStateEngine(void)187 TreeViewStateEngine& treeViewStateEngine( void ) const 188 { return *_treeViewStateEngine; } 189 190 //! menubar mouse-over animation engine menuBarStateEngine(void)191 MenuBarStateEngine& menuBarStateEngine( void ) const 192 { return *_menuBarStateEngine; } 193 194 //! menu mouse-over animation engine menuStateEngine(void)195 MenuStateEngine& menuStateEngine( void ) const 196 { return *_menuStateEngine; } 197 198 //! toolbar mouse-over animation engine toolBarStateEngine(void)199 ToolBarStateEngine& toolBarStateEngine( void ) const 200 { return *_toolBarStateEngine; } 201 202 //@} 203 204 protected: 205 206 //! register new engine registerEngine(BaseEngine * engine)207 void registerEngine( BaseEngine* engine ) 208 { _engines.push_back( engine ); } 209 210 //! groupbox engine groupBoxLabelEngine(void)211 GroupBoxLabelEngine& groupBoxLabelEngine( void ) const 212 { return *_groupBoxLabelEngine; } 213 214 //! destruction callback 215 static gboolean destroyNotifyEvent( GtkWidget*, gpointer ); 216 217 //! combobox list size adjustment hook 218 static gboolean sizeAllocationHook( GSignalInvocationHint*, guint, const GValue*, gpointer ); 219 220 //! inner shadow composited mode enabling hook 221 static gboolean innerShadowHook( GSignalInvocationHint*, guint, const GValue*, gpointer ); 222 223 //! widget realize hook 224 static gboolean realizationHook( GSignalInvocationHint*, guint, const GValue*, gpointer ); 225 226 private: 227 228 //! inner shadow enabled state 229 bool _innerShadowsEnabled; 230 231 //! list of engines 232 BaseEngine::List _engines; 233 234 //! background hint engine 235 BackgroundHintEngine* _backgroundHintEngine; 236 237 //! combobox engine 238 ComboEngine* _comboEngine; 239 240 //! combobox engine 241 ComboBoxEngine* _comboBoxEngine; 242 243 //! combobox entry engine 244 ComboBoxEntryEngine* _comboBoxEntryEngine; 245 246 //! dialog engine 247 DialogEngine* _dialogEngine; 248 249 //! flat widget 250 FlatWidgetEngine* _flatWidgetEngine; 251 252 //! groupbox engine 253 GroupBoxEngine* _groupBoxEngine; 254 255 //! groupbox engine 256 GroupBoxLabelEngine* _groupBoxLabelEngine; 257 258 //! hover engine 259 HoverEngine* _hoverEngine; 260 261 //! main window engine 262 MainWindowEngine* _mainWindowEngine; 263 264 //! menu item engine 265 MenuItemEngine* _menuItemEngine; 266 267 //! paned engine 268 PanedEngine* _panedEngine; 269 270 //! scrollbar engine 271 ScrollBarEngine* _scrollBarEngine; 272 273 //! scrolled window engine 274 ScrolledWindowEngine* _scrolledWindowEngine; 275 276 //! inner shadow engine 277 InnerShadowEngine* _innerShadowEngine; 278 279 //! tab widget engine 280 TabWidgetEngine* _tabWidgetEngine; 281 282 //! tree view engine 283 TreeViewEngine* _treeViewEngine; 284 285 //! widget size engine 286 WidgetSizeEngine* _widgetSizeEngine; 287 288 //!@name Animation specific engines 289 //@{ 290 291 //! widget mouse-over and focus animations engine 292 WidgetStateEngine* _widgetStateEngine; 293 294 //! arrow mouse-over animations engine 295 ArrowStateEngine* _arrowStateEngine; 296 297 //! scrollbar arrow mouse-over animations engine 298 ScrollBarStateEngine* _scrollBarStateEngine; 299 300 //! notebook tabs mouse-over animations engine 301 TabWidgetStateEngine* _tabWidgetStateEngine; 302 303 //! tree view mouse-over animation engine 304 TreeViewStateEngine* _treeViewStateEngine; 305 306 //! menubar mouse-over animation engine 307 MenuBarStateEngine* _menuBarStateEngine; 308 309 //! menu mouse-over animation engine 310 MenuStateEngine* _menuStateEngine; 311 312 //! toolbar mouse-over animation engine 313 ToolBarStateEngine* _toolBarStateEngine; 314 315 //@} 316 317 //!@name hooks 318 //@{ 319 320 //! true when hooks are initialized 321 bool _hooksInitialized; 322 323 //! realization hook 324 Hook _realizationHook; 325 326 //! combobox hook 327 Hook _sizeAllocationHook; 328 329 //! inner shadows hook 330 Hook _innerShadowHook; 331 332 333 //@} 334 335 //! keep track of all registered widgets, and associated destroy callback 336 typedef std::map< GtkWidget*, Signal > WidgetMap; 337 WidgetMap _allWidgets; 338 339 }; 340 341 } 342 343 #endif 344