gtk工具栏改变背景色,在linux上正常,windows上不行
gtk 与C语言编写工具栏改变背景颜色的功能,在linux上运行正常,但在windows上toolbar颜色无法改变,是什么原因?#include <gtk/gtk.h>
void on_button_clicked(GtkButton *button,gpointer data)
{
g_print("你点击的按钮是:%s !\n",(gchar*)data);
}
void quit()
{
gtk_main_quit();
}
int main(int argc,char* argv[])
{
GtkWidget* window;
GtkWidget* box;
GtkWidget* toolbar;
GtkWidget* entry;
GtkWidget* label;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"添加工具条");
gtk_window_set_default_size(GTK_WINDOW(window),500,100);
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);
box=gtk_vbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(window),box);
toolbar=gtk_toolbar_new();
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2);
GdkColor color;
color.red = 0x3333;
color.green =0x9999;
color.blue = 0xcccc;
gtk_widget_modify_bg(toolbar, GTK_STATE_NORMAL, &color);
gtk_rc_parse_string("style \"default\" \n{GtkToolbar::space_size = 50\n}");
gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar),GTK_STOCK_NEW,"新建一个文件","新建",GTK_SIGNAL_FUNC(on_button_clicked),(gpointer)("新建"),-1);
gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar),GTK_STOCK_OPEN,"打开一个文件","打开",GTK_SIGNAL_FUNC(on_button_clicked),(gpointer)("打开"),-1);
gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar),GTK_STOCK_SAVE,"保存一个文件","保存",GTK_SIGNAL_FUNC(on_button_clicked),(gpointer)("保存"),-1);
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),GTK_TOOLBAR_BOTH_HORIZ);
gtk_box_pack_start(GTK_BOX(box),toolbar,FALSE,FALSE,0);
gtk_widget_show_all(window);
gtk_main();
return FALSE;
}
本人的Windows环境下
gtk_toolbar_insert_stock 该函数好像不能引用
页:
[1]