File: bonobo-ui-toolbar-icon.h

package info (click to toggle)
bonobo 1.0.22-2.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,412 kB
  • ctags: 5,445
  • sloc: ansic: 51,714; sh: 7,733; makefile: 1,425; yacc: 318; xml: 266; sed: 16
file content (128 lines) | stat: -rw-r--r-- 6,267 bytes parent folder | download | duplicates (2)
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
122
123
124
125
126
127
128
/*  -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*-

   Copyright (C) 1999, 2000 Red Hat, Inc.
    
   Authors: Havoc Pennington, Jonathan Blandford
*/

#ifndef BONOBO_UI_TOOLBAR_ICON_H
#define BONOBO_UI_TOOLBAR_ICON_H

#include <gtk/gtkmisc.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

#include "libgnome/gnome-defs.h"

BEGIN_GNOME_DECLS

typedef enum {
        /* update struct when adding enum values */
	BONOBO_UI_TOOLBAR_ICON_SIMPLE, /* No alpha blending */
	BONOBO_UI_TOOLBAR_ICON_COLOR   /* */
} BonoboUIToolbarIconDrawMode;

#define BONOBO_TYPE_UI_TOOLBAR_ICON            (bonobo_ui_toolbar_icon_get_type ())
#define BONOBO_UI_TOOLBAR_ICON(obj)            (GTK_CHECK_CAST ((obj), BONOBO_TYPE_UI_TOOLBAR_ICON, BonoboUIToolbarIcon))
#define BONOBO_UI_TOOLBAR_ICON_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_UI_TOOLBAR_ICON, BonoboUIToolbarIconClass))
#define BONOBO_IS_UI_TOOLBAR_ICON(obj)         (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_UI_TOOLBAR_ICON))
#define BONOBO_IS_UI_TOOLBAR_ICON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_UI_TOOLBAR_ICON))
#define BONOBO_UI_TOOLBAR_ICON_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), BONOBO_TYPE_UI_TOOLBAR_ICON, BonoboUIToolbarIconClass))


typedef struct {
	GtkMisc misc;

        /* NOTE. In the old BonoboUIToolbarIcon, _lots_ of people were using BonoboUIToolbarIcon to
	 * load images, sucking out the pixmap field, and then not using the
	 * BonoboUIToolbarIcon as a widget at all. IF YOU DO THIS I WILL PERSONALLY
	 * KICK YOUR ASS. Use gdk_pixbuf_new_from_file(). Thank you.
	 * These are PRIVATE FIELDS which I will gratuitously change just to
	 * break your broken code.
	 *                          -  hp + jrb + quartic + Jesse Ventura + GW Bush 
	 */

	GdkPixbuf *provided_image;

        struct {
                GdkPixbuf *pixbuf;
                GdkBitmap *mask;
		gfloat saturation;
		gboolean pixelate;
        } provided[5]; /* the five states */

	GdkPixbuf *generated_scaled_image;
	GdkBitmap *generated_scaled_mask;
        
        struct {
                GdkPixbuf *pixbuf;
                GdkBitmap *mask;
        } generated[5]; /* the five states */
        
	gint width, height;
	gint alpha_threshold;

	BonoboUIToolbarIconDrawMode mode : 2;
} BonoboUIToolbarIcon;


typedef struct {
	GtkMiscClass parent_class;
} BonoboUIToolbarIconClass;

guint  bonobo_ui_toolbar_icon_get_type  (void) G_GNUC_CONST;

GtkWidget *bonobo_ui_toolbar_icon_new                      (void);
GtkWidget *bonobo_ui_toolbar_icon_new_from_file            (const gchar  *filename);
GtkWidget *bonobo_ui_toolbar_icon_new_from_file_at_size    (const gchar  *filename,
                                                            gint          width,
                                                            gint          height);
GtkWidget *bonobo_ui_toolbar_icon_new_from_xpm_d           (const gchar **xpm_data);
GtkWidget *bonobo_ui_toolbar_icon_new_from_xpm_d_at_size   (const gchar **xpm_data,
                                                            gint          width,
                                                            gint          height);
GtkWidget *bonobo_ui_toolbar_icon_new_from_pixbuf          (GdkPixbuf    *pixbuf);
GtkWidget *bonobo_ui_toolbar_icon_new_from_pixbuf_at_size  (GdkPixbuf    *pixbuf,
                                                            gint          width,
                                                            gint          height);

void       bonobo_ui_toolbar_icon_set_pixbuf_size  (BonoboUIToolbarIcon *gpixmap,
                                                    gint                 width,
                                                    gint                 height);
void       bonobo_ui_toolbar_icon_get_pixbuf_size  (BonoboUIToolbarIcon *gpixmap,
                                                    gint                *width,
                                                    gint                *height);

void       bonobo_ui_toolbar_icon_set_pixbuf       (BonoboUIToolbarIcon *gpixmap,
                                                    GdkPixbuf           *pixbuf);
GdkPixbuf *bonobo_ui_toolbar_icon_get_pixbuf       (BonoboUIToolbarIcon *gpixmap);
   
/* Sets the individual states, instead of generating them. */
void  bonobo_ui_toolbar_icon_set_pixbuf_at_state  (BonoboUIToolbarIcon *gpixmap,
                                                   GtkStateType         state,
                                                   GdkPixbuf           *pixbuf,
                                                   GdkBitmap           *mask);
void  bonobo_ui_toolbar_icon_set_state_pixbufs    (BonoboUIToolbarIcon *gpixmap,
                                                   GdkPixbuf           *pixbufs[5],
                                                   GdkBitmap           *masks[5]);
void  bonobo_ui_toolbar_icon_set_draw_vals        (BonoboUIToolbarIcon *gpixmap,
                                                   GtkStateType         state,
                                                   gfloat               saturation,
                                                   gboolean             pixelate);
void  bonobo_ui_toolbar_icon_get_draw_vals        (BonoboUIToolbarIcon *gpixmap,
                                                   GtkStateType         state,
                                                   gfloat              *saturation,
                                                   gboolean            *pixelate);

void                         bonobo_ui_toolbar_icon_set_draw_mode            (BonoboUIToolbarIcon          *gpixmap,
                                                                              BonoboUIToolbarIconDrawMode   mode);
BonoboUIToolbarIconDrawMode  bonobo_ui_toolbar_icon_get_draw_mode            (BonoboUIToolbarIcon          *gpixmap);

void  bonobo_ui_toolbar_icon_clear                (BonoboUIToolbarIcon *gpixmap);
void  bonobo_ui_toolbar_icon_set_alpha_threshold  (BonoboUIToolbarIcon *gpixmap,
                                                   gint                 alpha_threshold);
gint  bonobo_ui_toolbar_icon_get_alpha_threshold  (BonoboUIToolbarIcon *gpixmap);


END_GNOME_DECLS

#endif /* __BONOBO_UI_TOOLBAR_ICON_H__ */