The WindowDecoration(装饰)
Remove the window decoration(删除窗口装饰):
1. GtkWidget *window = gtk_window_new (); gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
复制代码
Window Size(窗口大小)Find the size of the screen and then set your preferred window size to it(找到窗口大小,设置为你的首选窗口大小):
1. gtk_window_resize (GTK_WINDOW (window), max_screen_width, max_screen_height); gtk_window_maximize (GTK_WINDOW (window));
复制代码
The Toolbar(工具条)Use a standard GtkToolbar along the top of the screen. Name this "MeeGoToolbar"(屏幕顶部用一个标准的GTK Toolbar):
1. GtkWidget *toolbar = gtk_toolbar_new (); gtk_widget_set_name (GTK_WIDGET (toolbar), "MeeGoToolbar");
复制代码
The Close Button(关闭按钮)Use a button in the far right hand corner of the toolbar for closing the window, name this "MeeGoCloseButton"(使用工具栏的最右边右上角的关闭窗口按钮):
1. GtkWidget *close_button, *image; close_button = gtk_button_new (); gtk_widget_set_name (close_button, "MeeGoCloseButton");
复制代码
Use "window-close-hover" as the icon name(用“window-close-hover”作为图标名):
1. image = gtk_image_new_from_icon_name ("window-close-hover", GTK_ICON_SIZE_DIALOG); gtk_container_add (GTK_CONTAINER (close_button), image);
复制代码
The Settings Button(Settings按钮)If your application has a settings area, add a GtkButton called "MeeGoSettingsButton"(假如你的应用有一个设置区,添加一个“MeeGoSettingsButton”为名的GtkButton):
1. GtkWidget *close_button, *image; close_button = gtk_button_new (); gtk_widget_set_name (close_button, "MeeGoSettingsButton");
复制代码
Use "preferences-other-hover" as the icon name(用“preferences-other-hover”作为图标的名):
1. image = gtk_image_new_from_icon_name ("preferences-other-hover", GTK_ICON_SIZE_DIALOG);
2. gtk_container_add (GTK_CONTAINER (close_button), image);
复制代码
本文介绍了如何使用GTK库创建并配置窗口装饰,包括移除装饰、调整窗口大小及实现最大化。此外,还介绍了如何创建工具栏,并在工具栏中添加关闭按钮和设置按钮。
1366

被折叠的 条评论
为什么被折叠?



