]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/plugintoolbar.cpp
Merge commit 'e28939e7b819e0cb0c3050037ec0e57160f7dba1' into master-merge
[xonotic/netradiant.git] / radiant / plugintoolbar.cpp
index 66deb284c34af1e8bf8e2ace751af00ead0de2d2..e06491d8f31f259690ec5f91025a4dc749e91880 100644 (file)
@@ -42,13 +42,13 @@ ui::Image new_plugin_image( const char* filename ){
 
        {
                StringOutputStream fullpath( 256 );
-               fullpath << AppPath_get() << g_pluginsDir << "bitmaps/" << filename;
+               fullpath << DataPath_get() << g_pluginsDir << "bitmaps/" << filename;
                if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
        }
 
        {
                StringOutputStream fullpath( 256 );
-               fullpath << AppPath_get() << g_modulesDir << "bitmaps/" << filename;
+               fullpath << DataPath_get() << g_modulesDir << "bitmaps/" << filename;
                if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
        }
 
@@ -57,13 +57,13 @@ ui::Image new_plugin_image( const char* filename ){
 
 void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){
        if (type == IToolbarButton::eSpace) {
-               auto it = ui::Widget(GTK_WIDGET(gtk_separator_tool_item_new()));
+               auto it = ui::ToolItem::from(gtk_separator_tool_item_new());
                it.show();
                toolbar.add(it);
                return;
        }
        if (type == IToolbarButton::eButton) {
-               auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_plugin_image(icon)), text)));
+               auto button = ui::ToolButton::from(gtk_tool_button_new(new_plugin_image(icon), text));
                gtk_widget_set_tooltip_text(button, tooltip);
                gtk_widget_show_all(button);
                button.connect("clicked", G_CALLBACK(handler), data);
@@ -71,8 +71,8 @@ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, co
                return;
        }
        if (type == IToolbarButton::eToggleButton) {
-               auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_toggle_tool_button_new()));
-               gtk_tool_button_set_icon_widget(button, GTK_WIDGET(new_plugin_image(icon)));
+               auto button = ui::ToolButton::from(gtk_toggle_tool_button_new());
+               gtk_tool_button_set_icon_widget(button, new_plugin_image(icon));
                gtk_tool_button_set_label(button, text);
                gtk_widget_set_tooltip_text(button, tooltip);
                gtk_widget_show_all(button);
@@ -83,7 +83,7 @@ void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, co
        ERROR_MESSAGE( "invalid toolbar button type" );
 }
 
-void ActivateToolbarButton( GtkToolButton *widget, gpointer data ){
+void ActivateToolbarButton( ui::ToolButton widget, gpointer data ){
        (const_cast<const IToolbarButton *>( reinterpret_cast<IToolbarButton *>( data )))->activate();
 }
 
@@ -91,7 +91,7 @@ void PlugInToolbar_AddButton( ui::Toolbar toolbar, const IToolbarButton* button
        toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), G_CALLBACK( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
 }
 
-ui::Toolbar g_plugin_toolbar{nullptr};
+ui::Toolbar g_plugin_toolbar{ui::null};
 
 void PluginToolbar_populate(){
        class AddToolbarItemVisitor : public ToolbarModules::Visitor
@@ -120,7 +120,7 @@ void PluginToolbar_clear(){
 
 ui::Toolbar create_plugin_toolbar(){
 
-       auto toolbar = ui::Toolbar(GTK_TOOLBAR( gtk_toolbar_new() ));
+       auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
        gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
        gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
        toolbar.show();