~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-container.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
21
#ifndef __CAIRO_DOCK_CONTAINER__
 
22
#define  __CAIRO_DOCK_CONTAINER__
 
23
 
 
24
#include <glib.h>
 
25
 
 
26
#include "cairo-dock-struct.h"
 
27
G_BEGIN_DECLS
 
28
 
 
29
 
 
30
/**
 
31
*@file cairo-dock-container.h This class defines the Containers, that are classic or hardware accelerated animated windows.
 
32
*
 
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.
 
34
*
 
35
* Docks, Desklets, Dialogs, and Flying-containers all derive from Containers.
 
36
*/
 
37
 
 
38
/// Main orientation of a container.
 
39
typedef enum {
 
40
        CAIRO_DOCK_VERTICAL = 0,
 
41
        CAIRO_DOCK_HORIZONTAL
 
42
        } CairoDockTypeHorizontality;
 
43
 
 
44
/// Types of available containers.
 
45
typedef enum {
 
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;
 
52
 
 
53
struct _CairoContainerInterface {
 
54
        void (*set_icon_size) (CairoContainer *pContainer, Icon *icon);
 
55
        };
 
56
 
 
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;
 
63
        /// External data.
 
64
        gpointer pDataSlot[CAIRO_DOCK_NB_DATA_SLOT];
 
65
        /// window of the container.
 
66
        GtkWidget *pWidget;
 
67
        /// size of the container.
 
68
        gint iWidth, iHeight;
 
69
        /// position of the container.
 
70
        gint iWindowPositionX, iWindowPositionY;
 
71
        /// TURE is the mouse is inside the container (including the possible sub-widgets).
 
72
        gboolean bInside;
 
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;
 
77
#ifdef HAVE_GLITZ
 
78
        glitz_drawable_format_t *pDrawFormat;
 
79
        glitz_drawable_t* pGlitzDrawable;
 
80
        glitz_format_t* pGlitzFormat;
 
81
#else
 
82
        gpointer padding[3];
 
83
#endif
 
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.
 
89
        gint iMouseX;
 
90
        /// Y position of the mouse in the container's system of reference.
 
91
        gint iMouseY;
 
92
        /// zoom applied to the container's elements.
 
93
        gdouble fRatio;
 
94
        /// TRUE if the container has a reflection power.
 
95
        gboolean bUseReflect;
 
96
        /// OpenGL context.
 
97
        GLXContext glContext;
 
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.
 
103
        gint iAnimationStep;
 
104
        CairoContainerInterface iface;
 
105
};
 
106
 
 
107
/// Get the Container part of a pointer.
 
108
#define CAIRO_CONTAINER(p) ((CairoContainer *) (p))
 
109
 
 
110
  /////////////
 
111
 // WINDOW //
 
112
///////////
 
113
 
 
114
GtkWidget *cairo_dock_init_container_full (CairoContainer *pContainer, gboolean bOpenGLWindow);
 
115
 
 
116
/** Initialize a Container : create a GTK window with transparency and OpenGL support.
 
117
*@return the newly allocated GTK window.
 
118
*/
 
119
#define cairo_dock_init_container(pContainer) cairo_dock_init_container_full (pContainer, TRUE)
 
120
/** Same as above, but with no OpenGL support.
 
121
 */
 
122
#define cairo_dock_init_container_no_opengl(pContainer) cairo_dock_init_container_full (pContainer, FALSE)
 
123
 
 
124
void cairo_dock_finish_container (CairoContainer *pContainer);
 
125
 
 
126
/** Apply the scren colormap to a window, providing it transparency.
 
127
*@param pWidget a GTK window.
 
128
*/
 
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.
 
132
*/
 
133
void cairo_dock_set_colormap (CairoContainer *pContainer);
 
134
 
 
135
  ////////////
 
136
 // REDRAW //
 
137
////////////
 
138
 
 
139
/** Clear and trigger the redraw of a Container.
 
140
*@param pContainer the Container to redraw.
 
141
*/
 
142
void cairo_dock_redraw_container (CairoContainer *pContainer);
 
143
 
 
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.
 
147
*/
 
148
void cairo_dock_redraw_container_area (CairoContainer *pContainer, GdkRectangle *pArea);
 
149
 
 
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.
 
153
*/
 
154
void cairo_dock_redraw_icon (Icon *icon, CairoContainer *pContainer);
 
155
 
 
156
 
 
157
 
 
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.
 
161
*/
 
162
CairoContainer *cairo_dock_search_container_from_icon (Icon *icon);
 
163
 
 
164
 
 
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.
 
169
*/
 
170
void cairo_dock_allow_widget_to_receive_data (GtkWidget *pWidget, GCallback pCallBack, gpointer data);
 
171
 
 
172
void cairo_dock_disallow_widget_to_receive_data (GtkWidget *pWidget);
 
173
 
 
174
/** Say if a string is an adress (file://xxx, http://xxx, ftp://xxx, etc).
 
175
* @param cString a string.
 
176
*/
 
177
gboolean cairo_dock_string_is_adress (const gchar *cString);
 
178
 
 
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
 
184
*/
 
185
void cairo_dock_notify_drop_data (gchar *cReceivedData, Icon *pPointedIcon, double fOrder, CairoContainer *pContainer);
 
186
 
 
187
 
 
188
/** Get the maximum zoom of ths icons inside a given container.
 
189
* @param pContainer the container.
 
190
* @return the maximum scale factor.
 
191
*/
 
192
#define cairo_dock_get_max_scale(pContainer) (CAIRO_DOCK_IS_DOCK (pContainer) ? (1 + myIcons.fAmplitude) : 1)
 
193
 
 
194
 
 
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);
 
198
 
 
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.
 
202
*/
 
203
void cairo_dock_popup_menu_on_container (GtkWidget *menu, CairoContainer *pContainer);
 
204
 
 
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
 
211
*/
 
212
GtkWidget *cairo_dock_add_in_menu_with_stock_and_data (const gchar *cLabel, const gchar *gtkStock, GFunc pFunction, GtkWidget *pMenu, gpointer pData);
 
213
 
 
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.
 
217
*@return the menu.
 
218
*/
 
219
GtkWidget *cairo_dock_build_menu (Icon *icon, CairoContainer *pContainer);
 
220
 
 
221
 
 
222
G_END_DECLS
 
223
#endif