gnome_wrapper patch
- From: lacage email enst fr (Mathieu Lacage)
- To: gnome-components-list gnome org
- Subject: gnome_wrapper patch
- Date: 03 Oct 1999 13:56:33 +0200
hi,
I was sick to be waiting for someone to implement greying on the GnomeWrapper
widget.
Here is a patch which begins to add this functionality to the GnomeWrapper
I am sick as hell so i just cannot finish it and, well... I doubt i have
the knowledge to make it really work: i don't really understand how things
work. (most notably the fact that this patch will really apply the
painting only when the views get a resize_event...)
I'll try nonethless this evening but don't count on it. Do whatever you wish with
this thing.
One should note that i corrected the first line of gnome-wrapper.c
which should be #include "./gnome-wrapper.h" instead of <bonobo/gnome-wrapper.h>
(i think this is to be considered a bug).
------------------------gnome-wrapper.c.patch---------------------------
11c11
< #include <bonobo/gnome-wrapper.h>
---
> #include "./gnome-wrapper.h"
23c23,25
<
---
> static gint gnome_wrapper_expose (GtkWidget *widget, GdkEventExpose *event);
> static void gnome_wrapper_draw (GtkWidget *widget, GdkRectangle *area);
> static void gnome_wrapper_paint (GtkWidget *widget);
72a75,76
> widget_class->expose_event = gnome_wrapper_expose;
> widget_class->draw = gnome_wrapper_draw;
79a84
> wrapper->is_in_place = TRUE;
138a144,145
> GdkColor color;
> GdkColormap *colormap;
158c165,168
< attributes.colormap = gtk_widget_get_colormap (widget);
---
> colormap = gtk_widget_get_colormap (widget);
> if (gdk_color_parse ("grey", &color))
> gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
> attributes.colormap = colormap;
207c217
< GnomeWrapper *wrapper;
---
> GnomeWrapper *wrapper = GNOME_WRAPPER (widget);
215,217c225,232
< if (wrapper->bin.child)
< gtk_widget_size_request (wrapper->bin.child, requisition);
< else {
---
> if (wrapper->bin.child) {
> gtk_widget_size_request (wrapper->bin.child,
> requisition);
> if (!wrapper->covered && wrapper->is_in_place) {
> requisition->width += 5 + 5;
> requisition->height += 5 + 5;
> }
> } else {
258c273,280
<
---
> if (!wrapper->covered && wrapper->is_in_place) {
> /* we make sure we have some small border
> to draw onto */
> child_allocation.x = 5;
> child_allocation.y = 5;
> child_allocation.width -= 5 + 5;
> child_allocation.height -= 5 + 5;
> }
262a285,333
> static void
> gnome_wrapper_paint (GtkWidget *widget)
> {
> GnomeWrapper *wrapper = GNOME_WRAPPER(widget);
> GdkPixmap *pixmap;
> GdkColor color;
> GdkGC *gc = gdk_gc_new (widget->window);
> gdk_color_parse ("grey", &color);
> gdk_gc_set_foreground (gc, &color);
> /* gdk_gc_set_stipple (GDK_GC (gc), pixmap);*/
> gdk_gc_set_fill (gc, GDK_SOLID);
>
> gtk_widget_draw (GTK_WIDGET(wrapper->bin.child), NULL);
> if (!wrapper->covered && wrapper->is_in_place) {
> gdk_gc_set_subwindow (gc, GDK_CLIP_BY_CHILDREN);
> gdk_draw_rectangle (widget->window,
> gc,
> FALSE,
> 0, 0,
> widget->allocation.width,
> widget->allocation.height);
> } else if ( !wrapper->covered && !wrapper->is_in_place) {
> gdk_gc_set_subwindow (gc, GDK_INCLUDE_INFERIORS);
> gdk_draw_rectangle (widget->window,
> gc,
> TRUE,
> 0, 0,
> widget->allocation.width,
> widget->allocation.height);
>
> }
>
> }
>
> static void
> gnome_wrapper_draw (GtkWidget *widget, GdkRectangle *area)
> {
> gnome_wrapper_paint (widget);
> }
>
> static gint
> gnome_wrapper_expose (GtkWidget *widget, GdkEventExpose *event)
> {
> gnome_wrapper_paint (widget);
>
> return FALSE;
> }
>
>
317a389,400
> }
>
> void
> gnome_wrapper_set_style (GnomeWrapper *wrapper, gboolean is_in_place)
> {
> wrapper->is_in_place = is_in_place;
> }
>
> gboolean
> gnome_wrapper_get_style (GnomeWrapper *wrapper)
> {
> return wrapper->is_in_place;
------------------------gnome-wrapper.c.patch---------------------------
------------------------gnome-wrapper.h.patch---------------------------
35a36,38
>
> /* Whether the child should be painted in_place or not */
> int is_in_place : 1;
48a52,53
> void gnome_wrapper_set_style (GnomeWrapper *wrapper, gboolean is_in_place);
> gboolean gnome_wrapper_get_style (GnomeWrapper *wrapper);
------------------------gnome-wrapper.h.patch---------------------------
Regards,
Mathieu
--
Mathieu Lacage
Snailmail: ch 224, 212 Rue de Tolbiac 75013 Paris
email: lacage@email.enst.fr
url: http://www.stud.enst.fr/~lacage
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]