Details
enum BonoboUIToolbarIconDrawMode
typedef enum {
/* update struct when adding enum values */
BONOBO_UI_TOOLBAR_ICON_SIMPLE, /* No alpha blending */
BONOBO_UI_TOOLBAR_ICON_COLOR /* */
} BonoboUIToolbarIconDrawMode; |
BonoboUIToolbarIcon
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; |
BonoboUIToolbarIconClass
typedef struct {
GtkMiscClass parent_class;
} BonoboUIToolbarIconClass; |
bonobo_ui_toolbar_icon_new ()
GtkWidget* bonobo_ui_toolbar_icon_new (void); |
Creates a new empty BonoboUIToolbarIcon.
bonobo_ui_toolbar_icon_new_from_file ()
GtkWidget* bonobo_ui_toolbar_icon_new_from_file
(const gchar *filename); |
Note that the new_from_file functions give you no way to detect errors;
if the file isn't found/loaded, you get an empty widget.
to detect errors just do:
<programlisting>
gdk_pixbuf_new_from_file (filename);
if (pixbuf != NULL) {
gpixmap = bonobo_ui_toolbar_icon_new_from_pixbuf (pixbuf);
} else {
// handle your error...
}
</programlisting>
bonobo_ui_toolbar_icon_new_from_file_at_size ()
GtkWidget* bonobo_ui_toolbar_icon_new_from_file_at_size
(const gchar *filename,
gint width,
gint height); |
Loads a new BonoboUIToolbarIcon from the pixbuf, and scales it (if necessary) to
the size indicated by height and width. If either are set to -1, then the
"natural" dimension of the image is used in place.
bonobo_ui_toolbar_icon_new_from_xpm_d ()
GtkWidget* bonobo_ui_toolbar_icon_new_from_xpm_d
(const gchar **xpm_data); |
bonobo_ui_toolbar_icon_new_from_xpm_d_at_size ()
GtkWidget* bonobo_ui_toolbar_icon_new_from_xpm_d_at_size
(const gchar **xpm_data,
gint width,
gint height); |
bonobo_ui_toolbar_icon_new_from_pixbuf ()
GtkWidget* bonobo_ui_toolbar_icon_new_from_pixbuf
(GdkPixbuf *pixbuf); |
bonobo_ui_toolbar_icon_new_from_pixbuf_at_size ()
GtkWidget* bonobo_ui_toolbar_icon_new_from_pixbuf_at_size
(GdkPixbuf *pixbuf,
gint width,
gint height); |
bonobo_ui_toolbar_icon_set_pixbuf_size ()
void bonobo_ui_toolbar_icon_set_pixbuf_size
(BonoboUIToolbarIcon *gpixmap,
gint width,
gint height); |
Sets the current size of the image displayed. If there were custom "state"
pixbufs set, as a side effect, they are discarded and must be re set at the
new size.
bonobo_ui_toolbar_icon_get_pixbuf_size ()
void bonobo_ui_toolbar_icon_get_pixbuf_size
(BonoboUIToolbarIcon *gpixmap,
gint *width,
gint *height); |
Sets width and height to be the widgets current dimensions. They will
return the width or height of the image, or -1, -1 if the image's "natural"
dimensions are used. Either or both dimension arguments may be NULL, as
necessary.
bonobo_ui_toolbar_icon_set_pixbuf ()
Sets the image shown to be that of the pixbuf. If there is a current image
used by the gpixmap, it is discarded along with any pixmaps at a particular
state. However, the gpixmap will keep the same geometry as the old image,
or if the width or height are set to -1, it will inherit the new image's
geometry.
bonobo_ui_toolbar_icon_get_pixbuf ()
Gets the current image used by gpixmap, if you have set the
pixbuf. If you've only set the value for particular states,
then this won't return anything.
bonobo_ui_toolbar_icon_set_pixbuf_at_state ()
void bonobo_ui_toolbar_icon_set_pixbuf_at_state
(BonoboUIToolbarIcon *gpixmap,
GtkStateType state,
GdkPixbuf *pixbuf,
GdkBitmap *mask); |
Sets a custom image for the image at state. For example, you can set the
prelighted appearance to a different image from the normal one. If
necessary, the image will be scaled to the appropriate size. The mask can
also be optionally NULL. The image set will be modified by the draw vals as
normal.
bonobo_ui_toolbar_icon_set_state_pixbufs ()
void bonobo_ui_toolbar_icon_set_state_pixbufs
(BonoboUIToolbarIcon *gpixmap,
GdkPixbuf *pixbufs[5],
GdkBitmap *masks[5]); |
Sets a custom image for all the possible states of the image. Both pixbufs
and masks are indexed by a GtkStateType. Any or all of the images can be
NULL, as necessary. The image set will be modified by the draw vals as
normal.
bonobo_ui_toolbar_icon_set_draw_vals ()
void bonobo_ui_toolbar_icon_set_draw_vals
(BonoboUIToolbarIcon *gpixmap,
GtkStateType state,
gfloat saturation,
gboolean pixelate); |
Sets the modification parameters for a particular state. The saturation
level determines the amount of color in the image. The default level of 1.0
leaves the color unchanged while a level of 0.0 means the image is fully
saturated, and has no color. saturation can be set to values greater then 1.0,
or less then 0.0, but this produces less meaningful results. If pixelate is
set to TRUE, then in adition to any saturation, a light stipple is overlayed
over the image.
bonobo_ui_toolbar_icon_get_draw_vals ()
void bonobo_ui_toolbar_icon_get_draw_vals
(BonoboUIToolbarIcon *gpixmap,
GtkStateType state,
gfloat *saturation,
gboolean *pixelate); |
Retrieve the values set by bonobo_ui_toolbar_icon_set_draw_vals(). Either
return location can be NULL if you don't care about it.
bonobo_ui_toolbar_icon_set_draw_mode ()
This sets the drawing mode of the image to be mode. The image
must have an alpha channel if BONOBO_UI_TOOLBAR_ICON_COLOR is to be used.
bonobo_ui_toolbar_icon_get_draw_mode ()
Gets the current draw mode.
bonobo_ui_toolbar_icon_clear ()
Removes any images from gpixmap. If still visible, the image will appear empty.
bonobo_ui_toolbar_icon_set_alpha_threshold ()
void bonobo_ui_toolbar_icon_set_alpha_threshold
(BonoboUIToolbarIcon *gpixmap,
gint alpha_threshold); |
Sets the alpha threshold for gpixmap. It is used to determine which pixels
are shown when the image has an alpha channel, and is only used if no mask is
set.
bonobo_ui_toolbar_icon_get_alpha_threshold ()
Gets the current alpha threshold.