Commit 297927c2 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

When the edit lined receives focus start editing. (accept_input) : No need


2000-03-11  Jody Goldberg <jgoldberg@home.com>

	* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
	  focus start editing.
	(accept_input) : No need to force edit mode we should already be in
	  edit mode.
	(workbook_setup_edit_area) : Move the wizard button to the begining of
	  the list and store the ok and cancel buttons in the Private section.
	  Hook cb_editline_focus_in to focus-in.
	(workbook_new) : After show_all, we need to hide the ok/cancel edit
	  buttons.  We start out not editing.
	(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
	(workbook_finish_editing) : Hide them.
parent 36110ef0
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
2000-03-11 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (cb_editline_focus_in) : When the edit lined receives
focus start editing.
(accept_input) : No need to force edit mode we should already be in
edit mode.
(workbook_setup_edit_area) : Move the wizard button to the begining of
the list and store the ok and cancel buttons in the Private section.
Hook cb_editline_focus_in to focus-in.
(workbook_new) : After show_all, we need to hide the ok/cancel edit
buttons. We start out not editing.
(workbook_start_editing_at_cursor) : Show the ok/cancel edit buttons.
(workbook_finish_editing) : Hide them.
2000-03-11 Jon K Hellan <hellan@acm.org>
* src/main.c (main): #ifdef out the fix for now.
......
......@@ -15,7 +15,7 @@ Description Difficulty Integration
functions to samples/regress.gnumeric so we can be
sure that we are returning the right error code.
- Make the new combo boxes tear-off-able High Low
- Finish making the new combo boxes tear-off-able Low Low
- Save/Restore the values of the last selected colours Low Low
from the toolbar for background or font.
......
/*
* GtkComboBox: A customizable ComboBox.
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
* Adrian E Feiguin (feiguin@ifir.edu.ar)
......@@ -14,8 +14,9 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtktearoffmenuitem.h>
#include "gtk-combo-box.h"
static GtkHBoxClass *gtk_combo_box_parent_class;
......@@ -39,7 +40,7 @@ struct _GtkComboBoxPrivate {
GtkWidget *frame;
GtkWidget *popwin;
GtkWidget *arrow_button;
/*
* Closure for invoking the callbacks above
*/
......@@ -104,7 +105,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
{
GtkWidget *arrow;
gboolean popup_info_destroyed = FALSE;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
......@@ -117,7 +118,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
gtk_signal_emit (GTK_OBJECT (combo_box),
gtk_combo_box_signals [POP_DOWN_DONE],
combo_box->priv->pop_down_widget, &popup_info_destroyed);
if (popup_info_destroyed){
gtk_container_remove (
GTK_CONTAINER (combo_box->priv->frame),
......@@ -133,7 +134,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
combo_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (arrow),
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
......@@ -148,17 +149,17 @@ gtk_combo_box_get_pos (GtkComboBox *combo_box, int *x, int *y)
{
GtkWidget *wcombo = GTK_WIDGET (combo_box);
int ph, pw;
gdk_window_get_origin (wcombo->window, x, y);
*y += wcombo->allocation.height + wcombo->allocation.y;
*x += wcombo->allocation.x;
ph = combo_box->priv->popwin->allocation.height;
pw = combo_box->priv->popwin->allocation.width;
if ((*y + ph) > gdk_screen_height ())
*y = gdk_screen_height () - ph;
if ((*x + pw) > gdk_screen_width ())
*x = gdk_screen_width () - pw;
}
......@@ -167,7 +168,7 @@ static void
gtk_combo_box_popup_display (GtkComboBox *combo_box)
{
int x, y;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
......@@ -234,7 +235,7 @@ cb_state_change (GtkWidget *widget, GtkStateType old_state, GtkComboBox *combo_b
GtkStateType const new_state = GTK_WIDGET_STATE(widget);
gtk_widget_set_state ((combo_box->priv->display_widget != widget)
? combo_box->priv->display_widget
: combo_box->priv->arrow_button,
: combo_box->priv->arrow_button,
new_state);
}
......@@ -243,7 +244,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
{
GtkWidget *arrow, *event_box;
GdkCursor *cursor;
combo_box->priv = g_new0 (GtkComboBoxPrivate, 1);
/*
......@@ -275,23 +276,21 @@ gtk_combo_box_init (GtkComboBox *combo_box)
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (combo_box->priv->popwin), event_box);
gtk_widget_show (event_box);
gtk_widget_realize (event_box);
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor (event_box->window, cursor);
gdk_cursor_destroy (cursor);
combo_box->priv->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (event_box), combo_box->priv->frame);
gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->frame), GTK_SHADOW_OUT);
gtk_widget_show (combo_box->priv->frame);
gtk_signal_connect (
GTK_OBJECT (combo_box->priv->popwin), "button_press_event",
GTK_SIGNAL_FUNC (gtk_combo_box_button_press), combo_box);
}
GtkType
gtk_combo_box_get_type (void)
{
......@@ -319,7 +318,7 @@ gtk_combo_box_get_type (void)
* gtk_combo_box_set_display:
* @combo_box: the Combo Box to modify
* @display_widget: The widget to be displayed
*
* Sets the displayed widget for the @combo_box to be @display_widget
*/
void
......@@ -344,9 +343,27 @@ gtk_combo_box_set_display (GtkComboBox *combo_box, GtkWidget *display_widget)
gtk_box_pack_start (GTK_BOX (combo_box), display_widget, TRUE, TRUE, 0);
}
static gboolean
cb_tearable_enter_leave (GtkWidget *w, GdkEventCrossing *event, gpointer data)
{
gboolean const flag = GPOINTER_TO_INT(data);
gtk_widget_set_state (w, flag ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
return FALSE;
}
static gboolean
cb_tearable_button_release (GtkWidget *w, GdkEventButton *event, gpointer data)
{
/* FIXME : TODO finish this */
g_warning ("Tearoff is unfinished");
return TRUE;
}
void
gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkWidget *pop_down_widget)
{
GtkWidget *tearable;
GtkWidget *vbox;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
g_return_if_fail (display_widget != NULL);
......@@ -358,12 +375,27 @@ gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkW
combo_box->priv->pop_down_widget = pop_down_widget;
combo_box->priv->display_widget = NULL;
vbox = gtk_vbox_new (FALSE, 5);
tearable = gtk_tearoff_menu_item_new ();
gtk_signal_connect (GTK_OBJECT (tearable), "enter-notify-event",
GTK_SIGNAL_FUNC (cb_tearable_enter_leave),
GINT_TO_POINTER (TRUE));
gtk_signal_connect (GTK_OBJECT (tearable), "leave-notify-event",
GTK_SIGNAL_FUNC (cb_tearable_enter_leave),
GINT_TO_POINTER (FALSE));
gtk_signal_connect (GTK_OBJECT (tearable), "button-release-event",
GTK_SIGNAL_FUNC (cb_tearable_button_release),
GINT_TO_POINTER (FALSE));
gtk_box_pack_start (GTK_BOX (vbox), tearable, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), pop_down_widget, TRUE, TRUE, 0);
/*
* Finish setup
*/
gtk_combo_box_set_display (combo_box, display_widget);
gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), pop_down_widget);
gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), vbox);
gtk_widget_show_all (combo_box->priv->frame);
}
GtkWidget *
......
......@@ -202,7 +202,8 @@ color_table_setup (ColorCombo *cc, char const * const no_color_label, int ncols,
if (no_color_label != NULL) {
desc_label = gtk_button_new_with_label (no_color_label);
gtk_table_attach (GTK_TABLE (table), desc_label, 0, ncols, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), desc_label,
0, ncols, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
gtk_signal_connect (GTK_OBJECT (desc_label), "clicked",
GTK_SIGNAL_FUNC(desc_label_clicked), cc);
}
......
/*
* GtkComboBox: A customizable ComboBox.
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
* Adrian E Feiguin (feiguin@ifir.edu.ar)
......@@ -14,8 +14,9 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtktearoffmenuitem.h>
#include "gtk-combo-box.h"
static GtkHBoxClass *gtk_combo_box_parent_class;
......@@ -39,7 +40,7 @@ struct _GtkComboBoxPrivate {
GtkWidget *frame;
GtkWidget *popwin;
GtkWidget *arrow_button;
/*
* Closure for invoking the callbacks above
*/
......@@ -104,7 +105,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
{
GtkWidget *arrow;
gboolean popup_info_destroyed = FALSE;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
......@@ -117,7 +118,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
gtk_signal_emit (GTK_OBJECT (combo_box),
gtk_combo_box_signals [POP_DOWN_DONE],
combo_box->priv->pop_down_widget, &popup_info_destroyed);
if (popup_info_destroyed){
gtk_container_remove (
GTK_CONTAINER (combo_box->priv->frame),
......@@ -133,7 +134,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
combo_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (arrow),
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
......@@ -148,17 +149,17 @@ gtk_combo_box_get_pos (GtkComboBox *combo_box, int *x, int *y)
{
GtkWidget *wcombo = GTK_WIDGET (combo_box);
int ph, pw;
gdk_window_get_origin (wcombo->window, x, y);
*y += wcombo->allocation.height + wcombo->allocation.y;
*x += wcombo->allocation.x;
ph = combo_box->priv->popwin->allocation.height;
pw = combo_box->priv->popwin->allocation.width;
if ((*y + ph) > gdk_screen_height ())
*y = gdk_screen_height () - ph;
if ((*x + pw) > gdk_screen_width ())
*x = gdk_screen_width () - pw;
}
......@@ -167,7 +168,7 @@ static void
gtk_combo_box_popup_display (GtkComboBox *combo_box)
{
int x, y;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
......@@ -234,7 +235,7 @@ cb_state_change (GtkWidget *widget, GtkStateType old_state, GtkComboBox *combo_b
GtkStateType const new_state = GTK_WIDGET_STATE(widget);
gtk_widget_set_state ((combo_box->priv->display_widget != widget)
? combo_box->priv->display_widget
: combo_box->priv->arrow_button,
: combo_box->priv->arrow_button,
new_state);
}
......@@ -243,7 +244,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
{
GtkWidget *arrow, *event_box;
GdkCursor *cursor;
combo_box->priv = g_new0 (GtkComboBoxPrivate, 1);
/*
......@@ -275,23 +276,21 @@ gtk_combo_box_init (GtkComboBox *combo_box)
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (combo_box->priv->popwin), event_box);
gtk_widget_show (event_box);
gtk_widget_realize (event_box);
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor (event_box->window, cursor);
gdk_cursor_destroy (cursor);
combo_box->priv->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (event_box), combo_box->priv->frame);
gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->frame), GTK_SHADOW_OUT);
gtk_widget_show (combo_box->priv->frame);
gtk_signal_connect (
GTK_OBJECT (combo_box->priv->popwin), "button_press_event",
GTK_SIGNAL_FUNC (gtk_combo_box_button_press), combo_box);
}
GtkType
gtk_combo_box_get_type (void)
{
......@@ -319,7 +318,7 @@ gtk_combo_box_get_type (void)
* gtk_combo_box_set_display:
* @combo_box: the Combo Box to modify
* @display_widget: The widget to be displayed
*
* Sets the displayed widget for the @combo_box to be @display_widget
*/
void
......@@ -344,9 +343,27 @@ gtk_combo_box_set_display (GtkComboBox *combo_box, GtkWidget *display_widget)
gtk_box_pack_start (GTK_BOX (combo_box), display_widget, TRUE, TRUE, 0);
}
static gboolean
cb_tearable_enter_leave (GtkWidget *w, GdkEventCrossing *event, gpointer data)
{
gboolean const flag = GPOINTER_TO_INT(data);
gtk_widget_set_state (w, flag ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
return FALSE;
}
static gboolean
cb_tearable_button_release (GtkWidget *w, GdkEventButton *event, gpointer data)
{
/* FIXME : TODO finish this */
g_warning ("Tearoff is unfinished");
return TRUE;
}
void
gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkWidget *pop_down_widget)
{
GtkWidget *tearable;
GtkWidget *vbox;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
g_return_if_fail (display_widget != NULL);
......@@ -358,12 +375,27 @@ gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkW
combo_box->priv->pop_down_widget = pop_down_widget;
combo_box->priv->display_widget = NULL;
vbox = gtk_vbox_new (FALSE, 5);
tearable = gtk_tearoff_menu_item_new ();
gtk_signal_connect (GTK_OBJECT (tearable), "enter-notify-event",
GTK_SIGNAL_FUNC (cb_tearable_enter_leave),
GINT_TO_POINTER (TRUE));
gtk_signal_connect (GTK_OBJECT (tearable), "leave-notify-event",
GTK_SIGNAL_FUNC (cb_tearable_enter_leave),
GINT_TO_POINTER (FALSE));
gtk_signal_connect (GTK_OBJECT (tearable), "button-release-event",
GTK_SIGNAL_FUNC (cb_tearable_button_release),
GINT_TO_POINTER (FALSE));
gtk_box_pack_start (GTK_BOX (vbox), tearable, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), pop_down_widget, TRUE, TRUE, 0);
/*
* Finish setup
*/
gtk_combo_box_set_display (combo_box, display_widget);
gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), pop_down_widget);
gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), vbox);
gtk_widget_show_all (combo_box->priv->frame);
}
GtkWidget *
......
/*
* GtkComboBox: A customizable ComboBox.
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
* Adrian E Feiguin (feiguin@ifir.edu.ar)
......@@ -14,8 +14,9 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtktearoffmenuitem.h>
#include "gtk-combo-box.h"
static GtkHBoxClass *gtk_combo_box_parent_class;
......@@ -39,7 +40,7 @@ struct _GtkComboBoxPrivate {
GtkWidget *frame;
GtkWidget *popwin;
GtkWidget *arrow_button;
/*
* Closure for invoking the callbacks above
*/
......@@ -104,7 +105,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
{
GtkWidget *arrow;
gboolean popup_info_destroyed = FALSE;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
......@@ -117,7 +118,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
gtk_signal_emit (GTK_OBJECT (combo_box),
gtk_combo_box_signals [POP_DOWN_DONE],
combo_box->priv->pop_down_widget, &popup_info_destroyed);
if (popup_info_destroyed){
gtk_container_remove (
GTK_CONTAINER (combo_box->priv->frame),
......@@ -133,7 +134,7 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
combo_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (arrow),
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
......@@ -148,17 +149,17 @@ gtk_combo_box_get_pos (GtkComboBox *combo_box, int *x, int *y)
{
GtkWidget *wcombo = GTK_WIDGET (combo_box);
int ph, pw;
gdk_window_get_origin (wcombo->window, x, y);
*y += wcombo->allocation.height + wcombo->allocation.y;
*x += wcombo->allocation.x;
ph = combo_box->priv->popwin->allocation.height;
pw = combo_box->priv->popwin->allocation.width;
if ((*y + ph) > gdk_screen_height ())
*y = gdk_screen_height () - ph;
if ((*x + pw) > gdk_screen_width ())
*x = gdk_screen_width () - pw;
}
......@@ -167,7 +168,7 @@ static void
gtk_combo_box_popup_display (GtkComboBox *combo_box)
{
int x, y;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
......@@ -234,7 +235,7 @@ cb_state_change (GtkWidget *widget, GtkStateType old_state, GtkComboBox *combo_b
GtkStateType const new_state = GTK_WIDGET_STATE(widget);
gtk_widget_set_state ((combo_box->priv->display_widget != widget)
? combo_box->priv->display_widget
: combo_box->priv->arrow_button,
: combo_box->priv->arrow_button,
new_state);
}
......@@ -243,7 +244,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
{
GtkWidget *arrow, *event_box;
GdkCursor *cursor;
combo_box->priv = g_new0 (GtkComboBoxPrivate, 1);
/*
......@@ -275,23 +276,21 @@ gtk_combo_box_init (GtkComboBox *combo_box)
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (combo_box->priv->popwin), event_box);
gtk_widget_show (event_box);
gtk_widget_realize (event_box);
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor (event_box->window, cursor);
gdk_cursor_destroy (cursor);
combo_box->priv->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (event_box), combo_box->priv->frame);
gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->frame), GTK_SHADOW_OUT);
gtk_widget_show (combo_box->priv->frame);
gtk_signal_connect (
GTK_OBJECT (combo_box->priv->popwin), "button_press_event",
GTK_SIGNAL_FUNC (gtk_combo_box_button_press), combo_box);
}
GtkType
gtk_combo_box_get_type (void)
{
......@@ -319,7 +318,7 @@ gtk_combo_box_get_type (void)
* gtk_combo_box_set_display:
* @combo_box: the Combo Box to modify
* @display_widget: The widget to be displayed
*
* Sets the displayed widget for the @combo_box to be @display_widget
*/
void
......@@ -344,9 +343,27 @@ gtk_combo_box_set_display (GtkComboBox *combo_box, GtkWidget *display_widget)
gtk_box_pack_start (GTK_BOX (combo_box), display_widget, TRUE, TRUE, 0);
}
static gboolean
cb_tearable_enter_leave (GtkWidget *w, GdkEventCrossing *event, gpointer data)
{
gboolean const flag = GPOINTER_TO_INT(data);
gtk_widget_set_state (w, flag ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
return FALSE;
}
static gboolean
cb_tearable_button_release (GtkWidget *w, GdkEventButton *event, gpointer data)
{
/* FIXME : TODO finish this */
g_warning ("Tearoff is unfinished");
return TRUE;
}
void
gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkWidget *pop_down_widget)
{
GtkWidget *tearable;
GtkWidget *vbox;
g_return_if_fail (combo_box != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
g_return_if_fail (display_widget != NULL);
......@@ -358,12 +375,27 @@ gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkW
combo_box->priv->pop_down_widget = pop_down_widget;
combo_box->priv->display_widget = NULL;
vbox = gtk_vbox_new (FALSE, 5);
tearable = gtk_tearoff_menu_item_new ();
gtk_signal_connect (GTK_OBJECT (tearable), "enter-notify-event",
GTK_SIGNAL_FUNC (cb_tearable_enter_leave),
GINT_TO_POINTER (TRUE));
gtk_signal_connect (GTK_OBJECT (tearable), "leave-notify-event",
GTK_SIGNAL_FUNC (cb_tearable_enter_leave),
GINT_TO_POINTER (FALSE));
gtk_signal_connect (GTK_OBJECT (tearable), "button-release-event",
GTK_SIGNAL_FUNC (cb_tearable_button_release),
GINT_TO_POINTER (FALSE));
gtk_box_pack_start (GTK_BOX (vbox), tearable, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), pop_down_widget, TRUE, TRUE, 0);
/*
* Finish setup
*/
gtk_combo_box_set_display (combo_box, display_widget);
gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), pop_down_widget);
gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), vbox);
gtk_widget_show_all (combo_box->priv->frame);
}
GtkWidget *
......
......@@ -202,7 +202,8 @@ color_table_setup (ColorCombo *cc, char const * const no_color_label, int ncols,
if (no_color_label != NULL) {
desc_label = gtk_button_new_with_label (no_color_label);
gtk_table_attach (GTK_TABLE (table), desc_label, 0, ncols, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), desc_label,
0, ncols, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
gtk_signal_connect (GTK_OBJECT (desc_label), "clicked",
GTK_SIGNAL_FUNC(desc_label_clicked), cc);
}
......
......@@ -46,6 +46,9 @@ struct _WorkbookPrivate {
/* Edit area */
GtkWidget *ea_status;
/* While editing these should be visible */
GtkWidget *ok_button, *cancel_button;
/* The status bar */
GnomeAppBar *appbar;
......
......@@ -644,11 +644,16 @@ quit_cmd (void)
g_list_free (n);
}
static gboolean
cb_editline_focus_in (GtkWidget *w, GdkEventFocus *event, Workbook *wb)
{
workbook_start_editing_at_cursor (wb, FALSE, TRUE);
<