c - GTK2 How to center a progressbar inside a statusbar? - Stack Overflow

With the following C code for GTK2.24, I'm displaying a progress bar inside a status bar, but the

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

相关推荐

  • c - GTK2 How to center a progressbar inside a statusbar? - Stack Overflow

    With the following C code for GTK2.24, I'm displaying a progress bar inside a status bar, but the

    8天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信