|
半成品,不过基本能使用了。
用法:
1. 图片窗口:
类名:MagicWindow
API函数:- GtkWidget *magic_window_new(GtkWindowType *type);
- void magic_window_set_background(MagicWindow *window, Gdkpixbuf *pixbuf);
- void magic_window_set_transparent(MagicWindow *window, gboolean transparent);
复制代码
用法举例:- GtkWidget *window;
- GdkPixbuf *bg;
- window = magic_window_new (GTK_WINDOW_TOPLEVEL);
- bg = gdk_pixbuf_new_from_file("background.png", NULL);
- magic_window_set_background(MAGIC_WINDOW(window), bg);
- magic_window_set_transparent (MAGIC_WINDOW(window), TRUE);
复制代码
2. 图片按钮:
类名:MagicButton
API函数:- GtkWidget* magic_button_new (GdkPixbuf *pixbuf);
- GtkWidget* magic_button_new_with_images (GdkPixbuf *pixbuf, const gchar *first_property_name, ...);
复制代码
属性名支持:"normal-pixbuf", "active-pixbuf", "prelight-pixbuf", 分别是正常状态,按下状态及高亮状态的图片, 默认的第一个参数为正常状态的图片。
用法举例:- GdkPixbuf *normal, *active, *prelight;
- GtkWidget *button;
- normal = gdk_pixbuf_new_from_file("leave.png", NULL);
- active = gdk_pixbuf_new_from_file("press.png", NULL);
- prelight = gdk_pixbuf_new_from_file("enter.png", NULL);
- button = magic_button_new_with_images(normal, "active-pixbuf", active, "prelight-pixbuf", prelight, NULL); // 设置三种状态。
- //button = magic_button_new_with_images(normal, "active-pixbuf", active, NULL); //只设置正常和按下两种状态
- //button = magic_button_new(normal); //只设置正常状态.
- //button = magic_button_new_with_images(normal, NULL); //同上,只设置正常状态
复制代码
已知问题:
不支持gtk-3.0, 按钮的tooltip位置显示错误。
运行效果:
下载:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?马上加入
x
|