aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2015-08-10 13:46:40 +0200
committerThomas Martitz <kugel@rockbox.org>2015-08-10 13:46:40 +0200
commit4ec6923a5f5df2961fc16bd53eba10c81dded1e3 (patch)
tree24b5acf0ecbc50db3e70318489fdc9f88bb416ef
parent5f346c235306e50a0785fad89275e4d3548f2c5a (diff)
downloadscintilla-mirror-4ec6923a5f5df2961fc16bd53eba10c81dded1e3.tar.gz
Enable g-ir-scanner to run on ScintillaWidget.h
g-ir-scanner expects a certain naming scheme. Adhering gives the benefit of automatically getting correct gobject-introspection data.
-rw-r--r--gtk/ScintillaGTK.cxx25
-rw-r--r--include/ScintillaWidget.h19
2 files changed, 39 insertions, 5 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 6be14c267..ad6898072 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -3058,26 +3058,33 @@ sptr_t ScintillaGTK::DirectFunction(
return reinterpret_cast<ScintillaGTK *>(ptr)->WndProc(iMessage, wParam, lParam);
}
+/* old name for compatibility */
sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
ScintillaGTK *psci = static_cast<ScintillaGTK *>(sci->pscin);
return psci->WndProc(iMessage, wParam, lParam);
}
+sptr_t scintilla_object_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
+
+ return scintilla_send_message(sci, iMessage, wParam, lParam);
+}
+
static void scintilla_class_init(ScintillaClass *klass);
static void scintilla_init(ScintillaObject *sci);
extern void Platform_Initialise();
extern void Platform_Finalise();
+/* old name for compatibility */
GType scintilla_get_type() {
static GType scintilla_type = 0;
try {
if (!scintilla_type) {
- scintilla_type = g_type_from_name("Scintilla");
+ scintilla_type = g_type_from_name("ScintillaObject");
if (!scintilla_type) {
static GTypeInfo scintilla_info = {
- (guint16) sizeof (ScintillaClass),
+ (guint16) sizeof (ScintillaObjectClass),
NULL, //(GBaseInitFunc)
NULL, //(GBaseFinalizeFunc)
(GClassInitFunc) scintilla_class_init,
@@ -3088,9 +3095,8 @@ GType scintilla_get_type() {
(GInstanceInitFunc) scintilla_init,
NULL //(GTypeValueTable*)
};
-
scintilla_type = g_type_register_static(
- GTK_TYPE_CONTAINER, "Scintilla", &scintilla_info, (GTypeFlags) 0);
+ GTK_TYPE_CONTAINER, "ScintillaObject", &scintilla_info, (GTypeFlags) 0);
}
}
@@ -3099,6 +3105,11 @@ GType scintilla_get_type() {
return scintilla_type;
}
+GType scintilla_object_get_type() {
+
+ return scintilla_get_type();
+}
+
void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class) {
Platform_Initialise();
#ifdef SCI_LEXER
@@ -3203,6 +3214,7 @@ static void scintilla_init(ScintillaObject *sci) {
}
}
+/* old name for compatibility */
GtkWidget* scintilla_new() {
GtkWidget *widget = GTK_WIDGET(g_object_new(scintilla_get_type(), NULL));
gtk_widget_set_direction(widget, GTK_TEXT_DIR_LTR);
@@ -3210,6 +3222,11 @@ GtkWidget* scintilla_new() {
return widget;
}
+GtkWidget *scintilla_object_new() {
+
+ return scintilla_new();
+}
+
void scintilla_set_id(ScintillaObject *sci, uptr_t id) {
ScintillaGTK *psci = static_cast<ScintillaGTK *>(sci->pscin);
psci->ctrlID = id;
diff --git a/include/ScintillaWidget.h b/include/ScintillaWidget.h
index f8cd212b0..37bb2ecbe 100644
--- a/include/ScintillaWidget.h
+++ b/include/ScintillaWidget.h
@@ -19,8 +19,15 @@ extern "C" {
#define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass)
#define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ())
+#define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type())
+#define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject))
+#define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT))
+#define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass))
+#define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT))
+#define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass))
+
typedef struct _ScintillaObject ScintillaObject;
-typedef struct _ScintillaClass ScintillaClass;
+typedef struct _ScintillaClass ScintillaObjectClass;
struct _ScintillaObject {
GtkContainer cont;
@@ -34,11 +41,21 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt);
};
+GType scintilla_object_get_type (void);
+GtkWidget* scintilla_object_new (void);
+long scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam);
+
+#ifndef G_IR_SCANNING
+/* The following declarations are preserved for compatibility reasons. However, they confuse
+ * the g-ir-scanner program */
+typedef struct _ScintillaClass ScintillaClass;
+
GType scintilla_get_type (void);
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void scintilla_release_resources(void);
+#endif
#define SCINTILLA_NOTIFY "sci-notify"