summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp')
-rw-r--r--Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp55
1 files changed, 42 insertions, 13 deletions
diff --git a/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp b/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp
index 4d79f13..fee7a14 100644
--- a/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp
+++ b/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007 Holger Hans Peter Freyther
* Copyright (C) 2010 Igalia S.L
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -144,28 +145,42 @@ ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction act
m_platformDescription = GTK_MENU_ITEM(gtk_action_create_menu_item(platformAction));
g_object_unref(platformAction);
- g_object_set_data(G_OBJECT(m_platformDescription.get()), WEBKIT_CONTEXT_MENU_ACTION, GINT_TO_POINTER(action));
+ g_object_set_data(G_OBJECT(m_platformDescription), WEBKIT_CONTEXT_MENU_ACTION, GINT_TO_POINTER(action));
if (subMenu)
setSubMenu(subMenu);
}
+ContextMenuItem::ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, bool, bool)
+{
+ // FIXME: Implement with WebKit2 ContextMenu changes.
+ notImplemented();
+}
+
+ContextMenuItem::ContextMenuItem(ContextMenuAction, const String&, bool, bool, Vector<ContextMenuItem>&)
+{
+ // FIXME: Implement with WebKit2 ContextMenu changes.
+ notImplemented();
+}
+
ContextMenuItem::~ContextMenuItem()
{
}
PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription()
{
- return m_platformDescription.leakRef();
+ PlatformMenuItemDescription platformDescription = m_platformDescription;
+ m_platformDescription = 0;
+ return platformDescription;
}
ContextMenuItemType ContextMenuItem::type() const
{
- if (GTK_IS_SEPARATOR_MENU_ITEM(m_platformDescription.get()))
+ if (GTK_IS_SEPARATOR_MENU_ITEM(m_platformDescription))
return SeparatorType;
- if (GTK_IS_CHECK_MENU_ITEM(m_platformDescription.get()))
+ if (GTK_IS_CHECK_MENU_ITEM(m_platformDescription))
return CheckableActionType;
- if (gtk_menu_item_get_submenu(m_platformDescription.get()))
+ if (gtk_menu_item_get_submenu(m_platformDescription))
return SubmenuType;
return ActionType;
}
@@ -178,48 +193,62 @@ void ContextMenuItem::setType(ContextMenuItemType type)
ContextMenuAction ContextMenuItem::action() const
{
- return static_cast<ContextMenuAction>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(m_platformDescription.get()), WEBKIT_CONTEXT_MENU_ACTION)));
+ return static_cast<ContextMenuAction>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(m_platformDescription), WEBKIT_CONTEXT_MENU_ACTION)));
}
void ContextMenuItem::setAction(ContextMenuAction action)
{
- g_object_set_data(G_OBJECT(m_platformDescription.get()), WEBKIT_CONTEXT_MENU_ACTION, GINT_TO_POINTER(action));
+ g_object_set_data(G_OBJECT(m_platformDescription), WEBKIT_CONTEXT_MENU_ACTION, GINT_TO_POINTER(action));
}
String ContextMenuItem::title() const
{
- GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription.get()));
+ GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription));
return action ? String(gtk_action_get_label(action)) : String();
}
void ContextMenuItem::setTitle(const String& title)
{
- GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription.get()));
+ GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription));
if (action)
gtk_action_set_label(action, title.utf8().data());
}
PlatformMenuDescription ContextMenuItem::platformSubMenu() const
{
- GtkWidget* subMenu = gtk_menu_item_get_submenu(m_platformDescription.get());
+ GtkWidget* subMenu = gtk_menu_item_get_submenu(m_platformDescription);
return subMenu ? GTK_MENU(subMenu) : 0;
}
void ContextMenuItem::setSubMenu(ContextMenu* menu)
{
- gtk_menu_item_set_submenu(m_platformDescription.get(), GTK_WIDGET(menu->platformDescription()));
+ gtk_menu_item_set_submenu(m_platformDescription, GTK_WIDGET(menu->platformDescription()));
}
void ContextMenuItem::setChecked(bool shouldCheck)
{
- GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription.get()));
+ GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription));
if (action && GTK_IS_TOGGLE_ACTION(action))
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), shouldCheck);
}
+bool ContextMenuItem::checked() const
+{
+ // FIXME: Implement with WebKit2 ContextMenu changes.
+ notImplemented();
+ return false;
+}
+
+bool ContextMenuItem::enabled() const
+{
+ // FIXME: Implement with WebKit2 ContextMenu changes.
+ notImplemented();
+ return false;
+}
+
void ContextMenuItem::setEnabled(bool shouldEnable)
{
- GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription.get()));
+ GtkAction* action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(m_platformDescription));
if (action)
gtk_action_set_sensitive(action, shouldEnable);
}