With the following C code for GTK2.24, I'm displaying a progress bar inside a status bar, but the progress bar is not centered, how to do?
GtkStyle *style = gtk_widget_get_style (progressbar9);
PangoFontDescription *desc = pango_font_description_copy (style->font_desc);
pango_font_description_set_size (desc, 8 * PANGO_SCALE);
gtk_widget_modify_font (progressbar9, desc);
pango_font_description_free (desc);
alignment = gtk_alignment_new (0, 0, 0, 0); // or 0, 0.5, 0, 0
gtk_widget_set_name (progressbar9, "progressbar9");
gtk_rc_parse_string ("style \"progressbar9\"\n"
"{\n"
"GtkProgressBar::min-horizontal-bar-height = 16\n"
"GtkProgressBar::yspacing = 0\n"
"}\n"
"widget \"*.progressbar9\" style \"progressbar9\"");
gtk_container_add (GTK_CONTAINER (alignment), progressbar9);
gtk_widget_show (alignment);
gtk_box_pack_end (GTK_BOX (gtk_statusbar_get_message_area (GTK_STATUSBAR (statusbar))), alignment, FALSE, FALSE, 0);
result: ok for gtk 3.24 above / ko for gtk 2.24 below
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744334896a4569066.html
评论列表(0条)