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 Containers, that are classic or hardware accelerated animated windows.
33
* A Container is a rectangular on-screen 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
struct _CairoContainerInterface {
54
void (*set_icon_size) (CairoContainer *pContainer, Icon *icon);
57
/// Definition of a Container, whom derive Dock, Desklet, Dialog and FlyingContainer.
58
struct _CairoContainer {
59
/// type of container.
60
CairoDockTypeContainer iType;
61
/// list of available notifications.
62
GPtrArray *pNotificationsTab;
64
gpointer pDataSlot[CAIRO_DOCK_NB_DATA_SLOT];
65
/// window of the container.
67
/// size of the container.
69
/// position of the container.
70
gint iWindowPositionX, iWindowPositionY;
71
/// TURE is the mouse is inside the container (including the possible sub-widgets).
73
/// TRUE if the container is horizontal, FALSE if vertical
74
CairoDockTypeHorizontality bIsHorizontal;
75
/// TRUE if the container is oriented upwards, FALSE if downwards.
76
gboolean bDirectionUp;
78
glitz_drawable_format_t *pDrawFormat;
79
glitz_drawable_t* pGlitzDrawable;
80
glitz_format_t* pGlitzFormat;
84
/// Source ID of the animation loop.
85
guint iSidGLAnimation;
86
/// interval of time between 2 animation steps.
87
gint iAnimationDeltaT;
88
/// X position of the mouse in the container's system of reference.
90
/// Y position of the mouse in the container's system of reference.
92
/// zoom applied to the container's elements.
94
/// TRUE if the container has a reflection power.
98
/// whether the GL context is an ortho or a perspective view.
99
gboolean bPerspectiveView;
100
/// TRUE if a slow animation is running.
101
gboolean bKeepSlowAnimation;
102
/// counter for the animation loop.
104
CairoContainerInterface iface;
107
/// Get the Container part of a pointer.
108
#define CAIRO_CONTAINER(p) ((CairoContainer *) (p))
114
GtkWidget *cairo_dock_init_container_full (CairoContainer *pContainer, gboolean bOpenGLWindow);
116
/** Initialize a Container : create a GTK window with transparency and OpenGL support.
117
*@return the newly allocated GTK window.
119
#define cairo_dock_init_container(pContainer) cairo_dock_init_container_full (pContainer, TRUE)
120
/** Same as above, but with no OpenGL support.
122
#define cairo_dock_init_container_no_opengl(pContainer) cairo_dock_init_container_full (pContainer, FALSE)
124
void cairo_dock_finish_container (CairoContainer *pContainer);
126
/** Apply the scren colormap to a window, providing it transparency.
127
*@param pWidget a GTK window.
129
void cairo_dock_set_colormap_for_window (GtkWidget *pWidget);
130
/** Apply the scren colormap to a container, providing it transparency, and activate Glitz if possible.
131
* @param pContainer the container.
133
void cairo_dock_set_colormap (CairoContainer *pContainer);
139
/** Clear and trigger the redraw of a Container.
140
*@param pContainer the Container to redraw.
142
void cairo_dock_redraw_container (CairoContainer *pContainer);
144
/** Clear and trigger the redraw of a part of a container.
145
*@param pContainer the Container to redraw.
146
*@param pArea the zone to redraw.
148
void cairo_dock_redraw_container_area (CairoContainer *pContainer, GdkRectangle *pArea);
150
/** Clear and trigger the redraw of an Icon. The drawing is not done immediately, but when the expose event is received.
151
*@param icon l'icone a retracer.
152
*@param pContainer le container de l'icone.
154
void cairo_dock_redraw_icon (Icon *icon, CairoContainer *pContainer);
158
/** Search for the Container of a given Icon (dock or desklet in the case of an applet).
159
* @param icon the icon.
160
* @return the container contening this icon, or NULL if the icon is nowhere.
162
CairoContainer *cairo_dock_search_container_from_icon (Icon *icon);
165
/** Let a widget accepts drag-and-drops.
166
* @param pWidget a widget.
167
* @param pCallBack the function that will be called when some data is received.
168
* @param data data passed to the callback.
170
void cairo_dock_allow_widget_to_receive_data (GtkWidget *pWidget, GCallback pCallBack, gpointer data);
172
void cairo_dock_disallow_widget_to_receive_data (GtkWidget *pWidget);
174
/** Say if a string is an adress (file://xxx, http://xxx, ftp://xxx, etc).
175
* @param cString a string.
177
gboolean cairo_dock_string_is_adress (const gchar *cString);
179
/** Notify everybody that a drop has just occured.
180
* @param cReceivedData the dropped data.
181
* @param pPointedIcon the icon which was pointed when the drop occured.
182
* @param fOrder the order of the icon if the drop occured on it, or LAST_ORDER if the drop occured between 2 icons.
183
* @param pContainer the container of the icon
185
void cairo_dock_notify_drop_data (gchar *cReceivedData, Icon *pPointedIcon, double fOrder, CairoContainer *pContainer);
188
/** Get the maximum zoom of ths icons inside a given container.
189
* @param pContainer the container.
190
* @return the maximum scale factor.
192
#define cairo_dock_get_max_scale(pContainer) (CAIRO_DOCK_IS_DOCK (pContainer) ? (1 + myIcons.fAmplitude) : 1)
195
gboolean cairo_dock_emit_signal_on_container (CairoContainer *pContainer, const gchar *cSignal);
196
gboolean cairo_dock_emit_leave_signal (CairoContainer *pContainer);
197
gboolean cairo_dock_emit_enter_signal (CairoContainer *pContainer);
199
/** Pop-up a menu on a container. In the case of a dock, it prevents this one from shrinking down.
200
*@param menu the menu.
201
*@param pContainer the container that was clicked.
203
void cairo_dock_popup_menu_on_container (GtkWidget *menu, CairoContainer *pContainer);
205
/** Add an entry to a given menu.
206
*@param cLabel label of the entry
207
*@param gtkStock a GTK stock or a path to an image
208
*@param pFunction callback
209
*@param pMenu the menu to insert the entry in
210
*@param pData data to feed the callback with
212
GtkWidget *cairo_dock_add_in_menu_with_stock_and_data (const gchar *cLabel, const gchar *gtkStock, GFunc pFunction, GtkWidget *pMenu, gpointer pData);
214
/** Build the main menu of a Container.
215
*@param icon the icon that was left-clicked, or NULL if none.
216
*@param pContainer the container that was left-clicked.
219
GtkWidget *cairo_dock_build_menu (Icon *icon, CairoContainer *pContainer);