GLib的一些规范

GObject, Glib, GDK, GTK+...

simplyzhao posted @ 2009年6月07日 06:27 in Gtk+ with tags GObject glib gtk+ , 2465 阅读

原本只是打算学习怎么使用GTK+进行图形界面的开发,不过在看了tigersoldier写的控件之后,对GTK+的内部机制产生了强烈的好奇心,于是下载了源码来看。

结果,越看越迷糊,涉及到的内容好多:

GObject:

“GObject provides the object system used for Pango and GTK+.”

Glib:

"GLib provides the core application building blocks for libraries and applications written in C. It provides the core object system used in GNOME, the main loop implementation, and a large set of utility functions for strings and common data structures."

GDK:

"An intermediate layer which isolates GTK+ from the details of the windowing system."

GTK+

"GTK+ is the primary library used to construct user interfaces in GNOME applications. It provides user interface controls and signal callbacks to control user interfaces."

 

目标是彻底理解下面这段最简单的GTK+代码的工作原理及实现:

 

#include<gtk/gtk.h>

static gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
    gtk_main_quit();
}

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

        gtk_init(&argc, &argv);

        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

        g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL);

        gtk_widget_show(window);

        gtk_main();

        return 0;
}

 

 

加油,加油...

 

Enjoy Linux, Fighting.

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter