voc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_previous_line): (gtk_text_layout_move_iter_to_next_line): fix these two for invisible text, lots of other stuff still hosed. * gtk/gtkcolorsel.c (gtk_color_selection_set_change_palette_hook): new function, replaces the get/set palette stuff. This function is intended for use by libgnomeui which should set the hook to a thing which sets the palette in GConf, and we need the GConf-to-xsettings proxy which will result in the change being propagated back to the GTK app. * gtk/gtkaccelgroup.c (gtk_accel_group_add): add note to warning about unusable signals that it may be because the signal has parameters. * gtk/gtkwidget.c (gtk_widget_modify_style): always copy the style, otherwise gtkrc.c won't know to create a new GtkStyle for it. (gtk_widget_modify_color_component): call gtk_widget_modify_style() so the rc style will get copied. (gtk_widget_modify_font): ditto * gtk/gtkrc.c: make a couple variables static * gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init): hide help button by default, since it does nothing * gtk/gtkcolorsel.c: add tooltips, work on key navigation, fool around with UI * gtk/gtkentry.c (gtk_entry_realize): request enter/leave notify so we can have tooltips * gtk/gtkhsv.c (gtk_hsv_realize): request enter/leave notify so we can have tooltips * gdk/gdkimage.h: mark gdk_image_new_bitmap with GDK_ENABLE_BROKEN, because its memory behavior is completely hosed. * gtk/gtknotebook.c: remove key press handler, replace with binding set, add numeric keypad support * gtk/gtktextview.c (gtk_text_view_class_init): accept KP_Delete * gtk/gtktext.c (gtk_text_key_press): add a bunch of KP keysyms * gtk/gtkentry.c (gtk_entry_class_init): accept GDK_KP_Delete in addition to plain Delete * gtk/gtktextview.c (gtk_text_view_key_press_event): accept GDK_KP_Enter in addition to GDK_Return * gtk/gtkfontsel.c (gtk_font_selection_size_key_press): connect to activate on entry instead of key press (gtk_font_selection_on_clist_key_press): get rid of this signal handler, not needed with new font sel. * gtk/gtkfilesel.c (gtk_file_selection_key_press): remove a no-longer-needed emit_stop_by_name(), just return TRUE * gtk/gtkhscrollbar.c, gtk/gtkvscrollbar.c: remove keybindings cruft, this widget is no longer focusable. * gtk/gtkrange.h, gtk/gtkrange.c, gtk/gtkvscale.c, gtk/gtkhscale.c: Get rid of trough_keys virtual function, add move_slider action signal, add binding set for vscale/hscale, in the process support numeric keypad * gtk/gtkentry.c (gtk_entry_class_init): Add keypad bindings; make GDK_Return and GDK_KP_Enter activate the entry via binding set, instead of hardcoded.
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <stdio.h>
|
||||
#include "gtkintl.h"
|
||||
#include "gtkbindings.h"
|
||||
|
||||
|
||||
#define TAB_OVERLAP 2
|
||||
@ -46,6 +47,8 @@
|
||||
|
||||
enum {
|
||||
SWITCH_PAGE,
|
||||
FOCUS_TAB,
|
||||
SELECT_PAGE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -111,6 +114,11 @@ struct _GtkNotebookPage
|
||||
static void gtk_notebook_class_init (GtkNotebookClass *klass);
|
||||
static void gtk_notebook_init (GtkNotebook *notebook);
|
||||
|
||||
static void gtk_notebook_select_page (GtkNotebook *notebook,
|
||||
gboolean move_focus);
|
||||
static void gtk_notebook_focus_tab (GtkNotebook *notebook,
|
||||
GtkNotebookTab type);
|
||||
|
||||
/*** GtkObject Methods ***/
|
||||
static void gtk_notebook_destroy (GtkObject *object);
|
||||
static void gtk_notebook_set_arg (GtkObject *object,
|
||||
@ -141,8 +149,6 @@ static gint gtk_notebook_leave_notify (GtkWidget *widget,
|
||||
GdkEventCrossing *event);
|
||||
static gint gtk_notebook_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
static gint gtk_notebook_key_press (GtkWidget *widget,
|
||||
GdkEventKey *event);
|
||||
static gint gtk_notebook_focus_in (GtkWidget *widget,
|
||||
GdkEventFocus *event);
|
||||
static void gtk_notebook_draw_focus (GtkWidget *widget);
|
||||
@ -274,7 +280,8 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkContainerClass *container_class;
|
||||
|
||||
GtkBindingSet *binding_set;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
container_class = (GtkContainerClass*) class;
|
||||
@ -297,7 +304,6 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
widget_class->enter_notify_event = gtk_notebook_enter_notify;
|
||||
widget_class->leave_notify_event = gtk_notebook_leave_notify;
|
||||
widget_class->motion_notify_event = gtk_notebook_motion_notify;
|
||||
widget_class->key_press_event = gtk_notebook_key_press;
|
||||
widget_class->focus_in_event = gtk_notebook_focus_in;
|
||||
widget_class->style_set = gtk_notebook_style_set;
|
||||
|
||||
@ -312,6 +318,9 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
|
||||
class->switch_page = gtk_notebook_real_switch_page;
|
||||
|
||||
class->focus_tab = gtk_notebook_focus_tab;
|
||||
class->select_page = gtk_notebook_select_page;
|
||||
|
||||
gtk_object_add_arg_type ("GtkNotebook::page", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PAGE);
|
||||
gtk_object_add_arg_type ("GtkNotebook::tab_pos", GTK_TYPE_POSITION_TYPE, GTK_ARG_READWRITE, ARG_TAB_POS);
|
||||
gtk_object_add_arg_type ("GtkNotebook::tab_border", GTK_TYPE_UINT, GTK_ARG_WRITABLE, ARG_TAB_BORDER);
|
||||
@ -338,6 +347,60 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_UINT);
|
||||
|
||||
notebook_signals[FOCUS_TAB] =
|
||||
g_signal_newc ("focus_tab",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkNotebookClass, focus_tab),
|
||||
NULL, NULL,
|
||||
gtk_marshal_VOID__ENUM,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_NOTEBOOK_TAB);
|
||||
|
||||
notebook_signals[SELECT_PAGE] =
|
||||
g_signal_newc ("select_page",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkNotebookClass, select_page),
|
||||
NULL, NULL,
|
||||
gtk_marshal_VOID__BOOLEAN,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_BOOLEAN);
|
||||
|
||||
binding_set = gtk_binding_set_by_class (object_class);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_Return, 0,
|
||||
"select_page", 1,
|
||||
G_TYPE_BOOLEAN, TRUE);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_KP_Enter, 0,
|
||||
"select_page", 1,
|
||||
G_TYPE_BOOLEAN, TRUE);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_space, 0,
|
||||
"select_page", 1,
|
||||
G_TYPE_BOOLEAN, FALSE);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_Home, 0,
|
||||
"focus_tab", 1,
|
||||
GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_FIRST);
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_KP_Home, 0,
|
||||
"focus_tab", 1,
|
||||
GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_FIRST);
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_End, 0,
|
||||
"focus_tab", 1,
|
||||
GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_LAST);
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_KP_End, 0,
|
||||
"focus_tab", 1,
|
||||
GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_LAST);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -368,6 +431,34 @@ gtk_notebook_init (GtkNotebook *notebook)
|
||||
notebook->have_visible_child = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_select_page (GtkNotebook *notebook,
|
||||
gboolean move_focus)
|
||||
{
|
||||
gtk_notebook_page_select (notebook, move_focus);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_focus_tab (GtkNotebook *notebook,
|
||||
GtkNotebookTab type)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GTK_NOTEBOOK_TAB_FIRST:
|
||||
list = gtk_notebook_search_page (notebook, NULL, STEP_NEXT, TRUE);
|
||||
if (list)
|
||||
gtk_notebook_switch_focus_tab (notebook, list);
|
||||
break;
|
||||
case GTK_NOTEBOOK_TAB_LAST:
|
||||
list = gtk_notebook_search_page (notebook, NULL, STEP_PREV, TRUE);
|
||||
if (list)
|
||||
gtk_notebook_switch_focus_tab (notebook, list);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_notebook_new:
|
||||
*
|
||||
@ -509,7 +600,6 @@ gtk_notebook_get_arg (GtkObject *object,
|
||||
* gtk_notebook_enter_notify
|
||||
* gtk_notebook_leave_notify
|
||||
* gtk_notebook_motion_notify
|
||||
* gtk_notebook_key_press
|
||||
* gtk_notebook_focus_in
|
||||
* gtk_notebook_focus_out
|
||||
* gtk_notebook_draw_focus
|
||||
@ -1236,45 +1326,6 @@ gtk_notebook_motion_notify (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_notebook_key_press (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
|
||||
if (!notebook->children || !notebook->show_tabs)
|
||||
return FALSE;
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_Home:
|
||||
list = gtk_notebook_search_page (notebook, NULL, STEP_NEXT, TRUE);
|
||||
if (list)
|
||||
gtk_notebook_switch_focus_tab (notebook, list);
|
||||
return TRUE;
|
||||
case GDK_End:
|
||||
list = gtk_notebook_search_page (notebook, NULL, STEP_PREV, TRUE);
|
||||
if (list)
|
||||
gtk_notebook_switch_focus_tab (notebook, list);
|
||||
return TRUE;
|
||||
case GDK_Return:
|
||||
gtk_notebook_page_select (GTK_NOTEBOOK (widget), TRUE);
|
||||
return TRUE;
|
||||
case GDK_space:
|
||||
gtk_notebook_page_select (GTK_NOTEBOOK (widget), FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_notebook_focus_in (GtkWidget *widget,
|
||||
GdkEventFocus *event)
|
||||
|
||||
Reference in New Issue
Block a user