new enum GtkCornerType added window_placement. new method to set

Mon Nov  9 00:39:20 1998  Lars Hamann  <lars@gtk.org>

        * gtk/gtkenums.h : new enum GtkCornerType
        * gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
        window_placement.
        * gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
        new method to set window_placement.
        (gtk_scrolled_window_viewport_allocate)
        (gtk_scrolled_window_size_allocate): few changes due to
        window_placement.
        * gtk/testgtk.c (remove_selection): fixed while loop.
This commit is contained in:
Lars Hamann 1998-11-09 00:23:37 +00:00 committed by Lars Hamann
parent 3c07b7ebbd
commit 6ef274c0ed
12 changed files with 160 additions and 22 deletions

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -1,3 +1,15 @@
Mon Nov 9 00:39:20 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkenums.h : new enum GtkCornerType
* gtk/gtkscrolledwindow.h (struct _GtkScrolledWindow): added
window_placement.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_set_placement):
new method to set window_placement.
(gtk_scrolled_window_viewport_allocate)
(gtk_scrolled_window_size_allocate): few changes due to
window_placement.
* gtk/testgtk.c (remove_selection): fixed while loop.
Sat Nov 7 21:55:00 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkclist.c: check if column[i].button is valid before calling

View File

@ -136,6 +136,15 @@ typedef enum
GTK_ORIENTATION_VERTICAL
} GtkOrientation;
/* Placement type for scrolled window */
typedef enum
{
GTK_CORNER_TOP_LEFT,
GTK_CORNER_BOTTOM_LEFT,
GTK_CORNER_TOP_RIGHT,
GTK_CORNER_BOTTOM_RIGHT
} GtkCornerType;
/* Packing types (for boxes) */
typedef enum
{

View File

@ -201,6 +201,7 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
scrolled_window->vscrollbar = NULL;
scrolled_window->hscrollbar_policy = GTK_POLICY_ALWAYS;
scrolled_window->vscrollbar_policy = GTK_POLICY_ALWAYS;
scrolled_window->window_placement = GTK_CORNER_TOP_LEFT;
scrolled_window->autogenerated_viewport = FALSE;
}
@ -289,6 +290,21 @@ gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
}
}
void
gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
GtkCornerType window_placement)
{
g_return_if_fail (scrolled_window != NULL);
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
if (scrolled_window->window_placement != window_placement)
{
scrolled_window->window_placement = window_placement;
if (GTK_WIDGET (scrolled_window)->parent)
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
}
}
static void
gtk_scrolled_window_destroy (GtkObject *object)
@ -517,7 +533,14 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_widget_show (scrolled_window->hscrollbar);
child_allocation.x = viewport_allocation.x;
child_allocation.y = viewport_allocation.y + viewport_allocation.height + SCROLLBAR_SPACING (scrolled_window);
if (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT ||
scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT)
child_allocation.y = (viewport_allocation.y +
viewport_allocation.height +
SCROLLBAR_SPACING (scrolled_window));
else
child_allocation.y = GTK_CONTAINER (scrolled_window)->border_width;
child_allocation.width = viewport_allocation.width;
child_allocation.height = scrolled_window->hscrollbar->requisition.height;
child_allocation.x += allocation->x;
@ -525,18 +548,22 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (scrolled_window->hscrollbar, &child_allocation);
}
else
{
if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
gtk_widget_hide (scrolled_window->hscrollbar);
}
else if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
gtk_widget_hide (scrolled_window->hscrollbar);
if (scrolled_window->vscrollbar_visible)
{
if (!GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
gtk_widget_show (scrolled_window->vscrollbar);
child_allocation.x = viewport_allocation.x + viewport_allocation.width + SCROLLBAR_SPACING (scrolled_window);
if (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT ||
scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT)
child_allocation.x = (viewport_allocation.x +
viewport_allocation.width +
SCROLLBAR_SPACING (scrolled_window));
else
child_allocation.x = GTK_CONTAINER (scrolled_window)->border_width;
child_allocation.y = viewport_allocation.y;
child_allocation.width = scrolled_window->vscrollbar->requisition.width;
child_allocation.height = viewport_allocation.height;
@ -545,11 +572,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (scrolled_window->vscrollbar, &child_allocation);
}
else
{
if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
gtk_widget_hide (scrolled_window->vscrollbar);
}
else if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
gtk_widget_hide (scrolled_window->vscrollbar);
}
static void
@ -559,7 +583,6 @@ gtk_scrolled_window_add (GtkContainer *container,
GtkScrolledWindow *scrolled_window;
GtkArgInfo *info_hadj;
GtkArgInfo *info_vadj;
GtkArg arg;
gchar *error;
g_return_if_fail (container != NULL);
@ -694,11 +717,29 @@ gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
allocation->height = MAX (1, widget->allocation.height - allocation->y * 2);
if (scrolled_window->vscrollbar_visible)
allocation->width = MAX (1,
allocation->width - (scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window)));
{
if (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT ||
scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)
allocation->x += (scrolled_window->vscrollbar->requisition.width +
SCROLLBAR_SPACING (scrolled_window));
allocation->width =
MAX (1, allocation->width -
(scrolled_window->vscrollbar->requisition.width +
SCROLLBAR_SPACING (scrolled_window)));
}
if (scrolled_window->hscrollbar_visible)
allocation->height = MAX (1,
allocation->height - (scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window)));
{
if (scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT ||
scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)
allocation->y += (scrolled_window->hscrollbar->requisition.height +
SCROLLBAR_SPACING (scrolled_window));
allocation->height =
MAX (1, allocation->height -
(scrolled_window->hscrollbar->requisition.height +
SCROLLBAR_SPACING (scrolled_window)));
}
}
static void

View File

@ -53,6 +53,7 @@ struct _GtkScrolledWindow
guint vscrollbar_policy : 2;
guint hscrollbar_visible : 1;
guint vscrollbar_visible : 1;
guint window_placement : 2;
guint autogenerated_viewport : 1;
};
@ -75,7 +76,8 @@ GtkAdjustment* gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_
void gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
GtkPolicyType hscrollbar_policy,
GtkPolicyType vscrollbar_policy);
void gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
GtkCornerType window_placement);
#ifdef __cplusplus
}

View File

@ -4319,6 +4319,8 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
while (selection)
{
work = selection->data;
selection = selection->next;
if (GTK_CTREE_ROW (work)->is_leaf)
pages--;
else
@ -4343,7 +4345,6 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
}
gtk_ctree_remove_node (ctree, work);
selection = GTK_CLIST (ctree)->selection;
}
if (new_sel)
@ -4634,7 +4635,7 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
pixmap1, mask1, pixmap2, mask2,
FALSE, FALSE);
style = gtk_style_new();
style = gtk_style_new ();
switch (cur_depth % 3)
{
case 0:

View File

@ -4319,6 +4319,8 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
while (selection)
{
work = selection->data;
selection = selection->next;
if (GTK_CTREE_ROW (work)->is_leaf)
pages--;
else
@ -4343,7 +4345,6 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
}
gtk_ctree_remove_node (ctree, work);
selection = GTK_CLIST (ctree)->selection;
}
if (new_sel)
@ -4634,7 +4635,7 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
pixmap1, mask1, pixmap2, mask2,
FALSE, FALSE);
style = gtk_style_new();
style = gtk_style_new ();
switch (cur_depth % 3)
{
case 0: