aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Lu <harry.lu@sun.com>2005-01-04 15:39:56 +0800
committerHarry Lu <haip@src.gnome.org>2005-01-04 15:39:56 +0800
commit929792231aae9868bbcf6388b309a78e26ae10ba (patch)
treed8165bbeebb414605a99417c135315b50ac350ef
parent5905e1452b32f0adee2e97846a1d4c62818403f2 (diff)
downloadgsoc2013-evolution-929792231aae9868bbcf6388b309a78e26ae10ba.tar.gz
gsoc2013-evolution-929792231aae9868bbcf6388b309a78e26ae10ba.tar.zst
gsoc2013-evolution-929792231aae9868bbcf6388b309a78e26ae10ba.zip
new internal function to popup the menu. (impl_button_press_event): call
2004-01-04 Harry Lu <harry.lu@sun.com> * misc/e-combo-button.c: (e_combo_button_popup): new internal function to popup the menu. (impl_button_press_event): call the new function. (e_combo_button_class_init): init a11y. (e_combo_button_get_label): new function to return label. (e_combo_button_popup_menu): new function to popup menu. * misc/e-combo-button.h: add function declarations. svn path=/trunk/; revision=28227
-rw-r--r--widgets/misc/ChangeLog10
-rw-r--r--widgets/misc/e-combo-button.c51
-rw-r--r--widgets/misc/e-combo-button.h4
3 files changed, 61 insertions, 4 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index fe113e8c5b..c5d73d9490 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-04 Harry Lu <harry.lu@sun.com>
+
+ * misc/e-combo-button.c: (e_combo_button_popup): new internal function
+ to popup the menu.
+ (impl_button_press_event): call the new function.
+ (e_combo_button_class_init): init a11y.
+ (e_combo_button_get_label): new function to return label.
+ (e_combo_button_popup_menu): new function to popup menu.
+ * misc/e-combo-button.h: add function declarations.
+
2004-12-17 Not Zed <NotZed@Ximian.com>
* e-error.c (ee_load, e_error_newv): translate strings based on
diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c
index 66706c1f21..f48c4f3c68 100644
--- a/widgets/misc/e-combo-button.c
+++ b/widgets/misc/e-combo-button.c
@@ -25,6 +25,7 @@
#endif
#include "e-combo-button.h"
+#include "ea-widgets.h"
#include <e-util/e-icon-factory.h>
#include <gtk/gtkarrow.h>
@@ -251,6 +252,30 @@ impl_destroy (GtkObject *object)
}
+
+static gboolean
+e_combo_button_popup (EComboButton *combo_button, GdkEventButton *event)
+{
+ EComboButtonPrivate *priv;
+
+ g_return_val_if_fail (combo_button != NULL, FALSE);
+ g_return_val_if_fail (E_IS_COMBO_BUTTON (combo_button), FALSE);
+
+ priv = combo_button->priv;
+
+ priv->menu_popped_up = TRUE;
+
+ if (event)
+ gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
+ menu_position_func, combo_button,
+ event->button, event->time);
+ else
+ gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
+ menu_position_func, combo_button,
+ 0, gtk_get_current_event_time());
+
+ return TRUE;
+}
/* GtkWidget methods. */
static int
@@ -272,10 +297,7 @@ impl_button_press_event (GtkWidget *widget,
/* User clicked on the right side: pop up the menu. */
gtk_button_pressed (GTK_BUTTON (widget));
- priv->menu_popped_up = TRUE;
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_func, combo_button,
- event->button, event->time);
+ e_combo_button_popup (combo_button, event);
} else {
/* User clicked on the left side: just behave like a
normal button (i.e. not a toggle). */
@@ -393,6 +415,8 @@ e_combo_button_class_init (EComboButtonClass *combo_button_class)
G_STRUCT_OFFSET (EComboButtonClass, activate_default),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+
+ e_combo_button_a11y_init ();
}
static void
@@ -509,3 +533,22 @@ e_combo_button_set_menu (EComboButton *combo_button,
G_CALLBACK (menu_deactivate_callback),
combo_button);
}
+
+GtkWidget *
+e_combo_button_get_label (EComboButton *combo_button)
+{
+ EComboButtonPrivate *priv;
+
+ g_return_val_if_fail (combo_button != NULL, NULL);
+ g_return_val_if_fail (E_IS_COMBO_BUTTON (combo_button), NULL);
+
+ priv = combo_button->priv;
+
+ return priv->label;
+}
+
+gboolean
+e_combo_button_popup_menu (EComboButton *combo_button)
+{
+ return e_combo_button_popup (combo_button, NULL);
+}
diff --git a/widgets/misc/e-combo-button.h b/widgets/misc/e-combo-button.h
index fa4dcc65a2..f7d5b878de 100644
--- a/widgets/misc/e-combo-button.h
+++ b/widgets/misc/e-combo-button.h
@@ -73,6 +73,10 @@ void e_combo_button_set_label (EComboButton *combo_button,
void e_combo_button_set_menu (EComboButton *combo_button,
GtkMenu *menu);
+GtkWidget *e_combo_button_get_label (EComboButton *combo_button);
+
+gboolean e_combo_button_popup_menu (EComboButton *combo_button);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */