当前位置: 技术问答>linux和unix
怎样改变GtkButton边框颜色?
来源: 互联网 发布时间:2016-06-27
本文导语: 大家好!当鼠标接触到GtkButton的时候,怎样改变该GtkButton的边框的颜色呢? | 我找到了以前参考的东西,你仔细看一下吧! 如果没有,那就没办法了啊! | 需要写yourname.rc...
大家好!当鼠标接触到GtkButton的时候,怎样改变该GtkButton的边框的颜色呢?
|
我找到了以前参考的东西,你仔细看一下吧!
如果没有,那就没办法了啊!
如果没有,那就没办法了啊!
|
需要写yourname.rc文件,程序运行时用gtk的函数设置,你可以到网上找找.rc文件的写法,里面有些参数可以实现你需要的功能!
|
不好意思,我不是专家!只是我们的一个项目中用到gtk学了一些皮毛而已。
我只能告诉你方法,还需要你自己去试验的。
gtk函数很简单: gtk_rc_parse ("yourname.rc")。
而且我觉得如何使用在gtk 的源码包中的帮助文件可能有,祝你好运!
我只能告诉你方法,还需要你自己去试验的。
gtk函数很简单: gtk_rc_parse ("yourname.rc")。
而且我觉得如何使用在gtk 的源码包中的帮助文件可能有,祝你好运!
|
肯定是可以的,我以前做个!(只是没有记录)你仔细查查参数吧,如果实在不行,我再给你试试
|
21. GTK's rc Files
GTK has its own way of dealing with application defaults, by using rc files. These can be used to set the colors of just about any widget, and can also be used to tile pixmaps onto the background of some widgets.
21.1 Functions For rc Files
When your application starts, you should include a call to:
void gtk_rc_parse( char *filename );
Passing in the filename of your rc file. This will cause GTK to parse this file, and use the style settings for the widget types defined there.
If you wish to have a special set of widgets that can take on a different style from others, or any other logical division of widgets, use a call to:
void gtk_widget_set_name( GtkWidget *widget,
gchar *name );
Passing your newly created widget as the first argument, and the name you wish to give it as the second. This will allow you to change the attributes of this widget by name through the rc file.
If we use a call something like this:
button = gtk_button_new_with_label ("Special Button");
gtk_widget_set_name (button, "special button");
Then this button is given the name "special button" and may be addressed by name in the rc file as "special button.GtkButton". [
GTK has its own way of dealing with application defaults, by using rc files. These can be used to set the colors of just about any widget, and can also be used to tile pixmaps onto the background of some widgets.
21.1 Functions For rc Files
When your application starts, you should include a call to:
void gtk_rc_parse( char *filename );
Passing in the filename of your rc file. This will cause GTK to parse this file, and use the style settings for the widget types defined there.
If you wish to have a special set of widgets that can take on a different style from others, or any other logical division of widgets, use a call to:
void gtk_widget_set_name( GtkWidget *widget,
gchar *name );
Passing your newly created widget as the first argument, and the name you wish to give it as the second. This will allow you to change the attributes of this widget by name through the rc file.
If we use a call something like this:
button = gtk_button_new_with_label ("Special Button");
gtk_widget_set_name (button, "special button");
Then this button is given the name "special button" and may be addressed by name in the rc file as "special button.GtkButton". [