I have a program with text widgets and button in box.
What do I need: resized text widgets with corners rounded (look link with picture below)
What I tried: resize widgets (text and box) with gtk_widget_set_size_request()
.
Problem: strange position if box size changes; if text widget size changes width doesn’t change and height of all widgets (in the box: text widgets, button) changes
UI prototype: ApplicationPrototype.pdf (19.5 KB)
Full code: https://drive.google.com/file/d/1xcs1FxoJ_teIOUF2uriLm6CJcRBwHToW/view?usp=drive_link
P. S. I also appreciate it if you could give an overview of my coding style and give some advice if necessary.
UPD: I added CSS and it doesn’t work with widgets. The one thing I wrote there is border-radius. I checked data program gets from css file and how it changes but… it doesn’t. Parsing is successful
/*--------------------------TEXTS----------------------------*/
TextIn = gtk_text_view_new();
TextOut = gtk_text_view_new();
gtk_widget_set_margin_bottom(TextIn, 5);
gtk_widget_set_margin_bottom(TextOut, 3);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(TextIn), GTK_WRAP_WORD_CHAR);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(TextOut), GTK_WRAP_WORD_CHAR);
/*...*/
/*--------------------------SCROLLED-------------------------*/
ScrollTextIn = gtk_scrolled_window_new();
ScrollTextOut = gtk_scrolled_window_new();
gtk_widget_set_size_request(ScrollTextIn, NULL, 100);
// Width option doesn't matter. Height option changes all widget's height
gchar *css_class = load_css(); // function returns css class (css provider used)
gtk_widget_add_css_class(ScrollTextIn, css_class);
gtk_widget_add_css_class(ScrollTextOut, css_class);
gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(ScrollTextIn), TextIn);
gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(ScrollTextOut), TextOut);
/*--------------------------BUTTON---------------------------*/
// Default button setting such as creating, signal bindings...
/*--------------------------BOX------------------------------*/
Box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous(GTK_BOX (Box), TRUE);
gtk_widget_set_size_request(Box, 300, 150);
// Maybe there are other ways to resize box?
gtk_widget_set_valign(Box, GTK_ALIGN_CENTER);
gtk_widget_set_halign(Box, GTK_ALIGN_CENTER);
gtk_window_set_child(GTK_WINDOW(Window), Box);
gtk_box_append(GTK_BOX(Box), ScrollTextIn);
gtk_box_append(GTK_BOX(Box), ScrollTextOut);
gtk_box_append(GTK_BOX(Box), Button);
/*...*/
P.P.S. Please, edit the question if you can make it more helpful or clearer for others