]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Wrap more GTK
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Aug 2017 05:33:28 +0000 (15:33 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Aug 2017 05:33:28 +0000 (15:33 +1000)
18 files changed:
contrib/bkgrnd2d/dialog.cpp
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/camwindow.cpp
radiant/console.cpp
radiant/dialog.cpp
radiant/entityinspector.cpp
radiant/entitylist.cpp
radiant/findtexturedialog.cpp
radiant/gtkdlgs.cpp
radiant/gtkmisc.cpp
radiant/mainframe.cpp
radiant/map.cpp
radiant/mru.cpp
radiant/patchdialog.cpp
radiant/select.cpp
radiant/surfacedialog.cpp
radiant/xywindow.cpp

index f66fb6fba5c097a1422b6bb1884220f4f1ce0a6c..9db8133057aabdd7987583565981412ad3af75de 100644 (file)
@@ -43,7 +43,7 @@ class CBackgroundDialogPage
 private:
 GtkWidget *m_pWidget;
 GtkWidget *m_pTabLabel;
 private:
 GtkWidget *m_pWidget;
 GtkWidget *m_pTabLabel;
-GtkWidget *m_pFileLabel;
+ui::Label m_pFileLabel;
 GtkWidget *m_pPosLabel;
 VIEWTYPE m_vt;
 bool m_bValidFile;
 GtkWidget *m_pPosLabel;
 VIEWTYPE m_vt;
 bool m_bValidFile;
@@ -159,7 +159,7 @@ void CBackgroundDialogPage::Browse(){
 
        if ( m_pImage->Load( newfile ) ) {
                m_bValidFile = true;
 
        if ( m_pImage->Load( newfile ) ) {
                m_bValidFile = true;
-               gtk_label_set_text( GTK_LABEL( m_pFileLabel ),newfile );
+               m_pFileLabel.text(newfile);
        }
 }
 
        }
 }
 
@@ -168,7 +168,7 @@ void CBackgroundDialogPage::SetPosLabel(){
        // TODO no snprintf ?
        sprintf( s, "Size/Position (%d,%d) (%d,%d)",(int)( m_pImage->m_xmin ),
                         (int)( m_pImage->m_ymin ),(int)( m_pImage->m_xmax ),(int)( m_pImage->m_ymax ) );
        // TODO no snprintf ?
        sprintf( s, "Size/Position (%d,%d) (%d,%d)",(int)( m_pImage->m_xmin ),
                         (int)( m_pImage->m_ymin ),(int)( m_pImage->m_xmax ),(int)( m_pImage->m_ymax ) );
-       gtk_label_set_text( GTK_LABEL( m_pPosLabel ),s );
+       m_pPosLabel.text(s);
 }
 
 CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
 }
 
 CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
index f25172242acbcd48fe45e534039a50bd7802cf9e..72da1de0a652fbab16f82759326ae06bcce38db2 100644 (file)
@@ -92,11 +92,28 @@ namespace ui {
         return ::file_dialog(this, open, title, path, pattern, want_load, want_import, want_save);
     }
 
         return ::file_dialog(this, open, title, path, pattern, want_load, want_import, want_save);
     }
 
+    bool IWidget::visible()
+    {
+        return gtk_widget_get_visible(this) != 0;
+    }
+
     void IWidget::show()
     {
         gtk_widget_show(this);
     }
 
     void IWidget::show()
     {
         gtk_widget_show(this);
     }
 
+    Dimensions IWidget::dimensions()
+    {
+        GtkAllocation allocation;
+        gtk_widget_get_allocation(this, &allocation);
+        return Dimensions{allocation.width, allocation.height};
+    }
+
+    void IWidget::dimensions(int width, int height)
+    {
+        gtk_widget_set_size_request(this, width, height);
+    }
+
     IMPL(Container, GTK_CONTAINER);
 
     void IContainer::add(Widget widget)
     IMPL(Container, GTK_CONTAINER);
 
     void IContainer::add(Widget widget)
@@ -185,6 +202,9 @@ namespace ui {
 
     IMPL(CheckButton, GTK_CHECK_BUTTON);
 
 
     IMPL(CheckButton, GTK_CHECK_BUTTON);
 
+    CheckButton::CheckButton() : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new()))
+    {}
+
     CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
     {}
 
     CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
     {}
 
@@ -212,6 +232,11 @@ namespace ui {
     ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
     {}
 
     ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
     {}
 
+    void IScrolledWindow::overflow(Policy x, Policy y)
+    {
+        gtk_scrolled_window_set_policy(this, static_cast<GtkPolicyType>(x), static_cast<GtkPolicyType>(y));
+    }
+
     IMPL(VBox, GTK_VBOX);
 
     VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing)))
     IMPL(VBox, GTK_VBOX);
 
     VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing)))
@@ -249,6 +274,12 @@ namespace ui {
     TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new()))
     {}
 
     TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new()))
     {}
 
+    void ITextView::text(char const *str)
+    {
+        GtkTextBuffer *buffer = gtk_text_view_get_buffer(this);
+        gtk_text_buffer_set_text(buffer, str, -1);
+    }
+
     TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new()))
     {}
 
     TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new()))
     {}
 
@@ -260,6 +291,11 @@ namespace ui {
     Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
     {}
 
     Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
     {}
 
+    void ILabel::text(char const *str)
+    {
+        gtk_label_set_text(this, str);
+    }
+
     IMPL(Image, GTK_IMAGE);
 
     Image::Image() : Image(GTK_IMAGE(gtk_image_new()))
     IMPL(Image, GTK_IMAGE);
 
     Image::Image() : Image(GTK_IMAGE(gtk_image_new()))
@@ -275,6 +311,16 @@ namespace ui {
         gtk_entry_set_max_length(this, static_cast<gint>(max_length));
     }
 
         gtk_entry_set_max_length(this, static_cast<gint>(max_length));
     }
 
+    char const *IEntry::text()
+    {
+        return gtk_entry_get_text(this);
+    }
+
+    void IEntry::text(char const *str)
+    {
+        return gtk_entry_set_text(this, str);
+    }
+
     IMPL(SpinButton, GTK_SPIN_BUTTON);
 
     SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(
     IMPL(SpinButton, GTK_SPIN_BUTTON);
 
     SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(
index c64835154b818bb21d5a04e2a3775c33ce3a9bf4..53241ec24716f696afa459c2706b01803eaa93a7 100644 (file)
@@ -175,7 +175,7 @@ namespace ui {
         using native = _GtkObject *;
         native _handle;
 
         using native = _GtkObject *;
         native _handle;
 
-        Object(native h) : _handle(h)
+        explicit Object(native h) : _handle(h)
         {}
 
         explicit operator bool() const
         {}
 
         explicit operator bool() const
@@ -223,7 +223,7 @@ namespace ui {
     );
 
     WRAP(Editable, Object, _GtkEditable, (),
     );
 
     WRAP(Editable, Object, _GtkEditable, (),
-         Editable();
+         explicit Editable();
     ,
          void editable(bool value);
     );
     ,
          void editable(bool value);
     );
@@ -234,8 +234,13 @@ namespace ui {
 
     // GObject
 
 
     // GObject
 
+    struct Dimensions {
+        int width;
+        int height;
+    };
+
     WRAP(Widget, Object, _GtkWidget, (),
     WRAP(Widget, Object, _GtkWidget, (),
-         Widget();
+         explicit Widget();
     ,
          alert_response alert(
                  std::string text,
     ,
          alert_response alert(
                  std::string text,
@@ -252,7 +257,10 @@ namespace ui {
                  bool want_import = false,
                  bool want_save = false
          );
                  bool want_import = false,
                  bool want_save = false
          );
+         bool visible();
          void show();
          void show();
+         Dimensions dimensions();
+         void dimensions(int width, int height);
     );
 
     WRAP(Container, Widget, _GtkContainer, (),
     );
 
     WRAP(Container, Widget, _GtkContainer, (),
@@ -271,7 +279,7 @@ namespace ui {
 
     class AccelGroup;
     WRAP(Window, Bin, _GtkWindow, (),
 
     class AccelGroup;
     WRAP(Window, Bin, _GtkWindow, (),
-         Window(window_type type);
+         explicit Window(window_type type);
     ,
          Window create_dialog_window(
                  const char *title,
     ,
          Window create_dialog_window(
                  const char *title,
@@ -308,13 +316,13 @@ namespace ui {
     );
 
     WRAP(Frame, Bin, _GtkFrame, (),
     );
 
     WRAP(Frame, Bin, _GtkFrame, (),
-         Frame(const char *label = nullptr);
+         explicit Frame(const char *label = nullptr);
     ,
     );
 
     WRAP(Button, Bin, _GtkButton, (),
     ,
     );
 
     WRAP(Button, Bin, _GtkButton, (),
-         Button();
-         Button(const char *label);
+         explicit Button();
+         explicit Button(const char *label);
     ,
     );
 
     ,
     );
 
@@ -324,7 +332,8 @@ namespace ui {
     );
 
     WRAP(CheckButton, ToggleButton, _GtkCheckButton, (),
     );
 
     WRAP(CheckButton, ToggleButton, _GtkCheckButton, (),
-         CheckButton(const char *label);
+         explicit CheckButton();
+         explicit CheckButton(const char *label);
     ,
     );
 
     ,
     );
 
@@ -337,8 +346,8 @@ namespace ui {
     );
 
     WRAP(MenuItem, Item, _GtkMenuItem, (),
     );
 
     WRAP(MenuItem, Item, _GtkMenuItem, (),
-         MenuItem();
-         MenuItem(const char *label, bool mnemonic = false);
+         explicit MenuItem();
+         explicit MenuItem(const char *label, bool mnemonic = false);
     ,
     );
 
     ,
     );
 
@@ -351,7 +360,7 @@ namespace ui {
     );
 
     WRAP(TearoffMenuItem, MenuItem, _GtkTearoffMenuItem, (),
     );
 
     WRAP(TearoffMenuItem, MenuItem, _GtkTearoffMenuItem, (),
-         TearoffMenuItem();
+         explicit TearoffMenuItem();
     ,
     );
 
     ,
     );
 
@@ -360,7 +369,7 @@ namespace ui {
     );
 
     WRAP(ComboBoxText, ComboBox, _GtkComboBoxText, (),
     );
 
     WRAP(ComboBoxText, ComboBox, _GtkComboBoxText, (),
-         ComboBoxText();
+         explicit ComboBoxText();
     ,
     );
 
     ,
     );
 
@@ -381,8 +390,9 @@ namespace ui {
     );
 
     WRAP(ScrolledWindow, Bin, _GtkScrolledWindow, (),
     );
 
     WRAP(ScrolledWindow, Bin, _GtkScrolledWindow, (),
-         ScrolledWindow();
+         explicit ScrolledWindow();
     ,
     ,
+         void overflow(Policy x, Policy y);
     );
 
     WRAP(Box, Container, _GtkBox, (),
     );
 
     WRAP(Box, Container, _GtkBox, (),
@@ -404,12 +414,12 @@ namespace ui {
     );
 
     WRAP(HPaned, Paned, _GtkHPaned, (),
     );
 
     WRAP(HPaned, Paned, _GtkHPaned, (),
-         HPaned();
+         explicit HPaned();
     ,
     );
 
     WRAP(VPaned, Paned, _GtkVPaned, (),
     ,
     );
 
     WRAP(VPaned, Paned, _GtkVPaned, (),
-         VPaned();
+         explicit VPaned();
     ,
     );
 
     ,
     );
 
@@ -422,7 +432,7 @@ namespace ui {
     );
 
     WRAP(Menu, MenuShell, _GtkMenu, (),
     );
 
     WRAP(Menu, MenuShell, _GtkMenu, (),
-         Menu();
+         explicit Menu();
     ,
     );
 
     ,
     );
 
@@ -432,8 +442,9 @@ namespace ui {
     );
 
     WRAP(TextView, Container, _GtkTextView, (),
     );
 
     WRAP(TextView, Container, _GtkTextView, (),
-         TextView();
+         explicit TextView();
     ,
     ,
+         void text(char const *str);
     );
 
     WRAP(Toolbar, Container, _GtkToolbar, (),
     );
 
     WRAP(Toolbar, Container, _GtkToolbar, (),
@@ -442,7 +453,7 @@ namespace ui {
 
     class TreeModel;
     WRAP(TreeView, Widget, _GtkTreeView, (),
 
     class TreeModel;
     WRAP(TreeView, Widget, _GtkTreeView, (),
-         TreeView();
+         explicit TreeView();
          TreeView(TreeModel model);
     ,
     );
          TreeView(TreeModel model);
     ,
     );
@@ -452,19 +463,22 @@ namespace ui {
     );
 
     WRAP(Label, Widget, _GtkLabel, (),
     );
 
     WRAP(Label, Widget, _GtkLabel, (),
-         Label(const char *label);
+         explicit Label(const char *label);
     ,
     ,
+         void text(char const *str);
     );
 
     WRAP(Image, Widget, _GtkImage, (),
     );
 
     WRAP(Image, Widget, _GtkImage, (),
-         Image();
+         explicit Image();
     ,
     );
 
     WRAP(Entry, Widget, _GtkEntry, (IEditable, ICellEditable),
     ,
     );
 
     WRAP(Entry, Widget, _GtkEntry, (IEditable, ICellEditable),
-         Entry();
-         Entry(std::size_t max_length);
+         explicit Entry();
+         explicit Entry(std::size_t max_length);
     ,
     ,
+        char const *text();
+        void text(char const *str);
     );
 
     class Adjustment;
     );
 
     class Adjustment;
@@ -482,7 +496,7 @@ namespace ui {
     );
 
     WRAP(HScale, Scale, _GtkHScale, (),
     );
 
     WRAP(HScale, Scale, _GtkHScale, (),
-         HScale(Adjustment adjustment);
+         explicit HScale(Adjustment adjustment);
          HScale(double min, double max, double step);
     ,
     );
          HScale(double min, double max, double step);
     ,
     );
@@ -500,7 +514,7 @@ namespace ui {
     );
 
     WRAP(CellRendererText, CellRenderer, _GtkCellRendererText, (),
     );
 
     WRAP(CellRendererText, CellRenderer, _GtkCellRendererText, (),
-         CellRendererText();
+         explicit CellRendererText();
     ,
     );
 
     ,
     );
 
@@ -514,7 +528,7 @@ namespace ui {
     );
 
     WRAP(AccelGroup, Object, _GtkAccelGroup, (),
     );
 
     WRAP(AccelGroup, Object, _GtkAccelGroup, (),
-         AccelGroup();
+         explicit AccelGroup();
     ,
     );
 
     ,
     );
 
@@ -534,8 +548,8 @@ namespace ui {
     // GBoxed
 
     WRAP(TreePath, Object, _GtkTreePath, (),
     // GBoxed
 
     WRAP(TreePath, Object, _GtkTreePath, (),
-         TreePath();
-         TreePath(const char *path);
+         explicit TreePath();
+         explicit TreePath(const char *path);
     ,
     );
 
     ,
     );
 
index 0f729b40d34a56950380db5760e1e31e3ef5c317..0a8c80fd149940330604c622bcbd4ce0f0036c4e 100644 (file)
@@ -828,7 +828,7 @@ gboolean mousecontrol_button_press( ui::Widget widget, GdkEventButton* event, Ca
 #endif
 
 void camwnd_update_xor_rectangle( CamWnd& self, rect_t area ){
 #endif
 
 void camwnd_update_xor_rectangle( CamWnd& self, rect_t area ){
-       if ( gtk_widget_get_visible( self.m_gl_widget ) ) {
+       if ( self.m_gl_widget.visible() ) {
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.getCamera().width, self.getCamera().height ) );
        }
 }
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.getCamera().width, self.getCamera().height ) );
        }
 }
@@ -854,8 +854,7 @@ void selection_motion( gdouble x, gdouble y, guint state, void* data ){
 }
 
 inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){
 }
 
 inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){
-       GtkAllocation allocation;
-       gtk_widget_get_allocation(widget, &allocation);
+       auto allocation = widget.dimensions();
        return WindowVector( static_cast<float>( allocation.width / 2 ), static_cast<float>(allocation.height / 2 ) );
 }
 
        return WindowVector( static_cast<float>( allocation.width / 2 ), static_cast<float>(allocation.height / 2 ) );
 }
 
index 2f156dd27de9630087eff3b000f4f2c905eede99..68c22ea1147bd12d11861234554bf66d5cbc79d2 100644 (file)
@@ -81,14 +81,13 @@ void Sys_LogFile( bool enable ){
        }
 }
 
        }
 }
 
-ui::Widget g_console;
+ui::TextView g_console{ui::null};
 
 void console_clear(){
 
 void console_clear(){
-       GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
-       gtk_text_buffer_set_text( buffer, "", -1 );
+       g_console.text("");
 }
 
 }
 
-void console_populate_popup( GtkTextView* textview, ui::Menu menu, gpointer user_data ){
+void console_populate_popup( ui::TextView textview, ui::Menu menu, gpointer user_data ){
        menu_separator( menu );
 
        ui::Widget item(ui::MenuItem( "Clear" ));
        menu_separator( menu );
 
        ui::Widget item(ui::MenuItem( "Clear" ));
@@ -106,12 +105,12 @@ WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
 
 ui::Widget Console_constructWindow( ui::Window toplevel ){
        auto scr = ui::ScrolledWindow();
 
 ui::Widget Console_constructWindow( ui::Window toplevel ){
        auto scr = ui::ScrolledWindow();
-       gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+       scr.overflow(ui::Policy::AUTOMATIC, ui::Policy::AUTOMATIC);
        gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
        scr.show();
 
        {
        gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
        scr.show();
 
        {
-               ui::Widget text = ui::TextView();
+               auto text = ui::TextView();
                gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
                gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
                gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
                gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
                gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
                gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
@@ -163,7 +162,7 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){
        }
 
        if ( level != SYS_NOCON ) {
        }
 
        if ( level != SYS_NOCON ) {
-               if ( g_console != 0 ) {
+               if ( g_console ) {
                        GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
 
                        GtkTextIter iter;
                        GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
 
                        GtkTextIter iter;
index 01e58f7cedec09f6bbce2bdb2913c7bd098f3c3c..6e558bb92234d73ae2247b4b56301ec4a1f8981a 100644 (file)
@@ -150,7 +150,7 @@ void IntRadioExport( GtkRadioButton& widget, const IntImportCallback& importCall
 typedef ImportExport<GtkRadioButton, int, IntRadioImport, IntRadioExport> IntRadioImportExport;
 
 void TextEntryImport( GtkEntry& widget, const char* text ){
 typedef ImportExport<GtkRadioButton, int, IntRadioImport, IntRadioExport> IntRadioImportExport;
 
 void TextEntryImport( GtkEntry& widget, const char* text ){
-       gtk_entry_set_text( &widget, text );
+       ui::Entry(&widget).text(text);
 }
 void TextEntryExport( GtkEntry& widget, const StringImportCallback& importCallback ){
        importCallback( gtk_entry_get_text( &widget ) );
 }
 void TextEntryExport( GtkEntry& widget, const StringImportCallback& importCallback ){
        importCallback( gtk_entry_get_text( &widget ) );
index 82c0bb5f96533254b2c9c32480186a1e5876a222..cffa9358bbf52e9219944043375e6834c9952398 100644 (file)
@@ -67,7 +67,7 @@
 ui::Entry numeric_entry_new(){
        auto entry = ui::Entry();
        entry.show();
 ui::Entry numeric_entry_new(){
        auto entry = ui::Entry();
        entry.show();
-       gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
+       entry.dimensions(64, -1);
        return entry;
 }
 
        return entry;
 }
 
@@ -112,7 +112,7 @@ virtual void release() = 0;
 class BooleanAttribute : public EntityAttribute
 {
 CopiedString m_key;
 class BooleanAttribute : public EntityAttribute
 {
 CopiedString m_key;
-GtkCheckButton* m_check;
+ui::CheckButton m_check;
 
 static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
        self->apply();
 
 static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
        self->apply();
@@ -121,8 +121,8 @@ static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
 public:
 BooleanAttribute( const char* key ) :
        m_key( key ),
 public:
 BooleanAttribute( const char* key ) :
        m_key( key ),
-       m_check( 0 ){
-       auto check = ui::CheckButton(GTK_CHECK_BUTTON( gtk_check_button_new() ));
+       m_check( ui::null ){
+       auto check = ui::CheckButton();
        check.show();
 
        m_check = check;
        check.show();
 
        m_check = check;
@@ -133,24 +133,24 @@ BooleanAttribute( const char* key ) :
        update();
 }
 ui::Widget getWidget() const {
        update();
 }
 ui::Widget getWidget() const {
-       return ui::Widget(GTK_WIDGET( m_check ));
+       return m_check;
 }
 void release(){
        delete this;
 }
 void apply(){
 }
 void release(){
        delete this;
 }
 void apply(){
-       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( m_check ) ) ? "1" : "0" );
+       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_check.active() ? "1" : "0" );
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::apply> ApplyCaller;
 
 void update(){
        const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
        if ( !string_empty( value ) ) {
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::apply> ApplyCaller;
 
 void update(){
        const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
        if ( !string_empty( value ) ) {
-               toggle_button_set_active_no_signal( ui::ToggleButton(GTK_TOGGLE_BUTTON( m_check )), atoi( value ) != 0 );
+               toggle_button_set_active_no_signal( m_check, atoi( value ) != 0 );
        }
        else
        {
        }
        else
        {
-               toggle_button_set_active_no_signal( ui::ToggleButton(GTK_TOGGLE_BUTTON( m_check )), false );
+               toggle_button_set_active_no_signal( m_check, false );
        }
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::update> UpdateCaller;
@@ -169,13 +169,13 @@ StringAttribute( const char* key ) :
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
        auto entry = ui::Entry();
        entry.show();
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
        auto entry = ui::Entry();
        entry.show();
-       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+       entry.dimensions(50, -1);
 
        m_entry = entry;
        m_nonModal.connect( m_entry );
 }
 ui::Widget getWidget() const {
 
        m_entry = entry;
        m_nonModal.connect( m_entry );
 }
 ui::Widget getWidget() const {
-       return ui::Widget(GTK_WIDGET( m_entry ));
+       return m_entry;
 }
 ui::Entry getEntry() const {
        return m_entry;
 }
 ui::Entry getEntry() const {
        return m_entry;
@@ -186,7 +186,7 @@ void release(){
 }
 void apply(){
        StringOutputStream value( 64 );
 }
 void apply(){
        StringOutputStream value( 64 );
-       value << gtk_entry_get_text( m_entry );
+       value << m_entry.text();
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
@@ -194,7 +194,7 @@ typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
-       gtk_entry_set_text( m_entry, value.c_str() );
+       m_entry.text(value.c_str());
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::update> UpdateCaller;
 };
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::update> UpdateCaller;
 };
@@ -224,18 +224,18 @@ void release(){
        delete this;
 }
 ui::Widget getWidget() const {
        delete this;
 }
 ui::Widget getWidget() const {
-       return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
+       return m_entry.m_entry.m_frame;
 }
 void apply(){
        StringOutputStream value( 64 );
 }
 void apply(){
        StringOutputStream value( 64 );
-       value << gtk_entry_get_text( GTK_ENTRY( m_entry.m_entry.m_entry ) );
+       value << m_entry.m_entry.m_entry.text();
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
-       gtk_entry_set_text( GTK_ENTRY( m_entry.m_entry.m_entry ), value.c_str() );
+       m_entry.m_entry.m_entry.text(value.c_str());
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
@@ -291,14 +291,14 @@ ui::Widget getWidget() const {
 }
 void apply(){
        StringOutputStream value( 64 );
 }
 void apply(){
        StringOutputStream value( 64 );
-       value << gtk_entry_get_text( GTK_ENTRY( m_entry.m_entry.m_entry ) );
+       value << m_entry.m_entry.m_entry.text();
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
-       gtk_entry_set_text( GTK_ENTRY( m_entry.m_entry.m_entry ), value.c_str() );
+       m_entry.m_entry.m_entry.text(value.c_str());
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
@@ -348,11 +348,11 @@ void update(){
        if ( !string_empty( value ) ) {
                StringOutputStream angle( 32 );
                angle << angle_normalised( atof( value ) );
        if ( !string_empty( value ) ) {
                StringOutputStream angle( 32 );
                angle << angle_normalised( atof( value ) );
-               gtk_entry_set_text( m_entry, angle.c_str() );
+               m_entry.text(angle.c_str());
        }
        else
        {
        }
        else
        {
-               gtk_entry_set_text( m_entry, "0" );
+               m_entry.text("0");
        }
 }
 typedef MemberCaller<AngleAttribute, &AngleAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<AngleAttribute, &AngleAttribute::update> UpdateCaller;
@@ -411,12 +411,12 @@ void update(){
                if ( f == -1 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 0 );
                if ( f == -1 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 0 );
-                       gtk_entry_set_text( m_entry, "" );
+                       m_entry.text("");
                }
                else if ( f == -2 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 1 );
                }
                else if ( f == -2 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 1 );
-                       gtk_entry_set_text( m_entry, "" );
+                       m_entry.text("");
                }
                else
                {
                }
                else
                {
@@ -424,12 +424,12 @@ void update(){
                        radio_button_set_active_no_signal( m_radio.m_radio, 2 );
                        StringOutputStream angle( 32 );
                        angle << angle_normalised( f );
                        radio_button_set_active_no_signal( m_radio.m_radio, 2 );
                        StringOutputStream angle( 32 );
                        angle << angle_normalised( f );
-                       gtk_entry_set_text( m_entry, angle.c_str() );
+                       m_entry.text(angle.c_str());
                }
        }
        else
        {
                }
        }
        else
        {
-               gtk_entry_set_text( m_entry, "0" );
+               m_entry.text("0");
        }
 }
 typedef MemberCaller<DirectionAttribute, &DirectionAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<DirectionAttribute, &DirectionAttribute::update> UpdateCaller;
@@ -519,22 +519,22 @@ void update(){
                }
 
                angle << angle_normalised( pitch_yaw_roll.x() );
                }
 
                angle << angle_normalised( pitch_yaw_roll.x() );
-               gtk_entry_set_text( m_angles.m_pitch, angle.c_str() );
+               m_angles.m_pitch.text(angle.c_str());
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.y() );
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.y() );
-               gtk_entry_set_text( m_angles.m_yaw, angle.c_str() );
+               m_angles.m_yaw.text(angle.c_str());
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.z() );
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.z() );
-               gtk_entry_set_text( m_angles.m_roll, angle.c_str() );
+               m_angles.m_roll.text(angle.c_str());
                angle.clear();
        }
        else
        {
                angle.clear();
        }
        else
        {
-               gtk_entry_set_text( m_angles.m_pitch, "0" );
-               gtk_entry_set_text( m_angles.m_yaw, "0" );
-               gtk_entry_set_text( m_angles.m_roll, "0" );
+               m_angles.m_pitch.text("0");
+               m_angles.m_yaw.text("0");
+               m_angles.m_roll.text("0");
        }
 }
 typedef MemberCaller<AnglesAttribute, &AnglesAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<AnglesAttribute, &AnglesAttribute::update> UpdateCaller;
@@ -606,22 +606,22 @@ void update(){
                }
 
                buffer << x_y_z.x();
                }
 
                buffer << x_y_z.x();
-               gtk_entry_set_text( m_vector3.m_x, buffer.c_str() );
+               m_vector3.m_x.text(buffer.c_str());
                buffer.clear();
 
                buffer << x_y_z.y();
                buffer.clear();
 
                buffer << x_y_z.y();
-               gtk_entry_set_text( m_vector3.m_y, buffer.c_str() );
+               m_vector3.m_y.text(buffer.c_str());
                buffer.clear();
 
                buffer << x_y_z.z();
                buffer.clear();
 
                buffer << x_y_z.z();
-               gtk_entry_set_text( m_vector3.m_z, buffer.c_str() );
+               m_vector3.m_z.text(buffer.c_str());
                buffer.clear();
        }
        else
        {
                buffer.clear();
        }
        else
        {
-               gtk_entry_set_text( m_vector3.m_x, "0" );
-               gtk_entry_set_text( m_vector3.m_y, "0" );
-               gtk_entry_set_text( m_vector3.m_z, "0" );
+               m_vector3.m_x.text("0");
+               m_vector3.m_y.text("0");
+               m_vector3.m_z.text("0");
        }
 }
 typedef MemberCaller<Vector3Attribute, &Vector3Attribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<Vector3Attribute, &Vector3Attribute::update> UpdateCaller;
@@ -710,12 +710,12 @@ int g_entitysplit2_position;
 bool g_entityInspector_windowConstructed = false;
 
 GtkTreeView* g_entityClassList;
 bool g_entityInspector_windowConstructed = false;
 
 GtkTreeView* g_entityClassList;
-GtkTextView* g_entityClassComment;
+ui::TextView g_entityClassComment;
 
 GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS];
 
 
 GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS];
 
-GtkEntry* g_entityKeyEntry;
-GtkEntry* g_entityValueEntry;
+ui::Entry g_entityKeyEntry;
+ui::Entry g_entityValueEntry;
 
 ui::ListStore g_entlist_store{ui::null};
 ui::ListStore g_entprops_store{ui::null};
 
 ui::ListStore g_entlist_store{ui::null};
 ui::ListStore g_entprops_store{ui::null};
@@ -831,8 +831,7 @@ void SetComment( EntityClass* eclass ){
 
        g_current_comment = eclass;
 
 
        g_current_comment = eclass;
 
-       GtkTextBuffer* buffer = gtk_text_view_get_buffer( g_entityClassComment );
-       gtk_text_buffer_set_text( buffer, eclass->comments(), -1 );
+       g_entityClassComment.text(eclass->comments());
 }
 
 void SurfaceFlags_setEntityClass( EntityClass* eclass ){
 }
 
 void SurfaceFlags_setEntityClass( EntityClass* eclass ){
@@ -860,8 +859,9 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
        {
                for ( int i = 0; i < g_spawnflag_count; ++i )
                {
        {
                for ( int i = 0; i < g_spawnflag_count; ++i )
                {
-                       ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
-                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), " " );
+                       auto widget = ui::Widget(GTK_WIDGET(g_entitySpawnflagsCheck[i]));
+                       auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget))));
+                       label.text(" ");
                        gtk_widget_hide( widget );
                        g_object_ref( widget );
                        gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget );
                        gtk_widget_hide( widget );
                        g_object_ref( widget );
                        gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget );
@@ -884,7 +884,8 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
                                                          (GtkAttachOptions)( GTK_FILL ), 0, 0 );
                        widget.unref();
 
                                                          (GtkAttachOptions)( GTK_FILL ), 0, 0 );
                        widget.unref();
 
-                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), str.c_str() );
+                       auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget)) ));
+                       label.text(str.c_str());
                }
        }
 }
                }
        }
 }
@@ -1038,8 +1039,8 @@ void EntityInspector_updateKeyValues(){
 
        // save current key/val pair around filling epair box
        // row_select wipes it and sets to first in list
 
        // save current key/val pair around filling epair box
        // row_select wipes it and sets to first in list
-       CopiedString strKey( gtk_entry_get_text( g_entityKeyEntry ) );
-       CopiedString strVal( gtk_entry_get_text( g_entityValueEntry ) );
+       CopiedString strKey( g_entityKeyEntry.text() );
+       CopiedString strVal( g_entityValueEntry.text() );
 
        gtk_list_store_clear( store );
        // Walk through list and add pairs
 
        gtk_list_store_clear( store );
        // Walk through list and add pairs
@@ -1054,8 +1055,8 @@ void EntityInspector_updateKeyValues(){
                gtk_list_store_set( store, &iter, 0, key.c_str(), 1, value.c_str(), -1 );
        }
 
                gtk_list_store_set( store, &iter, 0, key.c_str(), 1, value.c_str(), -1 );
        }
 
-       gtk_entry_set_text( g_entityKeyEntry, strKey.c_str() );
-       gtk_entry_set_text( g_entityValueEntry, strVal.c_str() );
+       g_entityKeyEntry.text( strKey.c_str() );
+       g_entityValueEntry.text( strVal.c_str() );
 
        for ( EntityAttributes::const_iterator i = g_entityAttributes.begin(); i != g_entityAttributes.end(); ++i )
        {
 
        for ( EntityAttributes::const_iterator i = g_entityAttributes.begin(); i != g_entityAttributes.end(); ++i )
        {
@@ -1249,8 +1250,8 @@ static void EntityProperties_selection_changed( GtkTreeSelection* selection, gpo
        char* val;
        gtk_tree_model_get( model, &iter, 0, &key, 1, &val, -1 );
 
        char* val;
        gtk_tree_model_get( model, &iter, 0, &key, 1, &val, -1 );
 
-       gtk_entry_set_text( g_entityKeyEntry, key );
-       gtk_entry_set_text( g_entityValueEntry, val );
+       g_entityKeyEntry.text( key );
+       g_entityValueEntry.text( val );
 
        g_free( key );
        g_free( val );
 
        g_free( key );
        g_free( val );
@@ -1263,7 +1264,7 @@ static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){
 static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){
        if ( event->keyval == GDK_KEY_Return ) {
                if ( widget == g_entityKeyEntry ) {
 static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){
        if ( event->keyval == GDK_KEY_Return ) {
                if ( widget == g_entityKeyEntry ) {
-                       gtk_entry_set_text( g_entityValueEntry, "" );
+                       g_entityValueEntry.text( "" );
                        gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) );
                }
                else
                        gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) );
                }
                else
index dad00e4e0c8780950e526fd498e9ad0c37341af0..239aef06ca7d4dd13f4e0fad04e61c6e0045a1e1 100644 (file)
@@ -71,8 +71,8 @@ EntityList() :
        m_selection_disabled( false ){
 }
 
        m_selection_disabled( false ){
 }
 
-bool visible() const {
-       return gtk_widget_get_visible( m_window );
+bool visible() {
+       return m_window.visible();
 }
 };
 
 }
 };
 
index 9766843a0f086392c488f48690b2c913b1e17930..49efe49e3dc27ec4cefa65d90ee43ce918a6bbd6 100644 (file)
@@ -222,7 +222,7 @@ void FindTextureDialog::updateTextures( const char* name ){
 }
 
 bool FindTextureDialog::isOpen(){
 }
 
 bool FindTextureDialog::isOpen(){
-       return gtk_widget_get_visible( g_FindTextureDialog.GetWidget() ) == TRUE;
+       return g_FindTextureDialog.GetWidget().visible();
 }
 
 void FindTextureDialog::setFindStr( const char* name ){
 }
 
 void FindTextureDialog::setFindStr( const char* name ){
index 7994425239d4b490813d99a3beada1554345a345..f39487a535f3f543ea584e0225dd1a34e34020c9 100644 (file)
@@ -155,7 +155,7 @@ inline void path_copy_clean( char* destination, const char* source ){
 struct GameCombo
 {
        ui::ComboBoxText game_select;
 struct GameCombo
 {
        ui::ComboBoxText game_select;
-       GtkEntry* fsgame_entry;
+       ui::Entry fsgame_entry;
 };
 
 gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
 };
 
 gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
@@ -168,7 +168,7 @@ gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
 
        gamecombo_t gamecombo = gamecombo_for_gamename( gamename );
 
 
        gamecombo_t gamecombo = gamecombo_for_gamename( gamename );
 
-       gtk_entry_set_text( combo->fsgame_entry, gamecombo.fs_game );
+       combo->fsgame_entry.text( gamecombo.fs_game );
        gtk_widget_set_sensitive( GTK_WIDGET( combo->fsgame_entry ), gamecombo.sensitive );
 
        return FALSE;
        gtk_widget_set_sensitive( GTK_WIDGET( combo->fsgame_entry ), gamecombo.sensitive );
 
        return FALSE;
@@ -301,7 +301,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal
        gamecombo_t gamecombo = gamecombo_for_dir( dir );
 
        gtk_combo_box_set_active( dialog.game_combo.game_select, gamecombo.game );
        gamecombo_t gamecombo = gamecombo_for_dir( dir );
 
        gtk_combo_box_set_active( dialog.game_combo.game_select, gamecombo.game );
-       gtk_entry_set_text( dialog.game_combo.fsgame_entry, gamecombo.fs_game );
+       dialog.game_combo.fsgame_entry.text( gamecombo.fs_game );
        gtk_widget_set_sensitive( GTK_WIDGET( dialog.game_combo.fsgame_entry ), gamecombo.sensitive );
 
        if ( globalMappingMode().do_mapping_mode ) {
        gtk_widget_set_sensitive( GTK_WIDGET( dialog.game_combo.fsgame_entry ), gamecombo.sensitive );
 
        if ( globalMappingMode().do_mapping_mode ) {
@@ -569,8 +569,7 @@ void DoAbout(){
                                                auto text_extensions = ui::TextView();
                                                gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
                                                sc_extensions.add(text_extensions);
                                                auto text_extensions = ui::TextView();
                                                gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
                                                sc_extensions.add(text_extensions);
-                                               GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
-                                               gtk_text_buffer_set_text( buffer, reinterpret_cast<const char*>( glGetString( GL_EXTENSIONS ) ), -1 );
+                                               text_extensions.text(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
                                                gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text_extensions ), GTK_WRAP_WORD );
                                                text_extensions.show();
                                        }
                                                gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text_extensions ), GTK_WRAP_WORD );
                                                text_extensions.show();
                                        }
@@ -595,8 +594,8 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
        ModalDialog dialog;
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
-       GtkEntry* x;
-       GtkEntry* y;
+       ui::Entry x;
+       ui::Entry y;
 
        auto window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
 
 
        auto window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
 
@@ -679,10 +678,10 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){
        char buf[16];
        
        sprintf( buf, "%f", last_used_texture_layout_scale_x );
        char buf[16];
        
        sprintf( buf, "%f", last_used_texture_layout_scale_x );
-       gtk_entry_set_text( x, buf );
+       x.text( buf );
        
        sprintf( buf, "%f", last_used_texture_layout_scale_y );
        
        sprintf( buf, "%f", last_used_texture_layout_scale_y );
-       gtk_entry_set_text( y, buf );
+       y.text( buf );
 
        // Set focus after intializing the values
        gtk_widget_grab_focus( GTK_WIDGET( x ) );
 
        // Set focus after intializing the values
        gtk_widget_grab_focus( GTK_WIDGET( x ) );
@@ -854,7 +853,7 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos ){
 
 EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
        ModalDialog dialog;
 
 EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
        ModalDialog dialog;
-       GtkEntry* intensity_entry;
+       ui::Entry intensity_entry;
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
 
        ModalDialogButton ok_button( dialog, eIDOK );
        ModalDialogButton cancel_button( dialog, eIDCANCEL );
 
@@ -904,7 +903,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){
 
        char buf[16];
        sprintf( buf, "%d", *intensity );
 
        char buf[16];
        sprintf( buf, "%d", *intensity );
-       gtk_entry_set_text( intensity_entry, buf );
+       intensity_entry.text(buf);
 
        EMessageBoxReturn ret = modal_dialog_show( window, dialog );
        if ( ret == eIDOK ) {
 
        EMessageBoxReturn ret = modal_dialog_show( window, dialog );
        if ( ret == eIDOK ) {
index 693d569fc1c0b35c3dbde17d9478018edb42b78a..acb6da1286879a9d04009cbdc7796ae511b4339f 100644 (file)
@@ -131,7 +131,7 @@ void button_clicked_entry_browse_file( ui::Widget widget, ui::Entry entry ){
        const char *filename = ui::Widget(gtk_widget_get_toplevel( widget )).file_dialog( TRUE, "Choose File", gtk_entry_get_text( entry ) );
 
        if ( filename != 0 ) {
        const char *filename = ui::Widget(gtk_widget_get_toplevel( widget )).file_dialog( TRUE, "Choose File", gtk_entry_get_text( entry ) );
 
        if ( filename != 0 ) {
-               gtk_entry_set_text( entry, filename );
+               entry.text(filename);
        }
 }
 
        }
 }
 
@@ -141,7 +141,7 @@ void button_clicked_entry_browse_directory( ui::Widget widget, ui::Entry entry )
 
        if ( dir != 0 ) {
                gchar* converted = g_filename_to_utf8( dir, -1, 0, 0, 0 );
 
        if ( dir != 0 ) {
                gchar* converted = g_filename_to_utf8( dir, -1, 0, 0, 0 );
-               gtk_entry_set_text( entry, converted );
+               entry.text(converted);
                g_free( dir );
                g_free( converted );
        }
                g_free( dir );
                g_free( converted );
        }
index 92e1960ab8543f4c18617023fe48e0ec450e177d..2e01ca05adf9929ab67f69179d19404807268543 100644 (file)
@@ -443,7 +443,7 @@ ui::Window BuildDialog(){
        frame.add(vbox2);
 
        {
        frame.add(vbox2);
 
        {
-               PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
+               PreferencesPage preferencesPage( *this, vbox2 );
                Paths_constructPreferences( preferencesPage );
        }
 
                Paths_constructPreferences( preferencesPage );
        }
 
@@ -1676,7 +1676,7 @@ bool ScreenUpdates_Enabled(){
 }
 
 void ScreenUpdates_process(){
 }
 
 void ScreenUpdates_process(){
-       if ( redrawRequired() && gtk_widget_get_visible( g_wait.m_window ) ) {
+       if ( redrawRequired() && g_wait.m_window.visible() ) {
                ui::process();
        }
 }
                ui::process();
        }
 }
@@ -1698,8 +1698,8 @@ void ScreenUpdates_Disable( const char* message, const char* title ){
                        ScreenUpdates_process();
                }
        }
                        ScreenUpdates_process();
                }
        }
-       else if ( gtk_widget_get_visible( g_wait.m_window ) ) {
-               gtk_label_set_text( g_wait.m_label, message );
+       else if ( g_wait.m_window.visible() ) {
+               g_wait.m_label.text(message);
                ScreenUpdates_process();
        }
        g_wait_stack.push_back( message );
                ScreenUpdates_process();
        }
        g_wait_stack.push_back( message );
@@ -1718,8 +1718,8 @@ void ScreenUpdates_Enable(){
 
                //gtk_window_present(MainFrame_getWindow());
        }
 
                //gtk_window_present(MainFrame_getWindow());
        }
-       else if ( gtk_widget_get_visible( g_wait.m_window ) ) {
-               gtk_label_set_text( g_wait.m_label, g_wait_stack.back().c_str() );
+       else if ( g_wait.m_window.visible() ) {
+               g_wait.m_label.text(g_wait_stack.back().c_str());
                ScreenUpdates_process();
        }
 }
                ScreenUpdates_process();
        }
 }
@@ -2469,7 +2469,7 @@ WindowFocusPrinter g_mainframeFocusPrinter( "mainframe" );
 class MainWindowActive
 {
 static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* self ){
 class MainWindowActive
 {
 static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* self ){
-       if ( g_wait.m_window && gtk_window_is_active( window ) && !gtk_widget_get_visible( g_wait.m_window ) ) {
+       if ( g_wait.m_window && gtk_window_is_active( window ) && !g_wait.m_window.visible() ) {
                g_wait.m_window.show();
        }
 
                g_wait.m_window.show();
        }
 
@@ -2521,7 +2521,7 @@ MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusText
 
        for ( int n = 0; n < c_count_status; n++ )
        {
 
        for ( int n = 0; n < c_count_status; n++ )
        {
-               m_pStatusLabel[n] = ui::root;
+               m_pStatusLabel[n] = ui::Label(ui::null);
        }
 
        m_bSleeping = false;
        }
 
        m_bSleeping = false;
@@ -3040,11 +3040,11 @@ void MainFrame::Shutdown(){
 }
 
 void MainFrame::RedrawStatusText(){
 }
 
 void MainFrame::RedrawStatusText(){
-       gtk_label_set_text( GTK_LABEL( m_pStatusLabel[c_command_status] ), m_command_status.c_str() );
-       gtk_label_set_text( GTK_LABEL( m_pStatusLabel[c_position_status] ), m_position_status.c_str() );
-       gtk_label_set_text( GTK_LABEL( m_pStatusLabel[c_brushcount_status] ), m_brushcount_status.c_str() );
-       gtk_label_set_text( GTK_LABEL( m_pStatusLabel[c_texture_status] ), m_texture_status.c_str() );
-       gtk_label_set_text( GTK_LABEL( m_pStatusLabel[c_grid_status] ), m_grid_status.c_str() );
+       ui::Label::from(m_pStatusLabel[c_command_status]).text(m_command_status.c_str());
+       ui::Label::from(m_pStatusLabel[c_position_status]).text(m_position_status.c_str());
+       ui::Label::from(m_pStatusLabel[c_brushcount_status]).text(m_brushcount_status.c_str());
+       ui::Label::from(m_pStatusLabel[c_texture_status]).text(m_texture_status.c_str());
+       ui::Label::from(m_pStatusLabel[c_grid_status]).text(m_grid_status.c_str());
 }
 
 void MainFrame::UpdateStatusText(){
 }
 
 void MainFrame::UpdateStatusText(){
index 056f3ecfb04ae1c6db67030f84b9d2c3c3d78e5d..42f8a70652c5a023d24896b4b121766a7320f18b 100644 (file)
@@ -763,8 +763,8 @@ WindowPosition g_posMapInfoWnd( c_default_window_pos );
 
 void DoMapInfo(){
        ModalDialog dialog;
 
 void DoMapInfo(){
        ModalDialog dialog;
-       GtkEntry* brushes_entry;
-       GtkEntry* entities_entry;
+       ui::Entry brushes_entry;
+       ui::Entry entities_entry;
        ui::ListStore EntityBreakdownWalker{ui::null};
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
        ui::ListStore EntityBreakdownWalker{ui::null};
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
@@ -889,9 +889,9 @@ void DoMapInfo(){
 
        char tmp[16];
        sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
 
        char tmp[16];
        sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
-       gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp );
+       brushes_entry.text(tmp);
        sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) );
        sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) );
-       gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp );
+       entities_entry.text(tmp);
 
        modal_dialog_show( window, dialog );
 
 
        modal_dialog_show( window, dialog );
 
@@ -2036,8 +2036,8 @@ static void GetSelectionIndex( int *ent, int *brush ){
 
 void DoFind(){
        ModalDialog dialog;
 
 void DoFind(){
        ModalDialog dialog;
-       GtkEntry* entity;
-       GtkEntry* brush;
+       ui::Entry entity;
+       ui::Entry brush;
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
 
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
 
@@ -2106,9 +2106,9 @@ void DoFind(){
 
        GetSelectionIndex( &ent, &br );
        sprintf( buf, "%i", ent );
 
        GetSelectionIndex( &ent, &br );
        sprintf( buf, "%i", ent );
-       gtk_entry_set_text( entity, buf );
+       entity.text(buf);
        sprintf( buf, "%i", br );
        sprintf( buf, "%i", br );
-       gtk_entry_set_text( brush, buf );
+       brush.text(buf);
 
        if ( modal_dialog_show( window, dialog ) == eIDOK ) {
                const char *entstr = gtk_entry_get_text( entity );
 
        if ( modal_dialog_show( window, dialog ) == eIDOK ) {
                const char *entstr = gtk_entry_get_text( entity );
index 50d89bf1c0ad29db4760fc5693445b65239a37e5..3a01d142ef7297069db4e5870d595693672081ee 100644 (file)
@@ -159,7 +159,8 @@ void MRU_Activate( std::size_t index ){
                        MRU_SetText( i, MRU_GetText( i + 1 ) );
 
                if ( MRU_used == 0 ) {
                        MRU_SetText( i, MRU_GetText( i + 1 ) );
 
                if ( MRU_used == 0 ) {
-                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( MRU_items[0] )) ), "Recent Files" );
+                       auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[0] )) ));
+                       label.text("Recent Files");
                        gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE );
                }
                else
                        gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE );
                }
                else
index 96e60eac73ecd3e2c77defc0cb46f123043f9c72..0d8b2276ec1dfa8d13827bd49c3ccb1861c5649d 100644 (file)
@@ -176,8 +176,8 @@ void update(){
        }
        else
        {
        }
        else
        {
-               gtk_entry_set_text( m_horizontal, "" );
-               gtk_entry_set_text( m_vertical, "" );
+               m_horizontal.text("");
+               m_vertical.text("");
                gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE );
                gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE );
        }
                gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE );
                gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE );
        }
@@ -256,7 +256,7 @@ PatchInspector() :
 }
 
 bool visible(){
 }
 
 bool visible(){
-       return gtk_widget_get_visible( GetWidget() );
+       return GetWidget().visible();
 }
 
 //  void UpdateInfo();
 }
 
 //  void UpdateInfo();
index eff55f515ebd1566e4b5b6ae6ab8bd2312c7b8bc..5a36f5a49994a7768bdc767e71f22cc271f24c72 100644 (file)
@@ -1016,9 +1016,9 @@ void DoRotateDlg(){
 
 struct ScaleDialog
 {
 
 struct ScaleDialog
 {
-       ui::Widget x;
-       ui::Widget y;
-       ui::Widget z;
+       ui::Entry x;
+       ui::Entry y;
+       ui::Entry z;
        ui::Window window{ui::null};
 };
 
        ui::Window window{ui::null};
 };
 
@@ -1041,9 +1041,9 @@ static gboolean scaledlg_apply( ui::Widget widget, ScaleDialog* scaleDialog ){
 static gboolean scaledlg_cancel( ui::Widget widget, ScaleDialog* scaleDialog ){
        gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
 
 static gboolean scaledlg_cancel( ui::Widget widget, ScaleDialog* scaleDialog ){
        gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
 
-       gtk_entry_set_text( GTK_ENTRY( scaleDialog->x ), "1.0" );
-       gtk_entry_set_text( GTK_ENTRY( scaleDialog->y ), "1.0" );
-       gtk_entry_set_text( GTK_ENTRY( scaleDialog->z ), "1.0" );
+       scaleDialog->x.text("1.0");
+       scaleDialog->y.text("1.0");
+       scaleDialog->z.text("1.0");
 
        return TRUE;
 }
 
        return TRUE;
 }
@@ -1096,8 +1096,8 @@ void DoScaleDlg(){
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       ui::Widget entry = ui::Entry();
-                                       gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
+                                       auto entry = ui::Entry();
+                                       entry.text("1.0");
                                        entry.show();
                                        gtk_table_attach( table, entry, 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                        entry.show();
                                        gtk_table_attach( table, entry, 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1106,8 +1106,8 @@ void DoScaleDlg(){
                                        g_scale_dialog.x = entry;
                                }
                                {
                                        g_scale_dialog.x = entry;
                                }
                                {
-                                       ui::Widget entry = ui::Entry();
-                                       gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
+                                       auto entry = ui::Entry();
+                                       entry.text("1.0");
                                        entry.show();
                                        gtk_table_attach( table, entry, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                        entry.show();
                                        gtk_table_attach( table, entry, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -1116,8 +1116,8 @@ void DoScaleDlg(){
                                        g_scale_dialog.y = entry;
                                }
                                {
                                        g_scale_dialog.y = entry;
                                }
                                {
-                                       ui::Widget entry = ui::Entry();
-                                       gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
+                                       auto entry = ui::Entry();
+                                       entry.text("1.0");
                                        entry.show();
                                        gtk_table_attach( table, entry, 1, 2, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
                                        entry.show();
                                        gtk_table_attach( table, entry, 1, 2, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
index f97745598e2c551174ca5ea4321368f6d9614056..24e358901b06fa6f2580e82744b5de907618febb 100644 (file)
@@ -174,7 +174,7 @@ Increment m_vshiftIncrement;
 Increment m_hscaleIncrement;
 Increment m_vscaleIncrement;
 Increment m_rotateIncrement;
 Increment m_hscaleIncrement;
 Increment m_vscaleIncrement;
 Increment m_rotateIncrement;
-GtkEntry* m_texture;
+ui::Entry m_texture;
 
 SurfaceInspector() :
        m_textureEntry( ApplyShaderCaller( *this ), UpdateCaller( *this ) ),
 
 SurfaceInspector() :
        m_textureEntry( ApplyShaderCaller( *this ), UpdateCaller( *this ) ),
@@ -210,8 +210,8 @@ void constructWindow( ui::Window main_window ){
 void destroyWindow(){
        Destroy();
 }
 void destroyWindow(){
        Destroy();
 }
-bool visible() const {
-       return gtk_widget_get_visible( GetWidget() );
+bool visible() {
+       return GetWidget().visible();
 }
 void queueDraw(){
        if ( visible() ) {
 }
 void queueDraw(){
        if ( visible() ) {
@@ -1112,11 +1112,11 @@ void SurfaceInspector::Update(){
        const char * name = SurfaceInspector_GetSelectedShader();
 
        if ( shader_is_texture( name ) ) {
        const char * name = SurfaceInspector_GetSelectedShader();
 
        if ( shader_is_texture( name ) ) {
-               gtk_entry_set_text( m_texture, shader_get_textureName( name ) );
+               m_texture.text(shader_get_textureName(name));
        }
        else
        {
        }
        else
        {
-               gtk_entry_set_text( m_texture, "" );
+               m_texture.text("");
        }
 
        texdef_t shiftScaleRotate;
        }
 
        texdef_t shiftScaleRotate;
index eb275baf0cabf37c778ed35c9f7978de9b8a6a9b..b265c25e0d3e11b86c6ad6ae14defabbd6c97476 100644 (file)
@@ -707,7 +707,7 @@ bool XYWnd::chaseMouseMotion( int pointx, int pointy ){
 Shader* XYWnd::m_state_selected = 0;
 
 void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
 Shader* XYWnd::m_state_selected = 0;
 
 void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
-       if ( gtk_widget_get_visible( self.GetWidget() ) ) {
+       if ( self.GetWidget().visible() ) {
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) );
        }
 }
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) );
        }
 }