2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
21
#ifndef __CAIRO_DOCK_CONTAINER__
22
#define __CAIRO_DOCK_CONTAINER__
26
#include "cairo-dock-struct.h"
31
*@file cairo-dock-container.h This class defines the basis of containers, that are classic or hardware accelerated animated windows.
33
* A container is a rectangular located surface, has the notion of orientation, can hold external datas, monitors the mouse position, and has its own animation loop.
35
* Docks, Desklets, Dialogs, and Flying-containers all derive from Containers.
38
/// Main orientation of a container.
40
CAIRO_DOCK_VERTICAL = 0,
42
} CairoDockTypeHorizontality;
44
/// Types of available containers.
46
CAIRO_DOCK_TYPE_DOCK = 0,
47
CAIRO_DOCK_TYPE_DESKLET,
48
CAIRO_DOCK_TYPE_DIALOG,
49
CAIRO_DOCK_TYPE_FLYING_CONTAINER,
50
CAIRO_DOCK_NB_CONTAINER_TYPES
51
} CairoDockTypeContainer;
53
/// Definition of a Container, whom derive Dock, Desklet, Dialog and FlyingContainer.
54
struct _CairoContainer {
55
/// type of container.
56
CairoDockTypeContainer iType;
57
/// list of available notifications.
58
GPtrArray *pNotificationsTab;
60
gpointer pDataSlot[CAIRO_DOCK_NB_DATA_SLOT];
61
/// window of the container.
63
/// size of the container.
65
/// position of the container.
66
gint iWindowPositionX, iWindowPositionY;
67
/// TURE is the mouse is inside the container (including the possible sub-widgets).
69
/// TRUE if the container is horizontal, FALSE if vertical
70
CairoDockTypeHorizontality bIsHorizontal;
71
/// TRUE if the container is oriented upwards, FALSE if downwards.
72
gboolean bDirectionUp;
74
glitz_drawable_format_t *pDrawFormat;
75
glitz_drawable_t* pGlitzDrawable;
76
glitz_format_t* pGlitzFormat;
80
/// Source ID of the animation loop.
81
guint iSidGLAnimation;
82
/// interval of time between 2 animation steps.
83
gint iAnimationDeltaT;
84
/// X position of the mouse in the container's system of reference.
86
/// Y position of the mouse in the container's system of reference.
88
/// zoom applied to the container's elements.
90
/// TRUE if the container has a reflection power.
94
/// TRUE if a slow animation is running.
95
gboolean bKeepSlowAnimation;
96
/// counter for the animation loop.
100
/// Get the Container part of a pointer.
101
#define CAIRO_CONTAINER(p) ((CairoContainer *) (p))
107
GtkWidget *cairo_dock_create_container_window_full (gboolean bOpenGLWindow);
109
/** Create a GTK window that fits a CairoContainer (with transparency among others).
110
*@return the newly allocated GTK window.
112
#define cairo_dock_create_container_window(...) cairo_dock_create_container_window_full (TRUE)
113
/** Same as above, but without an OpenGL context.
115
#define cairo_dock_create_container_window_no_opengl(...) cairo_dock_create_container_window_full (FALSE)
117
/** Apply the scren colormap to a window, providing it transparency.
118
*@param pWidget a GTK window.
120
void cairo_dock_set_colormap_for_window (GtkWidget *pWidget);
121
/** Apply the scren colormap to a container, providing it transparency, and activate Glitz if possible.
122
* @param pContainer the container.
124
void cairo_dock_set_colormap (CairoContainer *pContainer);
130
/** Clear and trigger the redraw of a Container.
131
*@param pContainer the Container to redraw.
133
void cairo_dock_redraw_container (CairoContainer *pContainer);
135
/** Clear and trigger the redraw of a part of a container.
136
*@param pContainer the Container to redraw.
137
*@param pArea the zone to redraw.
139
void cairo_dock_redraw_container_area (CairoContainer *pContainer, GdkRectangle *pArea);
141
/** Clear and trigger the redraw of an Icon. The drawing is not done immediately, but when the expose event is received.
142
*@param icon l'icone a retracer.
143
*@param pContainer le container de l'icone.
145
void cairo_dock_redraw_icon (Icon *icon, CairoContainer *pContainer);
149
/** Search for the Container of a given Icon (dock or desklet in the case of an applet).
150
* @param icon the icon.
151
* @return the container contening this icon, or NULL if the icon is nowhere.
153
CairoContainer *cairo_dock_search_container_from_icon (Icon *icon);
156
void cairo_dock_show_hide_container (CairoContainer *pContainer);
159
/** Let a widget accepts drag-and-drops.
160
* @param pWidget a widget.
161
* @param pCallBack the function that will be called when some data is received.
162
* @param data data passed to the callback.
164
void cairo_dock_allow_widget_to_receive_data (GtkWidget *pWidget, GCallback pCallBack, gpointer data);
166
/** Say if a string is an adress (file://xxx, http://xxx, ftp://xxx, etc).
167
* @param cString a string.
169
gboolean cairo_dock_string_is_adress (const gchar *cString);
171
/** Notify everybody that a drop has just occured.
172
* @param cReceivedData the dropped data.
173
* @param pPointedIcon the icon which was pointed when the drop occured.
174
* @param fOrder the order of the icon if the drop occured on it, or LAST_ORDER if the drop occured between 2 icons.
175
* @param pContainer the container of the icon
177
void cairo_dock_notify_drop_data (gchar *cReceivedData, Icon *pPointedIcon, double fOrder, CairoContainer *pContainer);
180
/** Get the maximum zoom of ths icons inside a given container.
181
* @param pContainer the container.
182
* @return the maximum scale factor.
184
#define cairo_dock_get_max_scale(pContainer) (CAIRO_DOCK_IS_DOCK (pContainer) ? (1 + myIcons.fAmplitude) : 1)