summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-smooth-widget.h
blob: d92fc0515da1338d8e5c8479c755577a61077fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* nautilus-smooth-widget.h - Functions and types shared by smooth widgets.

   Copyright (C) 2000 Eazel, Inc.

   The Gnome Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Gnome Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Authors: Ramiro Estrugo <ramiro@eazel.com>
*/

#ifndef NAUTILUS_SMOOTH_WIDGET_H
#define NAUTILUS_SMOOTH_WIDGET_H

#include <libgnome/gnome-defs.h>
#include <gtk/gtkwidget.h>
#include <libnautilus-extensions/nautilus-art-extensions.h>
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>

BEGIN_GNOME_DECLS

/* See nautilus_smooth_widget_get_tile_bounds() */
#define NAUTILUS_SMOOTH_TILE_EXTENT_FULL	-1
#define NAUTILUS_SMOOTH_TILE_EXTENT_ONE_STEP	-2

/* See nautilus_smooth_widget_paint() */
typedef enum
{
	NAUTILUS_SMOOTH_BACKGROUND_GTK,
	NAUTILUS_SMOOTH_BACKGROUND_CALLBACK,
	NAUTILUS_SMOOTH_BACKGROUND_SOLID_COLOR
} NautilusSmoothBackgroundMode;

/* See nautilus_smooth_widget_paint() */
typedef enum
{
	NAUTILUS_SMOOTH_TILE_SELF,
	NAUTILUS_SMOOTH_TILE_ANCESTOR
} NautilusSmoothTileMode;

/* Prototypes for shared methods.  We declare these here so that
 * the signatures in the smooth widget's class struture dont
 * get out of whack.
 */
typedef void (* NautilusSmoothWidgetDrawBackground) (GtkWidget *widget,
						     GdkPixbuf *buffer,
						     const ArtIRect *area);
typedef void (* NautilusSmoothWidgetSetIsSmooth) (GtkWidget *widget,
						  gboolean is_smooth);


/* Callback for nautilus_smooth_widget_paint() used to render the
 * smooth widget's content when not in smooth mode.
 */
typedef void (* NautilusSmoothPaintOpaqueCallback) (GtkWidget *widget,
						    GdkDrawable *destination_drawable,
						    GdkGC *gc,
						    int source_x,
						    int source_y,
						    const ArtIRect *area,
						    gpointer callback_data);

/* Callback for nautilus_smooth_widget_paint() used to composite the
 * smooth widget's content when in smooth mode.
 */
typedef void (* NautilusSmoothCompositeCallback) (GtkWidget *widget,
						  GdkPixbuf *destination_pixbuf,
						  int source_x,
						  int source_y,
						  const ArtIRect *area,
						  int opacity,
						  gpointer callback_data);

void               nautilus_smooth_widget_register                 (GtkWidget                         *widget);
void               nautilus_smooth_widget_paint                    (GtkWidget                         *widget,
								    GdkGC                             *gc,
								    gboolean                           is_smooth,
								    NautilusSmoothBackgroundMode       background_mode,
								    guint32                            solid_background_color,
								    const GdkPixbuf                   *tile_pixbuf,
								    const ArtIRect                    *tile_bounds,
								    int                                tile_opacity,
								    NautilusSmoothTileMode             tile_mode_vertical,
								    NautilusSmoothTileMode             tile_mode_horizontal,
								    const ArtIRect                    *content_bounds,
								    int                                content_opacity,
								    const ArtIRect                    *dirty_area,
								    NautilusSmoothPaintOpaqueCallback  paint_callback,
								    NautilusSmoothCompositeCallback    composite_callback,
								    gpointer                           callback_data);
ArtIRect           nautilus_smooth_widget_get_tile_bounds          (const GtkWidget                   *widget,
								    const GdkPixbuf                   *tile_pixbuf,
								    int                                tile_width,
								    int                                tile_height);
NautilusDimensions nautilus_smooth_widget_get_preferred_dimensions (const GtkWidget                   *widget,
								    const NautilusDimensions          *content_dimensions,
								    const NautilusDimensions          *tile_dimensions,
								    int                                tile_width,
								    int                                tile_height);
void               nautilus_smooth_widget_register_type            (GtkType                            type);

void               nautilus_smooth_widget_global_set_is_smooth     (gboolean                           is_smooth);

END_GNOME_DECLS

#endif /* NAUTILUS_SMOOTH_WIDGET_H */