]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap GtkAccelGroup
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 05:09:07 +0000 (16:09 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 05:09:07 +0000 (16:09 +1100)
libs/gtkutil/accelerator.cpp
libs/gtkutil/messagebox.cpp
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/commands.cpp
radiant/gtkdlgs.cpp
radiant/map.cpp
radiant/patchmanip.cpp
radiant/select.cpp

index bba9ebe3434967f745066aa779cf3f9b89b96573..3b9924f98f9094472c18574b1888f7b46787a790 100644 (file)
@@ -327,6 +327,7 @@ PressedButtons g_pressedButtons;
 
 
 #include <set>
+#include <uilib/uilib.h>
 
 struct PressedKeys
 {
@@ -484,7 +485,7 @@ void accel_group_remove_accelerator( GtkAccelGroup* group, Accelerator accelerat
 GtkAccelGroup* global_accel = 0;
 
 void global_accel_init(){
-       global_accel = gtk_accel_group_new();
+       global_accel = ui::AccelGroup();
 }
 
 void global_accel_destroy(){
index b3d17a242b09a7d7ffb7289477cc6d8782c76aad..d07deddc88389838da67fcba0f98c76f6749e22f 100644 (file)
@@ -75,7 +75,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha
                gtk_window_deiconify( parentWindow );
        }
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        GtkVBox* vbox = create_dialog_vbox( 8, 8 );
index 21a603d52aa0e009ba630b1aa3ea5be12a0d2e71..79d3848b066dc1a7b4bce79d5cd156e0a208176c 100644 (file)
@@ -84,6 +84,9 @@ namespace ui {
         return g_signal_connect(G_OBJECT(*this), "key-press-event", (GCallback) +func, &pass);
     }
 
+    AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new()))
+    { }
+
     Adjustment::Adjustment(double value,
                            double lower, double upper,
                            double step_increment, double page_increment,
index d42428a00c1bf4da0886357a9a6be6577ed13759..f0eb3b1f9a8742678a47d2d4f7b6ee4d2e9a6d49 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <string>
 
+using ui_accelgroup = struct _GtkAccelGroup;
 using ui_adjustment = struct _GtkAdjustment;
 using ui_alignment = struct _GtkAlignment;
 using ui_box = struct _GtkBox;
@@ -74,6 +75,7 @@ namespace ui {
 
     class Object : public Convertible<Object, ui_object, false> {
     public:
+        using native = ui_object;
         void *_handle;
 
         Object(void *h) : _handle(h)
@@ -118,6 +120,10 @@ namespace ui {
     }; \
     static_assert(sizeof(name) == sizeof(super), "object slicing")
 
+    WRAP(AccelGroup, Object, ui_accelgroup,
+         AccelGroup();
+    );
+
     WRAP(Adjustment, Widget, ui_adjustment,
          Adjustment(double value,
                     double lower, double upper,
@@ -136,7 +142,7 @@ namespace ui {
          Button(const char *label);
     );
 
-    WRAP(CellRenderer, Widget, ui_cellrenderer,);
+    WRAP(CellRenderer, Object, ui_cellrenderer,);
 
     WRAP(CellRendererText, CellRenderer, ui_cellrenderertext,
          CellRendererText();
index eaf4a15f9ec4de95516ce03b414e3478d4ee922f..b220e3b5f3060e626c2535c1ba5511039afe9c1e 100644 (file)
@@ -393,7 +393,7 @@ void DoCommandListDlg(){
                return accelerator_window_key_press(widget, event, dialogptr);
        }, &dialog);
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        GtkHBox* hbox = create_dialog_hbox( 4, 4 );
index bfffe8f434f15bb45b85b1db3fa9d8e6c6a2a582..91cb00c4f1363f096728c61fd392e2546e865f7f 100644 (file)
@@ -386,7 +386,7 @@ void DoSides( int type, int axis ){
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
@@ -604,7 +604,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
 
        ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
@@ -865,7 +865,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
 
        ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
@@ -932,7 +932,7 @@ EMessageBoxReturn DoShaderTagDlg( std::string* tag, const char* title ){
 
        ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
@@ -991,7 +991,7 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const
 
        ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
index a035726b48b1664a999a6d9ed3a932c4ee34be41..10b6075451a05319f7675754137d1e44f910444e 100644 (file)
@@ -2007,7 +2007,7 @@ void DoFind(){
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
index 1bc56c21734c4281526f81819c4e726b0c091e09..f4e9c17d85e84e9f0a436a5da64443eb174deba9 100644 (file)
@@ -853,7 +853,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows,
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       GtkAccelGroup* accel = gtk_accel_group_new();
+       GtkAccelGroup* accel = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel );
 
        {
@@ -980,7 +980,7 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){
 
        ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog );
 
-       GtkAccelGroup *accel_group = gtk_accel_group_new();
+       GtkAccelGroup *accel_group = ui::AccelGroup();
        gtk_window_add_accel_group( window, accel_group );
 
        {
index e8f1db1dcffc0a00ee09a5ce1c1d45dc4decedb6..fa04701ebffd76cc02f5f66f43ac7de348770668 100644 (file)
@@ -914,7 +914,7 @@ void DoRotateDlg(){
        if ( !g_rotate_dialog.window ) {
                g_rotate_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary rotation", G_CALLBACK(rotatedlg_delete ), &g_rotate_dialog );
 
-               GtkAccelGroup* accel = gtk_accel_group_new();
+               GtkAccelGroup* accel = ui::AccelGroup();
                gtk_window_add_accel_group( g_rotate_dialog.window, accel );
 
                {
@@ -1067,7 +1067,7 @@ void DoScaleDlg(){
        if ( !g_scale_dialog.window ) {
                g_scale_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary scale", G_CALLBACK(scaledlg_delete ), &g_scale_dialog );
 
-               GtkAccelGroup* accel = gtk_accel_group_new();
+               GtkAccelGroup* accel = ui::AccelGroup();
                gtk_window_add_accel_group( g_scale_dialog.window, accel );
 
                {