注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Code@Pig Home

喜欢背着一袋Code傻笑的Pig .. 忧美.欢笑.记忆.忘却 .之. 角落

 
 
 

日志

 
 

[gtk+] layout container - GtkPaned  

2009-05-03 17:21:56|  分类: gui_X |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
GtkPaned is a special type of container widget that holds exactly two widgets. A resize bar is placed between them, which allows the user to resize the two widgets by dragging the bar in one direction or the other. When the bar is moved, eighter by user interaction or programmatic calls, one of the two widgets will shrink while the other expands.
-----------------------------------
#include <gtk/gtk.h>

static void
destroy(GtkWidget *window, gpointer data)
{
    gtk_main_quit();
}

int main(int argc, char *argv[])
{
    GtkWidget *window, *hpaned, *button1, *button2;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "Panes");
    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL);

    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
    gtk_widget_set_size_request(window, 320, 240);

    hpaned = gtk_hpaned_new();
    button1 = gtk_button_new_with_label("Resize");
    button2 = gtk_button_new_with_label("Me!");

    g_signal_connect_swapped(G_OBJECT(button1), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
    g_signal_connect_swapped(G_OBJECT(button2), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);

    gtk_paned_add1(GTK_PANED(hpaned), button1);
    gtk_paned_add2(GTK_PANED(hpaned), button2);

    gtk_container_add(GTK_CONTAINER(window), hpaned);
    gtk_widget_show_all(window);

    gtk_main();
    return 0;
}
-----------------------------------
[gtk+] layout container - GtkPaned - kasicass - Code@Pig Home

  评论这张
 
阅读(783)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017