From: Jim Evins Date: Fri, 11 Sep 2009 02:14:58 +0000 (+0000) Subject: 2009-09-10 Jim Evins X-Git-Tag: glabels-2_3_0~195 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=96a9288a2f2f9b72daf98f7a768d0e37345dcc9e;p=glabels 2009-09-10 Jim Evins * src/Makefile.am: * src/mini-label-preview.c: * src/mini-label-preview.h: Created new glMiniLabelPreview widget to support glRotateLabelButton. * src/rotate-label-button.c: * src/rotate-label-button.h: Renamed glWdgtRotateLabel to glRotateLabelButton. * src/new-label-dialog.c: (gl_new_label_dialog_construct), (template_changed_cb), (gl_new_label_dialog_get_rotate_state), (gl_new_label_dialog_set_rotate_state): Propogated above renaming. * src/mini-preview.c: (gl_mini_preview_set_template), (draw), (draw_shadow), (draw_paper), (draw_labels): Use GtkStyle for colors instead of hardcoded ones. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@882 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index e96980df..c28d00e2 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,20 @@ +2009-09-10 Jim Evins + + * src/Makefile.am: + * src/mini-label-preview.c: + * src/mini-label-preview.h: + Created new glMiniLabelPreview widget to support glRotateLabelButton. + * src/rotate-label-button.c: + * src/rotate-label-button.h: + Renamed glWdgtRotateLabel to glRotateLabelButton. + * src/new-label-dialog.c: (gl_new_label_dialog_construct), + (template_changed_cb), (gl_new_label_dialog_get_rotate_state), + (gl_new_label_dialog_set_rotate_state): + Propogated above renaming. + * src/mini-preview.c: (gl_mini_preview_set_template), (draw), + (draw_shadow), (draw_paper), (draw_labels): + Use GtkStyle for colors instead of hardcoded ones. + 2009-09-09 Jim Evins * configure.in: diff --git a/glabels2/src/Makefile.am b/glabels2/src/Makefile.am index 4a78708a..7baaf2a1 100644 --- a/glabels2/src/Makefile.am +++ b/glabels2/src/Makefile.am @@ -173,8 +173,10 @@ glabels_SOURCES = \ wdgt-media-select.h \ mini-preview.c \ mini-preview.h \ - wdgt-rotate-label.c \ - wdgt-rotate-label.h \ + mini-label-preview.c \ + mini-label-preview.h \ + rotate-label-button.c \ + rotate-label-button.h \ wdgt-chain-button.c \ wdgt-chain-button.h \ wdgt-merge-menu.c \ diff --git a/glabels2/src/mini-label-preview.c b/glabels2/src/mini-label-preview.c new file mode 100644 index 00000000..a6ff906f --- /dev/null +++ b/glabels2/src/mini-label-preview.c @@ -0,0 +1,315 @@ +/* + * mini-label-preview.c + * Copyright (C) 2009 Jim Evins . + * + * This file is part of gLabels. + * + * gLabels is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gLabels 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gLabels. If not, see . + */ + +#include + +#include "mini-label-preview.h" + +#include +#include "marshal.h" +#include "cairo-label-path.h" +#include "color.h" + + +/*===========================================*/ +/* Private macros and constants. */ +/*===========================================*/ + +#define MARGIN 2 +#define SHADOW_OFFSET 3 + + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +struct _glMiniLabelPreviewPrivate { + + lglTemplate *template; + gboolean rotate_flag; +}; + + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_mini_label_preview_finalize (GObject *object); + +static void style_set_cb (GtkWidget *widget, + GtkStyle *previous_style); + +static void redraw (glMiniLabelPreview *this); + +static gboolean expose_event_cb (GtkWidget *widget, + GdkEventExpose *event); + +static void draw_preview (glMiniLabelPreview *this, + cairo_t *cr); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +G_DEFINE_TYPE (glMiniLabelPreview, gl_mini_label_preview, GTK_TYPE_DRAWING_AREA); + + +/*****************************************************************************/ +/* Class Init Function. */ +/*****************************************************************************/ +static void +gl_mini_label_preview_class_init (glMiniLabelPreviewClass *class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (class); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); + + gl_mini_label_preview_parent_class = g_type_class_peek_parent (class); + + gobject_class->finalize = gl_mini_label_preview_finalize; + + widget_class->expose_event = expose_event_cb; + widget_class->style_set = style_set_cb; +} + + +/*****************************************************************************/ +/* Object Instance Init Function. */ +/*****************************************************************************/ +static void +gl_mini_label_preview_init (glMiniLabelPreview *this) +{ + GTK_WIDGET_SET_FLAGS (GTK_WIDGET (this), GTK_NO_WINDOW); + + this->priv = g_new0 (glMiniLabelPreviewPrivate, 1); +} + + +/*****************************************************************************/ +/* Finalize Method. */ +/*****************************************************************************/ +static void +gl_mini_label_preview_finalize (GObject *object) +{ + glMiniLabelPreview *this = GL_MINI_LABEL_PREVIEW (object); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MINI_LABEL_PREVIEW (object)); + + lgl_template_free (this->priv->template); + g_free (this->priv); + + G_OBJECT_CLASS (gl_mini_label_preview_parent_class)->finalize (object); +} + + +/*****************************************************************************/ +/** New Object Generator. */ +/*****************************************************************************/ +GtkWidget * +gl_mini_label_preview_new (gint w, + gint h) +{ + glMiniLabelPreview *this; + + this = g_object_new (GL_TYPE_MINI_LABEL_PREVIEW, NULL); + + gtk_widget_set_size_request (GTK_WIDGET (this), w, h); + + return GTK_WIDGET (this); +} + + +/*****************************************************************************/ +/* Set label by name. */ +/*****************************************************************************/ +void +gl_mini_label_preview_set_by_name (glMiniLabelPreview *this, + gchar *name, + gboolean rotate_flag) +{ + if (!name) + { + lgl_template_free (this->priv->template); + this->priv->template = NULL; + } + else + { + this->priv->template = lgl_db_lookup_template_from_name (name); + this->priv->rotate_flag = rotate_flag; + } + + redraw (this); +} + + +/*--------------------------------------------------------------------------*/ +/* Style set handler (updates colors when style/theme changes). */ +/*--------------------------------------------------------------------------*/ +static void +style_set_cb (GtkWidget *widget, + GtkStyle *previous_style) +{ + redraw (GL_MINI_LABEL_PREVIEW (widget)); +} + + +/*****************************************************************************/ +/* Request redraw. */ +/*****************************************************************************/ +static void +redraw (glMiniLabelPreview *this) +{ + GdkRegion *region; + + if (GTK_WIDGET_REALIZED (GTK_WIDGET (this))) + { + /* redraw the cairo canvas forcing an expose event */ + region = gdk_drawable_get_clip_region (GTK_WIDGET (this)->window); + gdk_window_invalidate_region (GTK_WIDGET (this)->window, region, TRUE); + gdk_region_destroy (region); + } +} + + +/*****************************************************************************/ +/* "Expose event" callback. */ +/*****************************************************************************/ +static gboolean +expose_event_cb (GtkWidget *widget, + GdkEventExpose *event) +{ + cairo_t *cr; + + cr = gdk_cairo_create (widget->window); + + cairo_rectangle (cr, + event->area.x, event->area.y, + event->area.width, event->area.height); + cairo_clip (cr); + + cairo_translate (cr, widget->allocation.x, widget->allocation.y); + + draw_preview (GL_MINI_LABEL_PREVIEW (widget), cr); + + cairo_destroy (cr); + + return FALSE; +} + + +/*****************************************************************************/ +/* Draw sample. */ +/*****************************************************************************/ +static void +draw_preview (glMiniLabelPreview *this, + cairo_t *cr) +{ + GtkStyle *style; + gdouble w, h; + guint fill_color, line_color, shadow_color; + const lglTemplateFrame *frame; + gdouble w_label, h_label; + gdouble scale; + + + w = GTK_WIDGET (this)->allocation.width; + h = GTK_WIDGET (this)->allocation.height; + + + style = gtk_widget_get_style (GTK_WIDGET (this)); + if ( GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (this)) ) + { + fill_color = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]); + line_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]); + shadow_color = gl_color_from_gdk_color (&style->dark[GTK_STATE_NORMAL]); + } + else + { + fill_color = GL_COLOR_NONE; + line_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_INSENSITIVE]); + shadow_color = GL_COLOR_NONE; + } + + + if (this->priv->template == NULL) + { + return; + } + + frame = (lglTemplateFrame *)this->priv->template->frames->data; + + if (this->priv->rotate_flag) + { + lgl_template_frame_get_size (frame, &h_label, &w_label); + } + else + { + lgl_template_frame_get_size (frame, &w_label, &h_label); + } + + scale = MIN( (w - 2*MARGIN - 2*SHADOW_OFFSET)/w_label, + (h - 2*MARGIN - 2*SHADOW_OFFSET)/h_label ); + + + cairo_translate (cr, w/2.0, h/2.0); + cairo_scale (cr, scale, scale); + cairo_translate (cr, -w_label/2.0, -h_label/2.0); + + + /* + * Shadow + */ + cairo_save (cr); + cairo_translate (cr, SHADOW_OFFSET/scale, SHADOW_OFFSET/scale); + gl_cairo_label_path (cr, this->priv->template, this->priv->rotate_flag, FALSE); + + cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (shadow_color)); + cairo_fill (cr); + cairo_restore (cr); + + /* + * Label + outline + */ + gl_cairo_label_path (cr, this->priv->template, this->priv->rotate_flag, FALSE); + + cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (fill_color)); + cairo_fill_preserve (cr); + + cairo_set_line_width (cr, 1.0/scale); + cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (line_color)); + cairo_stroke (cr); + +} + + + +/* + * Local Variables: -- emacs + * mode: C -- emacs + * c-basic-offset: 8 -- emacs + * tab-width: 8 -- emacs + * indent-tabs-mode: nil -- emacs + * End: -- emacs + */ diff --git a/glabels2/src/mini-label-preview.h b/glabels2/src/mini-label-preview.h new file mode 100644 index 00000000..a107edd4 --- /dev/null +++ b/glabels2/src/mini-label-preview.h @@ -0,0 +1,79 @@ +/* + * mini-label-preview.h + * Copyright (C) 2009 Jim Evins . + * + * This file is part of gLabels. + * + * gLabels is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gLabels 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gLabels. If not, see . + */ + +#ifndef __MINI_LABEL_PREVIEW_H__ +#define __MINI_LABEL_PREVIEW_H__ + + +#include + + +G_BEGIN_DECLS + +#define GL_TYPE_MINI_LABEL_PREVIEW (gl_mini_label_preview_get_type ()) +#define GL_MINI_LABEL_PREVIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_MINI_LABEL_PREVIEW, glMiniLabelPreview )) +#define GL_MINI_LABEL_PREVIEW_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MINI_LABEL_PREVIEW, glMiniLabelPreviewClass)) +#define GL_IS_MINI_LABEL_PREVIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MINI_LABEL_PREVIEW)) +#define GL_IS_MINI_LABEL_PREVIEW_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MINI_LABEL_PREVIEW)) + +typedef struct _glMiniLabelPreview glMiniLabelPreview; +typedef struct _glMiniLabelPreviewPrivate glMiniLabelPreviewPrivate; +typedef struct _glMiniLabelPreviewClass glMiniLabelPreviewClass; + +struct _glMiniLabelPreview { + GtkDrawingArea parent_widget; + + glMiniLabelPreviewPrivate *priv; +}; + +struct _glMiniLabelPreviewClass { + GtkDrawingAreaClass parent_class; +}; + + +GType gl_mini_label_preview_get_type (void) G_GNUC_CONST; + +GtkWidget *gl_mini_label_preview_new (gint w, + gint h); + +void gl_mini_label_preview_set_by_name (glMiniLabelPreview *this, + gchar *name, + gboolean rotate_flag); + + + +G_END_DECLS + +#endif /* __MINI_LABEL_PREVIEW_H__ */ + + + +/* + * Local Variables: -- emacs + * mode: C -- emacs + * c-basic-offset: 8 -- emacs + * tab-width: 8 -- emacs + * indent-tabs-mode: nil -- emacs + * End: -- emacs + */ diff --git a/glabels2/src/mini-preview.c b/glabels2/src/mini-preview.c index 26ff50c0..5af8b9fa 100644 --- a/glabels2/src/mini-preview.c +++ b/glabels2/src/mini-preview.c @@ -36,12 +36,8 @@ /* Private macros and constants. */ /*===========================================*/ -#define PAPER_RGB_ARGS 1.0, 1.0, 1.0 -#define PAPER_OUTLINE_RGB_ARGS 0.0, 0.0, 0.0 -#define LABEL_OUTLINE_RGB_ARGS 0.5, 0.5, 0.5 - -#define SHADOW_X_OFFSET 5 -#define SHADOW_Y_OFFSET 5 +#define MARGIN +#define SHADOW_OFFSET 3 /*===========================================*/ @@ -326,8 +322,8 @@ gl_mini_preview_set_template (glMiniPreview *this, /* * Set scale and offsets */ - w = this->priv->width - 4 - 2*SHADOW_X_OFFSET; - h = this->priv->height - 4 - 2*SHADOW_Y_OFFSET; + w = this->priv->width - 2*MARGIN - 2*SHADOW_OFFSET; + h = this->priv->height - 2*MARGIN - 2*SHADOW_OFFSET; if ( (w/template->page_width) > (h/template->page_height) ) { this->priv->scale = h / template->page_height; } else { @@ -627,8 +623,8 @@ draw (glMiniPreview *this, /* update shadow */ - shadow_x = SHADOW_X_OFFSET/this->priv->scale; - shadow_y = SHADOW_Y_OFFSET/this->priv->scale; + shadow_x = SHADOW_OFFSET/this->priv->scale; + shadow_y = SHADOW_OFFSET/this->priv->scale; draw_shadow (this, cr, shadow_x, shadow_y, @@ -668,7 +664,7 @@ draw_shadow (glMiniPreview *this, cairo_rectangle (cr, x, y, width, height); style = gtk_widget_get_style (GTK_WIDGET(this)); - shadow_color = gl_color_from_gdk_color (&style->bg[GTK_STATE_ACTIVE]); + shadow_color = gl_color_from_gdk_color (&style->dark[GTK_STATE_NORMAL]); cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (shadow_color)); cairo_fill (cr); @@ -689,16 +685,23 @@ draw_paper (glMiniPreview *this, gdouble height, gdouble line_width) { - cairo_save (cr); + GtkStyle *style; + guint paper_color, outline_color; gl_debug (DEBUG_MINI_PREVIEW, "START"); + cairo_save (cr); + + style = gtk_widget_get_style (GTK_WIDGET(this)); + paper_color = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]); + outline_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]); + cairo_rectangle (cr, 0.0, 0.0, width, height); - cairo_set_source_rgb (cr, PAPER_RGB_ARGS); + cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (paper_color)); cairo_fill_preserve (cr); - cairo_set_source_rgb (cr, PAPER_OUTLINE_RGB_ARGS); + cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (outline_color)); cairo_set_line_width (cr, line_width); cairo_stroke (cr); @@ -721,7 +724,7 @@ draw_labels (glMiniPreview *this, gint i, n_labels; lglTemplateOrigin *origins; GtkStyle *style; - guint highlight_color; + guint highlight_color, paper_color, outline_color; gl_debug (DEBUG_MINI_PREVIEW, "START"); @@ -732,6 +735,8 @@ draw_labels (glMiniPreview *this, style = gtk_widget_get_style (GTK_WIDGET(this)); highlight_color = gl_color_from_gdk_color (&style->base[GTK_STATE_SELECTED]); + paper_color = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]); + outline_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]); for ( i=0; i < n_labels; i++ ) { @@ -747,13 +752,13 @@ draw_labels (glMiniPreview *this, } else { - cairo_set_source_rgb (cr, PAPER_RGB_ARGS); + cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (paper_color)); } cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); cairo_fill_preserve (cr); cairo_set_line_width (cr, line_width); - cairo_set_source_rgb (cr, LABEL_OUTLINE_RGB_ARGS); + cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (outline_color)); cairo_stroke (cr); cairo_restore (cr); diff --git a/glabels2/src/new-label-dialog.c b/glabels2/src/new-label-dialog.c index 8734e198..f892d04b 100644 --- a/glabels2/src/new-label-dialog.c +++ b/glabels2/src/new-label-dialog.c @@ -29,7 +29,7 @@ #include "hig.h" #include "wdgt-media-select.h" -#include "wdgt-rotate-label.h" +#include "rotate-label-button.h" #include "util.h" #include "debug.h" @@ -192,14 +192,14 @@ gl_new_label_dialog_construct (glNewLabelDialog *dialog, gtk_box_pack_start (GTK_BOX (media_select_vbox), dialog->priv->media_select, FALSE, FALSE, 0); - dialog->priv->rotate_label = gl_wdgt_rotate_label_new (); + dialog->priv->rotate_label = gl_rotate_label_button_new (); gtk_box_pack_start (GTK_BOX (rotate_label_vbox), dialog->priv->rotate_label, FALSE, FALSE, 0); /* Sync template name from media select with rotate widget. */ name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select)); - gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label), - name); + gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label), + name); g_signal_connect (G_OBJECT (dialog->priv->media_select), "changed", G_CALLBACK (template_changed_cb), dialog); @@ -222,8 +222,8 @@ template_changed_cb (glWdgtMediaSelect *select, name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select)); - gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label), - name); + gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label), + name); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, @@ -294,8 +294,8 @@ gl_new_label_dialog_set_filter_parameters (glNewLabelDialog *dialog, gboolean gl_new_label_dialog_get_rotate_state (glNewLabelDialog *dialog) { - return gl_wdgt_rotate_label_get_state ( - GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label)); + return gl_rotate_label_button_get_state ( + GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label)); } @@ -306,8 +306,8 @@ void gl_new_label_dialog_set_rotate_state (glNewLabelDialog *dialog, gboolean state) { - gl_wdgt_rotate_label_set_state ( - GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label), state); + gl_rotate_label_button_set_state ( + GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label), state); } diff --git a/glabels2/src/rotate-label-button.c b/glabels2/src/rotate-label-button.c new file mode 100644 index 00000000..29955c55 --- /dev/null +++ b/glabels2/src/rotate-label-button.c @@ -0,0 +1,266 @@ +/* + * rotate-label-button.c + * Copyright (C) 2001-2009 Jim Evins . + * + * This file is part of gLabels. + * + * gLabels is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gLabels 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gLabels. If not, see . + */ + +#include + +#include "rotate-label-button.h" + +#include +#include +#include +#include +#include +#include "mini-label-preview.h" +#include +#include "hig.h" +#include "marshal.h" + +#include "debug.h" + + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define SIZE 48 + + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +struct _glRotateLabelButtonPrivate { + + GtkWidget *no_rotate_radio; + GtkWidget *rotate_radio; + GtkWidget *no_rotate_preview; + GtkWidget *rotate_preview; +}; + +enum { + CHANGED, + LAST_SIGNAL +}; + + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static gint rotate_label_button_signals[LAST_SIGNAL] = { 0 }; + + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_rotate_label_button_finalize (GObject *object); + +static void toggled_cb (GtkToggleButton *toggle, + gpointer user_data); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +G_DEFINE_TYPE (glRotateLabelButton, gl_rotate_label_button, GTK_TYPE_HBOX); + + +static void +gl_rotate_label_button_class_init (glRotateLabelButtonClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + gl_rotate_label_button_parent_class = g_type_class_peek_parent (class); + + object_class->finalize = gl_rotate_label_button_finalize; + + rotate_label_button_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glRotateLabelButtonClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + + +static void +gl_rotate_label_button_init (glRotateLabelButton *this) +{ + GtkWidget *vbox; + GtkWidget *label; + + this->priv = g_new0 (glRotateLabelButtonPrivate, 1); + + gtk_container_set_border_width (GTK_CONTAINER (this), GL_HIG_PAD2); + + this->priv->no_rotate_radio = gtk_radio_button_new (NULL); + gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (this->priv->no_rotate_radio), + FALSE); + vbox = gtk_vbox_new (FALSE, 1); + this->priv->no_rotate_preview = gl_mini_label_preview_new (SIZE, SIZE); + gtk_box_pack_start (GTK_BOX (vbox), this->priv->no_rotate_preview, FALSE, FALSE, 0); + label = gtk_label_new (_("Normal")); + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (this->priv->no_rotate_radio), vbox); + + + this->priv->rotate_radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (this->priv->no_rotate_radio)); + gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (this->priv->rotate_radio), + FALSE); + vbox = gtk_vbox_new (FALSE, 1); + this->priv->rotate_preview = gl_mini_label_preview_new (SIZE, SIZE); + gtk_box_pack_start (GTK_BOX (vbox), this->priv->rotate_preview, FALSE, FALSE, 0); + label = gtk_label_new (_("Rotated")); + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (this->priv->rotate_radio), vbox); + + gtk_box_pack_start (GTK_BOX (this), + this->priv->no_rotate_radio, + FALSE, FALSE, GL_HIG_PAD1); + gtk_box_pack_start (GTK_BOX (this), + this->priv->rotate_radio, + FALSE, FALSE, GL_HIG_PAD1); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (this->priv->no_rotate_radio), + "toggled", + G_CALLBACK (toggled_cb), this); + g_signal_connect (G_OBJECT (this->priv->rotate_radio), + "toggled", + G_CALLBACK (toggled_cb), this); +} + + +static void +gl_rotate_label_button_finalize (GObject *object) +{ + glRotateLabelButton *this = GL_ROTATE_LABEL_BUTTON (object); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_ROTATE_LABEL_BUTTON (object)); + + g_free (this->priv); + + G_OBJECT_CLASS (gl_rotate_label_button_parent_class)->finalize (object); +} + + +GtkWidget * +gl_rotate_label_button_new (void) +{ + glRotateLabelButton *this; + + this = g_object_new (gl_rotate_label_button_get_type (), NULL); + + return GTK_WIDGET (this); +} + + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of check button */ +/*--------------------------------------------------------------------------*/ +static void +toggled_cb (GtkToggleButton *toggle, + gpointer user_data) +{ + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (user_data), + rotate_label_button_signals[CHANGED], 0); + +} + + +/****************************************************************************/ +/* query state of widget. */ +/****************************************************************************/ +gboolean +gl_rotate_label_button_get_state (glRotateLabelButton *this) +{ + return + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (this->priv->rotate_radio)); +} + +/****************************************************************************/ +/* set state of widget. */ +/****************************************************************************/ +void +gl_rotate_label_button_set_state (glRotateLabelButton *this, + gboolean state) +{ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (this->priv->rotate_radio), state); +} + +/****************************************************************************/ +/* set template for widget. */ +/****************************************************************************/ +void +gl_rotate_label_button_set_template_name (glRotateLabelButton *this, + gchar *name) +{ + lglTemplate *template; + const lglTemplateFrame *frame; + gdouble raw_w, raw_h; + + if (name == NULL) + { + gtk_widget_set_sensitive (this->priv->no_rotate_radio, FALSE); + gtk_widget_set_sensitive (this->priv->rotate_radio, FALSE); + } + else + { + template = lgl_db_lookup_template_from_name (name); + frame = (lglTemplateFrame *)template->frames->data; + + gl_mini_label_preview_set_by_name (GL_MINI_LABEL_PREVIEW (this->priv->no_rotate_preview), + name, FALSE); + gl_mini_label_preview_set_by_name (GL_MINI_LABEL_PREVIEW (this->priv->rotate_preview), + name, TRUE); + + lgl_template_frame_get_size (frame, &raw_w, &raw_h); + gtk_widget_set_sensitive (this->priv->no_rotate_radio, + (raw_w != raw_h)); + gtk_widget_set_sensitive (this->priv->rotate_radio, + (raw_w != raw_h)); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (this->priv->no_rotate_radio), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (this->priv->rotate_radio), FALSE); + } + +} + + + +/* + * Local Variables: -- emacs + * mode: C -- emacs + * c-basic-offset: 8 -- emacs + * tab-width: 8 -- emacs + * indent-tabs-mode: nil -- emacs + * End: -- emacs + */ diff --git a/glabels2/src/rotate-label-button.h b/glabels2/src/rotate-label-button.h new file mode 100644 index 00000000..0dda489e --- /dev/null +++ b/glabels2/src/rotate-label-button.h @@ -0,0 +1,83 @@ +/* + * rotate-label-button.h + * Copyright (C) 2001-2009 Jim Evins . + * + * This file is part of gLabels. + * + * gLabels is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gLabels 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gLabels. If not, see . + */ + +#ifndef __ROTATE_LABEL_BUTTON_H__ +#define __ROTATE_LABEL_BUTTON_H__ + +#include + +G_BEGIN_DECLS + +#define GL_TYPE_ROTATE_LABEL_BUTTON (gl_rotate_label_button_get_type ()) +#define GL_ROTATE_LABEL_BUTTON(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_ROTATE_LABEL_BUTTON, glRotateLabelButton )) +#define GL_ROTATE_LABEL_BUTTON_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_ROTATE_LABEL_BUTTON, glRotateLabelButtonClass)) +#define GL_IS_ROTATE_LABEL_BUTTON(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_ROTATE_LABEL_BUTTON)) +#define GL_IS_ROTATE_LABEL_BUTTON_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_ROTATE_LABEL_BUTTON)) + + +typedef struct _glRotateLabelButton glRotateLabelButton; +typedef struct _glRotateLabelButtonClass glRotateLabelButtonClass; + +typedef struct _glRotateLabelButtonPrivate glRotateLabelButtonPrivate; + +struct _glRotateLabelButton { + GtkHBox parent_widget; + + glRotateLabelButtonPrivate *priv; +}; + +struct _glRotateLabelButtonClass { + GtkHBoxClass parent_class; + + void (*changed) (glRotateLabelButton *rotate_label_button, + gpointer user_data); +}; + + +GType gl_rotate_label_button_get_type (void) G_GNUC_CONST; + +GtkWidget *gl_rotate_label_button_new (void); + +gboolean gl_rotate_label_button_get_state (glRotateLabelButton *rotate_label); + +void gl_rotate_label_button_set_state (glRotateLabelButton *rotate_label, + gboolean state); + +void gl_rotate_label_button_set_template_name (glRotateLabelButton *rotate_label, + gchar *name); + +G_END_DECLS + +#endif + + + +/* + * Local Variables: -- emacs + * mode: C -- emacs + * c-basic-offset: 8 -- emacs + * tab-width: 8 -- emacs + * indent-tabs-mode: nil -- emacs + * End: -- emacs + */ diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c deleted file mode 100644 index 4a924280..00000000 --- a/glabels2/src/wdgt-rotate-label.c +++ /dev/null @@ -1,361 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ - -/* - * (GLABELS) Label and Business Card Creation program for GNOME - * - * wdgt_rotate_label.c: label rotate selection widget module - * - * Copyright (C) 2001-2006 Jim Evins . - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wdgt-rotate-label.h" - -#include -#include -#include -#include - -#include "marshal.h" -#include "color.h" -#include "hig.h" -#include -#include "cairo-label-path.h" - -#include "debug.h" - -/*========================================================*/ -/* Private macros and constants. */ -/*========================================================*/ -#define MINI_PREVIEW_MAX_PIXELS 48 -#define MINI_PREVIEW_CANVAS_PIXELS (MINI_PREVIEW_MAX_PIXELS + 8) - -#define LINE_COLOR GL_COLOR(0,0,0) -#define FILL_COLOR GL_COLOR(255,255,255) -#define SHADOW_COLOR GL_COLOR_A(192,192,192,128) - -#define LINE_WIDTH_PIXELS 1.0 - -#define SHADOW_X_OFFSET 3 -#define SHADOW_Y_OFFSET 3 - - -/*===========================================*/ -/* Private types */ -/*===========================================*/ - -struct _glWdgtRotateLabelPrivate { - - GtkWidget *no_rotate_radio; - GtkWidget *rotate_radio; - GtkWidget *no_rotate_image; - GtkWidget *rotate_image; - - lglTemplate *template; -}; - -enum { - CHANGED, - LAST_SIGNAL -}; - -/*===========================================*/ -/* Private globals */ -/*===========================================*/ - -static gint wdgt_rotate_label_signals[LAST_SIGNAL] = { 0 }; - -/*===========================================*/ -/* Local function prototypes */ -/*===========================================*/ - -static void gl_wdgt_rotate_label_finalize (GObject *object); - -static void toggled_cb (GtkToggleButton *toggle, - gpointer user_data); - -static GdkPixbuf *create_pixbuf (lglTemplate *template, - gboolean rotate_flag); - - -/****************************************************************************/ -/* Boilerplate Object stuff. */ -/****************************************************************************/ -G_DEFINE_TYPE (glWdgtRotateLabel, gl_wdgt_rotate_label, GTK_TYPE_HBOX); - - -static void -gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - - gl_wdgt_rotate_label_parent_class = g_type_class_peek_parent (class); - - object_class->finalize = gl_wdgt_rotate_label_finalize; - - wdgt_rotate_label_signals[CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE(object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (glWdgtRotateLabelClass, changed), - NULL, NULL, - gl_marshal_VOID__VOID, - G_TYPE_NONE, 0); - -} - -static void -gl_wdgt_rotate_label_init (glWdgtRotateLabel *rotate_label) -{ - rotate_label->priv = g_new0 (glWdgtRotateLabelPrivate, 1); - - gtk_container_set_border_width (GTK_CONTAINER (rotate_label), GL_HIG_PAD2); - - rotate_label->priv->no_rotate_radio = gtk_radio_button_new_with_label (NULL, _("Normal")); - rotate_label->priv->rotate_radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rotate_label->priv->no_rotate_radio), _("Rotated")); - - gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (rotate_label->priv->no_rotate_radio), - FALSE); - gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (rotate_label->priv->rotate_radio), - FALSE); - - gtk_button_set_image_position (GTK_BUTTON (rotate_label->priv->no_rotate_radio), - GTK_POS_TOP); - gtk_button_set_image_position (GTK_BUTTON (rotate_label->priv->rotate_radio), - GTK_POS_TOP); - - rotate_label->priv->no_rotate_image = gtk_image_new (); - rotate_label->priv->rotate_image = gtk_image_new (); - - gtk_button_set_image (GTK_BUTTON (rotate_label->priv->no_rotate_radio), - rotate_label->priv->no_rotate_image); - gtk_button_set_image (GTK_BUTTON (rotate_label->priv->rotate_radio), - rotate_label->priv->rotate_image); - - gtk_box_pack_start (GTK_BOX (rotate_label), - rotate_label->priv->no_rotate_radio, - FALSE, FALSE, GL_HIG_PAD1); - gtk_box_pack_start (GTK_BOX (rotate_label), - rotate_label->priv->rotate_radio, - FALSE, FALSE, GL_HIG_PAD1); - - /* Connect signals to controls */ - g_signal_connect (G_OBJECT (rotate_label->priv->no_rotate_radio), - "toggled", - G_CALLBACK (toggled_cb), rotate_label); - g_signal_connect (G_OBJECT (rotate_label->priv->rotate_radio), - "toggled", - G_CALLBACK (toggled_cb), rotate_label); -} - -static void -gl_wdgt_rotate_label_finalize (GObject *object) -{ - glWdgtRotateLabel *rotate_label = GL_WDGT_ROTATE_LABEL (object); - - g_return_if_fail (object != NULL); - g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (object)); - - if (rotate_label->priv->template) { - lgl_template_free (rotate_label->priv->template); - rotate_label->priv->template = NULL; - } - g_free (rotate_label->priv); - - G_OBJECT_CLASS (gl_wdgt_rotate_label_parent_class)->finalize (object); -} - -GtkWidget * -gl_wdgt_rotate_label_new (void) -{ - glWdgtRotateLabel *rotate_label; - - rotate_label = g_object_new (gl_wdgt_rotate_label_get_type (), NULL); - - return GTK_WIDGET (rotate_label); -} - -/*--------------------------------------------------------------------------*/ -/* PRIVATE. modify widget due to change of check button */ -/*--------------------------------------------------------------------------*/ -static void -toggled_cb (GtkToggleButton *toggle, - gpointer user_data) -{ - - /* Emit our "changed" signal */ - g_signal_emit (G_OBJECT (user_data), - wdgt_rotate_label_signals[CHANGED], 0); - -} - -/*--------------------------------------------------------------------------*/ -/* PRIVATE. Update mini-preview from template . */ -/*--------------------------------------------------------------------------*/ -static GdkPixbuf * -create_pixbuf (lglTemplate *template, - gboolean rotate_flag) -{ - GdkPixbuf *pixbuf; - cairo_surface_t *surface; - const lglTemplateFrame *frame; - gdouble m, m_canvas, w, h, scale; - cairo_t *cr; - - /* Create pixbuf and cairo context. */ - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, MINI_PREVIEW_CANVAS_PIXELS, MINI_PREVIEW_CANVAS_PIXELS); - surface = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (pixbuf), - CAIRO_FORMAT_RGB24, - gdk_pixbuf_get_width (pixbuf), - gdk_pixbuf_get_height (pixbuf), - gdk_pixbuf_get_rowstride (pixbuf)); - - - if (template == NULL) - { - return pixbuf; - } - - frame = (lglTemplateFrame *)template->frames->data; - - if (rotate_flag) - { - lgl_template_frame_get_size (frame, &h, &w); - } - else - { - lgl_template_frame_get_size (frame, &w, &h); - } - m = MAX (w, h); - scale = MINI_PREVIEW_MAX_PIXELS / m; - m_canvas = MINI_PREVIEW_CANVAS_PIXELS / scale; - - cr = cairo_create (surface); - cairo_surface_destroy (surface); - - /* Clear pixbuf */ - cairo_save (cr); - cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); - cairo_paint (cr); - cairo_restore (cr); - - cairo_set_antialias (cr, CAIRO_ANTIALIAS_GRAY); - - cairo_identity_matrix (cr); - cairo_translate (cr, MINI_PREVIEW_CANVAS_PIXELS/2, MINI_PREVIEW_CANVAS_PIXELS/2); - cairo_scale (cr, scale, scale); - cairo_translate (cr, -w/2.0, -h/2.0); - - /* - * Shadow - */ - cairo_save (cr); - cairo_translate (cr, SHADOW_X_OFFSET/scale, SHADOW_Y_OFFSET/scale); - gl_cairo_label_path (cr, template, rotate_flag, FALSE); - - cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (SHADOW_COLOR)); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill (cr); - cairo_restore (cr); - - /* - * Label + outline - */ - gl_cairo_label_path (cr, template, rotate_flag, FALSE); - - cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (FILL_COLOR)); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_fill_preserve (cr); - - cairo_set_line_width (cr, LINE_WIDTH_PIXELS/scale); - cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (LINE_COLOR)); - cairo_stroke (cr); - - - cairo_destroy (cr); - - return pixbuf; -} - -/****************************************************************************/ -/* query state of widget. */ -/****************************************************************************/ -gboolean -gl_wdgt_rotate_label_get_state (glWdgtRotateLabel *rotate_label) -{ - return - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON - (rotate_label->priv->rotate_radio)); -} - -/****************************************************************************/ -/* set state of widget. */ -/****************************************************************************/ -void -gl_wdgt_rotate_label_set_state (glWdgtRotateLabel *rotate_label, - gboolean state) -{ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (rotate_label->priv->rotate_radio), state); -} - -/****************************************************************************/ -/* set template for widget. */ -/****************************************************************************/ -void -gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_label, - gchar *name) -{ - lglTemplate *template; - const lglTemplateFrame *frame; - gdouble raw_w, raw_h; - - if (name == NULL) - { - rotate_label->priv->template = NULL; - - gtk_widget_set_sensitive (rotate_label->priv->no_rotate_radio, FALSE); - gtk_widget_set_sensitive (rotate_label->priv->rotate_radio, FALSE); - } - else - { - template = lgl_db_lookup_template_from_name (name); - frame = (lglTemplateFrame *)template->frames->data; - - rotate_label->priv->template = template; - lgl_template_frame_get_size (frame, &raw_w, &raw_h); - - gtk_image_set_from_pixbuf (GTK_IMAGE (rotate_label->priv->no_rotate_image), - create_pixbuf (rotate_label->priv->template, FALSE)); - gtk_image_set_from_pixbuf (GTK_IMAGE (rotate_label->priv->rotate_image), - create_pixbuf (rotate_label->priv->template, TRUE)); - - gtk_widget_set_sensitive (rotate_label->priv->no_rotate_radio, - (raw_w != raw_h)); - gtk_widget_set_sensitive (rotate_label->priv->rotate_radio, - (raw_w != raw_h)); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (rotate_label->priv->no_rotate_radio), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (rotate_label->priv->rotate_radio), FALSE); - - } - -} - diff --git a/glabels2/src/wdgt-rotate-label.h b/glabels2/src/wdgt-rotate-label.h deleted file mode 100644 index c2bc1912..00000000 --- a/glabels2/src/wdgt-rotate-label.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ - -/* - * (GLABELS) Label and Business Card Creation program for GNOME - * - * wdgt_rotate_label.h: label rotate selection widget module header file - * - * Copyright (C) 2001-2006 Jim Evins . - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __WDGT_ROTATE_LABEL_H__ -#define __WDGT_ROTATE_LABEL_H__ - -#include - -G_BEGIN_DECLS - -#define GL_TYPE_WDGT_ROTATE_LABEL (gl_wdgt_rotate_label_get_type ()) -#define GL_WDGT_ROTATE_LABEL(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_WDGT_ROTATE_LABEL, glWdgtRotateLabel )) -#define GL_WDGT_ROTATE_LABEL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_ROTATE_LABEL, glWdgtRotateLabelClass)) -#define GL_IS_WDGT_ROTATE_LABEL(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_WDGT_ROTATE_LABEL)) -#define GL_IS_WDGT_ROTATE_LABEL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_ROTATE_LABEL)) - -typedef struct _glWdgtRotateLabel glWdgtRotateLabel; -typedef struct _glWdgtRotateLabelClass glWdgtRotateLabelClass; - -typedef struct _glWdgtRotateLabelPrivate glWdgtRotateLabelPrivate; - -struct _glWdgtRotateLabel { - GtkHBox parent_widget; - - glWdgtRotateLabelPrivate *priv; -}; - -struct _glWdgtRotateLabelClass { - GtkHBoxClass parent_class; - - void (*changed) (glWdgtRotateLabel *wdgt_rotate_label, - gpointer user_data); -}; - -GType gl_wdgt_rotate_label_get_type (void) G_GNUC_CONST; - -GtkWidget *gl_wdgt_rotate_label_new (void); - -gboolean gl_wdgt_rotate_label_get_state (glWdgtRotateLabel *rotate_label); - -void gl_wdgt_rotate_label_set_state (glWdgtRotateLabel *rotate_label, - gboolean state); - -void gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_label, - gchar *name); - -G_END_DECLS - -#endif