我正在閱讀有關GtkFrame
的教程,我已經編譯了一些代碼示例,但與本教程的screnhoot不同,但我的程序使用GtkFrame
沒有邊框。爲什麼在這個GtkFrame上沒有邊框?
下面的代碼:
#include <gtk/gtk.h>
int main(int argc,
char *argv[])
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkWidget *frame;
GtkWidget *button;
GtkWidget *label;
gint i;
/* Initialise GTK */
gtk_init(&argc, &argv);
/* Create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Frame Example");
/* Here we connect the "destroy" event to a signal handler */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_size_request(window, 300, 300);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
label = gtk_label_new("foo");
/* Create a Frame */
frame = gtk_frame_new(NULL);
gtk_container_add(GTK_CONTAINER(frame), label);
gtk_widget_set_size_request(frame, 30, 30);
gtk_container_add(GTK_CONTAINER(window), frame);
/* Set the frame's label */
gtk_frame_set_label(GTK_FRAME(frame), "GTK Frame Widget");
/* Set the style of the frame */
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
gtk_widget_show(frame);
/* Display the window */
gtk_widget_show (window);
/* Enter the event loop */
gtk_main();
return(0);
}
/* example-end */
生成程序:
我缺少什麼?
嗯,有趣的是,我得到了gtk2的邊界,但沒有與gtk3的邊界。也許它與造型有關? – Ancurio
@Ancurio:我做了大量的谷歌搜索,並且從頭到尾閱讀了「devhelp」,尋找像設置邊框/ gtk框架樣式的東西,但沒有運氣。我不知道爲什麼它被刪除,或者我們有一個bug到我們的gtk + 3? (對不起英語,不是我的母語) – Jack
那麼,看起來像它被刪除在Gtk3 http://developer.gnome.org/gtk3/3.4/GtkFrame.html替換的想法? – Jack