# include & ltgtk/gtk.h>。
gchar * row【】= {“ABC . MP4“、“23“、“816KB/s“、“2016-05-21 10:28“};
GTK widget * button 1;
GtkWidget * button2
GtkWidget * button3
GTK widget * entry 1;
GtkWidget * entry2
GtkWidget * entry3
GtkWidget * entry4
void on _ button _ clicked(GTK widget * widget,gpointer數據)
{
if(button 1 = = widget)
{
GTK _ clist _ append((GtkCList *)data,row);
}
if(button 2 = = widget)
{
int * pArray =(int *)g _ malloc 0(16);//既然要動態播放,就必須申請內存。
pArray【0】=(int)GTK _ entry _ get _ text(entry 1);
pArray【1】=(int)GTK _ entry _ get _ text(entry 2);
pArray【2】=(int)GTK _ entry _ get _ text(entry 3);
pArray【3】=(int)GTK _ entry _ get _ text(entry 4);
GTK _ clist _ append((GtkCList *)data,(char * *)pArray);
g _ free(pArray);
}
if(button 3 = = widget)
{
GTK _ clist _ clear((GtkCList *)數據);
}
}
int main(int argc,char * argv【】)/*程序入口主函數*/
{
GtkWidget * window/*GtkWidget*類型指針定義*/
GtkWidget *已修復;
GtkWidget * clist
GTK _ init(& amp;argc & amp;argv);/*初始化命令行參數*/
WINDOW = GTK _ WINDOW _ new(GTK _窗口_頂層);/*創建窗口*/
GTK _ WINDOW _ set _ title(GTK _ WINDOW(窗口),“GTK fixed“);
GTK _ window _ set _ default _ size(GTK窗口(WINDOW),500,300);
GTK _ WINDOW _ set _ position(GTK _ WINDOW(窗口),GTK _ WIN _ POS _ CENTER);
fixed = GTK _ fixed _ new();
GTK _ CONTAINER _ add(GTK _容器(窗口),固定);
entry 1 = GTK _ entry _ new();
GTK條目集合文本((GTK條目*)條目1,“文件名“);
GTK _ FIXED _ put(GTK _ FIXED(固定),entry1,20,20);
GTK _ widget _ set _ size _ request(entry 1,80,30);
entry 2 = GTK _ entry _ new();
GTK條目集合文本((GTK條目*)條目2,“資源ID“);
GTK _ FIXED _ put(GTK _ FIXED(固定),entry2,120,20);
GTK _ widget _ set _ size _ request(entry 2,80,30);
entry 3 = GTK _ entry _ new();
GTK條目集合文本((GTK條目*)條目3,“碼流”);
GTK _ FIXED _ put(GTK _ FIXED(固定),entry3,20,70);
GTK _ widget _ set _ size _ request(entry 3,80,30);
entry 4 = GTK _ entry _ new();
GTK條目集合文本((GTK條目*)條目4,“時間“);
GTK _ FIXED _ put(GTK _ FIXED(固定),entry4,120,70);
GTK _ widget _ set _ size _ request(entry 4,80,30);
Button 1 = GTK按鈕新標簽(“數組添加“);
GTK _ FIXED _ put(GTK _ FIXED(FIXED),button1,20,120);
GTK _ widget _ set _ size _ request(button 1,60,30);
Button 2 = GTK按鈕新標簽(“條目添加“);
GTK _ FIXED _ put(GTK _ FIXED(固定),button2,100,120);
GTK _ widget _ set _ size _ request(button 2,60,30);
Button 3 = GTK按鈕新標簽(“刪除?除外“);
GTK _ FIXED _ put(GTK _ FIXED(固定),button3,180,120);
GTK _ widget _ set _ size _ request(button 3,60,30);
clist = GTK _ clist _ new(4);
GTK _ FIXED _ put(GTK _ FIXED(固定),clist,220,20);
GTK _ widget _ set _ size _ request(clist,550,100);
GTK _ clist _ set _ column _ width((GtkCList *)clist,0,100);
GTK _ clist _ set _ column _ width((GtkCList *)clist,1,100);
GTK _ clist _ set _ column _ width((GtkCList *)clist,2,100);
GTK _ clist _ set _ column _ width((GtkCList *)clist,3,100);
G _ signal _ connect(G _ OBJECT(button 1),“clicked“,
g _ CALLBACK(on _ button _ clicked),(gpointer)clist);
G _ signal _ connect(G _ OBJECT(button 2),“clicked”,
g _ CALLBACK(on _ button _ clicked),(gpointer)clist);
G _ signal _ connect(G _ OBJECT(button 3),“clicked”,
g _ CALLBACK(on _ button _ clicked),(gpointer)clist);
G _ signal _ connect _ swapped(G _ OBJECT(window),“destroy”,
g _ CALLBACK(GTK _ main _ quit),NULL);
?
GTK _ widget _ show _ all(window);/*顯示所有組件窗口*/
GTK _ main();/*gtk主循環類似於windows消息循環*/
返回0;/*主要回報*/
}