2016.05.13 笔记
GTK+简介
GTK 最初为GIMP(一个图像处理软件,类似Photoshop)的工具包
后来GTK重写为面向对象的GTK+
GTK+ 并非是用C++写的,而是用C语言,所谓的面向对象是用C语言模拟的。强大
GTK+ 2.0 新特性:
使用Pango(a theme engine)增强了文本渲染
improved accessibility using the Accessibility Toolkit, transition to Unicode using UTF-8 strings, and a more flexible API.
GTK+ 2.8, GTK+ 2 depends on the Cairo graphics library for rendering vector graphics.
GTK+ 3.0
included revised input device handling, support for themes written with CSS-like syntax, and the ability to receive information about other opened GTK+ applications.
版本的新特性参考 wiki GTK+
编译
GTK+ 3.0的编译选项,用法见下文:
pkg-config --cflags gtk+-3.0
pkg-config --libs gtk+-3.0
https://developer.gnome.org/gtk3/stable/gtk-getting-started.html
fedora Linux
中安装gtk+/gnome开发包:
dnf install gnome-devel
dnf install gtk3-devel
dnf install gtk2-devel
dnf install gtk+-devel
dnf install gcc
dnf install gcc-c++
#include <gtk/gtk.h>
void CloseRequest(GtkWidget* theWindow, gpointer data);
gint main(gint argc, gchar* argv[])
{
GtkWidget* window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(CloseRequest), NULL);
gtk_widget_show(window);
gtk_main