[gtk-list] [patch] Scrolled_Window




This patch replace a define in the scrolled_window code with a
resource. The width between the viewport and a scrollbar is 
currently a define. It sounds more logical (and maybe cleaner)
to use a real resource so people can query it and even change
its value. 

The patch is against gtk+-0.99.0 version.

Patrice.


------------------------------8<-----------------------------
*** gtk+-0.99.0.orig/gtk/gtkscrolledwindow.c	Mon Nov 24 23:37:45 1997
--- gtk+-0.99.0/gtk/gtkscrolledwindow.c	Sat Dec 20 16:46:28 1997
***************
*** 19,25 ****
  #include "gtksignal.h"
  
  
! #define SCROLLBAR_SPACING  5
  
  
  static void gtk_scrolled_window_class_init         (GtkScrolledWindowClass *klass);
--- 19,25 ----
  #include "gtksignal.h"
  
  
! #define SCROLLED_WINDOW_CLASS(w)  GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (w)->klass)
  
  
  static void gtk_scrolled_window_class_init         (GtkScrolledWindowClass *klass);
***************
*** 96,101 ****
--- 96,103 ----
    container_class->add = gtk_scrolled_window_add;
    container_class->remove = gtk_scrolled_window_remove;
    container_class->foreach = gtk_scrolled_window_foreach;
+ 
+   class->scrollbar_spacing = 5;
  }
  
  static void
***************
*** 310,316 ****
  			       &scrolled_window->hscrollbar->requisition);
  
        requisition->width = MAX (requisition->width, scrolled_window->hscrollbar->requisition.width);
!       extra_height = SCROLLBAR_SPACING + scrolled_window->hscrollbar->requisition.height;
      }
  
    if ((scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC) ||
--- 312,318 ----
  			       &scrolled_window->hscrollbar->requisition);
  
        requisition->width = MAX (requisition->width, scrolled_window->hscrollbar->requisition.width);
!       extra_height = SCROLLED_WINDOW_CLASS (widget)->scrollbar_spacing + scrolled_window->hscrollbar->requisition.height;
      }
  
    if ((scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC) ||
***************
*** 320,326 ****
  			       &scrolled_window->vscrollbar->requisition);
  
        requisition->height = MAX (requisition->height, scrolled_window->vscrollbar->requisition.height);
!       extra_width = SCROLLBAR_SPACING + scrolled_window->vscrollbar->requisition.width;
      }
  
    requisition->width += GTK_CONTAINER (widget)->border_width * 2 + extra_width;
--- 322,328 ----
  			       &scrolled_window->vscrollbar->requisition);
  
        requisition->height = MAX (requisition->height, scrolled_window->vscrollbar->requisition.height);
!       extra_width = SCROLLED_WINDOW_CLASS (widget)->scrollbar_spacing + scrolled_window->vscrollbar->requisition.width;
      }
  
    requisition->width += GTK_CONTAINER (widget)->border_width * 2 + extra_width;
***************
*** 369,375 ****
    if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
      {
        child_allocation.x = viewport_allocation.x;
!       child_allocation.y = viewport_allocation.y + viewport_allocation.height + SCROLLBAR_SPACING;
        child_allocation.width = viewport_allocation.width;
        child_allocation.height = scrolled_window->hscrollbar->requisition.height;
        child_allocation.x += allocation->x;
--- 371,377 ----
    if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
      {
        child_allocation.x = viewport_allocation.x;
!       child_allocation.y = viewport_allocation.y + viewport_allocation.height + SCROLLED_WINDOW_CLASS (widget)->scrollbar_spacing;
        child_allocation.width = viewport_allocation.width;
        child_allocation.height = scrolled_window->hscrollbar->requisition.height;
        child_allocation.x += allocation->x;
***************
*** 380,386 ****
  
    if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
      {
!       child_allocation.x = viewport_allocation.x + viewport_allocation.width + SCROLLBAR_SPACING;
        child_allocation.y = viewport_allocation.y;
        child_allocation.width = scrolled_window->vscrollbar->requisition.width;
        child_allocation.height = viewport_allocation.height;
--- 382,388 ----
  
    if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
      {
!       child_allocation.x = viewport_allocation.x + viewport_allocation.width + SCROLLED_WINDOW_CLASS (widget)->scrollbar_spacing;
        child_allocation.y = viewport_allocation.y;
        child_allocation.width = scrolled_window->vscrollbar->requisition.width;
        child_allocation.height = viewport_allocation.height;
***************
*** 454,462 ****
    allocation->height = widget->allocation.height - allocation->y * 2;
  
    if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
!     allocation->width -= scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING;
    if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
!     allocation->height -= scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING;
  }
  
  static void
--- 456,464 ----
    allocation->height = widget->allocation.height - allocation->y * 2;
  
    if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
!     allocation->width -= scrolled_window->vscrollbar->requisition.width + SCROLLED_WINDOW_CLASS (widget)->scrollbar_spacing;
    if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
!     allocation->height -= scrolled_window->hscrollbar->requisition.height + SCROLLED_WINDOW_CLASS (widget)->scrollbar_spacing;
  }
  
  static void
Only in gtk+-0.99.0/gtk: gtkscrolledwindow.c~
diff -cr gtk+-0.99.0.orig/gtk/gtkscrolledwindow.h gtk+-0.99.0/gtk/gtkscrolledwindow.h
*** gtk+-0.99.0.orig/gtk/gtkscrolledwindow.h	Mon Nov 24 23:37:45 1997
--- gtk+-0.99.0/gtk/gtkscrolledwindow.h	Sat Dec 20 16:40:16 1997
***************
*** 53,58 ****
--- 53,60 ----
  struct _GtkScrolledWindowClass
  {
    GtkContainerClass parent_class;
+ 
+   gint scrollbar_spacing;
  };
  
  
------------------------------8<-----------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]