⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch-introduction.html

📁 gtk 开发手册和参考文档。 包括gtk glib gdk等
💻 HTML
字号:
<HTML><HEAD><TITLE>Introduction</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.49"><LINKREL="HOME"TITLE="GTK+ 1.2 Tutorial"HREF="gtk-tut.html"><LINKREL="PREVIOUS"TITLE="GTK+ 1.2 Tutorial"HREF="gtk-tut.html"><LINKREL="NEXT"TITLE="Getting Started"HREF="ch-gettingstarted.html"></HEAD></head><body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 width="100%"><table cellspacing=6 border=0 cellpadding=0 width="100%">  <tr>    <td bgcolor="#FFFFFF" valign=top nowrap>    <centeR><A HREF="/"><img src="/images/gtk-logo-rgb.gif" width=107 height=140 border=0></A>      <font face="helvetica,lucidia" color="#000000"><BR><BR><b>GTK+<BR>The GIMP Toolkit</b></center><BR><table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>General</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="/">Introduction</A><BR><A HREF="/screenshots/">Screenshots</A><br><A HREF="/download/">Download</A><br><A HREF="/mailinglists.html">Mailing Lists</A><BR><A HREF="/bindings.html">Language Bindings</A><BR><A HREF="http://gtk.themes.org/">Themes</A><BR><A HREF="/bugs.html">Bug Tracker</A><BR></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>Documentation</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="/faq/">FAQ</A><br><A HREF="/tutorial/">Tutorial</A><BR><A HREF="/api/">API Reference</A><br><A HREF="/books.html">Published Books</A><BR></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B>Projects</B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="http://www.pango.org/">Pango</A><BR><A HREF="http://sources.redhat.com/inti/">Inti</A><BR><A HREF="http://www.gnome.org/">GNOME</A><BR><A HREF="http://user.sgic.fi/~tml/gimp/win32/">GTK+ for Win32</A><br><A HREF="http://people.redhat.com/sopwith/gtkfb/">GtkFB (Framebuffer)</A><br><A HREF="http://www.directfb.org/gtk.xml">GTK+ on DirectFB</A><BR><A HREF="/beos/">GTK+ for BeOS</A></td></tr></table></td></tr></table><BR>  <table width=100% cellspacing=0 cellpadding=2 border=0><tr><td bgcolor="#000000"><table width=100% cellspacing=0 cellpadding=4 border=0><tr><td bgcolor="#AAAAEE" nowrap><B><B>Applications</B></B></td></tr><tr><td bgcolor="#FFFFFF" nowrap><A HREF="http://www.gimp.org/">GIMP</A><BR><A HREF="http://www.abiword.org/">Abiword</A><BR><A HREF="http://www.lysator.liu.se/~alla/dia/dia.html">Dia</A><BR><A HREF="http://glade.pn.org/">Glade</A><BR><A HREF="http://www.gnucash.org/">GnuCash</A><BR><A HREF="http://www.gnome.org/projects/gnumeric/">Gnumeric</A><BR><BR><A HREF="http://www.gnome.org/applist/">GNOME Software Map</A><br></td></tr></table></td></tr></table><BR>      </td>  <td bgcolor="#ffffff" valign=top width="99%"><font face="lucida,helvetica"><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GTK+ 1.2 Tutorial</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="gtk-tut.html">&#60;&#60;&#60; Previous</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="ch-gettingstarted.html">Next &#62;&#62;&#62;</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="CH-INTRODUCTION">Chapter 1. Introduction</A></H1><P>GTK (GIMP Toolkit) is a library for creating graphical userinterfaces. It is licensed using the LGPL license, so you can developopen software, free software, or even commercial non-free softwareusing GTK without having to spend anything for licenses or royalties.</P><P>It's called the GIMP toolkit because it was originally written fordeveloping the GNU Image Manipulation Program (GIMP), but GTK hasnow been used in a large number of software projects, including theGNU Network Object Model Environment (GNOME) project. GTK is built ontop of GDK (GIMP Drawing Kit) which is basically a wrapper around thelow-level functions for accessing the underlying windowing functions(Xlib in the case of the X windows system). The primary authors of GTKare:</P><P></P><UL><LI><P> Peter Mattis <AHREF="mailto:petm@xcf.berkeley.edu"TARGET="_top">petm@xcf.berkeley.edu</A></P></LI><LI><P> Spencer Kimball <AHREF="mailto:spencer@xcf.berkeley.edu"TARGET="_top">spencer@xcf.berkeley.edu</A></P></LI><LI><P> Josh MacDonald <AHREF="mailto:jmacd@xcf.berkeley.edu"TARGET="_top">jmacd@xcf.berkeley.edu</A></P></LI></UL><P>GTK is essentially an object oriented application programmersinterface (API). Although written completely in C, it is implementedusing the idea of classes and callback functions (pointers tofunctions).</P><P>There is also a third component called GLib which contains a fewreplacements for some standard calls, as well as some additionalfunctions for handling linked lists, etc. The replacement functionsare used to increase GTK's portability, as some of the functionsimplemented here are not available or are nonstandard on other unixessuch as g_strerror(). Some also contain enhancements to the libcversions, such as g_malloc that has enhanced debugging utilities.</P><P>This tutorial describes the C interface to GTK. There are GTKbindings for many other languages including C++, Guile, Perl, Python,TOM, Ada95, Objective C, Free Pascal, and Eiffel. If you intend touse another language's bindings to GTK, look at that binding'sdocumentation first. In some cases that documentation may describesome important conventions (which you should know first) and thenrefer you back to this tutorial. There are also some cross-platformAPIs (such as wxWindows and V) which use GTK as one of their targetplatforms; again, consult their documentation first.</P><P>If you're developing your GTK application in C++, a few extra notesare in order. There's a C++ binding to GTK called GTK--, whichprovides a more C++-like interface to GTK; you should probably lookinto this instead. If you don't like that approach for whateverreason, there are two alternatives for using GTK. First, you can useonly the C subset of C++ when interfacing with GTK and then use the Cinterface as described in this tutorial. Second, you can use GTK andC++ together by declaring all callbacks as static functions in C++classes, and again calling GTK using its C interface. If you choosethis last approach, you can include as the callback's data value apointer to the object to be manipulated (the so-called "this" value).Selecting between these options is simply a matter of preference,since in all three approaches you get C++ and GTK. None of theseapproaches requires the use of a specialized preprocessor, so nomatter what you choose you can use standard C++ with GTK.</P><P>This tutorial is an attempt to document as much as possible of GTK,but it is by no means complete. This tutorial assumes a goodunderstanding of C, and how to create C programs. It would be a greatbenefit for the reader to have previous X programming experience, butit shouldn't be necessary. If you are learning GTK as your firstwidget set, please comment on how you found this tutorial, and whatyou had trouble with. There are also C++, Objective C, ADA, Guile andother language bindings available, but I don't follow these.</P><P>This document is a "work in progress". Please look for updates on<AHREF="http://www.gtk.org/"TARGET="_top">http://www.gtk.org/</A>.</P><P>I would very much like to hear of any problems you have learning GTKfrom this document, and would appreciate input as to how it may beimproved. Please see the section on <AHREF="ch-contributing.html">Contributing</A> for further information.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="gtk-tut.html">&#60;&#60;&#60; Previous</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="gtk-tut.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="ch-gettingstarted.html">Next &#62;&#62;&#62;</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">GTK+ 1.2 Tutorial</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top">&nbsp;</TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Getting Started</TD></TR></TABLE></DIV>        </td>    </tr></table>  </td>  </tr></table></body></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -