corrects a small resize bug in the viewport widget. The viewport widget

* gtk/gtkviewport.c: corrects a small resize bug in the
          viewport widget.  The viewport widget provides a _set_shadow
          function to draw its shadows. But if GTK_SHADOW_NONE is sent
          to this function, the viewport isn't resized correctly (it's
          still considered as a shadowed widget).  (gtk-fortier-971213-0)

        * gtk/gtknotebook.c: this patch fixes the redraw problems of
          notebook tabs, without using gdk_gc_set_clip_rectangle.
          (gtk-hamann_jeske-971218-0)

        * add gtk_widget_(show/hide)_all (Stefan Wille)
          (gtk-wille-301297-0)  Patch for testgtk not included
          because it did not patch clean.

-Shawn
This commit is contained in:
Shawn Amundson 1998-01-02 20:22:38 +00:00
parent 0e9ff02e85
commit dc4e9e2fe1
15 changed files with 513 additions and 88 deletions

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -1,3 +1,19 @@
Fri Jan 2 12:07:33 CST 1998 Shawn T. Amundson <amundson@gimp.org>
* gtk/gtkviewport.c: corrects a small resize bug in the
viewport widget. The viewport widget provides a _set_shadow
function to draw its shadows. But if GTK_SHADOW_NONE is sent
to this function, the viewport isn't resized correctly (it's
still considered as a shadowed widget). (gtk-fortier-971213-0)
* gtk/gtknotebook.c: this patch fixes the redraw problems of
notebook tabs, without using gdk_gc_set_clip_rectangle.
(gtk-hamann_jeske-971218-0)
* add gtk_widget_(show/hide)_all (Stefan Wille)
(gtk-wille-301297-0) Patch for testgtk not included
because it did not patch clean.
Thu Jan 1 21:21:56 PST 1998 Manish Singh <yosh@gimp.org>
* configure.in: fixed up the xinput test
@ -11,6 +27,7 @@ Mon Dec 29 22:05:45 1997 Miguel de Icaza <miguel@nuclecu.unam.mx>
Sat Dec 27 20:39:99 1997 Elliot Lee <sopwith@redhat.com>
* gtk/gtkhandlebox.c: It mostly works now, please test it and make
fixes as needed.
Fri Dec 26 11:20:03 1997 Scott Goehring <scott@poverty.bloomington.in.us>
* gtk/Makefile.am (gtkinclude_HEADERS): added gtkhandlebox.c

View File

@ -83,6 +83,9 @@ static gint gtk_container_focus_move (GtkContainer *container,
GtkDirectionType direction);
static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget);
static gint container_signals[LAST_SIGNAL] = { 0 };
@ -168,6 +171,13 @@ gtk_container_class_init (GtkContainerClass *class)
gtk_object_class_add_signals (object_class, container_signals, LAST_SIGNAL);
/* Other container classes should overwrite show_all and hide_all,
unless they make all their children accessable
through gtk_container_foreach.
*/
widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_all;
class->need_resize = gtk_real_container_need_resize;
class->focus = gtk_real_container_focus;
}
@ -842,3 +852,39 @@ gtk_container_children_callback (GtkWidget *widget,
children = (GList**) client_data;
*children = g_list_prepend (*children, widget);
}
static void
gtk_container_show_all (GtkWidget *widget)
{
GtkContainer *container;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CONTAINER (widget));
container = GTK_CONTAINER (widget);
/* First show children, then self.
This makes sure that toplevel windows get shown as last widget.
Otherwise the user would see the widgets get
visible one after another.
*/
gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
gtk_widget_show (widget);
}
static void
gtk_container_hide_all (GtkWidget *widget)
{
GtkContainer *container;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CONTAINER (widget));
container = GTK_CONTAINER (widget);
/* First hide self, then children.
This is the reverse order of gtk_container_show_all.
*/
gtk_widget_hide (widget);
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
}

View File

@ -47,6 +47,8 @@ static gint gtk_menu_key_press (GtkWidget *widget,
GdkEventKey *event);
static gint gtk_menu_need_resize (GtkContainer *container);
static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
static void gtk_menu_show_all (GtkWidget *widget);
static void gtk_menu_hide_all (GtkWidget *widget);
guint
@ -93,7 +95,9 @@ gtk_menu_class_init (GtkMenuClass *class)
widget_class->expose_event = gtk_menu_expose;
widget_class->configure_event = gtk_menu_configure;
widget_class->key_press_event = gtk_menu_key_press;
widget_class->show_all = gtk_menu_show_all;
widget_class->hide_all = gtk_menu_hide_all;
container_class->need_resize = gtk_menu_need_resize;
menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
@ -732,3 +736,32 @@ gtk_menu_deactivate (GtkMenuShell *menu_shell)
if (parent)
gtk_menu_shell_deactivate (parent);
}
static void
gtk_menu_show_all (GtkWidget *widget)
{
GtkContainer *container;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU (widget));
container = GTK_CONTAINER (widget);
/* Show children, but not self. */
gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
}
static void
gtk_menu_hide_all (GtkWidget *widget)
{
GtkContainer *container;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU (widget));
container = GTK_CONTAINER (widget);
/* Hide children, but not self. */
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
}

View File

@ -65,6 +65,8 @@ static void gtk_menu_item_position_menu (GtkMenu *menu,
gint *x,
gint *y,
gpointer user_data);
static void gtk_menu_item_show_all (GtkWidget *widget);
static void gtk_menu_item_hide_all (GtkWidget *widget);
static GtkItemClass *parent_class;
static gint menu_item_signals[LAST_SIGNAL] = { 0 };
@ -127,6 +129,8 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
widget_class->expose_event = gtk_menu_item_expose;
widget_class->enter_notify_event = gtk_menu_item_enter;
widget_class->leave_notify_event = gtk_menu_item_leave;
widget_class->show_all = gtk_menu_item_show_all;
widget_class->hide_all = gtk_menu_item_hide_all;
item_class->select = gtk_real_menu_item_select;
item_class->deselect = gtk_real_menu_item_deselect;
@ -745,3 +749,40 @@ gtk_menu_item_right_justify(GtkMenuItem *menuitem)
menuitem->right_justify = 1;
}
static void
gtk_menu_item_show_all (GtkWidget *widget)
{
GtkContainer *container;
GtkMenuItem *menu_item;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
container = GTK_CONTAINER (widget);
menu_item = GTK_MENU_ITEM (widget);
/* Show children, traverse to submenu, show self. */
gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
if (menu_item->submenu)
gtk_widget_show_all (menu_item->submenu);
gtk_widget_show (widget);
}
static void
gtk_menu_item_hide_all (GtkWidget *widget)
{
GtkContainer *container;
GtkMenuItem *menu_item;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
container = GTK_CONTAINER (widget);
menu_item = GTK_MENU_ITEM (widget);
/* Reverse order of gtk_menu_item_show_all */
gtk_widget_hide (widget);
if (menu_item->submenu)
gtk_widget_hide_all (menu_item->submenu);
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
}

View File

@ -51,9 +51,6 @@ static void gtk_notebook_foreach (GtkContainer *container,
gpointer callback_data);
static void gtk_notebook_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page);
static void gtk_notebook_set_clip_rect (GtkNotebook *notebook,
GtkStateType state_type,
GdkRectangle *area);
static void gtk_notebook_draw_tab (GtkNotebook *notebook,
GtkNotebookPage *page,
GdkRectangle *area);
@ -738,11 +735,6 @@ gtk_notebook_paint (GtkWidget *widget,
{
notebook = GTK_NOTEBOOK (widget);
/* Set the clip rectangle here, so we don't overwrite things
* outside of exposed area when drawing shadows */
gtk_notebook_set_clip_rect (notebook, GTK_STATE_ACTIVE, area);
gtk_notebook_set_clip_rect (notebook, GTK_STATE_NORMAL, area);
gdk_window_clear_area (widget->window,
area->x, area->y,
area->width, area->height);
@ -874,9 +866,6 @@ gtk_notebook_paint (GtkWidget *widget,
x, y, width, height);
}
}
gtk_notebook_set_clip_rect (notebook, GTK_STATE_ACTIVE, NULL);
gtk_notebook_set_clip_rect (notebook, GTK_STATE_NORMAL, NULL);
}
}
@ -1071,18 +1060,6 @@ gtk_notebook_switch_page (GtkNotebook *notebook,
}
}
static void
gtk_notebook_set_clip_rect (GtkNotebook *notebook,
GtkStateType state_type,
GdkRectangle *area)
{
GtkWidget *widget = GTK_WIDGET (notebook);
gdk_gc_set_clip_rectangle (widget->style->bg_gc[state_type], area);
gdk_gc_set_clip_rectangle (widget->style->light_gc[state_type], area);
gdk_gc_set_clip_rectangle (widget->style->dark_gc[state_type], area);
gdk_gc_set_clip_rectangle (widget->style->black_gc, area);
}
static void
gtk_notebook_draw_tab (GtkNotebook *notebook,
@ -1093,7 +1070,8 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
GdkRectangle page_area;
GtkStateType state_type;
GdkPoint points[6];
gint n;
g_return_if_fail (notebook != NULL);
g_return_if_fail (page != NULL);
g_return_if_fail (area != NULL);
@ -1105,101 +1083,206 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
if (gdk_rectangle_intersect (&page_area, area, &child_area))
{
GtkWidget *widget;
switch (notebook->tab_pos)
{
case GTK_POS_TOP:
points[0].x = page->allocation.x + page->allocation.width - 1;
points[0].y = page->allocation.y + page->allocation.height - 1;
if( child_area.x + child_area.width >
page->allocation.x + page->allocation.width - TAB_OVERLAP )
{
points[0].x = page->allocation.x + page->allocation.width - 1;
points[0].y = page->allocation.y + page->allocation.height - 1;
points[1].x = page->allocation.x + page->allocation.width - 1;
points[1].y = page->allocation.y + TAB_CURVATURE;
points[1].x = page->allocation.x + page->allocation.width - 1;
points[1].y = page->allocation.y + TAB_CURVATURE;
points[2].x = page->allocation.x + page->allocation.width - TAB_CURVATURE - 1;
points[2].y = page->allocation.y;
points[2].x = page->allocation.x + page->allocation.width
- TAB_CURVATURE - 1;
points[2].y = page->allocation.y;
n = 3;
}
else
{
points[0].x = page->allocation.x + page->allocation.width
- TAB_OVERLAP - 1;
points[0].y = page->allocation.y;
n = 1;
}
if( (child_area.x < page->allocation.x + TAB_OVERLAP) &&
(page == notebook->cur_page ||
page == (GtkNotebookPage *)(notebook->children->data)) )
{
points[n].x = page->allocation.x + TAB_CURVATURE;
points[n++].y = page->allocation.y;
points[n].x = page->allocation.x;
points[n++].y = page->allocation.y + TAB_CURVATURE;
points[3].x = page->allocation.x + TAB_CURVATURE;
points[3].y = page->allocation.y;
points[4].x = page->allocation.x;
points[4].y = page->allocation.y + TAB_CURVATURE;
points[5].x = page->allocation.x;
points[5].y = page->allocation.y + page->allocation.height - 1;
points[n].x = page->allocation.x;
points[n++].y = page->allocation.y + page->allocation.height - 1;
}
else
{
points[n].x = page->allocation.x + TAB_OVERLAP;
points[n++].y = page->allocation.y;
}
break;
case GTK_POS_BOTTOM:
points[0].x = page->allocation.x;
points[0].y = page->allocation.y;
if( (child_area.x < page->allocation.x + TAB_OVERLAP) &&
(page == notebook->cur_page ||
page == (GtkNotebookPage *)(notebook->children->data)) )
{
points[0].x = page->allocation.x;
points[0].y = page->allocation.y;
points[1].x = page->allocation.x;
points[1].y = page->allocation.y + page->allocation.height - TAB_CURVATURE - 1;
points[1].x = page->allocation.x;
points[1].y = page->allocation.y + page->allocation.height
- TAB_CURVATURE - 1;
points[2].x = page->allocation.x + TAB_CURVATURE;
points[2].y = page->allocation.y + page->allocation.height - 1;
points[2].x = page->allocation.x + TAB_CURVATURE;
points[2].y = page->allocation.y + page->allocation.height - 1;
n = 3;
}
else
{
points[0].x = page->allocation.x + TAB_OVERLAP;
points[0].y = page->allocation.y + page->allocation.height - 1;
n = 1;
}
points[3].x = page->allocation.x + page->allocation.width - TAB_CURVATURE - 1;
points[3].y = page->allocation.y + page->allocation.height - 1;
if( child_area.x + child_area.width >
page->allocation.x + page->allocation.width - TAB_OVERLAP )
{
points[n].x = page->allocation.x + page->allocation.width
- TAB_CURVATURE - 1;
points[n++].y = page->allocation.y + page->allocation.height - 1;
points[4].x = page->allocation.x + page->allocation.width - 1;
points[4].y = page->allocation.y + page->allocation.height - TAB_CURVATURE - 1;
points[5].x = page->allocation.x + page->allocation.width - 1;
points[5].y = page->allocation.y;
points[n].x = page->allocation.x + page->allocation.width - 1;
points[n++].y = page->allocation.y + page->allocation.height
- TAB_CURVATURE - 1;
points[n].x = page->allocation.x + page->allocation.width - 1;
points[n++].y = page->allocation.y;
}
else
{
points[n].x = page->allocation.x + page->allocation.width
- TAB_OVERLAP - 1;
points[n++].y = page->allocation.y + page->allocation.height - 1;
}
break;
case GTK_POS_LEFT:
points[0].x = page->allocation.x + page->allocation.width - 1;
points[0].y = page->allocation.y;
if( (child_area.y < page->allocation.y + TAB_OVERLAP) &&
(page == notebook->cur_page ||
page == (GtkNotebookPage *)(notebook->children->data)) )
{
points[0].x = page->allocation.x + page->allocation.width - 1;
points[0].y = page->allocation.y;
points[1].x = page->allocation.x + TAB_CURVATURE;
points[1].y = page->allocation.y;
points[1].x = page->allocation.x + TAB_CURVATURE;
points[1].y = page->allocation.y;
points[2].x = page->allocation.x;
points[2].y = page->allocation.y + TAB_CURVATURE;
n = 3;
}
else
{
points[0].x = page->allocation.x;
points[0].y = page->allocation.y + TAB_OVERLAP;
n = 1;
}
points[2].x = page->allocation.x;
points[2].y = page->allocation.y + TAB_CURVATURE;
if( child_area.y + child_area.height >
page->allocation.y + page->allocation.height - TAB_OVERLAP )
{
points[n].x = page->allocation.x;
points[n++].y = page->allocation.y + page->allocation.height
- TAB_CURVATURE - 1;
points[3].x = page->allocation.x;
points[3].y = page->allocation.y + page->allocation.height - TAB_CURVATURE - 1;
points[n].x = page->allocation.x + TAB_CURVATURE;
points[n++].y = page->allocation.y + page->allocation.height - 1;
points[4].x = page->allocation.x + TAB_CURVATURE;
points[4].y = page->allocation.y + page->allocation.height - 1;
points[5].x = page->allocation.x + page->allocation.width - 1;
points[5].y = page->allocation.y + page->allocation.height - 1;
points[n].x = page->allocation.x + page->allocation.width - 1;
points[n++].y = page->allocation.y + page->allocation.height - 1;
}
else
{
points[n].x = page->allocation.x;
points[n++].y = page->allocation.y + page->allocation.height
- TAB_OVERLAP - 1;
}
break;
case GTK_POS_RIGHT:
points[0].x = page->allocation.x;
points[0].y = page->allocation.y + page->allocation.height - 1;
if( child_area.y + child_area.height >
page->allocation.y + page->allocation.height - TAB_OVERLAP )
{
points[0].x = page->allocation.x;
points[0].y = page->allocation.y + page->allocation.height - 1;
points[1].x = page->allocation.x + page->allocation.width - TAB_CURVATURE - 1;
points[1].y = page->allocation.y + page->allocation.height - 1;
points[1].x = page->allocation.x + page->allocation.width
- TAB_CURVATURE - 1;
points[1].y = page->allocation.y + page->allocation.height - 1;
points[2].x = page->allocation.x + page->allocation.width - 1;
points[2].y = page->allocation.y + page->allocation.height
- TAB_CURVATURE - 1;
n = 3;
}
else
{
points[0].x = page->allocation.x + page->allocation.width - 1;
points[0].y = page->allocation.y + page->allocation.height
- TAB_OVERLAP - 1;
n = 1;
}
points[2].x = page->allocation.x + page->allocation.width - 1;
points[2].y = page->allocation.y + page->allocation.height - TAB_CURVATURE - 1;
if( (child_area.y < page->allocation.y + TAB_OVERLAP) &&
(page == notebook->cur_page ||
page == (GtkNotebookPage *)(notebook->children->data)) )
{
points[n].x = page->allocation.x + page->allocation.width - 1;
points[n++].y = page->allocation.y + TAB_CURVATURE;
points[3].x = page->allocation.x + page->allocation.width - 1;
points[3].y = page->allocation.y + TAB_CURVATURE;
points[n].x = page->allocation.x + page->allocation.width
- TAB_CURVATURE - 1;
points[n++].y = page->allocation.y;
points[4].x = page->allocation.x + page->allocation.width - TAB_CURVATURE - 1;
points[4].y = page->allocation.y;
points[5].x = page->allocation.x;
points[5].y = page->allocation.y;
points[n].x = page->allocation.x;
points[n++].y = page->allocation.y;
}
else
{
points[n].x = page->allocation.x + page->allocation.width - 1;
points[n++].y = page->allocation.y + TAB_OVERLAP;
}
break;
}
widget = GTK_WIDGET(notebook);
if (notebook->cur_page == page)
state_type = GTK_STATE_NORMAL;
else
state_type = GTK_STATE_ACTIVE;
gtk_draw_polygon (GTK_WIDGET (notebook)->style,
GTK_WIDGET (notebook)->window,
state_type, GTK_SHADOW_OUT,
points, 6, (notebook->cur_page != page));
else
{
state_type = GTK_STATE_ACTIVE;
gdk_draw_rectangle (widget->window, widget->style->bg_gc[state_type],
TRUE, child_area.x, child_area.y,
child_area.width, child_area.height);
}
gtk_draw_polygon (widget->style, widget->window, state_type,
GTK_SHADOW_OUT, points, n, FALSE);
if (gtk_widget_intersect (page->tab_label, area, &child_area))
gtk_widget_draw (page->tab_label, &child_area);
}
}
static void
gtk_notebook_pages_allocate (GtkNotebook *notebook,
GtkAllocation *allocation)

View File

@ -54,6 +54,8 @@ static void gtk_option_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gpointer user_data);
static void gtk_option_menu_show_all (GtkWidget *widget);
static void gtk_option_menu_hide_all (GtkWidget *widget);
static GtkButtonClass *parent_class = NULL;
@ -103,6 +105,8 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class)
widget_class->size_allocate = gtk_option_menu_size_allocate;
widget_class->expose_event = gtk_option_menu_expose;
widget_class->button_press_event = gtk_option_menu_button_press;
widget_class->show_all = gtk_option_menu_show_all;
widget_class->hide_all = gtk_option_menu_hide_all;
}
static void
@ -583,3 +587,38 @@ gtk_option_menu_position (GtkMenu *menu,
*x = menu_xpos;
*y = menu_ypos;
}
static void
gtk_option_menu_show_all (GtkWidget *widget)
{
GtkContainer *container;
GtkOptionMenu *option_menu;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
container = GTK_CONTAINER (widget);
option_menu = GTK_OPTION_MENU (widget);
gtk_widget_show (widget);
gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
if (option_menu->menu)
gtk_widget_show_all (option_menu->menu);
if (option_menu->menu_item)
gtk_widget_show_all (option_menu->menu_item);
}
static void
gtk_option_menu_hide_all (GtkWidget *widget)
{
GtkContainer *container;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
container = GTK_CONTAINER (widget);
gtk_widget_hide (widget);
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
}

View File

@ -466,10 +466,16 @@ gtk_viewport_size_allocate (GtkWidget *widget,
viewport = GTK_VIEWPORT (widget);
bin = GTK_BIN (widget);
child_allocation.x = GTK_WIDGET (viewport)->style->klass->xthickness;
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
if (viewport->shadow_type != GTK_SHADOW_NONE)
{
child_allocation.x = GTK_WIDGET (viewport)->style->klass->xthickness;
child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
}
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.height = allocation->height - child_allocation.y * 2;
if (GTK_WIDGET_REALIZED (widget))

View File

@ -596,6 +596,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->activate_signal = 0;
klass->show = gtk_real_widget_show;
klass->hide = gtk_real_widget_hide;
klass->show_all = gtk_real_widget_show;
klass->hide_all = gtk_real_widget_hide;
klass->map = gtk_real_widget_map;
klass->unmap = gtk_real_widget_unmap;
klass->realize = gtk_real_widget_realize;
@ -1009,6 +1011,58 @@ gtk_widget_hide (GtkWidget *widget)
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
}
/*****************************************
* gtk_widget_show_all:
*
* Shows the widget and all children.
*
* Container classes overwrite
* show_all and hide_all to call
* show_all (hide_all) on both themselves
* and on their child widgets.
*
* arguments:
*
* results:
*****************************************/
void
gtk_widget_show_all (GtkWidget *widget)
{
GtkWidgetClass *widget_class;
g_return_if_fail (widget != NULL);
/* show_all shouldn't be invoked through a signal,
because in this case it would be quite slow - there would
be a show and show_all signal emitted for every child widget.
*/
widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
widget_class->show_all (widget);
}
/*****************************************
* gtk_widget_hide_all:
*
* Hides the widget and all children.
* See gtk_widget_show_all.
*
* arguments:
*
* results:
*****************************************/
void
gtk_widget_hide_all (GtkWidget *widget)
{
GtkWidgetClass *widget_class;
g_return_if_fail (widget != NULL);
widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
widget_class->hide_all (widget);
}
/*****************************************
* gtk_widget_map:
*

View File

@ -243,6 +243,8 @@ struct _GtkWidgetClass
/* basics */
void (* show) (GtkWidget *widget);
void (* hide) (GtkWidget *widget);
void (* show_all) (GtkWidget *widget);
void (* hide_all) (GtkWidget *widget);
void (* map) (GtkWidget *widget);
void (* unmap) (GtkWidget *widget);
void (* realize) (GtkWidget *widget);
@ -362,6 +364,8 @@ void gtk_widget_destroy (GtkWidget *widget);
void gtk_widget_unparent (GtkWidget *widget);
void gtk_widget_show (GtkWidget *widget);
void gtk_widget_hide (GtkWidget *widget);
void gtk_widget_show_all (GtkWidget *widget);
void gtk_widget_hide_all (GtkWidget *widget);
void gtk_widget_map (GtkWidget *widget);
void gtk_widget_unmap (GtkWidget *widget);
void gtk_widget_realize (GtkWidget *widget);