gtk2/gtk/gtkoptionmenu.c

1028 lines
30 KiB
C
Raw Normal View History

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 Lesser General Public
1997-11-24 22:37:52 +00:00
* 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
* Lesser General Public License for more details.
1997-11-24 22:37:52 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* 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
*/
/*
* Modified by the GTK+ Team and others 1997-2000. 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/.
*/
#include "gtkintl.h"
1997-11-24 22:37:52 +00:00
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtkoptionmenu.h"
#include "gtkmarshalers.h"
1997-11-24 22:37:52 +00:00
#include "gtksignal.h"
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
#include "gdk/gdkkeysyms.h"
1997-11-24 22:37:52 +00:00
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
#define CHILD_LEFT_SPACING 4
1997-11-24 22:37:52 +00:00
#define CHILD_RIGHT_SPACING 1
#define CHILD_TOP_SPACING 1
#define CHILD_BOTTOM_SPACING 1
typedef struct _GtkOptionMenuProps GtkOptionMenuProps;
struct _GtkOptionMenuProps
{
gboolean interior_focus;
GtkRequisition indicator_size;
GtkBorder indicator_spacing;
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
gint focus_width;
gint focus_pad;
};
static GtkOptionMenuProps default_props = {
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
TRUE,
{ 7, 13 },
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
{ 7, 5, 2, 2 }, /* Left, right, top, bottom */
1,
0
};
1997-11-24 22:37:52 +00:00
static void gtk_option_menu_class_init (GtkOptionMenuClass *klass);
static void gtk_option_menu_init (GtkOptionMenu *option_menu);
static void gtk_option_menu_destroy (GtkObject *object);
static void gtk_option_menu_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_option_menu_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
1997-11-24 22:37:52 +00:00
static void gtk_option_menu_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_option_menu_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_option_menu_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_option_menu_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_option_menu_button_press (GtkWidget *widget,
GdkEventButton *event);
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 gint gtk_option_menu_key_press (GtkWidget *widget,
GdkEventKey *event);
static void gtk_option_menu_selection_done (GtkMenuShell *menu_shell,
1997-11-24 22:37:52 +00:00
GtkOptionMenu *option_menu);
static void gtk_option_menu_update_contents (GtkOptionMenu *option_menu);
static void gtk_option_menu_remove_contents (GtkOptionMenu *option_menu);
static void gtk_option_menu_calc_size (GtkOptionMenu *option_menu);
static void gtk_option_menu_position (GtkMenu *menu,
gint *x,
gint *y,
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
gint *scroll_offet,
1997-11-24 22:37:52 +00:00
gpointer user_data);
static void gtk_option_menu_show_all (GtkWidget *widget);
static void gtk_option_menu_hide_all (GtkWidget *widget);
static gboolean gtk_option_menu_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static GtkType gtk_option_menu_child_type (GtkContainer *container);
static gint gtk_option_menu_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
1997-11-24 22:37:52 +00:00
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
enum
{
CHANGED,
LAST_SIGNAL
};
1997-11-24 22:37:52 +00:00
enum
{
PROP_0,
PROP_MENU,
LAST_PROP
};
1997-11-24 22:37:52 +00:00
static GtkButtonClass *parent_class = NULL;
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
static guint signals[LAST_SIGNAL] = { 0 };
1997-11-24 22:37:52 +00:00
GtkType
configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> * configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on the client and server side. (And, more importantly, check for the shape extension so we may include -lXext even when compiling with --disable-xshm) Don't set override_redirect on all shaped windows. It isn't necessary. * gdk/gdkwindow.c: Set ->colormap to NULL for root and foreign windows. Use this to check if we need to get the colormap from X. Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkbutton.c (gtk_button_paint): Draw the areas between the default and the button always in GTK_STATE_NORMAL. * gtk/gtkrange.c (gtk_range_style_set): Added a style_set callback. Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): Fix a buffer overflow on pixmaps that claim to have more than 31 characters per pixel. (gdk_pixmap_read_string): Don't wrap around strings longer than half of address space ;-) * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers that were used for printing integers. * */* (almost): Style: All int foo () { ... } changed to int foo (void) { ... } ^^^^^^^ This is why some many files changed Even where there were proper prototypes elsewhere. * gdk/gxid.c (handle_claim_device): Some extra checks. It isn't safe against being fed bad X id's, but at least it should be safe against deleting all your files.
1998-05-03 22:41:32 +00:00
gtk_option_menu_get_type (void)
1997-11-24 22:37:52 +00:00
{
static GtkType option_menu_type = 0;
1997-11-24 22:37:52 +00:00
if (!option_menu_type)
{
static const GtkTypeInfo option_menu_info =
1997-11-24 22:37:52 +00:00
{
"GtkOptionMenu",
sizeof (GtkOptionMenu),
sizeof (GtkOptionMenuClass),
(GtkClassInitFunc) gtk_option_menu_class_init,
(GtkObjectInitFunc) gtk_option_menu_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
call the base class init fucntions from all parent types upon class Sun Jun 28 04:29:10 1998 Tim Janik <timj@gtk.org> * gtk/gtktypeutils.c (gtk_type_class_init): call the base class init fucntions from all parent types upon class initialization. * gtk/gtkcontainer.c: (gtk_container_get_type): announce gtk_container_base_class_init to the type system. (gtk_container_base_class_init): new function to feature base class initialization. (gtk_container_get_child_arg): (gtk_container_set_child_arg): call the GtkContainerClass get_child_arg and set_child_arg methods of the class indicated through the argument name. * gtk/gtkobject.c: (gtk_object_base_class_init): new function to feature base class initialization. (gtk_object_init_type): announce gtk_object_base_class_init to the type system. (gtk_object_class_init): setup the get_arg and set_arg pointers for GtkObjectClass. (gtk_object_setv): (gtk_object_getv): call the GtkObjectClass get_arg and set_arg methods, instead of bothering the type system with this. * gtk/gtkaccellabel.c: * gtk/gtkbutton.c: * gtk/gtkradiobutton.c: * gtk/gtktable.c: * gtk/gtktogglebutton.c: * gtk/gtktipsquery.c: * gtk/gtkbox.c: * gtk/gtkpacker.c: * gtk/gtkwidget.c: * gtk/gtkwindow.c: * gtk/gtkframe.c: * gtk/gtkmisc.c: * gtk/gtklabel.c: set the object_class->{g|s}et_arg pointers to the corresponding gtk_*_{g|s]et_arg functions and updated the gtk_*_get_type functions wrt GtkTypeInfo initialization. changed a lot of the set/get arg functions to take a GtkObject argument. gtk/gtkadjustment.c: gtk/gtkalignment.c: gtk/gtkarrow.c: gtk/gtkaspectframe.c: gtk/gtkbbox.c: gtk/gtkbin.c: gtk/gtkcheckbutton.c: gtk/gtkcheckmenuitem.c: gtk/gtkclist.c: gtk/gtkcolorsel.c: gtk/gtkcombo.c: gtk/gtkctree.c: gtk/gtkcurve.c: gtk/gtkdata.c: gtk/gtkdialog.c: gtk/gtkdrawingarea.c: gtk/gtkeditable.c: gtk/gtkentry.c: gtk/gtkeventbox.c: gtk/gtkfilesel.c: gtk/gtkfixed.c: gtk/gtkfontsel.c: gtk/gtkgamma.c: gtk/gtkhandlebox.c: gtk/gtkhbbox.c: gtk/gtkhbox.c: gtk/gtkhpaned.c: gtk/gtkhruler.c: gtk/gtkhscale.c: gtk/gtkhscrollbar.c: gtk/gtkhseparator.c: gtk/gtkimage.c: gtk/gtkinputdialog.c: gtk/gtkitem.c: gtk/gtkitemfactory.c: gtk/gtklist.c: gtk/gtklistitem.c: gtk/gtkmenu.c: gtk/gtkmenubar.c: gtk/gtkmenuitem.c: gtk/gtkmenushell.c: gtk/gtknotebook.c: gtk/gtkoptionmenu.c: gtk/gtkpaned.c: gtk/gtkpixmap.c: gtk/gtkpreview.c: gtk/gtkprogressbar.c: gtk/gtkradiomenuitem.c: gtk/gtkrange.c: gtk/gtkruler.c: gtk/gtkscale.c: gtk/gtkscrollbar.c: gtk/gtkscrolledwindow.c: gtk/gtkseparator.c: gtk/gtkspinbutton.c: gtk/gtkstatusbar.c: gtk/gtktext.c: gtk/gtktoolbar.c: gtk/gtktooltips.c: gtk/gtktree.c: gtk/gtktreeitem.c: gtk/gtkvbbox.c: gtk/gtkvbox.c: gtk/gtkviewport.c: gtk/gtkvpaned.c: gtk/gtkvruler.c: gtk/gtkvscale.c: gtk/gtkvscrollbar.c: gtk/gtkvseparator.c: updated the GtkTypeInfo initialization code to match the modified GtkTypeInfo structure.
1998-06-28 07:46:10 +00:00
(GtkClassInitFunc) NULL,
1997-11-24 22:37:52 +00:00
};
option_menu_type = gtk_type_unique (gtk_button_get_type (), &option_menu_info);
}
return option_menu_type;
}
static void
gtk_option_menu_class_init (GtkOptionMenuClass *class)
{
GObjectClass *gobject_class;
1997-11-24 22:37:52 +00:00
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
GtkContainerClass *container_class;
1997-11-24 22:37:52 +00:00
gobject_class = (GObjectClass*) class;
1997-11-24 22:37:52 +00:00
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
button_class = (GtkButtonClass*) class;
container_class = (GtkContainerClass*) class;
1997-11-24 22:37:52 +00:00
parent_class = gtk_type_class (gtk_button_get_type ());
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
signals[CHANGED] =
g_signal_new ("changed",
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkOptionMenuClass, changed),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gobject_class->set_property = gtk_option_menu_set_property;
gobject_class->get_property = gtk_option_menu_get_property;
1997-11-24 22:37:52 +00:00
object_class->destroy = gtk_option_menu_destroy;
Remove "draw" virtual method and signal 2000-12-02 Havoc Pennington <hp@pobox.com> * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove "draw" virtual method and signal * gtk/gtkwidget.c (gtk_widget_draw): Now just queues a draw then calls gdk_window_process_updates() to push the exposes through (gtk_widget_class_init): No more draw signal, no gtk_widget_real_draw() * gtk/gtkbin.c (gtk_bin_draw): remove * gtk/gtkbox.c (gtk_box_draw): remove * gtk/gtkbutton.c (gtk_button_draw): remove * gtk/gtkcalendar.c (gtk_calendar_draw): remove * gtk/gtkcheckbutton.c (gtk_check_button_draw): remove * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_draw): remove * gtk/gtkclist.c (gtk_clist_draw): remove * gtk/gtkentry.c (gtk_entry_draw): remove * gtk/gtkeventbox.c (gtk_event_box_draw): remove * gtk/gtkfixed.c (gtk_fixed_draw): remove * gtk/gtkframe.c (gtk_frame_draw): remove * gtk/gtkhandlebox.c (gtk_handle_box_draw): remove * gtk/gtkhpaned.c (gtk_hpaned_draw): remove * gtk/gtklayout.c (gtk_layout_draw): remove * gtk/gtklist.c (gtk_list_draw): remove * gtk/gtklistitem.c (gtk_list_item_draw): remove * gtk/gtkmenu.c (gtk_menu_draw): remove * gtk/gtkmenubar.c (gtk_menu_bar_draw): remove * gtk/gtkmenuitem.c (gtk_menu_item_draw): remove * gtk/gtknotebook.c (gtk_notebook_draw): remove * gtk/gtkoptionmenu.c (gtk_option_menu_draw): remove * gtk/gtkpacker.c (gtk_packer_draw): remove * gtk/gtkrange.c (gtk_range_draw): remove * gtk/gtkscrolledwindow.c (gtk_scrolled_window_draw): remove * gtk/gtkspinbutton.c (gtk_spin_button_draw): remove * gtk/gtktable.c (gtk_table_draw): remove * gtk/gtktearoffmenuitem.c (gtk_tearoff_menu_item_draw): remove * gtk/gtktext.c (gtk_text_draw): remove * gtk/gtktextview.c (gtk_text_view_draw): remove * gtk/gtktogglebutton.c (gtk_toggle_button_draw): remove * gtk/gtktoolbar.c (gtk_toolbar_draw): remove * gtk/gtktree.c (gtk_tree_draw): remove * gtk/gtktreeitem.c (gtk_tree_item_draw): remove * gtk/gtktreeview.c (gtk_tree_view_draw): remove * gtk/gtkviewport.c (gtk_viewport_draw): remove * gtk/gtkvpaned.c (gtk_vpaned_draw): remove * gtk/gtkvscale.c (gtk_vscale_draw): remove * gtk/gtkwindow.c (gtk_window_draw): remove
2000-12-04 01:15:37 +00:00
1997-11-24 22:37:52 +00:00
widget_class->size_request = gtk_option_menu_size_request;
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;
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
widget_class->key_press_event = gtk_option_menu_key_press;
widget_class->scroll_event = gtk_option_menu_scroll_event;
widget_class->show_all = gtk_option_menu_show_all;
widget_class->hide_all = gtk_option_menu_hide_all;
widget_class->mnemonic_activate = gtk_option_menu_mnemonic_activate;
container_class->child_type = gtk_option_menu_child_type;
g_object_class_install_property (gobject_class,
PROP_MENU,
g_param_spec_object ("menu",
_("Menu"),
_("The menu of options"),
GTK_TYPE_MENU,
G_PARAM_READABLE | G_PARAM_WRITABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("indicator_size",
_("Indicator Size"),
_("Size of dropdown indicator"),
GTK_TYPE_REQUISITION,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("indicator_spacing",
_("Indicator Spacing"),
_("Spacing around indicator"),
GTK_TYPE_BORDER,
G_PARAM_READABLE));
}
static GtkType
gtk_option_menu_child_type (GtkContainer *container)
{
return GTK_TYPE_NONE;
1997-11-24 22:37:52 +00:00
}
static void
gtk_option_menu_init (GtkOptionMenu *option_menu)
{
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_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT | GTK_RECEIVES_DEFAULT);
1997-11-24 22:37:52 +00:00
option_menu->menu = NULL;
option_menu->menu_item = NULL;
option_menu->width = 0;
option_menu->height = 0;
}
GtkWidget*
configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> * configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on the client and server side. (And, more importantly, check for the shape extension so we may include -lXext even when compiling with --disable-xshm) Don't set override_redirect on all shaped windows. It isn't necessary. * gdk/gdkwindow.c: Set ->colormap to NULL for root and foreign windows. Use this to check if we need to get the colormap from X. Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkbutton.c (gtk_button_paint): Draw the areas between the default and the button always in GTK_STATE_NORMAL. * gtk/gtkrange.c (gtk_range_style_set): Added a style_set callback. Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): Fix a buffer overflow on pixmaps that claim to have more than 31 characters per pixel. (gdk_pixmap_read_string): Don't wrap around strings longer than half of address space ;-) * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers that were used for printing integers. * */* (almost): Style: All int foo () { ... } changed to int foo (void) { ... } ^^^^^^^ This is why some many files changed Even where there were proper prototypes elsewhere. * gdk/gxid.c (handle_claim_device): Some extra checks. It isn't safe against being fed bad X id's, but at least it should be safe against deleting all your files.
1998-05-03 22:41:32 +00:00
gtk_option_menu_new (void)
1997-11-24 22:37:52 +00:00
{
return GTK_WIDGET (gtk_type_new (gtk_option_menu_get_type ()));
}
GtkWidget*
gtk_option_menu_get_menu (GtkOptionMenu *option_menu)
{
g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), NULL);
return option_menu->menu;
}
static void
gtk_option_menu_detacher (GtkWidget *widget,
GtkMenu *menu)
{
GtkOptionMenu *option_menu;
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
option_menu = GTK_OPTION_MENU (widget);
g_return_if_fail (option_menu->menu == (GtkWidget*) menu);
gtk_option_menu_remove_contents (option_menu);
gtk_signal_disconnect_by_data (GTK_OBJECT (option_menu->menu),
option_menu);
option_menu->menu = NULL;
g_object_notify (G_OBJECT (option_menu), "menu");
}
1997-11-24 22:37:52 +00:00
void
gtk_option_menu_set_menu (GtkOptionMenu *option_menu,
GtkWidget *menu)
{
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
g_return_if_fail (GTK_IS_MENU (menu));
if (option_menu->menu != menu)
{
gtk_option_menu_remove_menu (option_menu);
option_menu->menu = menu;
gtk_menu_attach_to_widget (GTK_MENU (menu),
GTK_WIDGET (option_menu),
gtk_option_menu_detacher);
1997-11-24 22:37:52 +00:00
gtk_option_menu_calc_size (option_menu);
1997-11-24 22:37:52 +00:00
gtk_signal_connect_after (GTK_OBJECT (option_menu->menu), "selection_done",
G_CALLBACK (gtk_option_menu_selection_done),
option_menu);
gtk_signal_connect_object (GTK_OBJECT (option_menu->menu), "size_request",
(GtkSignalFunc) gtk_option_menu_calc_size,
GTK_OBJECT (option_menu));
1997-11-24 22:37:52 +00:00
if (GTK_WIDGET (option_menu)->parent)
gtk_widget_queue_resize (GTK_WIDGET (option_menu));
1997-11-24 22:37:52 +00:00
gtk_option_menu_update_contents (option_menu);
g_object_notify (G_OBJECT (option_menu), "menu");
}
1997-11-24 22:37:52 +00:00
}
void
gtk_option_menu_remove_menu (GtkOptionMenu *option_menu)
{
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
if (option_menu->menu)
gtk_menu_detach (GTK_MENU (option_menu->menu));
1997-11-24 22:37:52 +00:00
}
void
gtk_option_menu_set_history (GtkOptionMenu *option_menu,
made the <widget>_signals[] arrays of type guint rather than gint. made Mon Mar 9 15:48:10 1998 Tim Janik <timj@gimp.org> * Signal signedness and naming corrections, plus GtkType fixes: * gtk/gtkadjustment.c: * gtk/gtkbutton.c: * gtk/gtkcheckmenuitem.c: * gtk/gtkclist.c: * gtk/gtkcolorsel.c: * gtk/gtkcontainer.c: * gtk/gtkcurve.c: * gtk/gtkdata.c: * gtk/gtkeditable.c: * gtk/gtkentry.c: * gtk/gtkhandlebox.c: * gtk/gtkinputdialog.c: * gtk/gtkitem.c: * gtk/gtklist.c: * gtk/gtkmenuitem.c: * gtk/gtkmenushell.c: * gtk/gtknotebook.c: * gtk/gtkstatusbar.c: * gtk/gtktoolbar.c: * gtk/gtktree.c: * gtk/gtktreeitem.c: * gtk/gtkwidget.c: * gtk/gtktogglebutton.c: * gtk/gtkwindow.c: made the <widget>_signals[] arrays of type guint rather than gint. * gtk/gtkwidget.c (gtk_widget_get_ancestor): made widget_type a GtkType. * gtk/gtkcombo.h: handler ids need to be of type guint (entry_change_id, list_change_id). * gtk/gtkaccelerator.c: changed signal_num to signal_id and typed it guint. * gtk/gtkmain.c: made gtk_ndebug_keys a guint. * gtk/gtkmenu.h: * gtk/gtkmenu.c: (gtk_menu_popup): made button a guint. (gtk_menu_set_active): made index a guint. * gtk/gtkmenuitem.h: * gtk/gtkmenuitem.c: made accelerator_signal a guint. * gtk/gtkoptionmenu.h: * gtk/gtkoptionmenu.c: (gtk_option_menu_set_history): made index a guint. * gtk/gtksignal.h: * gtk/gtksignal.c: * gtk/gtkobject.h: * gtk/gtkobject.c: changed a bunch of prototypes to take guints rather than gints. also made some conversions from guint to GtkType, left over from when the fundamental-types system was introduced. * gtk/gtkobject.h: * gtk/gtkobject.c: made object_data_id_index and obj_count guints. made *signals and nsignals guints in GtkObjectClass.
1998-03-09 15:16:28 +00:00
guint index)
1997-11-24 22:37:52 +00:00
{
GtkWidget *menu_item;
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
if (option_menu->menu)
{
gtk_menu_set_active (GTK_MENU (option_menu->menu), index);
menu_item = gtk_menu_get_active (GTK_MENU (option_menu->menu));
if (menu_item != option_menu->menu_item)
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
gtk_option_menu_update_contents (option_menu);
1997-11-24 22:37:52 +00:00
}
}
/**
* gtk_option_menu_get_history:
* @option_menu: a #GtkOptionMenu
*
* Retrieves the index of the currently selected menu item. The menu
* items are numbered from top to bottom, starting with 0.
*
* Return value: index of the selected menu item, or -1 if there are no menu items
**/
gint
gtk_option_menu_get_history (GtkOptionMenu *option_menu)
{
GtkWidget *active_widget;
g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), -1);
if (option_menu->menu)
{
active_widget = gtk_menu_get_active (GTK_MENU (option_menu->menu));
if (active_widget)
return g_list_index (GTK_MENU_SHELL (option_menu->menu)->children,
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
active_widget);
else
return -1;
}
else
return -1;
}
1997-11-24 22:37:52 +00:00
static void
gtk_option_menu_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkOptionMenu *option_menu = GTK_OPTION_MENU (object);
switch (prop_id)
{
case PROP_MENU:
gtk_option_menu_set_menu (option_menu, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_option_menu_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkOptionMenu *option_menu = GTK_OPTION_MENU (object);
switch (prop_id)
{
case PROP_MENU:
g_value_set_object (value, option_menu->menu);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
1997-11-24 22:37:52 +00:00
static void
gtk_option_menu_destroy (GtkObject *object)
{
GtkOptionMenu *option_menu;
g_return_if_fail (GTK_IS_OPTION_MENU (object));
option_menu = GTK_OPTION_MENU (object);
if (option_menu->menu)
gtk_widget_destroy (option_menu->menu);
1997-11-24 22:37:52 +00:00
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
gtk_option_menu_get_props (GtkOptionMenu *option_menu,
GtkOptionMenuProps *props)
{
GtkRequisition *indicator_size;
GtkBorder *indicator_spacing;
gtk_widget_style_get (GTK_WIDGET (option_menu),
"indicator_size", &indicator_size,
"indicator_spacing", &indicator_spacing,
"interior_focus", &props->interior_focus,
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
"focus_line_width", &props->focus_width,
"focus_padding", &props->focus_pad,
NULL);
if (indicator_size)
props->indicator_size = *indicator_size;
else
props->indicator_size = default_props.indicator_size;
if (indicator_spacing)
props->indicator_spacing = *indicator_spacing;
else
props->indicator_spacing = default_props.indicator_spacing;
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
g_free (indicator_size);
g_free (indicator_spacing);
}
1997-11-24 22:37:52 +00:00
static void
gtk_option_menu_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkOptionMenu *option_menu = GTK_OPTION_MENU (widget);
GtkOptionMenuProps props;
1997-11-24 22:37:52 +00:00
gint tmp;
GtkRequisition child_requisition = { 0, 0 };
gtk_option_menu_get_props (option_menu, &props);
if (GTK_BIN (option_menu)->child && GTK_WIDGET_VISIBLE (GTK_BIN (option_menu)->child))
{
gtk_widget_size_request (GTK_BIN (option_menu)->child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
1997-11-24 22:37:52 +00:00
requisition->width = ((GTK_CONTAINER (widget)->border_width +
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
GTK_WIDGET (widget)->style->xthickness + props.focus_pad) * 2 +
MAX (child_requisition.width, option_menu->width) +
props.indicator_size.width +
props.indicator_spacing.left + props.indicator_spacing.right +
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING + props.focus_width * 2);
1997-11-24 22:37:52 +00:00
requisition->height = ((GTK_CONTAINER (widget)->border_width +
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
GTK_WIDGET (widget)->style->ythickness + props.focus_pad) * 2 +
MAX (child_requisition.height, option_menu->height) +
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING + props.focus_width * 2);
1997-11-24 22:37:52 +00:00
tmp = (requisition->height - MAX (child_requisition.height, option_menu->height) +
props.indicator_size.height + props.indicator_spacing.top + props.indicator_spacing.bottom);
1997-11-24 22:37:52 +00:00
requisition->height = MAX (requisition->height, tmp);
}
static void
gtk_option_menu_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkWidget *child;
GtkButton *button = GTK_BUTTON (widget);
1997-11-24 22:37:52 +00:00
GtkAllocation child_allocation;
GtkOptionMenuProps props;
gint border_width;
gtk_option_menu_get_props (GTK_OPTION_MENU (widget), &props);
border_width = GTK_CONTAINER (widget)->border_width;
1997-11-24 22:37:52 +00:00
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (button->event_window,
allocation->x + border_width, allocation->y + border_width,
allocation->width - border_width * 2, allocation->height - border_width * 2);
1997-11-24 22:37:52 +00:00
child = GTK_BIN (widget)->child;
1997-11-24 22:37:52 +00:00
if (child && GTK_WIDGET_VISIBLE (child))
{
gint xthickness = GTK_WIDGET (widget)->style->xthickness;
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
gint ythickness = GTK_WIDGET (widget)->style->ythickness;
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
child_allocation.x = widget->allocation.x + border_width + xthickness + props.focus_width + props.focus_pad + CHILD_LEFT_SPACING;
child_allocation.y = widget->allocation.y + border_width + ythickness + props.focus_width + props.focus_pad + CHILD_TOP_SPACING;
child_allocation.width = MAX (1, allocation->width - (border_width + xthickness + props.focus_width + props.focus_pad) * 2 -
props.indicator_size.width - props.indicator_spacing.left - props.indicator_spacing.right -
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING);
child_allocation.height = MAX (1, allocation->height - (border_width + ythickness + props.focus_width + props.focus_pad) * 2 -
CHILD_TOP_SPACING - CHILD_BOTTOM_SPACING);
1997-11-24 22:37:52 +00:00
gtk_widget_size_allocate (child, &child_allocation);
}
}
static void
gtk_option_menu_paint (GtkWidget *widget,
GdkRectangle *area)
{
GdkRectangle button_area;
GtkOptionMenuProps props;
gint border_width;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
g_return_if_fail (area != NULL);
if (GTK_WIDGET_DRAWABLE (widget))
{
border_width = GTK_CONTAINER (widget)->border_width;
gtk_option_menu_get_props (GTK_OPTION_MENU (widget), &props);
button_area.x = widget->allocation.x + border_width;
button_area.y = widget->allocation.y + border_width;
button_area.width = widget->allocation.width - 2 * border_width;
button_area.height = widget->allocation.height - 2 * border_width;
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
if (!props.interior_focus && GTK_WIDGET_HAS_FOCUS (widget))
{
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
button_area.x += props.focus_width + props.focus_pad;
button_area.y += props.focus_width + props.focus_pad;
button_area.width -= 2 * (props.focus_width + props.focus_pad);
button_area.height -= 2 * (props.focus_width + props.focus_pad);
}
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
area, widget, "optionmenu",
button_area.x, button_area.y,
button_area.width, button_area.height);
gtk_paint_tab (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
area, widget, "optionmenutab",
button_area.x + button_area.width -
props.indicator_size.width - props.indicator_spacing.right -
widget->style->xthickness,
button_area.y + (button_area.height - props.indicator_size.height) / 2,
props.indicator_size.width, props.indicator_size.height);
if (GTK_WIDGET_HAS_FOCUS (widget))
{
if (props.interior_focus)
{
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
button_area.x += widget->style->xthickness + props.focus_pad;
button_area.y += widget->style->ythickness + props.focus_pad;
button_area.width -= 2 * (widget->style->xthickness + props.focus_pad) +
props.indicator_spacing.left +
props.indicator_spacing.right +
props.indicator_size.width;
button_area.height -= 2 * (widget->style->ythickness + props.focus_pad);
}
else
{
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
button_area.x -= props.focus_width + props.focus_pad;
button_area.y -= props.focus_width + props.focus_pad;
button_area.width += 2 * (props.focus_width + props.focus_pad);
button_area.height += 2 * (props.focus_width + props.focus_pad);
}
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
area, widget, "button",
button_area.x,
button_area.y,
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
button_area.width,
button_area.height);
}
1997-11-24 22:37:52 +00:00
}
}
static gint
gtk_option_menu_expose (GtkWidget *widget,
GdkEventExpose *event)
{
g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_option_menu_paint (widget, &event->area);
/* The following code tries to draw the child in two places at
* once. It fails miserably for several reasons
*
* - If the child is not no-window, removing generates
* more expose events. Bad, bad, bad.
*
* - Even if the child is no-window, removing it now (properly)
* clears the space where it was, so it does no good
*/
#if 0
1997-11-24 22:37:52 +00:00
remove_child = FALSE;
child = GTK_BUTTON (widget)->child;
if (!child)
{
if (!GTK_OPTION_MENU (widget)->menu)
return FALSE;
gtk_option_menu_update_contents (GTK_OPTION_MENU (widget));
child = GTK_BUTTON (widget)->child;
if (!child)
return FALSE;
remove_child = TRUE;
}
child_event = *event;
if (GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event);
if (remove_child)
gtk_option_menu_remove_contents (GTK_OPTION_MENU (widget));
#else
Document expose event->region change and that gtk_widget_event doesn't 2001-03-09 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Document expose event->region change and that gtk_widget_event doesn't allow passing expose events. * gdk/gdkevents.h: Add region to expose event. * gdk/gdkevents.c: Handle event->region in gdk_event_copy() and gdk_event_free(). * gdk/gdkwindow.c (gdk_window_process_updates_internal): Generate expose_event->region when creating expose events. * gdk/x11/gdkevents-x11.c: Generate expose events with regions when translating X events. * gtk/gtkcontainer.[ch]: Default expose handler that propagates expose events to NO_WINDOW children. New function gtk_container_propagate_expose() * gtk/gtkwidget.[ch]: Moved gtk_widget_event implementation to gtk_widget_event_internal. gtk_widget_event calls gtk_widget_event_internal but doesn't allow expose events. New function gtk_widget_send_expose() to send expose events. New function gtk_widget_region_intersect() to calculate window/region intersections. * gtk/gtkmain.c (gtk_main_do_event): Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect(). Use gtk_widget_send_expose() to send expose events. * gtk/gtkbin.c: * gtk/gtkbox.c: * gtk/gtkfixed.c: * gtk/gtkimagemenuitem.c: * gtk/gtklist.c: * gtk/gtkpacker.c: * gtk/gtktable.c: * gtk/gtktree.c: Remove expose handler, using the default container implementation instead. * gtk/gtkbutton.c: * gtk/gtkcheckbutton.c: * gtk/gtkeventbox.c: * gtk/gtkfixed.c: * gtk/gtkhandlebox.c: * gtk/gtklayout.c: * gtk/gtklistitem.c: * gtk/gtkmenu.c: * gtk/gtkmenubar.c: * gtk/gtkmenuitem.c: * gtk/gtknotebook.c: * gtk/gtkoptionmenu.c: * gtk/gtkpaned.c: * gtk/gtkscrolledwindow.c: * gtk/gtktogglebutton.c: * gtk/gtktoolbar.c: * gtk/gtktreeitem.c: * gtk/gtkviewport.c: Chain expose handler to parent class handler. Use gtk_container_propagate_expose() to propagate exposes. * gtk/gtkclist.c (check_exposures): * gtk/gtktext.c (process_exposes): Use gtk_widget_send_expose instead of gtk_widget_event.
2001-03-09 13:28:26 +00:00
if (GTK_BIN (widget)->child)
gtk_container_propagate_expose (GTK_CONTAINER (widget),
GTK_BIN (widget)->child,
event);
#endif /* 0 */
1997-11-24 22:37:52 +00:00
}
return FALSE;
}
static gint
gtk_option_menu_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GtkOptionMenu *option_menu;
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
GtkWidget *menu_item;
1997-11-24 22:37:52 +00:00
g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
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
option_menu = GTK_OPTION_MENU (widget);
1997-11-24 22:37:52 +00:00
if ((event->type == GDK_BUTTON_PRESS) &&
(event->button == 1))
{
gtk_option_menu_remove_contents (option_menu);
gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
gtk_option_menu_position, option_menu,
event->button, event->time);
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
menu_item = gtk_menu_get_active (GTK_MENU (option_menu->menu));
if (menu_item)
gtk_menu_shell_select_item (GTK_MENU_SHELL (option_menu->menu), menu_item);
return TRUE;
1997-11-24 22:37:52 +00:00
}
return FALSE;
}
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 gint
gtk_option_menu_key_press (GtkWidget *widget,
GdkEventKey *event)
{
GtkOptionMenu *option_menu;
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
GtkWidget *menu_item;
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_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
option_menu = GTK_OPTION_MENU (widget);
switch (event->keyval)
{
Clip the retrieved image data to the screen, using a server grab to avoid 2001-06-28 Havoc Pennington <hp@pobox.com> * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved image data to the screen, using a server grab to avoid race conditions. * gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove check for NULL return from gtk_image_new_from_stock(), it never returns NULL. (gtk_item_factory_create_item): fix bug where we parsed the stock ID as an inline pixbuf * gtk/gtktext.c (gtk_text_key_press): numeric keypad support * gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad support (should be using binding set here) * gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad support (should be using binding set here) * gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad support * gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support * gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad * gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): keypad * gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad * gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes * gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support * gtk/gtkcolorsel.c (palette_activate): keypad support (of course, should be binding-setted) * gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes * gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes * gtk/gtkcalendar.c: numeric keypad fixes * gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad support * gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop screwup * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): clip the render area to the drawable's clip region in advance, so we don't get data from the server that we don't need. * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): check return value of gdk_pixbuf_get_from_drawable(), fall back to bilevel alpha if we can't get the pixbuf to composite against. * gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap * gdk/gdkimage.c (gdk_image_get_colormap): add gdk_image_set_colormap, gdk_image_get_colormap * gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to take a region of the image, instead of converting the entire image. * gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help keybinding signal. Add default bindings for it. Add default handler for show_help that shows the tooltip for the widget. * gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and "close" keybinding signal, remove key press handler. * gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this, it's not our usual practice to leave a deprecated function around with a runtime warning, plus we don't want it to appear in docs, plus if we make them yellow no one will want to change them anyhow.
2001-06-29 01:59:02 +00:00
case GDK_KP_Space:
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
case GDK_space:
gtk_option_menu_remove_contents (option_menu);
gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
gtk_option_menu_position, option_menu,
0, event->time);
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
menu_item = gtk_menu_get_active (GTK_MENU (option_menu->menu));
if (menu_item)
gtk_menu_shell_select_item (GTK_MENU_SHELL (option_menu->menu), menu_item);
return 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
}
return FALSE;
}
1997-11-24 22:37:52 +00:00
static void
gtk_option_menu_selection_done (GtkMenuShell *menu_shell,
GtkOptionMenu *option_menu)
1997-11-24 22:37:52 +00:00
{
g_return_if_fail (menu_shell != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
gtk_option_menu_update_contents (option_menu);
}
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
static void
gtk_option_menu_changed (GtkOptionMenu *option_menu)
{
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
g_signal_emit (G_OBJECT (option_menu), signals[CHANGED], 0);
}
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). * gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix), since some people set $(libdir) separately. (#1290, David Kaelbling) Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not defined, define MAXPATHLEN to 2048. (The Hurd doesn't have MAXPATHLEN, but the code here depends on a fixed value.) (#4524) Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g) Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c (real_tree_move): If the node being moved isn't viewable there is no way that moving the node will cause the focus row to become not viewable, so omit check on the visibility of new_sibling, which is irrelevant. (Fixes #8002, David Helder) Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current selection before inserting new text. Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb): Make the sensitivity of the reparented child track that of the original parent menu item. (#34218, David Hodson) * gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle the case where the current item is destroyed properly. * gtk/gtkoptionmenu.c: Some additional code cleanups and fix some edge cases with child-less menuitems. Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return key pop down window. (#12074, Jon K Hellan) Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan) The solution here isn't perfect - you get an extraneous emission of "toggle", which could conceivably confuse an app, but better than the current situation. LXR search seems to indicate that no apps in GNOME CVS connect to "toggle". Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from gtk_public_h_sources to directly here to avoid warning when building srcdir != builddir. (#9656) Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c: Patch from Kipp Hickman to make the event handlers in gtkrange.c return the proper values (TRUE == handled) (#10316). This is just the tip of the iceberg, but gtkrange.c is the most common place where the propagation is problematical, and also a place where it is almost certainly safe to change this in the stable branch. (You don't want right click popups on a range control or anything...) Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.c (clear_focus_area): We need to clear the focus area on focus out, even if a background pixmap isn't set. (#13941) Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham to deal with setting the shape properly when scrolling arrows are turned on, but not visible because there is sufficient space. (#13432) Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu items with submenus, destroy the item along with the submenu. (#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...' properly. * gtk/testgtk.c (menu_items): Add a dummy branch that we delete later. Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where the focus widget sometimes wasn't drawn with the default if there was no default widget. * gtk/gtkstyle.c (gtk_style_real_unrealize): free colors, unreference pixmaps. * gtk/gtkstyle.c (gtk_style_realize): Reference colormap for some extra safety. Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting the text of a cell to the old pointer value better, by copying the new text before freeing the old text. Some code cleanup. (#8079, Karl Nelson) Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text() gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN. Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c (gtk_menu_remove): When removing an item from a menu, check to see if it matches menu->old_active_menu_item, and if so, unref and clear old_active_menu_item (Patch from Pavel Cisler) * gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset menu_shell->active_menu_item, if it is the child being removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
static void
gtk_option_menu_select_first_sensitive (GtkOptionMenu *option_menu)
{
if (option_menu->menu)
{
GList *children = GTK_MENU_SHELL (option_menu->menu)->children;
gint index = 0;
while (children)
{
if (GTK_WIDGET_SENSITIVE (children->data))
{
gtk_option_menu_set_history (option_menu, index);
return;
}
children = children->next;
index++;
}
}
}
static void
gtk_option_menu_item_state_changed_cb (GtkWidget *widget,
GtkStateType previous_state,
GtkOptionMenu *option_menu)
{
GtkWidget *child = GTK_BIN (option_menu)->child;
if (child && GTK_WIDGET_SENSITIVE (child) != GTK_WIDGET_IS_SENSITIVE (widget))
gtk_widget_set_sensitive (child, GTK_WIDGET_IS_SENSITIVE (widget));
}
static void
gtk_option_menu_item_destroy_cb (GtkWidget *widget,
GtkOptionMenu *option_menu)
{
GtkWidget *child = GTK_BIN (option_menu)->child;
if (child)
{
gtk_widget_ref (child);
gtk_option_menu_remove_contents (option_menu);
gtk_widget_destroy (child);
gtk_widget_unref (child);
gtk_option_menu_select_first_sensitive (option_menu);
}
}
1997-11-24 22:37:52 +00:00
static void
gtk_option_menu_update_contents (GtkOptionMenu *option_menu)
{
GtkWidget *child;
GtkRequisition child_requisition;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
if (option_menu->menu)
{
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
GtkWidget *old_item = option_menu->menu_item;
1997-11-24 22:37:52 +00:00
gtk_option_menu_remove_contents (option_menu);
option_menu->menu_item = gtk_menu_get_active (GTK_MENU (option_menu->menu));
if (option_menu->menu_item)
{
gtk_widget_ref (option_menu->menu_item);
1997-11-24 22:37:52 +00:00
child = GTK_BIN (option_menu->menu_item)->child;
if (child)
{
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). * gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix), since some people set $(libdir) separately. (#1290, David Kaelbling) Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not defined, define MAXPATHLEN to 2048. (The Hurd doesn't have MAXPATHLEN, but the code here depends on a fixed value.) (#4524) Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g) Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c (real_tree_move): If the node being moved isn't viewable there is no way that moving the node will cause the focus row to become not viewable, so omit check on the visibility of new_sibling, which is irrelevant. (Fixes #8002, David Helder) Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current selection before inserting new text. Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb): Make the sensitivity of the reparented child track that of the original parent menu item. (#34218, David Hodson) * gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle the case where the current item is destroyed properly. * gtk/gtkoptionmenu.c: Some additional code cleanups and fix some edge cases with child-less menuitems. Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return key pop down window. (#12074, Jon K Hellan) Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan) The solution here isn't perfect - you get an extraneous emission of "toggle", which could conceivably confuse an app, but better than the current situation. LXR search seems to indicate that no apps in GNOME CVS connect to "toggle". Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from gtk_public_h_sources to directly here to avoid warning when building srcdir != builddir. (#9656) Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c: Patch from Kipp Hickman to make the event handlers in gtkrange.c return the proper values (TRUE == handled) (#10316). This is just the tip of the iceberg, but gtkrange.c is the most common place where the propagation is problematical, and also a place where it is almost certainly safe to change this in the stable branch. (You don't want right click popups on a range control or anything...) Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.c (clear_focus_area): We need to clear the focus area on focus out, even if a background pixmap isn't set. (#13941) Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham to deal with setting the shape properly when scrolling arrows are turned on, but not visible because there is sufficient space. (#13432) Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu items with submenus, destroy the item along with the submenu. (#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...' properly. * gtk/testgtk.c (menu_items): Add a dummy branch that we delete later. Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where the focus widget sometimes wasn't drawn with the default if there was no default widget. * gtk/gtkstyle.c (gtk_style_real_unrealize): free colors, unreference pixmaps. * gtk/gtkstyle.c (gtk_style_realize): Reference colormap for some extra safety. Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting the text of a cell to the old pointer value better, by copying the new text before freeing the old text. Some code cleanup. (#8079, Karl Nelson) Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text() gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN. Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c (gtk_menu_remove): When removing an item from a menu, check to see if it matches menu->old_active_menu_item, and if so, unref and clear old_active_menu_item (Patch from Pavel Cisler) * gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset menu_shell->active_menu_item, if it is the child being removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
if (!GTK_WIDGET_IS_SENSITIVE (option_menu->menu_item))
gtk_widget_set_sensitive (child, FALSE);
1997-11-24 22:37:52 +00:00
gtk_widget_reparent (child, GTK_WIDGET (option_menu));
}
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). * gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix), since some people set $(libdir) separately. (#1290, David Kaelbling) Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not defined, define MAXPATHLEN to 2048. (The Hurd doesn't have MAXPATHLEN, but the code here depends on a fixed value.) (#4524) Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g) Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c (real_tree_move): If the node being moved isn't viewable there is no way that moving the node will cause the focus row to become not viewable, so omit check on the visibility of new_sibling, which is irrelevant. (Fixes #8002, David Helder) Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current selection before inserting new text. Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb): Make the sensitivity of the reparented child track that of the original parent menu item. (#34218, David Hodson) * gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle the case where the current item is destroyed properly. * gtk/gtkoptionmenu.c: Some additional code cleanups and fix some edge cases with child-less menuitems. Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return key pop down window. (#12074, Jon K Hellan) Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan) The solution here isn't perfect - you get an extraneous emission of "toggle", which could conceivably confuse an app, but better than the current situation. LXR search seems to indicate that no apps in GNOME CVS connect to "toggle". Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from gtk_public_h_sources to directly here to avoid warning when building srcdir != builddir. (#9656) Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c: Patch from Kipp Hickman to make the event handlers in gtkrange.c return the proper values (TRUE == handled) (#10316). This is just the tip of the iceberg, but gtkrange.c is the most common place where the propagation is problematical, and also a place where it is almost certainly safe to change this in the stable branch. (You don't want right click popups on a range control or anything...) Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.c (clear_focus_area): We need to clear the focus area on focus out, even if a background pixmap isn't set. (#13941) Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham to deal with setting the shape properly when scrolling arrows are turned on, but not visible because there is sufficient space. (#13432) Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu items with submenus, destroy the item along with the submenu. (#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...' properly. * gtk/testgtk.c (menu_items): Add a dummy branch that we delete later. Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where the focus widget sometimes wasn't drawn with the default if there was no default widget. * gtk/gtkstyle.c (gtk_style_real_unrealize): free colors, unreference pixmaps. * gtk/gtkstyle.c (gtk_style_realize): Reference colormap for some extra safety. Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting the text of a cell to the old pointer value better, by copying the new text before freeing the old text. Some code cleanup. (#8079, Karl Nelson) Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text() gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN. Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c (gtk_menu_remove): When removing an item from a menu, check to see if it matches menu->old_active_menu_item, and if so, unref and clear old_active_menu_item (Patch from Pavel Cisler) * gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset menu_shell->active_menu_item, if it is the child being removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
gtk_signal_connect (GTK_OBJECT (option_menu->menu_item), "state_changed",
GTK_SIGNAL_FUNC (gtk_option_menu_item_state_changed_cb), option_menu);
gtk_signal_connect (GTK_OBJECT (option_menu->menu_item), "destroy",
GTK_SIGNAL_FUNC (gtk_option_menu_item_destroy_cb), option_menu);
gtk_widget_size_request (child, &child_requisition);
1997-11-24 22:37:52 +00:00
gtk_widget_size_allocate (GTK_WIDGET (option_menu),
&(GTK_WIDGET (option_menu)->allocation));
if (GTK_WIDGET_DRAWABLE (option_menu))
gtk_widget_queue_draw (GTK_WIDGET (option_menu));
}
Adapt to uscore-ification of gtktextiterprivate 2001-01-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c: Adapt to uscore-ification of gtktextiterprivate * gtk/gtktextdisplay.c (gtk_text_layout_draw): remove use of private functions; remove inclusion of private headers. * gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_line): Add this function, so we don't need private functions in gtktextdisplay.c * gtk/gtktextiterprivate.h: underscore-ification * gtk/gtkwidget.c: Clean up a bunch of docs that said "INTERNAL" to instead say "only useful to implement widgets" * gtk/gtkenums.h (GtkMovementStep): Rename GTK_MOVEMENT_CHARS, GTK_MOVEMENT_POSITIONS to GTK_MOVEMENT_LOGICAL_POSITIONS, GTK_MOVEMENT_VISUAL_POSITIONS. Resolves bug 40249. * gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_set_colormap): This function was completely broken * gtk/testtext.c (line_numbers_expose): use gtk_paint_layout * gtk/gtkvscale.c (gtk_vscale_draw_value): use gtk_paint_layout * gtk/gtkvruler.c (gtk_vruler_draw_ticks): use gtk_paint_layout * gtk/gtklabel.c (gtk_label_expose): use gtk_paint_layout * gtk/gtkhscale.c (gtk_hscale_draw_value): use gtk_paint_layout * gtk/gtkhruler.c (gtk_hruler_draw_ticks): use gtk_paint_layout * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render): use gtk_paint_layout * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): use gtk_paint_layout * gtk/gtkstyle.h: Add draw/paint expander to draw tree expanders. Progress on bug 40103. Add draw_layout to draw a PangoLayout. (struct _GtkStyleClass): Remove draw_cross, draw_oval, draw_ramp, which were not implemented. * gtk/gtktextbuffer.h (struct _GtkTextBufferClass): Add insert_pixbuf signal. Rename delete_text to delete_range since it also deletes pixbufs and child anchors. This almost closes bug 40245 (still need to deal with child anchors) * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add insert_pixbuf, change signal names as appropriate, change types of signals taking marks/tags to have the specific type, not just G_TYPE_OBJECT * gtk/gtkmain.c (gtk_get_current_event_state): Add this function; closes bug 40051 * gtk/gtkoptionmenu.c (gtk_option_menu_set_history): clean up unnecessary remove_contents() call (gtk_option_menu_class_init): add a "changed" signal, closes bug 40039 (gtk_option_menu_update_contents): emit "changed" if the active menu item changes * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): fix bad cast to GtkObject, reported by Jonas Borgstrom (gdk_pixbuf_loader_finalize): don't close the loader on finalize; we can't do stuff with side effects in finalize. Instead, spew a warning if the loader isn't closed. * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_finalize): free colormap in here, non-X ports probably need to sync to this change * gdk/x11/gdkdrawable-x11.c (gdk_x11_set_colormap): remove assertion that colormap != NULL, you can set the colormap to NULL if you like. * Makefile.am: remove gtk-config-2.0 * configure.in: Use pkg-config to locate GLib. Remove separated-out GMODULE_LIBS, GMODULE_CFLAGS; these were not used, and the gmodule libs/cflags were in GLIB_LIBS GLIB_CFLAGS anyhow. Use pkg-config to locate Pango. Output correct Pango libs to gdk-2.0.pc.in. Fix test for FREETYPE_CONFIG (typo fix). * Makefile.am (pkgconfig_DATA): install only target-specific pc files (install-data-local): symlink gtk+-2.0.pc and gdk-2.0.pc to the X11 pc files * gtk+-2.0.pc.in (Requires): require the GDK for the current target unref from here
2001-01-04 17:48:43 +00:00
if (old_item != option_menu->menu_item)
gtk_option_menu_changed (option_menu);
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_option_menu_remove_contents (GtkOptionMenu *option_menu)
{
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). * gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix), since some people set $(libdir) separately. (#1290, David Kaelbling) Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not defined, define MAXPATHLEN to 2048. (The Hurd doesn't have MAXPATHLEN, but the code here depends on a fixed value.) (#4524) Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g) Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c (real_tree_move): If the node being moved isn't viewable there is no way that moving the node will cause the focus row to become not viewable, so omit check on the visibility of new_sibling, which is irrelevant. (Fixes #8002, David Helder) Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current selection before inserting new text. Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb): Make the sensitivity of the reparented child track that of the original parent menu item. (#34218, David Hodson) * gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle the case where the current item is destroyed properly. * gtk/gtkoptionmenu.c: Some additional code cleanups and fix some edge cases with child-less menuitems. Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return key pop down window. (#12074, Jon K Hellan) Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan) The solution here isn't perfect - you get an extraneous emission of "toggle", which could conceivably confuse an app, but better than the current situation. LXR search seems to indicate that no apps in GNOME CVS connect to "toggle". Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from gtk_public_h_sources to directly here to avoid warning when building srcdir != builddir. (#9656) Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c: Patch from Kipp Hickman to make the event handlers in gtkrange.c return the proper values (TRUE == handled) (#10316). This is just the tip of the iceberg, but gtkrange.c is the most common place where the propagation is problematical, and also a place where it is almost certainly safe to change this in the stable branch. (You don't want right click popups on a range control or anything...) Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.c (clear_focus_area): We need to clear the focus area on focus out, even if a background pixmap isn't set. (#13941) Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham to deal with setting the shape properly when scrolling arrows are turned on, but not visible because there is sufficient space. (#13432) Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu items with submenus, destroy the item along with the submenu. (#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...' properly. * gtk/testgtk.c (menu_items): Add a dummy branch that we delete later. Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where the focus widget sometimes wasn't drawn with the default if there was no default widget. * gtk/gtkstyle.c (gtk_style_real_unrealize): free colors, unreference pixmaps. * gtk/gtkstyle.c (gtk_style_realize): Reference colormap for some extra safety. Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting the text of a cell to the old pointer value better, by copying the new text before freeing the old text. Some code cleanup. (#8079, Karl Nelson) Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text() gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN. Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c (gtk_menu_remove): When removing an item from a menu, check to see if it matches menu->old_active_menu_item, and if so, unref and clear old_active_menu_item (Patch from Pavel Cisler) * gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset menu_shell->active_menu_item, if it is the child being removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
GtkWidget *child;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). * gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix), since some people set $(libdir) separately. (#1290, David Kaelbling) Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not defined, define MAXPATHLEN to 2048. (The Hurd doesn't have MAXPATHLEN, but the code here depends on a fixed value.) (#4524) Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g) Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c (real_tree_move): If the node being moved isn't viewable there is no way that moving the node will cause the focus row to become not viewable, so omit check on the visibility of new_sibling, which is irrelevant. (Fixes #8002, David Helder) Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current selection before inserting new text. Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb): Make the sensitivity of the reparented child track that of the original parent menu item. (#34218, David Hodson) * gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle the case where the current item is destroyed properly. * gtk/gtkoptionmenu.c: Some additional code cleanups and fix some edge cases with child-less menuitems. Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return key pop down window. (#12074, Jon K Hellan) Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan) The solution here isn't perfect - you get an extraneous emission of "toggle", which could conceivably confuse an app, but better than the current situation. LXR search seems to indicate that no apps in GNOME CVS connect to "toggle". Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from gtk_public_h_sources to directly here to avoid warning when building srcdir != builddir. (#9656) Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c: Patch from Kipp Hickman to make the event handlers in gtkrange.c return the proper values (TRUE == handled) (#10316). This is just the tip of the iceberg, but gtkrange.c is the most common place where the propagation is problematical, and also a place where it is almost certainly safe to change this in the stable branch. (You don't want right click popups on a range control or anything...) Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.c (clear_focus_area): We need to clear the focus area on focus out, even if a background pixmap isn't set. (#13941) Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham to deal with setting the shape properly when scrolling arrows are turned on, but not visible because there is sufficient space. (#13432) Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu items with submenus, destroy the item along with the submenu. (#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...' properly. * gtk/testgtk.c (menu_items): Add a dummy branch that we delete later. Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where the focus widget sometimes wasn't drawn with the default if there was no default widget. * gtk/gtkstyle.c (gtk_style_real_unrealize): free colors, unreference pixmaps. * gtk/gtkstyle.c (gtk_style_realize): Reference colormap for some extra safety. Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting the text of a cell to the old pointer value better, by copying the new text before freeing the old text. Some code cleanup. (#8079, Karl Nelson) Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text() gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN. Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c (gtk_menu_remove): When removing an item from a menu, check to see if it matches menu->old_active_menu_item, and if so, unref and clear old_active_menu_item (Patch from Pavel Cisler) * gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset menu_shell->active_menu_item, if it is the child being removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
if (option_menu->menu_item)
1997-11-24 22:37:52 +00:00
{
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat(). * gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix), since some people set $(libdir) separately. (#1290, David Kaelbling) Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not defined, define MAXPATHLEN to 2048. (The Hurd doesn't have MAXPATHLEN, but the code here depends on a fixed value.) (#4524) Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g) Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c (real_tree_move): If the node being moved isn't viewable there is no way that moving the node will cause the focus row to become not viewable, so omit check on the visibility of new_sibling, which is irrelevant. (Fixes #8002, David Helder) Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current selection before inserting new text. Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb): Make the sensitivity of the reparented child track that of the original parent menu item. (#34218, David Hodson) * gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle the case where the current item is destroyed properly. * gtk/gtkoptionmenu.c: Some additional code cleanups and fix some edge cases with child-less menuitems. Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return key pop down window. (#12074, Jon K Hellan) Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan) The solution here isn't perfect - you get an extraneous emission of "toggle", which could conceivably confuse an app, but better than the current situation. LXR search seems to indicate that no apps in GNOME CVS connect to "toggle". Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from gtk_public_h_sources to directly here to avoid warning when building srcdir != builddir. (#9656) Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkrange.c: Patch from Kipp Hickman to make the event handlers in gtkrange.c return the proper values (TRUE == handled) (#10316). This is just the tip of the iceberg, but gtkrange.c is the most common place where the propagation is problematical, and also a place where it is almost certainly safe to change this in the stable branch. (You don't want right click popups on a range control or anything...) Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.c (clear_focus_area): We need to clear the focus area on focus out, even if a background pixmap isn't set. (#13941) Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham to deal with setting the shape properly when scrolling arrows are turned on, but not visible because there is sufficient space. (#13432) Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu items with submenus, destroy the item along with the submenu. (#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...' properly. * gtk/testgtk.c (menu_items): Add a dummy branch that we delete later. Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where the focus widget sometimes wasn't drawn with the default if there was no default widget. * gtk/gtkstyle.c (gtk_style_real_unrealize): free colors, unreference pixmaps. * gtk/gtkstyle.c (gtk_style_realize): Reference colormap for some extra safety. Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting the text of a cell to the old pointer value better, by copying the new text before freeing the old text. Some code cleanup. (#8079, Karl Nelson) Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text() gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN. Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenu.c (gtk_menu_remove): When removing an item from a menu, check to see if it matches menu->old_active_menu_item, and if so, unref and clear old_active_menu_item (Patch from Pavel Cisler) * gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset menu_shell->active_menu_item, if it is the child being removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
child = GTK_BIN (option_menu)->child;
if (child)
{
gtk_widget_set_sensitive (child, TRUE);
gtk_widget_reparent (child, option_menu->menu_item);
}
gtk_signal_disconnect_by_func (GTK_OBJECT (option_menu->menu_item),
GTK_SIGNAL_FUNC (gtk_option_menu_item_state_changed_cb),
option_menu);
gtk_signal_disconnect_by_func (GTK_OBJECT (option_menu->menu_item),
GTK_SIGNAL_FUNC (gtk_option_menu_item_destroy_cb),
option_menu);
gtk_widget_unref (option_menu->menu_item);
1997-11-24 22:37:52 +00:00
option_menu->menu_item = NULL;
}
}
static void
gtk_option_menu_calc_size (GtkOptionMenu *option_menu)
{
GtkWidget *child;
GList *children;
GtkRequisition child_requisition;
gint old_width = option_menu->width;
gint old_height = option_menu->height;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
option_menu->width = 0;
option_menu->height = 0;
if (option_menu->menu)
{
children = GTK_MENU_SHELL (option_menu->menu)->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_VISIBLE (child))
{
GtkWidget *inner = GTK_BIN (child)->child;
1997-11-24 22:37:52 +00:00
if (inner)
{
gtk_widget_size_request (inner, &child_requisition);
option_menu->width = MAX (option_menu->width, child_requisition.width);
option_menu->height = MAX (option_menu->height, child_requisition.height);
}
1997-11-24 22:37:52 +00:00
}
}
}
if (old_width != option_menu->width || old_height != option_menu->height)
gtk_widget_queue_resize (GTK_WIDGET (option_menu));
1997-11-24 22:37:52 +00:00
}
static void
gtk_option_menu_position (GtkMenu *menu,
gint *x,
gint *y,
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
gboolean *push_in,
1997-11-24 22:37:52 +00:00
gpointer user_data)
{
GtkOptionMenu *option_menu;
GtkWidget *active;
GtkWidget *child;
GtkWidget *widget;
2000-03-14 19:57:25 +00:00
GtkRequisition requisition;
1997-11-24 22:37:52 +00:00
GList *children;
gint screen_width;
gint menu_xpos;
gint menu_ypos;
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
gint menu_width;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_OPTION_MENU (user_data));
option_menu = GTK_OPTION_MENU (user_data);
widget = GTK_WIDGET (option_menu);
1997-11-24 22:37:52 +00:00
2000-03-14 19:57:25 +00:00
gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition);
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
menu_width = requisition.width;
1997-11-24 22:37:52 +00:00
active = gtk_menu_get_active (GTK_MENU (option_menu->menu));
gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos);
1997-11-24 22:37:52 +00:00
menu_xpos += widget->allocation.x;
menu_ypos += widget->allocation.y + widget->allocation.height / 2 - 2;
1997-11-24 22:37:52 +00:00
if (active != NULL)
2000-03-14 19:57:25 +00:00
{
gtk_widget_get_child_requisition (active, &requisition);
menu_ypos -= requisition.height / 2;
}
1997-11-24 22:37:52 +00:00
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
children = GTK_MENU_SHELL (option_menu->menu)->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
if (active == child)
break;
if (GTK_WIDGET_VISIBLE (child))
2000-03-14 19:57:25 +00:00
{
gtk_widget_get_child_requisition (child, &requisition);
menu_ypos -= requisition.height;
}
1997-11-24 22:37:52 +00:00
children = children->next;
}
screen_width = gdk_screen_width ();
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
1997-11-24 22:37:52 +00:00
if (menu_xpos < 0)
menu_xpos = 0;
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
else if ((menu_xpos + menu_width) > screen_width)
menu_xpos -= ((menu_xpos + menu_width) - screen_width);
1997-11-24 22:37:52 +00:00
*x = menu_xpos;
*y = menu_ypos;
Add note about GtkMenuPositionFunc API changes. 2000-11-08 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc API changes. * gtk/gtkmenu.c: Add support for scrolling menus. Remove gtk_menu_append/prepend/insert, these have been moved to gtkcompat.h as #defines. * gtk/gtkcompat.h.in: Add compatibility #defines for gtk_menu_append/prepend/insert * gtk/gtkmenu.h: Add data needed for scrolling menus. GtkMenuPositionFunc gets an extra argument push_in. gtk_menu_append/prepend/insert removed. * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu positioning behaviour to fit to scrolling menus. * gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse into menuitem->submeny. That is wrong, and broke torn off submenus of torn off menus, since they were unrealized when the first menu was unrealized. * gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and gtk_menu_shell_select_item() since these need to be overridden in GtkMenu. * gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu positioning behaviour to fit to scrolling menus. (gtk_option_menu_key_press, gtk_option_menu_button_press): Select the current item so that it is prelighted when the menu pops up. This is a workaround to the fact that the menu doesn't get the initial enter event (due to grabs). * gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c: s/gtk_menu_append/gtk_menu_shell_append/ * gtk/gtknotebook.c: s/gtk_menu_insert/gtk_menu_shell_insert/ * gtk/testgtk.c (create_menu, create_menus): Create the first menu with 50 items so that menu scrolling can be tested. Patch from Jonathan Blandford <jrb@redhat.com> * gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new system to handle size requests. First, we ask what the size of the toggle is. Then, when allocating the size, we allocate the toggle_size first. This way we can have multiple menu-item classes w/o needing a seperate class for each. * gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system. * gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system. * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): New function to handle the toggle size-request.
2000-11-08 17:34:52 +00:00
*push_in = TRUE;
1997-11-24 22:37:52 +00:00
}
static void
gtk_option_menu_show_all (GtkWidget *widget)
{
GtkContainer *container;
GtkOptionMenu *option_menu;
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 (GTK_IS_OPTION_MENU (widget));
container = GTK_CONTAINER (widget);
gtk_widget_hide (widget);
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
}
static gboolean
gtk_option_menu_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
gtk_widget_grab_focus (widget);
return TRUE;
}
static gint
gtk_option_menu_scroll_event (GtkWidget *widget,
GdkEventScroll *event)
{
GtkOptionMenu *option_menu = GTK_OPTION_MENU (widget);
gint index;
gint n_children;
gint index_dir;
GList *l;
GtkMenuItem *item;
index = gtk_option_menu_get_history (option_menu);
if (index != -1)
{
n_children = g_list_length (GTK_MENU_SHELL (option_menu->menu)->children);
if (event->direction == GDK_SCROLL_UP)
index_dir = -1;
else
index_dir = 1;
while (TRUE)
{
index += index_dir;
if (index < 0)
break;
if (index >= n_children)
break;
l = g_list_nth (GTK_MENU_SHELL (option_menu->menu)->children, index);
item = GTK_MENU_ITEM (l->data);
if (GTK_WIDGET_VISIBLE (item) && GTK_WIDGET_IS_SENSITIVE (item))
{
gtk_option_menu_set_history (option_menu, index);
break;
}
}
}
return TRUE;
}