/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ #include #include #include "e-util/e-util.h" #include "e-bevel-button.h" #include "e-bevel-button-util.h" #define PARENT_TYPE GTK_TYPE_BUTTON static GtkButtonClass *parent_class = NULL; struct _EBevelButtonPrivate { GdkColor base_color; GdkColor dark_color; GdkColor light_color; GdkGC *gc; }; static void e_bevel_button_paint (GtkWidget *widget, GdkRectangle *area) { EBevelButton *button; button = E_BEVEL_BUTTON (widget); if (GTK_WIDGET_DRAWABLE (widget)) { gdk_window_set_back_pixmap (widget->window, NULL, TRUE); gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height); gdk_gc_set_foreground (button->priv->gc, &button->priv->base_color); gdk_draw_rectangle (widget->window, button->priv->gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height); if (GTK_BUTTON (button)->in_button) { gdk_gc_set_foreground (button->priv->gc, GTK_BUTTON (button)->button_down ? &button->priv->dark_color : &button->priv->light_color); gdk_draw_line (widget->window, button->priv->gc, 0, 0, 0, widget->allocation.height - 2); gdk_draw_line (widget->window, button->priv->gc, 0, 0, widget->allocation.width - 2, 0); gdk_gc_set_foreground (button->priv->gc, GTK_BUTTON (button)->button_down ? &button->priv->light_color : &button->priv->dark_color); gdk_draw_line (widget->window, button->priv->gc, widget->allocation.width - 1 , 1, widget->allocation.width - 1, widget->allocation.height - 1); gdk_draw_line (widget->window, button->priv->gc, 1, widget->allocation.height - 1, widget->allocation.width - 1, widget->allocation.height - 1); } } } static gint e_bevel_button_expose (GtkWidget *widget, GdkEventExpose *event) { GtkBin *bin; GdkEventExpose child_event; if (GTK_WIDGET_DRAWABLE (widget)) { bin = GTK_BIN (widget); e_bevel_button_paint (widget, &event->area); child_event = *event; if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) && gtk_widget_intersect (bin->child, &event->area, &child_event.area)) gtk_widget_event (bin->child, (GdkEvent*) &child_event); } return FALSE; } static void e_bevel_button_draw (GtkWidget *widget, GdkRectangle *area) { GdkRectangle child_area; GdkRectangle tmp_area; g_return_if_fail (widget != NULL); g_return_if_fail (E_IS_BEVEL_BUTTON (widget)); g_return_if_fail (area != NULL); if (GTK_WIDGET_DRAWABLE (widget)) { tmp_area = *area; tmp_area.x -= GTK_CONTAINER (widget)->border_width; tmp_area.y -= GTK_CONTAINER (widget)->border_width; e_bevel_button_paint (widget, &tmp_area); if (GTK_BIN (widget)->child && gtk_widget_intersect (GTK_BIN (widget)->child, &tmp_area, &child_area)) gtk_widget_draw (GTK_BIN (widget)->child, &child_area); } } static void e_bevel_button_realize (GtkWidget *widget) { EBevelButton *button = E_BEVEL_BUTTON (widget); GTK_WIDGET_CLASS (parent_class)->realize (widget); button->priv->gc = gdk_gc_new (widget->window); gdk_color_parse ("#d0d888", &button->priv->base_color); e_bevel_button_util_shade (&button->priv->base_color, &button->priv->light_color, LIGHTNESS_MULT); e_bevel_button_util_shade (&button->priv->base_color, &button->priv->dark_color, DARKNESS_MULT); gdk_colormap_alloc_color (gdk_rgb_get_cmap (), &button->priv->base_color, FALSE, TRUE); gdk_colormap_alloc_color (gdk_rgb_get_cmap (), &button->priv->light_color, FALSE, TRUE); gdk_colormap_alloc_color (gdk_rgb_get_cmap (), &button->priv->dark_color, FALSE, TRUE); } static void e_bevel_button_class_init (EBevelButtonClass *klass) { GtkWidgetClass *widget_class; widget_class = (GtkWidgetClass *)klass; parent_class = gtk_type_class (PARENT_TYPE); widget_class->draw = e_bevel_button_draw; widget_class->expose_event = e_bevel_button_expose; widget_class->realize = e_bevel_button_realize; } static void e_bevel_button_init (EBevelButton *button) { EBevelButtonPrivate *priv; GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS); priv = g_new (EBevelButtonPrivate, 1); button->priv = priv; } GtkWidget * e_bevel_button_new (void) { EBevelButton *button; button = gtk_type_new (E_TYPE_BEVEL_BUTTON); return GTK_WIDGET (button); } E_MAKE_TYPE (e_bevel_button, "EBevelButton", EBevelButton, e_bevel_button_class_init, e_bevel_button_init, PARENT_TYPE); > FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* The KDE on FreeBSD team is pleased to update the KDE4 ports to 4.7.3.rakuco2011-11-142-2/+3
* The KDE/FreeBSD team is pleased to announce KDE Software Compilationavilla2011-10-172-6/+40
* Update KDE Software Compilation ports to 4.6.5makc2011-07-082-2/+28
* The FreeBSD KDE Team is pleased to announce KDE SC 4.6.4. Read fullavilla2011-06-141-2/+2
* Update KDE Software Compilation ports to 4.6.3makc2011-05-171-2/+2
* The FreeBSD KDE Team is pleased to announce April updates for KDEavilla2011-04-072-2/+19
* The FreeBSD KDE Team is pleased to announce KDE SC 4.6.1 and KDE PIMavilla2011-03-252-12/+18
* - The KDE FreeBSD team is proud to announce the release of KDE 4.5.5fluffy2011-01-081-2/+2
* KDE FreeBSD team presents KDE SC 4.5.4.makc2010-12-032-2/+5
* KDE FreeBSD team presents KDE SC 4.5.3.makc2010-11-041-3/+2
* KDE FreeBSD team presents KDE SC 4.5.2.makc2010-10-062-3/+5
* KDE FreeBSD team presents KDE SC 4.5.1.makc2010-09-032-50/+29
* Present KDE SC 4.4.5 for FreeBSD.makc2010-06-301-3/+3
* Present KDE SC 4.4.4 for FreeBSD.makc2010-06-021-3/+3
* - The FreeBSD KDE team is pleased to announce KDE SC 4.4.3 for FreeBSDfluffy2010-05-113-19/+55
* - update to 1.4.1dinoex2010-03-281-0/+1
* Presenting KDE 4.3.5 for FreeBSD. The official release notes for thismiwi2010-02-072-4/+3
* - update to jpeg-8dinoex2010-02-051-0/+1
* The FreeBSD KDE is please to announce the release of KDE 4.3.4,miwi2009-12-021-3/+3
* The KDE FreeBSD team is proud to announce the release of KDE 4.3.3miwi2009-11-272-5/+10
* The FreeBSD KDE is please to announce the release of KDE 4.3.1,tabthorpe2009-09-022-4/+4
* clean upmakc2009-08-081-3/+0
* The KDE FreeBSD team is proud to announce the release of KDE 4.3.0miwi2009-08-053-14/+16
* - bump all port that indirectly depends on libjpeg and have not yet been bump...dinoex2009-07-311-0/+1
* The KDE FreeBSD team is pleased to announce KDE 4.2.4, the last bugfixmiwi2009-06-031-3/+3
* Update KDE ports to 4.2.3makc2009-05-101-3/+3
* The KDE FreeBSD team is proud to announce the release of KDE 4.2.2miwi2009-04-022-4/+10
* Update KDE to 4.2.1.makc2009-03-09