1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
1997-12-18 02:17:14 +00:00
|
|
|
#include <stdio.h>
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtkwidget.h"
|
1998-12-15 18:48:19 +00:00
|
|
|
#include "gtkwindow.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtksignal.h"
|
|
|
|
#include "gtkstyle.h"
|
|
|
|
#include "gtktooltips.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_DELAY 500 /* Default delay in ms */
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
static void gtk_tooltips_class_init (GtkTooltipsClass *klass);
|
|
|
|
static void gtk_tooltips_init (GtkTooltips *tooltips);
|
|
|
|
static void gtk_tooltips_destroy (GtkObject *object);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static gint gtk_tooltips_event_handler (GtkWidget *widget,
|
|
|
|
GdkEvent *event);
|
|
|
|
static void gtk_tooltips_widget_unmap (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gtk_tooltips_widget_remove (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gtk_tooltips_set_active_widget (GtkTooltips *tooltips,
|
|
|
|
GtkWidget *widget);
|
|
|
|
static gint gtk_tooltips_timeout (gpointer data);
|
1998-11-06 22:05:02 +00:00
|
|
|
static gint gtk_tooltips_expose (GtkTooltips *tooltips,
|
|
|
|
GdkEventExpose *event);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_tooltips_draw_tips (GtkTooltips *tooltips);
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
static GtkDataClass *parent_class;
|
1998-02-18 02:40:08 +00:00
|
|
|
static const gchar *tooltips_data_key = "_GtkTooltipsData";
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_tooltips_get_type (void)
|
1998-01-30 23:47:09 +00:00
|
|
|
{
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
static GtkType tooltips_type = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
if (!tooltips_type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo tooltips_info =
|
1998-01-30 23:47:09 +00:00
|
|
|
{
|
|
|
|
"GtkTooltips",
|
|
|
|
sizeof (GtkTooltips),
|
|
|
|
sizeof (GtkTooltipsClass),
|
|
|
|
(GtkClassInitFunc) gtk_tooltips_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_tooltips_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1998-01-30 23:47:09 +00:00
|
|
|
};
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
tooltips_type = gtk_type_unique (GTK_TYPE_DATA, &tooltips_info);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
return tooltips_type;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
static void
|
|
|
|
gtk_tooltips_class_init (GtkTooltipsClass *class)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
GtkObjectClass *object_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) class;
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_DATA);
|
1998-01-30 23:47:09 +00:00
|
|
|
|
|
|
|
object_class->destroy = gtk_tooltips_destroy;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
static void
|
|
|
|
gtk_tooltips_init (GtkTooltips *tooltips)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
tooltips->tip_window = NULL;
|
|
|
|
tooltips->active_tips_data = NULL;
|
|
|
|
tooltips->tips_data_list = NULL;
|
1998-01-30 23:47:09 +00:00
|
|
|
tooltips->gc = NULL;
|
|
|
|
tooltips->foreground = NULL;
|
|
|
|
tooltips->background = NULL;
|
1998-03-11 02:41:15 +00:00
|
|
|
|
|
|
|
tooltips->delay = DEFAULT_DELAY;
|
|
|
|
tooltips->enabled = TRUE;
|
|
|
|
tooltips->timer_tag = 0;
|
1998-01-30 23:47:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkTooltips *
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_tooltips_new (void)
|
1998-01-30 23:47:09 +00:00
|
|
|
{
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
return gtk_type_new (GTK_TYPE_TOOLTIPS);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
static void
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_tooltips_free_string (gpointer data, gpointer user_data)
|
|
|
|
{
|
|
|
|
if (data)
|
|
|
|
g_free (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_tooltips_destroy_data (GtkTooltipsData *tooltipsdata)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-02-18 02:40:08 +00:00
|
|
|
g_free (tooltipsdata->tip_text);
|
|
|
|
g_free (tooltipsdata->tip_private);
|
1999-01-22 17:23:55 +00:00
|
|
|
if (tooltipsdata->row)
|
|
|
|
{
|
|
|
|
g_list_foreach (tooltipsdata->row, gtk_tooltips_free_string, 0);
|
|
|
|
g_list_free (tooltipsdata->row);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (tooltipsdata->widget),
|
1998-01-30 23:47:09 +00:00
|
|
|
(gpointer) tooltipsdata);
|
1998-02-18 02:40:08 +00:00
|
|
|
gtk_object_remove_data (GTK_OBJECT (tooltipsdata->widget), tooltips_data_key);
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_widget_unref (tooltipsdata->widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
g_free (tooltipsdata);
|
|
|
|
}
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
static void
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_tooltips_destroy (GtkObject *object)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
GtkTooltips *tooltips = GTK_TOOLTIPS (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
GList *current;
|
|
|
|
GtkTooltipsData *tooltipsdata;
|
|
|
|
|
|
|
|
g_return_if_fail (tooltips != NULL);
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
if (tooltips->timer_tag)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gtk_timeout_remove (tooltips->timer_tag);
|
1998-03-11 02:41:15 +00:00
|
|
|
tooltips->timer_tag = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
if (tooltips->tips_data_list != NULL)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
current = g_list_first (tooltips->tips_data_list);
|
1997-11-24 22:37:52 +00:00
|
|
|
while (current != NULL)
|
|
|
|
{
|
|
|
|
tooltipsdata = (GtkTooltipsData*) current->data;
|
|
|
|
current = current->next;
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
if (tooltips->tip_window)
|
|
|
|
gtk_widget_destroy (tooltips->tip_window);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (tooltips->gc != NULL)
|
1998-01-30 23:47:09 +00:00
|
|
|
{
|
|
|
|
gdk_gc_destroy (tooltips->gc);
|
|
|
|
tooltips->gc = NULL;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
void
|
|
|
|
gtk_tooltips_force_window (GtkTooltips *tooltips)
|
1997-12-05 04:27:44 +00:00
|
|
|
{
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
g_return_if_fail (tooltips != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
|
|
|
|
|
|
|
|
if (!tooltips->tip_window)
|
|
|
|
{
|
1998-12-15 18:48:19 +00:00
|
|
|
tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
|
1998-12-16 06:03:14 +00:00
|
|
|
gtk_widget_set_app_paintable (tooltips->tip_window, TRUE);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE);
|
1999-01-09 19:02:06 +00:00
|
|
|
gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips");
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_signal_connect_object (GTK_OBJECT (tooltips->tip_window),
|
|
|
|
"expose_event",
|
|
|
|
GTK_SIGNAL_FUNC (gtk_tooltips_expose),
|
|
|
|
GTK_OBJECT (tooltips));
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (tooltips->tip_window),
|
|
|
|
"destroy",
|
|
|
|
gtk_widget_destroyed,
|
|
|
|
&tooltips->tip_window);
|
|
|
|
}
|
1997-12-05 04:27:44 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_tooltips_layout_text (GtkTooltips *tooltips, GtkTooltipsData *data)
|
|
|
|
{
|
|
|
|
gchar *row_end, *text, *row_text, *break_pos;
|
|
|
|
gint i, row_width, window_width = 0;
|
|
|
|
size_t len;
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
if (!tooltips->tip_window)
|
|
|
|
gtk_tooltips_force_window (tooltips);
|
1997-12-05 04:27:44 +00:00
|
|
|
|
1999-01-22 17:23:55 +00:00
|
|
|
if (data->row)
|
|
|
|
{
|
|
|
|
g_list_foreach (data->row, gtk_tooltips_free_string, 0);
|
|
|
|
g_list_free (data->row);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
data->row = 0;
|
1997-12-05 04:27:44 +00:00
|
|
|
data->font = tooltips->tip_window->style->font;
|
1997-11-24 22:37:52 +00:00
|
|
|
data->width = 0;
|
|
|
|
|
1998-02-18 02:40:08 +00:00
|
|
|
text = data->tip_text;
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!text)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (*text)
|
|
|
|
{
|
|
|
|
row_end = strchr (text, '\n');
|
|
|
|
if (!row_end)
|
|
|
|
row_end = strchr (text, '\0');
|
|
|
|
|
|
|
|
len = row_end - text + 1;
|
|
|
|
row_text = g_new(gchar, len);
|
|
|
|
memcpy (row_text, text, len - 1);
|
|
|
|
row_text[len - 1] = '\0';
|
|
|
|
|
|
|
|
/* now either adjust the window's width or shorten the row until
|
|
|
|
it fits in the window */
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
row_width = gdk_string_width (data->font, row_text);
|
|
|
|
if (!window_width)
|
|
|
|
{
|
|
|
|
/* make an initial guess at window's width: */
|
|
|
|
|
|
|
|
if (row_width > gdk_screen_width () / 4)
|
|
|
|
window_width = gdk_screen_width () / 4;
|
|
|
|
else
|
|
|
|
window_width = row_width;
|
|
|
|
}
|
|
|
|
if (row_width <= window_width)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (strchr (row_text, ' '))
|
|
|
|
{
|
|
|
|
/* the row is currently too wide, but we have blanks in
|
|
|
|
the row so we can break it into smaller pieces */
|
|
|
|
|
|
|
|
gint avg_width = row_width / strlen (row_text);
|
|
|
|
|
|
|
|
i = window_width;
|
|
|
|
if (avg_width)
|
|
|
|
i /= avg_width;
|
|
|
|
if ((size_t) i >= len)
|
|
|
|
i = len - 1;
|
|
|
|
|
|
|
|
break_pos = strchr (row_text + i, ' ');
|
|
|
|
if (!break_pos)
|
|
|
|
{
|
|
|
|
break_pos = row_text + i;
|
|
|
|
while (*--break_pos != ' ');
|
|
|
|
}
|
|
|
|
*break_pos = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* we can't break this row into any smaller pieces, so
|
|
|
|
we have no choice but to widen the window: */
|
|
|
|
|
|
|
|
window_width = row_width;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (row_width > data->width)
|
|
|
|
data->width = row_width;
|
|
|
|
data->row = g_list_append (data->row, row_text);
|
|
|
|
text += strlen (row_text);
|
|
|
|
if (!*text)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (text[0] == '\n' && text[1])
|
|
|
|
/* end of paragraph and there is more text to come */
|
|
|
|
data->row = g_list_append (data->row, 0);
|
|
|
|
++text; /* skip blank or newline */
|
|
|
|
}
|
|
|
|
data->width += 8; /* leave some border */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_tooltips_enable (GtkTooltips *tooltips)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tooltips != NULL);
|
|
|
|
|
|
|
|
tooltips->enabled = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_tooltips_disable (GtkTooltips *tooltips)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tooltips != NULL);
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
gtk_tooltips_set_active_widget (tooltips, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
tooltips->enabled = FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_tooltips_set_delay (GtkTooltips *tooltips,
|
1998-03-11 02:41:15 +00:00
|
|
|
guint delay)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (tooltips != NULL);
|
|
|
|
|
|
|
|
tooltips->delay = delay;
|
|
|
|
}
|
|
|
|
|
1998-02-18 02:40:08 +00:00
|
|
|
GtkTooltipsData*
|
|
|
|
gtk_tooltips_data_get (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, NULL);
|
|
|
|
|
|
|
|
return gtk_object_get_data ((GtkObject*) widget, tooltips_data_key);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
1998-02-18 02:40:08 +00:00
|
|
|
gtk_tooltips_set_tip (GtkTooltips *tooltips,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *tip_text,
|
|
|
|
const gchar *tip_private)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkTooltipsData *tooltipsdata;
|
|
|
|
|
|
|
|
g_return_if_fail (tooltips != NULL);
|
1998-02-18 02:40:08 +00:00
|
|
|
g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
|
1998-02-18 02:40:08 +00:00
|
|
|
tooltipsdata = gtk_tooltips_data_get (widget);
|
1998-01-30 23:47:09 +00:00
|
|
|
if (tooltipsdata)
|
|
|
|
gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-02-18 02:40:08 +00:00
|
|
|
if (!tip_text)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tooltipsdata = g_new0 (GtkTooltipsData, 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (tooltipsdata != NULL)
|
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
tooltipsdata->tooltips = tooltips;
|
1997-11-24 22:37:52 +00:00
|
|
|
tooltipsdata->widget = widget;
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_widget_ref (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-02-18 02:40:08 +00:00
|
|
|
tooltipsdata->tip_text = g_strdup (tip_text);
|
|
|
|
tooltipsdata->tip_private = g_strdup (tip_private);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_tooltips_layout_text (tooltips, tooltipsdata);
|
1998-03-11 02:41:15 +00:00
|
|
|
tooltips->tips_data_list = g_list_append (tooltips->tips_data_list,
|
1997-11-24 22:37:52 +00:00
|
|
|
tooltipsdata);
|
|
|
|
gtk_signal_connect_after(GTK_OBJECT (widget), "event",
|
|
|
|
(GtkSignalFunc) gtk_tooltips_event_handler,
|
1998-01-30 23:47:09 +00:00
|
|
|
(gpointer) tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-02-18 02:40:08 +00:00
|
|
|
gtk_object_set_data (GTK_OBJECT (widget), tooltips_data_key,
|
1998-01-30 23:47:09 +00:00
|
|
|
(gpointer) tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (widget), "unmap",
|
|
|
|
(GtkSignalFunc) gtk_tooltips_widget_unmap,
|
1998-01-30 23:47:09 +00:00
|
|
|
(gpointer) tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (widget), "unrealize",
|
|
|
|
(GtkSignalFunc) gtk_tooltips_widget_unmap,
|
1998-01-30 23:47:09 +00:00
|
|
|
(gpointer) tooltipsdata);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (widget), "destroy",
|
|
|
|
(GtkSignalFunc) gtk_tooltips_widget_remove,
|
|
|
|
(gpointer) tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_tooltips_set_colors (GtkTooltips *tooltips,
|
|
|
|
GdkColor *background,
|
|
|
|
GdkColor *foreground)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tooltips != NULL);
|
|
|
|
|
|
|
|
if (background != NULL)
|
|
|
|
tooltips->foreground = foreground;
|
|
|
|
if (foreground != NULL)
|
|
|
|
tooltips->background = background;
|
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
static gint
|
|
|
|
gtk_tooltips_expose (GtkTooltips *tooltips, GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
GtkStyle *style;
|
|
|
|
gint y, baseline_skip, gap;
|
|
|
|
GtkTooltipsData *data;
|
|
|
|
GList *el;
|
|
|
|
|
|
|
|
style = tooltips->tip_window->style;
|
|
|
|
|
|
|
|
gap = (style->font->ascent + style->font->descent) / 4;
|
|
|
|
if (gap < 2)
|
|
|
|
gap = 2;
|
|
|
|
baseline_skip = style->font->ascent + style->font->descent + gap;
|
|
|
|
|
|
|
|
data = tooltips->active_tips_data;
|
|
|
|
if (!data)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
gtk_paint_flat_box(style, tooltips->tip_window->window,
|
|
|
|
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
|
|
|
NULL, GTK_WIDGET(tooltips->tip_window), "tooltip",
|
|
|
|
0, 0, -1, -1);
|
|
|
|
|
|
|
|
y = style->font->ascent + 4;
|
|
|
|
|
|
|
|
for (el = data->row; el; el = el->next)
|
|
|
|
{
|
|
|
|
if (el->data)
|
|
|
|
{
|
|
|
|
gtk_paint_string (style, tooltips->tip_window->window,
|
|
|
|
GTK_STATE_NORMAL,
|
|
|
|
NULL, GTK_WIDGET(tooltips->tip_window), "tooltip",
|
|
|
|
4, y, el->data);
|
|
|
|
y += baseline_skip;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
y += baseline_skip / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_tooltips_draw_tips (GtkTooltips * tooltips)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
1997-12-05 04:27:44 +00:00
|
|
|
GtkStyle *style;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint gap, x, y, w, h, scr_w, scr_h, baseline_skip;
|
|
|
|
GtkTooltipsData *data;
|
|
|
|
GList *el;
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
if (!tooltips->tip_window)
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
gtk_tooltips_force_window (tooltips);
|
1998-03-11 02:41:15 +00:00
|
|
|
else if (GTK_WIDGET_VISIBLE (tooltips->tip_window))
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_hide (tooltips->tip_window);
|
|
|
|
|
1997-12-05 04:27:44 +00:00
|
|
|
style = tooltips->tip_window->style;
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
widget = tooltips->active_tips_data->widget;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
scr_w = gdk_screen_width ();
|
|
|
|
scr_h = gdk_screen_height ();
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
data = tooltips->active_tips_data;
|
1997-11-24 22:37:52 +00:00
|
|
|
if (data->font != style->font)
|
|
|
|
gtk_tooltips_layout_text (tooltips, data);
|
|
|
|
|
|
|
|
gap = (style->font->ascent + style->font->descent) / 4;
|
|
|
|
if (gap < 2)
|
|
|
|
gap = 2;
|
|
|
|
baseline_skip = style->font->ascent + style->font->descent + gap;
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
w = data->width;
|
|
|
|
h = 8 - gap;
|
|
|
|
for (el = data->row; el; el = el->next)
|
|
|
|
if (el->data)
|
|
|
|
h += baseline_skip;
|
|
|
|
else
|
|
|
|
h += baseline_skip / 2;
|
|
|
|
if (h < 8)
|
|
|
|
h = 8;
|
|
|
|
|
|
|
|
gdk_window_get_pointer (NULL, &x, NULL, NULL);
|
|
|
|
gdk_window_get_origin (widget->window, NULL, &y);
|
1999-01-17 03:49:31 +00:00
|
|
|
if (GTK_WIDGET_NO_WINDOW (widget))
|
|
|
|
y += widget->allocation.y;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
x -= ((w >> 1) + 4);
|
|
|
|
|
|
|
|
if ((x + w) > scr_w)
|
|
|
|
x -= (x + w) - scr_w;
|
|
|
|
else if (x < 0)
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
if ((y + h + widget->allocation.height + 4) > scr_h)
|
|
|
|
y = y - h - 4;
|
|
|
|
else
|
|
|
|
y = y + widget->allocation.height + 4;
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_widget_set_usize (tooltips->tip_window, w, h);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_popup (tooltips->tip_window, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_tooltips_timeout (gpointer data)
|
|
|
|
{
|
|
|
|
GtkTooltips *tooltips = (GtkTooltips *) data;
|
|
|
|
|
1998-12-16 20:09:30 +00:00
|
|
|
GDK_THREADS_ENTER ();
|
1998-12-15 07:32:11 +00:00
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
if (tooltips->active_tips_data != NULL &&
|
|
|
|
GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_tooltips_draw_tips (tooltips);
|
|
|
|
|
1998-12-16 20:09:30 +00:00
|
|
|
GDK_THREADS_LEAVE ();
|
1998-12-15 07:32:11 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tooltips_set_active_widget (GtkTooltips *tooltips,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
if (tooltips->tip_window)
|
|
|
|
gtk_widget_hide (tooltips->tip_window);
|
|
|
|
if (tooltips->timer_tag)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
gtk_timeout_remove (tooltips->timer_tag);
|
|
|
|
tooltips->timer_tag = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
tooltips->active_tips_data = NULL;
|
|
|
|
|
|
|
|
if (widget)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = tooltips->tips_data_list; list; list = list->next)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
GtkTooltipsData *tooltipsdata;
|
|
|
|
|
|
|
|
tooltipsdata = list->data;
|
|
|
|
|
|
|
|
if (tooltipsdata->widget == widget &&
|
|
|
|
GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
tooltips->active_tips_data = tooltipsdata;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_tooltips_event_handler (GtkWidget *widget,
|
|
|
|
GdkEvent *event)
|
|
|
|
{
|
|
|
|
GtkTooltips *tooltips;
|
1998-03-11 02:41:15 +00:00
|
|
|
GtkTooltipsData *old_tips_data;
|
1998-02-18 02:40:08 +00:00
|
|
|
GtkWidget *event_widget;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if ((event->type == GDK_LEAVE_NOTIFY || event->type == GDK_ENTER_NOTIFY) &&
|
|
|
|
event->crossing.detail == GDK_NOTIFY_INFERIOR)
|
1998-03-11 02:41:15 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
event_widget = gtk_get_event_widget (event);
|
|
|
|
if (event_widget != widget)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
old_tips_data = gtk_tooltips_data_get (widget);
|
|
|
|
tooltips = old_tips_data->tooltips;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
switch (event->type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
case GDK_MOTION_NOTIFY:
|
1998-04-11 03:54:34 +00:00
|
|
|
case GDK_EXPOSE:
|
1998-03-11 02:41:15 +00:00
|
|
|
/* do nothing */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
old_tips_data = tooltips->active_tips_data;
|
|
|
|
if (tooltips->enabled &&
|
|
|
|
(!old_tips_data || old_tips_data->widget != widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-11 02:41:15 +00:00
|
|
|
gtk_tooltips_set_active_widget (tooltips, widget);
|
|
|
|
|
|
|
|
tooltips->timer_tag = gtk_timeout_add (tooltips->delay,
|
|
|
|
gtk_tooltips_timeout,
|
|
|
|
(gpointer) tooltips);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-03-11 02:41:15 +00:00
|
|
|
break;
|
1998-02-18 02:40:08 +00:00
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
default:
|
|
|
|
gtk_tooltips_set_active_widget (tooltips, NULL);
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-11 02:41:15 +00:00
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tooltips_widget_unmap (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
GtkTooltipsData *tooltipsdata = (GtkTooltipsData *)data;
|
|
|
|
GtkTooltips *tooltips = tooltipsdata->tooltips;
|
1998-03-11 02:41:15 +00:00
|
|
|
|
|
|
|
if (tooltips->active_tips_data &&
|
|
|
|
(tooltips->active_tips_data->widget == widget))
|
|
|
|
gtk_tooltips_set_active_widget (tooltips, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tooltips_widget_remove (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
1998-02-18 02:40:08 +00:00
|
|
|
GtkTooltipsData *tooltipsdata = (GtkTooltipsData*) data;
|
1998-01-30 23:47:09 +00:00
|
|
|
GtkTooltips *tooltips = tooltipsdata->tooltips;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
gtk_tooltips_widget_unmap (widget, data);
|
1998-03-11 02:41:15 +00:00
|
|
|
tooltips->tips_data_list = g_list_remove (tooltips->tips_data_list,
|
|
|
|
tooltipsdata);
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_tooltips_destroy_data (tooltipsdata);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|