Put dock upper

This commit is contained in:
daleclack 2022-01-12 22:55:12 +08:00
parent fae2d64e0f
commit 457a3aa767
1 changed files with 13 additions and 4 deletions

View File

@ -2,7 +2,11 @@
#include "Start.h"
void add_dock(GtkWidget * overlay, GtkStyleProvider * provider){
GtkWidget * dock_box;
GtkWidget * dock_box, * main_box;
//Create a box for layout
main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL,5);
//Get Widget
GtkBuilder * builder = gtk_builder_new_from_resource("/org/gtk/daleclack/dock.ui");
dock_box = (GtkWidget*)gtk_builder_get_object(builder,"main_dock");
@ -11,9 +15,14 @@ void add_dock(GtkWidget * overlay, GtkStyleProvider * provider){
add_start(GTK_BOX(dock_box));
//Put the dock on the overlay
gtk_widget_set_halign(dock_box,GTK_ALIGN_CENTER);
gtk_widget_set_valign(dock_box,GTK_ALIGN_END);
gtk_overlay_add_overlay(GTK_OVERLAY(overlay),dock_box);
gtk_box_append(GTK_BOX(main_box),dock_box);
gtk_widget_set_halign(main_box,GTK_ALIGN_CENTER);
gtk_widget_set_valign(main_box,GTK_ALIGN_END);
gtk_overlay_add_overlay(GTK_OVERLAY(overlay),main_box);
//Add a separator
GtkWidget * space = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
gtk_box_append(GTK_BOX(main_box),space);
//Set Style
gtk_style_context_add_provider(gtk_widget_get_style_context(dock_box), provider, G_MAXINT);