aboutsummaryrefslogtreecommitdiffhomepage
path: root/interface-gtk.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-15 01:25:38 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-15 01:25:38 +0100
commit1f7475248b369e18114086b507ceceacdc1a0c24 (patch)
tree3c4e157ff099dc6faa8978c4e5e1558e6424e4a0 /interface-gtk.h
parent33d3311dc9fe09e8cc670dc11378980f2f1d3eab (diff)
downloadsciteco-1f7475248b369e18114086b507ceceacdc1a0c24.tar.gz
added Interface class to ease porting SciTECO to other platforms (toolkits)
* will support Scintilla with Scinterm/NCurses * changes are in such a way that the generated machine code should have almost no overhead compared to the previous implementation (at least when compiled with optimizations)
Diffstat (limited to 'interface-gtk.h')
-rw-r--r--interface-gtk.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/interface-gtk.h b/interface-gtk.h
new file mode 100644
index 0000000..76868fd
--- /dev/null
+++ b/interface-gtk.h
@@ -0,0 +1,60 @@
+#ifndef __INTERFACE_GTK_H
+#define __INTERFACE_GTK_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <Scintilla.h>
+#include <ScintillaWidget.h>
+
+#include "interface.h"
+
+extern class InterfaceGtk : public Interface {
+ GtkWidget *editor_widget;
+ GtkWidget *cmdline_widget;
+ GtkWidget *info_widget, *message_widget;
+
+ GtkWidget *popup_widget;
+
+public:
+ InterfaceGtk();
+ //~InterfaceGtk();
+
+ inline void
+ parse_args(int &argc, char **&argv)
+ {
+ gtk_parse_args(&argc, &argv);
+ }
+
+ void msg(MessageType type, const gchar *fmt, ...) G_GNUC_PRINTF(3, 4);
+
+ inline sptr_t
+ ssm(unsigned int iMessage, uptr_t wParam = 0, sptr_t lParam = 0)
+ {
+ return scintilla_send_message(SCINTILLA(editor_widget),
+ iMessage, wParam, lParam);
+ }
+
+ void cmdline_update(const gchar *cmdline);
+
+ void popup_add_filename(PopupFileType type,
+ const gchar *filename, bool highlight = false);
+ inline void
+ popup_show(void)
+ {
+ gtk_widget_show(popup_widget);
+ }
+ void popup_clear(void);
+
+ /* main entry point */
+ inline void
+ event_loop(void)
+ {
+ gtk_main();
+ }
+
+private:
+ static void widget_set_font(GtkWidget *widget, const gchar *font_name);
+} interface;
+
+#endif