[gdl] Added missing file for new cairo drawn buttons
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Subject: [gdl] Added missing file for new cairo drawn buttons
- Date: Fri, 17 Apr 2009 07:13:20 -0400 (EDT)
commit 48b130b52013bf9ed33469cd9ccc52c8c00d9f93
Author: Johannes Schmid <jhs gnome org>
Date: Fri Apr 17 10:35:00 2009 +0200
Added missing file for new cairo drawn buttons
Joel Holdsworth pointed out that these file were missing from the last commit
---
gdl/gdl-dock-item-button-image.c | 169 ++++++++++++++++++++++++++++++++++++++
gdl/gdl-dock-item-button-image.h | 70 ++++++++++++++++
gdl/stock-close-12.png | Bin 293 -> 0 bytes
gdl/stock-menu-left-12.png | Bin 195 -> 0 bytes
gdl/stock-menu-right-12.png | Bin 191 -> 0 bytes
5 files changed, 239 insertions(+), 0 deletions(-)
diff --git a/gdl/gdl-dock-item-button-image.c b/gdl/gdl-dock-item-button-image.c
new file mode 100644
index 0000000..7997b9c
--- /dev/null
+++ b/gdl/gdl-dock-item-button-image.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * gdl-dock-item-button-image.c
+ *
+ * Author: Joel Holdsworth <joel airwebreathe org uk>
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gdl-dock-item-button-image.h"
+
+#include <math.h>
+#include "gdl-tools.h"
+
+#define ICON_SIZE 12
+
+GDL_CLASS_BOILERPLATE (GdlDockItemButtonImage,
+ gdl_dock_item_button_image,
+ GtkWidget, GTK_TYPE_WIDGET);
+
+static gint
+gdl_dock_item_button_image_expose (GtkWidget *widget,
+ GdkEventExpose *event)
+{
+ GdlDockItemButtonImage *button_image;
+ GtkStyle *style;
+ GdkColor *color;
+
+ g_return_if_fail (widget != NULL);
+ button_image = GDL_DOCK_ITEM_BUTTON_IMAGE (widget);
+
+ cairo_t *cr = gdk_cairo_create (event->window);
+ cairo_translate (cr, event->area.x, event->area.y);
+
+ /* Set up the pen */
+ cairo_set_line_width(cr, 1.0);
+
+ style = gtk_widget_get_style (widget);
+ g_return_if_fail (style != NULL);
+ color = &style->fg[GTK_STATE_NORMAL];
+ cairo_set_source_rgba(cr, color->red / 65535.0,
+ color->green / 65535.0, color->blue / 65535.0, 0.55);
+
+ /* Draw the icon border */
+ cairo_move_to (cr, 10.5, 2.5);
+ cairo_arc (cr, 10.5, 4.5, 2, -0.5 * M_PI, 0);
+ cairo_line_to (cr, 12.5, 10.5);
+ cairo_arc (cr, 10.5, 10.5, 2, 0, 0.5 * M_PI);
+ cairo_line_to (cr, 4.5, 12.5);
+ cairo_arc (cr, 4.5, 10.5, 2, 0.5 * M_PI, M_PI);
+ cairo_line_to (cr, 2.5, 4.5);
+ cairo_arc (cr, 4.5, 4.5, 2, M_PI, 1.5 * M_PI);
+ cairo_close_path (cr);
+
+ cairo_stroke (cr);
+
+ /* Draw the icon */
+ cairo_new_path (cr);
+
+ switch(button_image->image_type) {
+ case GDL_DOCK_ITEM_BUTTON_IMAGE_CLOSE:
+ cairo_move_to (cr, 4.0, 5.5);
+ cairo_line_to (cr, 4.0, 5.5);
+ cairo_line_to (cr, 6.0, 7.5);
+ cairo_line_to (cr, 4.0, 9.5);
+ cairo_line_to (cr, 5.5, 11.0);
+ cairo_line_to (cr, 7.5, 9.0);
+ cairo_line_to (cr, 9.5, 11.0);
+ cairo_line_to (cr, 11.0, 9.5);
+ cairo_line_to (cr, 9.0, 7.5);
+ cairo_line_to (cr, 11.0, 5.5);
+ cairo_line_to (cr, 9.5, 4.0);
+ cairo_line_to (cr, 7.5, 6.0);
+ cairo_line_to (cr, 5.5, 4.0);
+ cairo_close_path (cr);
+ break;
+
+ case GDL_DOCK_ITEM_BUTTON_IMAGE_ICONIFY:
+ if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL) {
+ cairo_move_to (cr, 4.5, 7.5);
+ cairo_line_to (cr, 10.0, 4.75);
+ cairo_line_to (cr, 10.0, 10.25);
+ cairo_close_path (cr);
+ } else {
+ cairo_move_to (cr, 10.5, 7.5);
+ cairo_line_to (cr, 5, 4.75);
+ cairo_line_to (cr, 5, 10.25);
+ cairo_close_path (cr);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ cairo_fill (cr);
+
+ /* Finish up */
+ cairo_destroy (cr);
+
+ return 0;
+}
+
+static void
+gdl_dock_item_button_image_instance_init (
+ GdlDockItemButtonImage *button_image)
+{
+ GTK_WIDGET_SET_FLAGS (button_image, GTK_NO_WINDOW);
+}
+
+static void
+gdl_dock_item_button_image_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ g_return_if_fail (GDL_IS_DOCK_ITEM_BUTTON_IMAGE (widget));
+ g_return_if_fail (requisition != NULL);
+
+ requisition->width = ICON_SIZE;
+ requisition->height = ICON_SIZE;
+}
+
+static void
+gdl_dock_item_button_image_class_init (
+ GdlDockItemButtonImageClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ widget_class->expose_event =
+ gdl_dock_item_button_image_expose;
+ widget_class->size_request =
+ gdl_dock_item_button_image_size_request;
+}
+
+/* ----- Public interface ----- */
+
+/**
+ * gdl_dock_item_button_image_new:
+ * @param image_type: Specifies what type of image the widget should
+ * display
+ *
+ * Creates a new GDL dock button image object.
+ * Returns: The newly created dock item button image widget.
+ **/
+GtkWidget*
+gdl_dock_item_button_image_new (GdlDockItemButtonImageType image_type)
+{
+ GdlDockItemButtonImage *button_image = g_object_new (
+ GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE, NULL);
+ button_image->image_type = image_type;
+
+ return GTK_WIDGET (button_image);
+}
diff --git a/gdl/gdl-dock-item-button-image.h b/gdl/gdl-dock-item-button-image.h
new file mode 100644
index 0000000..ce0c6fa
--- /dev/null
+++ b/gdl/gdl-dock-item-button-image.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * gdl-dock-item-button-image.h
+ *
+ * Author: Joel Holdsworth <joel airwebreathe org uk>
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _GDL_DOCK_ITEM_BUTTON_IMAGE_H_
+#define _GDL_DOCK_ITEM_BUTTON_IMAGE_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+/* Standard Macros */
+#define GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE \
+ (gdl_dock_item_button_image_get_type())
+#define GDL_DOCK_ITEM_BUTTON_IMAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE, GdlDockItemButtonImage))
+#define GDL_DOCK_ITEM_BUTTON_IMAGE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE, GdlDockItemButtonImageClass))
+#define GDL_IS_DOCK_ITEM_BUTTON_IMAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE))
+#define GDL_IS_DOCK_ITEM_BUTTON_IMAGE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE))
+#define GDL_DOCK_ITEM_BUTTON_IMAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GDL_TYPE_DOCK_ITEM_BUTTON_IMAGE, GdlDockItemButtonImageClass))
+
+/* Data Types & Structures */
+typedef enum {
+ GDL_DOCK_ITEM_BUTTON_IMAGE_CLOSE,
+ GDL_DOCK_ITEM_BUTTON_IMAGE_ICONIFY
+} GdlDockItemButtonImageType;
+
+typedef struct _GdlDockItemButtonImage GdlDockItemButtonImage;
+typedef struct _GdlDockItemButtonImageClass GdlDockItemButtonImageClass;
+
+struct _GdlDockItemButtonImage {
+ GtkWidget parent;
+
+ GdlDockItemButtonImageType image_type;
+};
+
+struct _GdlDockItemButtonImageClass {
+ GtkWidgetClass parent_class;
+};
+
+/* Data Public Functions */
+GType gdl_dock_item_button_image_get_type (void);
+GtkWidget *gdl_dock_item_button_image_new (
+ GdlDockItemButtonImageType image_type);
+
+G_END_DECLS
+
+#endif /* _GDL_DOCK_ITEM_BUTTON_IMAGE_H_ */
diff --git a/gdl/stock-close-12.png b/gdl/stock-close-12.png
deleted file mode 100644
index cba5bfa..0000000
Binary files a/gdl/stock-close-12.png and /dev/null differ
diff --git a/gdl/stock-menu-left-12.png b/gdl/stock-menu-left-12.png
deleted file mode 100644
index c1d3bef..0000000
Binary files a/gdl/stock-menu-left-12.png and /dev/null differ
diff --git a/gdl/stock-menu-right-12.png b/gdl/stock-menu-right-12.png
deleted file mode 100644
index df945cd..0000000
Binary files a/gdl/stock-menu-right-12.png and /dev/null differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]