]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/ufoaiplug/ufoai_gtk.cpp
Merge commit 'dfce2da577f1e56886ad26e58e37d9eda2d7c8a3' into garux-merge
[xonotic/netradiant.git] / contrib / ufoaiplug / ufoai_gtk.cpp
index c01a31fe721158748cda9cd267571fb59640f956..39a983b645f31f0b24b1ba1526f345af6a76e8cc 100644 (file)
 #include "iscenegraph.h"
 
 #include <gtk/gtk.h>
-
-/**
- * GTK callback functions
- */
-
-class UFOAIGtk
-{
-GtkWindow* m_gtk_window;
-public:
-UFOAIGtk( void* gtk_window ) : m_gtk_window( ( GtkWindow* )gtk_window ){
-}
-};
+#include <uilib/uilib.h>
 
 /**
  * @brief If you return FALSE in the "delete_event" signal handler,
@@ -43,27 +32,27 @@ UFOAIGtk( void* gtk_window ) : m_gtk_window( ( GtkWindow* )gtk_window ){
  * This is useful for popping up 'are you sure you want to quit?'
  * type dialogs.
  */
-static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ){
+static gboolean delete_event(ui::Widget widget, GdkEvent *event, gpointer data ){
        return FALSE;
 }
 
 /**
  * @brief destroy widget if destroy signal is passed to widget
  */
-static void destroy( GtkWidget *widget, gpointer data ){
-       gtk_widget_destroy( widget );
+static void destroy( ui::Widget widget, gpointer data ){
+       widget.destroy();
 }
 
 /**
  * @brief function for close button to destroy the toplevel widget
  */
-static void close_window( GtkWidget *widget, gpointer data ){
-       gtk_widget_destroy( gtk_widget_get_toplevel( widget ) );
+static void close_window( ui::Widget widget, gpointer data ){
+       widget.window().destroy();
 }
 
 /* =============================== */
 
-#define NUM_TOOLBARBUTTONS 12
+const int NUM_TOOLBARBUTTONS = 12;
 
 /**
  * @brief
@@ -88,18 +77,18 @@ public:
 virtual const char* getImage() const {
        switch ( mIndex )
        {
-       case 0: return "ufoai_level1.bmp";
-       case 1: return "ufoai_level2.bmp";
-       case 2: return "ufoai_level3.bmp";
-       case 3: return "ufoai_level4.bmp";
-       case 4: return "ufoai_level5.bmp";
-       case 5: return "ufoai_level6.bmp";
-       case 6: return "ufoai_level7.bmp";
-       case 7: return "ufoai_level8.bmp";
-       case 8: return "ufoai_stepon.bmp";
-       case 9: return "ufoai_actorclip.bmp";
-       case 10: return "ufoai_weaponclip.bmp";
-       case 11: return "ufoai_nodraw.bmp";
+       case 0: return "ufoai_level1.png";
+       case 1: return "ufoai_level2.png";
+       case 2: return "ufoai_level3.png";
+       case 3: return "ufoai_level4.png";
+       case 4: return "ufoai_level5.png";
+       case 5: return "ufoai_level6.png";
+       case 6: return "ufoai_level7.png";
+       case 7: return "ufoai_level8.png";
+       case 8: return "ufoai_stepon.png";
+       case 9: return "ufoai_actorclip.png";
+       case 10: return "ufoai_weaponclip.png";
+       case 11: return "ufoai_nodraw.png";
        }
        return NULL;
 }