Rework vttgui, old up/down buttons are gone, hello drag'n'drop!
[terminatorX.git] / src / tX_pbutton.cc
index d8c2b0597394eab59df1db5580886aab4f1a7ba6..2356da06e784bc7deae0ca7901bfb931b5323e09 100644 (file)
@@ -35,28 +35,35 @@ const char* tx_icons[ALL_ICONS];
 
 int tx_icon_size=20;
 
-void tx_icons_init(int size) 
-{
+static const char tx_css[] = "#close:hover { background-color: #FF5555; color: #FFFFFF; }";
+
+void tx_icons_init(int size) {
        tx_icon_size=size;
 
        tx_icons[AUDIOENGINE] = "audio-speakers-symbolic";
        tx_icons[POWER] = "system-shutdown-symbolic";
-       tx_icons[GRAB] = "input-mouse-symbolic";        
+       tx_icons[GRAB] = "input-mouse-symbolic";
 
        tx_icons[SEQUENCER] = "emblem-music-symbolic";
-       
+
        tx_icons[PLAY] = "media-playback-start-symbolic";
        tx_icons[STOP] = "media-playback-stop-symbolic";
        tx_icons[RECORD] = "media-record-symbolic";
        tx_icons[MIN_AUDIO] = "audio-x-generic-symbolic";
        tx_icons[MIN_CONTROL] = "multimedia-volume-control-symbolic";
-       
-       tx_icons[MINIMIZE] = "go-top-symbolic";
-       tx_icons[MAXIMIZE] = "go-bottom-symbolic";
+
+       tx_icons[MINIMIZE] = "window-minimize-symbolic";
+       tx_icons[MAXIMIZE] = "view-more-symbolic";
        tx_icons[FX_UP] = "go-up-symbolic";
        tx_icons[FX_DOWN] = "go-down-symbolic";
        tx_icons[FX_CLOSE] = "window-close-symbolic";
-       tx_icons[MINIMIZE_PANEL] = "window-minimize-symbolic";
+       tx_icons[ADD_ITEM] = "list-add-symbolic";
+       tx_icons[ADD_DRYWET] = "list-add-symbolic";
+       tx_icons[REMOVE_DRYWET] = "list-remove-symbolic";
+
+       GtkCssProvider *provider = gtk_css_provider_new();
+       gtk_css_provider_load_from_data(provider, tx_css, -1, NULL);
+       gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 }
 
 GtkWidget *tx_pixmap_widget(tX_icon id)
@@ -69,7 +76,7 @@ GtkWidget *tx_xpm_label_box(tX_icon id, const gchar *label_text, GtkWidget **lab
        GtkWidget *box1;
        GtkWidget *label;
        GtkWidget *pixmapwid;
-       
+
        switch (globals.button_type) {
                case BUTTON_TYPE_TEXT:
                        label = gtk_label_new(label_text);
@@ -90,23 +97,31 @@ GtkWidget *tx_xpm_label_box(tX_icon id, const gchar *label_text, GtkWidget **lab
                        gtk_widget_show(pixmapwid);
                        label = gtk_label_new (label_text);
                        gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
-                       gtk_widget_show(label); 
+                       gtk_widget_show(label);
                        if (labelwidget!=NULL)  *labelwidget=label;
                        return box1;
-       }    
+       }
 }
 
 extern GtkWidget *tx_xpm_button_new(tX_icon id, const char *label, int toggle, GtkWidget **labelwidget)
 {
        GtkWidget *box;
        GtkWidget *button;
-       
+
        if (toggle) button=gtk_toggle_button_new();
        else button=gtk_button_new();
-       
+
        box=tx_xpm_label_box(id, label, labelwidget);
        gtk_widget_show(box);
-       gtk_container_add (GTK_CONTAINER (button), box);                
-       
+       gtk_container_add (GTK_CONTAINER (button), box);
+
        return(button);
 }
+
+GtkWidget* create_top_button(int icon_id) {
+        GtkWidget* button = gtk_button_new_from_icon_name(tx_icons[icon_id], GTK_ICON_SIZE_SMALL_TOOLBAR);
+        gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+        gtk_widget_set_margin_end(button, 0);
+        gtk_container_set_border_width(GTK_CONTAINER(button),0);
+        return button;
+}