From 1f7475248b369e18114086b507ceceacdc1a0c24 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 15 Nov 2012 01:25:38 +0100 Subject: 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) --- interface-gtk.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 interface-gtk.h (limited to 'interface-gtk.h') 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 +#include + +#include +#include + +#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 -- cgit v1.2.3