Bug 1341296 - Move mozcontainer.c to cpp file, r?karlt
MozReview-Commit-ID: 2n18VlOMQod
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -14,17 +14,17 @@ EXPORTS += [
]
EXPORTS.mozilla += [
'WidgetUtilsGtk.h'
]
UNIFIED_SOURCES += [
'IMContextWrapper.cpp',
- 'mozcontainer.c',
+ 'mozcontainer.cpp',
'NativeKeyBindings.cpp',
'nsAppShell.cpp',
'nsBidiKeyboard.cpp',
'nsColorPicker.cpp',
'nsFilePicker.cpp',
'nsGtkKeyUtils.cpp',
'nsImageToPixbuf.cpp',
'nsLookAndFeel.cpp',
rename from widget/gtk/mozcontainer.c
rename to widget/gtk/mozcontainer.cpp
--- a/widget/gtk/mozcontainer.c
+++ b/widget/gtk/mozcontainer.cpp
@@ -66,17 +66,18 @@ moz_container_get_type(void)
sizeof(MozContainer), /* instance_size */
0, /* n_preallocs */
(GInstanceInitFunc) moz_container_init, /* instance_init */
NULL, /* value_table */
};
moz_container_type = g_type_register_static (GTK_TYPE_CONTAINER,
"MozContainer",
- &moz_container_info, 0);
+ &moz_container_info,
+ static_cast<GTypeFlags>(0));
#ifdef ACCESSIBILITY
/* Set a factory to return accessible object with ROLE_REDUNDANT for
* MozContainer, so that gail won't send focus notification for it */
atk_registry_set_factory_type(atk_get_default_registry(),
moz_container_type,
mai_redundant_object_factory_get_type());
#endif
}
@@ -84,17 +85,17 @@ moz_container_get_type(void)
return moz_container_type;
}
GtkWidget *
moz_container_new (void)
{
MozContainer *container;
- container = g_object_new (MOZ_CONTAINER_TYPE, NULL);
+ container = static_cast<MozContainer*>(g_object_new (MOZ_CONTAINER_TYPE, nullptr));
return GTK_WIDGET(container);
}
void
moz_container_put (MozContainer *container, GtkWidget *child_widget,
gint x, gint y)
{
@@ -285,17 +286,17 @@ moz_container_size_allocate (GtkWidget
return;
}
gtk_widget_set_allocation(widget, allocation);
tmp_list = container->children;
while (tmp_list) {
- MozContainerChild *child = tmp_list->data;
+ MozContainerChild *child = static_cast<MozContainerChild*>(tmp_list->data);
moz_container_allocate_child (container, child);
tmp_list = tmp_list->next;
}
if (gtk_widget_get_has_window (widget) &&
gtk_widget_get_realized (widget)) {
@@ -367,17 +368,17 @@ moz_container_forall (GtkContainer *cont
g_return_if_fail (IS_MOZ_CONTAINER(container));
g_return_if_fail (callback != NULL);
moz_container = MOZ_CONTAINER(container);
tmp_list = moz_container->children;
while (tmp_list) {
MozContainerChild *child;
- child = tmp_list->data;
+ child = static_cast<MozContainerChild*>(tmp_list->data);
tmp_list = tmp_list->next;
(* callback) (child->widget, callback_data);
}
}
static void
moz_container_allocate_child (MozContainer *container,
MozContainerChild *child)
@@ -395,24 +396,23 @@ MozContainerChild *
moz_container_get_child (MozContainer *container, GtkWidget *child_widget)
{
GList *tmp_list;
tmp_list = container->children;
while (tmp_list) {
MozContainerChild *child;
- child = tmp_list->data;
+ child = static_cast<MozContainerChild*>(tmp_list->data);
tmp_list = tmp_list->next;
if (child->widget == child_widget)
return child;
}
return NULL;
}
static void
moz_container_add(GtkContainer *container, GtkWidget *widget)
{
moz_container_put(MOZ_CONTAINER(container), widget, 0, 0);
}
-
--- a/widget/gtk/mozcontainer.h
+++ b/widget/gtk/mozcontainer.h
@@ -5,20 +5,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __MOZ_CONTAINER_H__
#define __MOZ_CONTAINER_H__
#include <gtk/gtk.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/*
* MozContainer
*
* This class serves two purposes in the nsIWidget implementation.
*
* - It provides objects to receive signals from GTK for events on native
* windows.
*
@@ -74,13 +70,9 @@ void moz_container_put (MozCo
gint y);
void moz_container_move (MozContainer *container,
GtkWidget *child_widget,
gint x,
gint y,
gint width,
gint height);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __MOZ_CONTAINER_H__ */