File indexing completed on 2024-05-12 05:34:32
0001 #ifndef oxygenanimations_h 0002 #define oxygenanimations_h 0003 0004 /* 0005 * this file is part of the oxygen gtk engine 0006 * SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0007 * 0008 * SPDX-License-Identifier: LGPL-2.0-or-later 0009 */ 0010 0011 #include "oxygenarrowstateengine.h" 0012 #include "oxygenbackgroundhintengine.h" 0013 #include "oxygenbaseengine.h" 0014 #include "oxygencomboengine.h" 0015 #include "oxygencomboboxengine.h" 0016 #include "oxygencomboboxentryengine.h" 0017 #include "oxygendialogengine.h" 0018 #include "oxygenflatwidgetengine.h" 0019 #include "oxygengroupboxengine.h" 0020 #include "oxygengroupboxlabelengine.h" 0021 #include "oxygenhook.h" 0022 #include "oxygenhoverengine.h" 0023 #include "oxygenmainwindowengine.h" 0024 #include "oxygenmenubarstateengine.h" 0025 #include "oxygenmenuitemengine.h" 0026 #include "oxygenmenustateengine.h" 0027 #include "oxygenpanedengine.h" 0028 #include "oxygenscrollbarengine.h" 0029 #include "oxygenscrollbarstateengine.h" 0030 #include "oxygenscrolledwindowengine.h" 0031 #include "oxygeninnershadowengine.h" 0032 #include "oxygensignal.h" 0033 #include "oxygentabwidgetengine.h" 0034 #include "oxygentabwidgetstateengine.h" 0035 #include "oxygentoolbarstateengine.h" 0036 #include "oxygentreeviewengine.h" 0037 #include "oxygentreeviewstateengine.h" 0038 #include "oxygenwidgetsizeengine.h" 0039 #include "oxygenwidgetstateengine.h" 0040 0041 #include <gtk/gtk.h> 0042 #include <vector> 0043 #include <map> 0044 0045 namespace Oxygen 0046 { 0047 0048 //! forward declaration 0049 class QtSettings; 0050 0051 //! keeps track of all animation engines 0052 class Animations 0053 { 0054 0055 public: 0056 0057 //! constructor 0058 Animations( void ); 0059 0060 //! destructor 0061 virtual ~Animations( void ); 0062 0063 //! initialize settings 0064 void initialize( const QtSettings& ); 0065 0066 //! initialize hooks 0067 void initializeHooks( void ); 0068 0069 //! unregister widget 0070 bool registerWidget( GtkWidget* ); 0071 0072 //! unregister widget 0073 void unregisterWidget( GtkWidget* ); 0074 0075 //! enabled state 0076 void setEnabled( bool value ); 0077 0078 //! inner shadow enabled state 0079 void setInnerShadowsEnabled( bool value ) 0080 { _innerShadowsEnabled = value; } 0081 0082 //! inner shadow enabled state 0083 bool innerShadowsEnabled( void ) const 0084 { return _innerShadowsEnabled; } 0085 0086 //! combo engine 0087 ComboEngine& comboEngine( void ) const 0088 { return *_comboEngine; } 0089 0090 //! combobox engine 0091 ComboBoxEngine& comboBoxEngine( void ) const 0092 { return *_comboBoxEngine; } 0093 0094 //! comboboxentry engine 0095 ComboBoxEntryEngine& comboBoxEntryEngine( void ) const 0096 { return *_comboBoxEntryEngine; } 0097 0098 //! dialog engine 0099 DialogEngine& dialogEngine( void ) const 0100 { return *_dialogEngine; } 0101 0102 //! flat widget 0103 FlatWidgetEngine& flatWidgetEngine( void ) const 0104 { return *_flatWidgetEngine; } 0105 0106 //! groupbox engine 0107 GroupBoxEngine& groupBoxEngine( void ) const 0108 { return *_groupBoxEngine; } 0109 0110 //! background hint 0111 BackgroundHintEngine& backgroundHintEngine( void ) const 0112 { return *_backgroundHintEngine; } 0113 0114 //! main window engine 0115 MainWindowEngine& mainWindowEngine( void ) const 0116 { return *_mainWindowEngine; } 0117 0118 //! menu item engine 0119 MenuItemEngine& menuItemEngine( void ) const 0120 { return *_menuItemEngine; } 0121 0122 //! hover engine 0123 HoverEngine& hoverEngine( void ) const 0124 { return *_hoverEngine; } 0125 0126 //! paned (splitter) engine 0127 PanedEngine& panedEngine( void ) const 0128 { return *_panedEngine; } 0129 0130 //! scrollbar engine 0131 ScrollBarEngine& scrollBarEngine( void ) const 0132 { return *_scrollBarEngine; } 0133 0134 //! scrolled window engine 0135 ScrolledWindowEngine& scrolledWindowEngine( void ) const 0136 { return *_scrolledWindowEngine; } 0137 0138 //! inner shadow engine 0139 InnerShadowEngine& innerShadowEngine( void ) const 0140 { return *_innerShadowEngine; } 0141 0142 //! tab widget engine 0143 TabWidgetEngine& tabWidgetEngine( void ) const 0144 { return *_tabWidgetEngine; } 0145 0146 //! tree view engine 0147 TreeViewEngine& treeViewEngine( void ) const 0148 { return *_treeViewEngine; } 0149 0150 //! window size engine 0151 WidgetSizeEngine& widgetSizeEngine( void ) const 0152 { return *_widgetSizeEngine; } 0153 0154 //!@name animations specific engines 0155 //@{ 0156 0157 //! widget mouse-over and focus animations engine 0158 WidgetStateEngine& widgetStateEngine( void ) const 0159 { return *_widgetStateEngine; } 0160 0161 //! arrow mouse-over animations engine 0162 ArrowStateEngine& arrowStateEngine( void ) const 0163 { return *_arrowStateEngine; } 0164 0165 //! scrollbar arrow mouse-over animations engine 0166 ScrollBarStateEngine& scrollBarStateEngine( void ) const 0167 { return *_scrollBarStateEngine; } 0168 0169 //! notebook tabs mouse-over animations engine 0170 TabWidgetStateEngine& tabWidgetStateEngine( void ) const 0171 { return *_tabWidgetStateEngine; } 0172 0173 //! tree view mouse-over animation engine 0174 TreeViewStateEngine& treeViewStateEngine( void ) const 0175 { return *_treeViewStateEngine; } 0176 0177 //! menubar mouse-over animation engine 0178 MenuBarStateEngine& menuBarStateEngine( void ) const 0179 { return *_menuBarStateEngine; } 0180 0181 //! menu mouse-over animation engine 0182 MenuStateEngine& menuStateEngine( void ) const 0183 { return *_menuStateEngine; } 0184 0185 //! toolbar mouse-over animation engine 0186 ToolBarStateEngine& toolBarStateEngine( void ) const 0187 { return *_toolBarStateEngine; } 0188 0189 //@} 0190 0191 protected: 0192 0193 //! register new engine 0194 void registerEngine( BaseEngine* engine ) 0195 { _engines.push_back( engine ); } 0196 0197 //! groupbox engine 0198 GroupBoxLabelEngine& groupBoxLabelEngine( void ) const 0199 { return *_groupBoxLabelEngine; } 0200 0201 //! destruction callback 0202 static gboolean destroyNotifyEvent( GtkWidget*, gpointer ); 0203 0204 //! combobox list size adjustment hook 0205 static gboolean sizeAllocationHook( GSignalInvocationHint*, guint, const GValue*, gpointer ); 0206 0207 //! inner shadow composited mode enabling hook 0208 static gboolean innerShadowHook( GSignalInvocationHint*, guint, const GValue*, gpointer ); 0209 0210 //! widget realize hook 0211 static gboolean realizationHook( GSignalInvocationHint*, guint, const GValue*, gpointer ); 0212 0213 private: 0214 0215 //! inner shadow enabled state 0216 bool _innerShadowsEnabled; 0217 0218 //! list of engines 0219 BaseEngine::List _engines; 0220 0221 //! background hint engine 0222 BackgroundHintEngine* _backgroundHintEngine; 0223 0224 //! combobox engine 0225 ComboEngine* _comboEngine; 0226 0227 //! combobox engine 0228 ComboBoxEngine* _comboBoxEngine; 0229 0230 //! combobox entry engine 0231 ComboBoxEntryEngine* _comboBoxEntryEngine; 0232 0233 //! dialog engine 0234 DialogEngine* _dialogEngine; 0235 0236 //! flat widget 0237 FlatWidgetEngine* _flatWidgetEngine; 0238 0239 //! groupbox engine 0240 GroupBoxEngine* _groupBoxEngine; 0241 0242 //! groupbox engine 0243 GroupBoxLabelEngine* _groupBoxLabelEngine; 0244 0245 //! hover engine 0246 HoverEngine* _hoverEngine; 0247 0248 //! main window engine 0249 MainWindowEngine* _mainWindowEngine; 0250 0251 //! menu item engine 0252 MenuItemEngine* _menuItemEngine; 0253 0254 //! paned engine 0255 PanedEngine* _panedEngine; 0256 0257 //! scrollbar engine 0258 ScrollBarEngine* _scrollBarEngine; 0259 0260 //! scrolled window engine 0261 ScrolledWindowEngine* _scrolledWindowEngine; 0262 0263 //! inner shadow engine 0264 InnerShadowEngine* _innerShadowEngine; 0265 0266 //! tab widget engine 0267 TabWidgetEngine* _tabWidgetEngine; 0268 0269 //! tree view engine 0270 TreeViewEngine* _treeViewEngine; 0271 0272 //! widget size engine 0273 WidgetSizeEngine* _widgetSizeEngine; 0274 0275 //!@name Animation specific engines 0276 //@{ 0277 0278 //! widget mouse-over and focus animations engine 0279 WidgetStateEngine* _widgetStateEngine; 0280 0281 //! arrow mouse-over animations engine 0282 ArrowStateEngine* _arrowStateEngine; 0283 0284 //! scrollbar arrow mouse-over animations engine 0285 ScrollBarStateEngine* _scrollBarStateEngine; 0286 0287 //! notebook tabs mouse-over animations engine 0288 TabWidgetStateEngine* _tabWidgetStateEngine; 0289 0290 //! tree view mouse-over animation engine 0291 TreeViewStateEngine* _treeViewStateEngine; 0292 0293 //! menubar mouse-over animation engine 0294 MenuBarStateEngine* _menuBarStateEngine; 0295 0296 //! menu mouse-over animation engine 0297 MenuStateEngine* _menuStateEngine; 0298 0299 //! toolbar mouse-over animation engine 0300 ToolBarStateEngine* _toolBarStateEngine; 0301 0302 //@} 0303 0304 //!@name hooks 0305 //@{ 0306 0307 //! true when hooks are initialized 0308 bool _hooksInitialized; 0309 0310 //! realization hook 0311 Hook _realizationHook; 0312 0313 //! combobox hook 0314 Hook _sizeAllocationHook; 0315 0316 //! inner shadows hook 0317 Hook _innerShadowHook; 0318 0319 0320 //@} 0321 0322 //! keep track of all registered widgets, and associated destroy callback 0323 typedef std::map< GtkWidget*, Signal > WidgetMap; 0324 WidgetMap _allWidgets; 0325 0326 }; 0327 0328 } 0329 0330 #endif