wrapper patch: II
- From: lacage email enst fr (Mathieu Lacage)
- To: gnome-components-list gnome org
- Subject: wrapper patch: II
- Date: 03 Oct 1999 17:04:23 +0200
hi,
finally, i am not that stupid: i managed to make this
patch work but here is my pb:
I want to support non inplace components.
to do so, i think we should change the API as follows:
gnome_view_frame_set_covered should be renamed
gnome_view_frame_activate
why ?
Well, for inplace components, activating them is
equivalent to uncovering them (+ calling GNOME::View::activate)
For non inplace components activating them is not:
I think non inplace components should not have their
gnome_wrapper covered and they should be painted in grey.
which means that the gnome_view_frame_set_activate function
could do different things for these different components.
It would uncover the gnome_wrapper and paint the border
for in_place components
and it would keep covered the gnome_wrapper and paint the
wrapper->window for non inplace components.
To do this, we should first add the activate field in GnomeViewFrame:
struct _GnomeViewFrame {
GnomeObject base;
GnomeWrapper *wrapper;
GnomeClientSite *client_site;
GNOME_View view;
GnomeUIHandler *uih;
GnomeViewFramePrivate *priv;
gint activate;
};
This should be done anyway because right now, the fact that the view is
activated is learnt from gnome_wrapper_is_covered which is BAD as
the gnome_wrapper has nothing to do with the view beeing covered or not.
(this is the idea of separating View from data)
Well, if you ppl think this is a good idea, let me know, i will send a
patch implementing this idea.
For now, here are the patches needed to add a clean border painting to
gnome_wrapper.
Oh, yes: these patches are valid against the latest cvs tree, of course !
---------------gnome-wrapper.c------------------------
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,146
> GdkColormap *colormap;
> GdkGCValues gc_values;
> char data[5*5] = { 21, 10, 21, 10, 21};
164a173,190
> /* pixmap data */
> wrapper->pixmap = gdk_bitmap_create_from_data (widget->window,
> data,
> 5, 5);
> /* gc's...*/
> gc_values.fill = GDK_STIPPLED;
> gc_values.stipple = wrapper->pixmap;
> gc_values.subwindow_mode = GDK_CLIP_BY_CHILDREN;
> wrapper->gc[0] = gdk_gc_new_with_values (widget->window,
> &gc_values,
> GDK_GC_FILL | GDK_GC_STIPPLE |
> GDK_GC_SUBWINDOW );
> gc_values.subwindow_mode = GDK_INCLUDE_INFERIORS;
> wrapper->gc[1] = gdk_gc_new_with_values (widget->window,
> &gc_values,
> GDK_GC_FILL | GDK_GC_STIPPLE |
> GDK_GC_SUBWINDOW );
>
207c233
< GnomeWrapper *wrapper;
---
> GnomeWrapper *wrapper = GNOME_WRAPPER (widget);
215,217c241,248
< 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 =+ 10;
> requisition->height =+ 10;
> }
> } else {
239a271,286
> if (wrapper->bin.child && GTK_WIDGET_VISIBLE (wrapper->bin.child)) {
> child_allocation.x = 0;
> child_allocation.y = 0;
> child_allocation.width = widget->allocation.width;
> child_allocation.height = widget->allocation.height;
> 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 -= 10;
> child_allocation.height -= 10;
> }
> gtk_widget_size_allocate (wrapper->bin.child, &child_allocation);
> }
>
251a299,300
> gtk_signal_emit_by_name (GTK_OBJECT (widget), "draw");
> }
253,257c302,305
< if (wrapper->bin.child && GTK_WIDGET_VISIBLE (wrapper->bin.child)) {
< child_allocation.x = 0;
< child_allocation.y = 0;
< child_allocation.width = widget->allocation.width;
< child_allocation.height = widget->allocation.height;
---
> static void
> gnome_wrapper_paint (GtkWidget *widget)
> {
> GnomeWrapper *wrapper = GNOME_WRAPPER(widget);
259c307,322
< gtk_widget_size_allocate (wrapper->bin.child, &child_allocation);
---
> gtk_widget_draw (GTK_WIDGET(wrapper->bin.child), NULL);
>
> if (!wrapper->covered && wrapper->is_in_place) {
> gdk_draw_rectangle (widget->window,
> wrapper->gc[0],
> TRUE,
> 0, 0,
> widget->allocation.width,
> widget->allocation.height);
> } else if (!wrapper->covered && !wrapper->is_in_place) {
> gdk_draw_rectangle (widget->window,
> wrapper->gc[1],
> TRUE,
> 0, 0,
> widget->allocation.width,
> widget->allocation.height);
262a326,340
> 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;
> }
>
>
317a396,407
> }
>
> void
> gnome_wrapper_set_inplace (GnomeWrapper *wrapper, gboolean inplace)
> {
> wrapper->is_in_place = inplace;
> }
>
> gboolean
> gnome_wrapper_is_inplace (GnomeWrapper *wrapper)
> {
> return wrapper->is_in_place;
---------------gnome-wrapper.c------------------------
---------------gnome-wrapper.h------------------------
35a36,40
>
> /* Whether the child should be painted in_place or not */
> int is_in_place : 1;
> GdkGC *gc[2];
> GdkPixmap *pixmap;
48a54,55
> void gnome_wrapper_set_inplace (GnomeWrapper *wrapper, gboolean in_place);
> gboolean gnome_wrapper_is_inplace (GnomeWrapper *wrapper);
---------------gnome-wrapper.h------------------------
---------------gnome-view-frame.c---------------------
462a463,464
> gtk_widget_queue_resize (GTK_WIDGET (wrapper));
>
---------------gnome-view-frame.c---------------------
Regards,
Mathieu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]