1 /* 2 * This file is a part of the Cairo-Dock project 3 * 4 * Copyright : (C) see the 'copyright' file. 5 * E-mail : see the 'copyright' file. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 3 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __CAIRO_DOCK_DOCK_MANAGER__ 21 #define __CAIRO_DOCK_DOCK_MANAGER__ 22 23 #include <glib.h> 24 25 #include "cairo-dock-struct.h" 26 #include "cairo-dock-style-facility.h" // GldiColor 27 #include "cairo-dock-icon-factory.h" 28 #include "cairo-dock-dock-factory.h" 29 G_BEGIN_DECLS 30 31 /** 32 *@file cairo-dock-dock-manager.h This class manages all the Docks. 33 * Each Dock has a name that is unique. A Dock can be a sub-dock or a root-dock, whether there exists an icon that points on it or not, but there is no fundamental difference between both. 34 */ 35 36 // manager 37 typedef struct _CairoDocksParam CairoDocksParam; 38 39 #ifndef _MANAGER_DEF_ 40 extern CairoDocksParam myDocksParam; 41 extern GldiManager myDocksMgr; 42 extern GldiObjectManager myDockObjectMgr; 43 #endif 44 45 typedef enum { 46 CAIRO_HIT_SCREEN_BORDER, 47 CAIRO_HIT_DOCK_PLACE, 48 CAIRO_HIT_SCREEN_CORNER, 49 CAIRO_HIT_ZONE, 50 CAIRO_HIT_NB_METHODS 51 } CairoCallbackMethod; 52 53 typedef enum { 54 ICON_DEFAULT, // same as main dock 55 ICON_TINY, 56 ICON_VERY_SMALL, 57 ICON_SMALL, 58 ICON_MEDIUM, 59 ICON_BIG, 60 ICON_HUGE 61 } GldiIconSizeEnum; 62 63 /// TODO: harmonize the values with the simple config -> make some public functions... 64 typedef enum { 65 ICON_SIZE_TINY = 28, 66 ICON_SIZE_VERY_SMALL = 36, 67 ICON_SIZE_SMALL = 42, 68 ICON_SIZE_MEDIUM = 48, 69 ICON_SIZE_BIG = 56, 70 ICON_SIZE_HUGE = 64 71 } GldiIconSize; 72 73 // params 74 struct _CairoDocksParam { 75 // frame 76 gint iDockRadius; 77 gint iDockLineWidth; 78 gint iFrameMargin; 79 GldiColor fLineColor; 80 gboolean bRoundedBottomCorner; 81 // background 82 gchar *cBackgroundImageFile; 83 gdouble fBackgroundImageAlpha; 84 gboolean bBackgroundImageRepeat; 85 gint iNbStripes; 86 gdouble fStripesWidth; 87 GldiColor fStripesColorBright; 88 GldiColor fStripesColorDark; 89 gdouble fStripesAngle; 90 GldiColor fHiddenBg; 91 // position 92 gint iGapX, iGapY; 93 CairoDockPositionType iScreenBorder; 94 gdouble fAlign; 95 gint iNumScreen; 96 // Root dock visibility 97 CairoDockVisibility iVisibility; 98 gchar *cHideEffect; 99 CairoCallbackMethod iCallbackMethod; 100 gint iZoneWidth, iZoneHeight; 101 gchar *cZoneImage; 102 gdouble fZoneAlpha; 103 gchar *cRaiseDockShortcut; 104 gint iUnhideDockDelay; 105 //Sub-Dock visibility 106 gboolean bShowSubDockOnClick; 107 gint iShowSubDockDelay; 108 gint iLeaveSubDockDelay; 109 gboolean bAnimateSubDock; 110 // others 111 gboolean bExtendedMode; 112 gboolean bLockIcons; 113 gboolean bLockAll; 114 gboolean bUseDefaultColors; 115 }; 116 117 /// signals 118 typedef enum { 119 /// notification called when the mouse enters a dock. 120 NOTIFICATION_ENTER_DOCK = NB_NOTIFICATIONS_CONTAINER, 121 /// notification called when the mouse leave a dock. 122 NOTIFICATION_LEAVE_DOCK, 123 /// notification called when an icon has just been inserted into a dock. data : {Icon, CairoDock} 124 NOTIFICATION_INSERT_ICON, 125 /// notification called when an icon is going to be removed from a dock. data : {Icon, CairoDock} 126 NOTIFICATION_REMOVE_ICON, 127 /// notification called when an icon is moved inside a dock. data : {Icon, CairoDock} 128 NOTIFICATION_ICON_MOVED, 129 NB_NOTIFICATIONS_DOCKS 130 } CairoDocksNotifications; 131 132 133 void cairo_dock_force_docks_above (void); 134 135 136 void cairo_dock_reset_docks_table (void); 137 138 139 void gldi_dock_make_subdock (CairoDock *pDock, CairoDock *pParentDock, const gchar *cRendererName); 140 141 /** Get the name of a Dock. 142 * @param pDock the dock. 143 * @return the name of the dock, that identifies it. 144 */ 145 #define gldi_dock_get_name(pDock) (pDock)->cDockName 146 147 /** Get a readable name for a main Dock, suitable for display (like "Bottom dock"). Sub-Docks names are defined by the user, so you can just use \ref gldi_dock_get_name for them. 148 * @param pDock the dock. 149 * @return the readable name of the dock, or NULL if not found. Free it when you're done. 150 */ 151 gchar *gldi_dock_get_readable_name (CairoDock *pDock); 152 153 /** Get a Dock from a given name. 154 * @param cDockName the name of the dock. 155 * @return the dock that has been registerd under this name, or NULL if none exists. 156 */ 157 CairoDock *gldi_dock_get (const gchar *cDockName); 158 159 /** Search an icon pointing on a dock. If several icons point on it, the first one will be returned. 160 * @param pDock the dock. 161 * @param pParentDock if not NULL, this will be filled with the dock containing the icon. 162 * @return the icon pointing on the dock. 163 */ 164 Icon *cairo_dock_search_icon_pointing_on_dock (CairoDock *pDock, CairoDock **pParentDock); 165 166 // renvoie un nom de dock unique; cPrefix peut etre NULL. 167 gchar *cairo_dock_get_unique_dock_name (const gchar *cPrefix); 168 gboolean cairo_dock_check_unique_subdock_name (Icon *pIcon); 169 170 /** Rename a dock. Update the container's name of all of its icons. 171 *@param pDock the dock (optional). 172 *@param cNewName the new name. 173 */ 174 void gldi_dock_rename (CairoDock *pDock, const gchar *cNewName); 175 176 /** Execute an action on all docks. 177 *@param pFunction the action. 178 *@param pUserData data passed to the callback. 179 */ 180 void gldi_docks_foreach (GHFunc pFunction, gpointer pUserData); 181 182 /** Execute an action on all main docks. 183 *@param pFunction the action. 184 *@param pUserData data passed to the callback. 185 */ 186 void gldi_docks_foreach_root (GFunc pFunction, gpointer pUserData); 187 188 /** Execute an action on all icons being inside a dock. 189 *@param pFunction the action. 190 *@param pUserData data passed to the callback. 191 */ 192 void gldi_icons_foreach_in_docks (GldiIconFunc pFunction, gpointer pUserData); 193 194 195 /** (Re)load all buffers of all icons in all docks. 196 @param bUpdateIconSize TRUE to recalculate the icons and docks size. 197 */ 198 void cairo_dock_reload_buffers_in_all_docks (gboolean bUpdateIconSize); 199 200 void cairo_dock_set_all_views_to_default (int iDockType); 201 202 203 void gldi_rootdock_write_gaps (CairoDock *pDock); 204 205 int cairo_dock_convert_icon_size_to_pixels (GldiIconSizeEnum s, double *fMaxScale, double *fReflectSize, int *iIconGap); 206 207 GldiIconSizeEnum cairo_dock_convert_icon_size_to_enum (int iIconSize); 208 209 /** Add a config file for a root dock. Does not create the dock (use \ref gldi_dock_new for that). If the config file already exists, it is overwritten (use \ref gldi_dock_get to check if the name is already used). 210 *@param cDockName name of the dock. 211 */ 212 void gldi_dock_add_conf_file_for_name (const gchar *cDockName); 213 214 /** Add a config file for a new root dock. Does not create the dock (use \ref gldi_dock_new for that). 215 *@return the unique name for the new dock, to be passed to \ref gldi_dock_new. 216 */ 217 gchar *gldi_dock_add_conf_file (void); 218 219 /** Redraw every root docks. 220 */ 221 void gldi_docks_redraw_all_root (void); 222 223 224 void cairo_dock_quick_hide_all_docks (void); 225 void cairo_dock_stop_quick_hide (void); 226 void cairo_dock_allow_entrance (CairoDock *pDock); 227 void cairo_dock_disable_entrance (CairoDock *pDock); 228 gboolean cairo_dock_entrance_is_allowed (CairoDock *pDock); 229 void cairo_dock_activate_temporary_auto_hide (CairoDock *pDock); 230 void cairo_dock_deactivate_temporary_auto_hide (CairoDock *pDock); 231 #define cairo_dock_is_temporary_hidden(pDock) (pDock)->bTemporaryHidden 232 void gldi_subdock_synchronize_orientation (CairoDock *pSubDock, CairoDock *pDock, gboolean bUpdateDockSize); 233 234 235 /** Set the visibility of a root dock. Perform all the necessary actions. 236 *@param pDock a root dock. 237 *@param iVisibility its new visibility. 238 */ 239 void gldi_dock_set_visibility (CairoDock *pDock, CairoDockVisibility iVisibility); 240 241 242 void gldi_register_docks_manager (void); 243 244 G_END_DECLS 245 #endif 246