#include "ubl-util-standard.h"
#ifndef __cplusplus
#ifndef UBL_GET_STANDARD_UI
#define UBL_GET_STANDARD_UI


inline returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id){
    returnstruct *ret=(returnstruct*)malloc(sizeof(returnstruct*));
    if (left_plug_id>0&&LeftWidget){
        GtkWidget *plug=gtk_plug_new(left_plug_id);
        GtkWidget *toplug=LeftWidget;
        if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
            g_object_ref(G_OBJECT(toplug));
            GtkWidget *parent=gtk_widget_get_parent(toplug);
            gtk_container_remove(GTK_CONTAINER(parent),toplug);
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        } else 
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        gtk_widget_show(GTK_WIDGET(plug));
        ret->plugLeft=plug;
    }
    if (right_plug_id>0&&RightWidget){
        GtkWidget *plug=gtk_plug_new(right_plug_id);
        GtkWidget *toplug=RightWidget;
        if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
            g_object_ref(G_OBJECT(toplug));
            GtkWidget *parent=gtk_widget_get_parent(toplug);
            gtk_container_remove(GTK_CONTAINER(parent),toplug);
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        } else 
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        gtk_widget_show(GTK_WIDGET(plug));
        ret->plugRight=plug;
    }
    return ret;
}

#endif

#else


inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id){
    if (left_plug_id>0&&LeftWidget){
        GtkWidget *plug=gtk_plug_new(left_plug_id);
        GtkWidget *toplug=GTK_WIDGET(LeftWidget->gobj());
        {GdkScreen *screen = gtk_widget_get_screen(plug);
        gtk_widget_set_app_paintable(plug,TRUE);
        GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
        gtk_widget_set_visual(plug, colormap);}
        {GdkScreen *screen = gtk_widget_get_screen(toplug);
        gtk_widget_set_app_paintable(toplug,TRUE);
        GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
        gtk_widget_set_visual(toplug, colormap);}
        if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
            g_object_ref(G_OBJECT(toplug));
            GtkWidget *parent=gtk_widget_get_parent(toplug);
            gtk_container_remove(GTK_CONTAINER(parent),toplug);
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        } else 
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        gtk_widget_show(GTK_WIDGET(plug));
        gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim");
        gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim");
        gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar");
    }
    if (right_plug_id>0&&RightWidget){
        GtkWidget *plug=gtk_plug_new(right_plug_id);
        GtkWidget *toplug=GTK_WIDGET(RightWidget->gobj());
        {GdkScreen *screen = gtk_widget_get_screen(plug);
        gtk_widget_set_app_paintable(plug,TRUE);
        GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
        gtk_widget_set_visual(plug, colormap);}
        {GdkScreen *screen = gtk_widget_get_screen(toplug);
        gtk_widget_set_app_paintable(toplug,TRUE);
        GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
        gtk_widget_set_visual(toplug, colormap);}
        if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
            g_object_ref(G_OBJECT(toplug));
            GtkWidget *parent=gtk_widget_get_parent(toplug);
            gtk_container_remove(GTK_CONTAINER(parent),toplug);
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        } else 
            gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
        gtk_widget_show(GTK_WIDGET(plug));
        gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim");
        gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim");
        gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar");
    }
}
#endif