]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap gtkutil/window
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 21 Jul 2017 15:53:28 +0000 (01:53 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 31 Jul 2017 12:35:47 +0000 (22:35 +1000)
libs/gtkutil/window.cpp
libs/gtkutil/window.h

index 6baa54374fed25e1b98a3336e9afe3ec47a646c2..05f50e821720f781e0aae91a2cbff87c6ca80e10 100644 (file)
 #include "pointer.h"
 #include "accelerator.h"
 
-inline void CHECK_RESTORE( GtkWidget* w ){
+inline void CHECK_RESTORE( ui::Widget w ){
        if ( gpointer_to_int( g_object_get_data( G_OBJECT( w ), "was_mapped" ) ) != 0 ) {
                gtk_widget_show( w );
        }
 }
 
-inline void CHECK_MINIMIZE( GtkWidget* w ){
+inline void CHECK_MINIMIZE( ui::Widget w ){
        g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( gtk_widget_get_visible( w ) ) );
        gtk_widget_hide( w );
 }
 
-static gboolean main_window_iconified( GtkWidget* widget, GdkEventWindowState* event, gpointer data ){
+static gboolean main_window_iconified( ui::Widget widget, GdkEventWindowState* event, gpointer data ){
        if ( ( event->changed_mask & ( GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_WITHDRAWN ) ) != 0 ) {
                if ( ( event->new_window_state & ( GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_WITHDRAWN ) ) != 0 ) {
-                       CHECK_MINIMIZE( GTK_WIDGET( data ) );
+                       CHECK_MINIMIZE( ui::Widget(GTK_WIDGET( data )) );
                }
                else
                {
-                       CHECK_RESTORE( GTK_WIDGET( data ) );
+                       CHECK_RESTORE( ui::Widget(GTK_WIDGET( data )) );
                }
        }
        return FALSE;
@@ -100,7 +100,7 @@ void destroy_floating_window( ui::Window window ){
        gtk_widget_destroy( GTK_WIDGET( window ) );
 }
 
-gint window_realize_remove_sysmenu( GtkWidget* widget, gpointer data ){
+gint window_realize_remove_sysmenu( ui::Widget widget, gpointer data ){
        gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) );
        return FALSE;
 }
@@ -127,7 +127,7 @@ ui::Window create_persistent_floating_window( const char* title, ui::Window main
        return window;
 }
 
-gint window_realize_remove_minmax( GtkWidget* widget, gpointer data ){
+gint window_realize_remove_minmax( ui::Widget widget, gpointer data ){
        gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
        return FALSE;
 }
@@ -137,8 +137,8 @@ void window_remove_minmax( ui::Window window ){
 }
 
 
-GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border ){
-       GtkScrolledWindow* scr = ui::ScrolledWindow();
+ui::ScrolledWindow create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border ){
+       auto scr = ui::ScrolledWindow();
        gtk_widget_show( GTK_WIDGET( scr ) );
        gtk_scrolled_window_set_policy( scr, hscrollbar_policy, vscrollbar_policy );
        gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN );
index 6cf8f63904ce2ec766f2d67bdd0d9ea4c235e2f9..3516857f9215d32a6ef7a85eddd6615a46c8232a 100644 (file)
@@ -29,7 +29,7 @@
 #include "generic/callback.h"
 #include "widget.h"
 
-inline gboolean window_focus_in_clear_focus_widget( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+inline gboolean window_focus_in_clear_focus_widget( ui::Widget widget, GdkEventKey* event, gpointer data ){
        gtk_window_set_focus( GTK_WINDOW( widget ), NULL );
        return FALSE;
 }
@@ -48,8 +48,7 @@ gboolean persistent_floating_window_delete( ui::Window floating, GdkEvent *event
 
 void window_remove_minmax( ui::Window window );
 
-typedef struct _GtkScrolledWindow GtkScrolledWindow;
-GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border = 0 );
+ui::ScrolledWindow create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border = 0 );
 
 
 struct WindowPosition
@@ -110,7 +109,7 @@ class WindowPositionTracker
 {
 WindowPosition m_position;
 
-static gboolean configure( GtkWidget* widget, GdkEventConfigure *event, WindowPositionTracker* self ){
+static gboolean configure( ui::Widget widget, GdkEventConfigure *event, WindowPositionTracker* self ){
        self->m_position = WindowPosition( event->x, event->y, event->width, event->height );
        return FALSE;
 }