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

📄 gnome-intro.html

📁 linux下gnome编程
💻 HTML
字号:
<HTML><HEAD><TITLE>GNOME</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.61"><LINKREL="HOME"TITLE="Writing GNOME Applications"HREF="index.html"><LINKREL="UP"TITLE="The GTK+/GNOME System"HREF="gtk-gnome-intro.html"><LINKREL="PREVIOUS"TITLE="GTK+"HREF="gtk.html"><LINKREL="NEXT"TITLE="The GNOME Build Environment"HREF="gnome-build.html"></HEAD><BODYCLASS="SECT1"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Writing GNOME Applications</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="gtk.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 2. The GTK+/GNOME System</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="gnome-build.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="GNOME-INTRO">GNOME</A></H1><P>        The GNOME layer is the highest, most abstract layer of        libraries that we will discuss. We'll spend most of the rest        of the book exploring libgnomeui, making an occasional foray        into libgnome. The remaining libraries lie beyond the scope of        this book. You can learn more about these other libraries at        the GNOME developers' Web site: http://developer.gnome.org.      </P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN258">Core Libraries</A></H2><P>          The core GNOME distribution is divided into numerous smaller          libraries, each with its own range of functionality. The          main GNOME libraries are libgnome, libgnomeui, and          libgnorba.        </P><P>          Libgnome implements the non-GUI functions that GNOME needs,          such as command line parsing, process execution, MIME          (Multipurpose Internet Mail Extensions), and metadata. It          also handles the GNOME configuration database, which is used          by applications to persistently store their state. Libgnome          provides wrappers for invoking the GNOME help system,          playing sounds, and managing games scores, plus a lot          more. Libgnome is GNOME's handyman tool belt.        </P><P>          Libgnomeui is GNOME's wrapper and extension around GTK+. It          adds more support for dialogs, graphics, and entry boxes,          plus a host of interesting new widgets. Libgnomeui also adds          extended support for dockable menus and toolbars, as well as          a multiple document interface (MDI) for handling multiple          windows in the same application (see Chapter 8).        </P><P>          The final core library is libgnorba, a helpful wrapper          around GNOME's CORBA functionality. Libgnorba provides          functions to initialize ORBit, and to integrate it into the          main loop of your application. Through GOAD, the GNOME          Object Activation Directory, libgnorba allows you to find,          load, and activate a wide variety of CORBA objects.        </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN264">Graphics Libraries</A></H2><P>          Xlib and GDK make up the foundation upon which GNOME's          graphics are built. GNOME adds a few layers of its own. The          simplest graphical extensions are GNOME's graphical widgets,          which implement a small, focused slice of          functionality. These include the GnomePixmap widget, which          makes it very easy to load a single image into a widget for          display. GNOME's graphical widgets, just like all its          other widgets, reside in libgnomeui.        </P><P>          One of GNOME's crowning achievements is a somewhat complex          drawing widget, the GNOME Canvas. The Canvas is a          double-buffered, object-oriented drawing surface that will          handle all the rendering and buffering for you. You can          rotate objects, and even click on them and drag them around          inside the Canvas. See Chapter 11 for details on how to do          this.        </P><P>          If you need more than image loading and simple manipulation,          GNOME provides libart, a library of advanced functions to          stretch, scale, rotate, bend, clip, and render raw RGB          (red-green-blue) images. This library is not for the faint          of heart, but fortunately GNOME wraps most of it up and uses          it behind the scenes, where you'll never have to see it          directly (unless you really want to). In fact, the GNOME          Canvas uses libart extensively, but for the most part it          exposes that functionality only through its own API.        </P><P>          The official image-loading library for GNOME 1.2 is the          gdk-pixbuf library, which has many useful functions for          loading different image file formats, like PNG, JPEG, TIFF,          and more, into RGB pixel buffers that you can then display          in your applications. It also provides some rendering          functions for copying images onto various drawing          surfaces. Gdk-pixbuf is the graphics library you'll most          likely use for manipulating images. We'll explore libart and          gdk-pixbuf in Chapter 10.        </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN270">Components</A></H2><P>          One of the main differences between GTK+ and GNOME is that          GNOME imposes a certain amount of GUI policy on its          applications. While at first this may seem like a limiting          choice, in practice it frees you from having to recon-          struct the basics of your GUI each time you create a new          application. GNOME's policy constraints aren't much of a          limitation, either, unless you plan on making a radical          departure from common GUI designs, as certain graphics-          intensive music-playing applications do.        </P><P>          Much of the added architecture of the GNOME system takes two          forms: (1) simplification of the more complex GTK+          interfaces and (2) division of the new functionality into          widgets, GTK+ objects, and CORBA components. The GnomeApp          widget is the cornerstone of the GNOME GUI          encapsulation. Transparently, GnomeApp adds support for          the menus and floating toolbars, with only minor effort from          you-much less than you would have to do to add the same          features to a GTK+-only application (see Chapter 5).        </P><P>          The GNOME Multiple Document Interface (GnomeMDI) provides an          infrastructure for displaying and managing more than one          document in the same application. GnomeMDI displays its          documents in various different MDI modes, including a tabbed          notebook mode and a multiwindow mode. End users can choose          which MDI mode they want to use.        </P><P>          GNOME also offers its own CORBA-based component system,          called Bonobo. Bonobo is a specification for communicating          between components in graphical applications. It has a lot          in common with Microsoft's OLE2 technology, and in fact          OLE2 was a prominent consideration in the initial design of          Bonobo. Using Bonobo, you can embed parts of one application          into another, transparently to the user.        </P><P>          The classic example is the spreadsheet inside a word          processor document.  GNOME's spreadsheet application,          Gnumeric, has a Bonobo spreadsheet component. Any          Bonobo-based application can load that spreadsheet into          itself.  The host application, called the container, will          take care of drawing the Bonobo spreadsheet and will add any          spreadsheet-specific menus and toolbars into the container          application. The actual functionality of the spreadsheet,          including data storage and math calculations, is contained          within Gnumeric's Bonobo component, using CORBA to          communicate back and forth.        </P><P>          Bonobo's component model makes good on the promise of the          object-oriented desktop. Rather than reimplementing          fundamental components like spreadsheets, text editors, and          file browsers in each new application that needs them,          developers can create these components once, as Bonobo          objects, and all new applications can share          them. Unfortunately, we don't have room for a full          CORBA/Bonobo treatment here. For more information about          Bonobo, look through the online documentation at          http://developer.gnome.org and examine the examples          distributed with the Bonobo source code. You may also want          to pore over the source code of some GNOME applications that          use Bonobo, to learn from example.        </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN278">Gnome-xml</A></H2><P>          One of the biggest buzzwords to come out of the computer          industry in recent years is XML (eXtensible Markup          Language). Yet despite the sudden glamour and hype, XML          rests on a foundation that has been around for years and          years: the Standard Generalized Markup Language (SGML). SGML          is one of the most widely used documentation and data          formats around, and HTML (HyperText Markup Language) is one          of its most popular variants. XML is essentially a          smaller, narrower snapshot of the larger SGML specification,          making it much easier to use and parse. Many          implementations of XML exist on a wide variety of platforms,          including UNIX and Microsoft Windows. GNOME's implementation          of XML resides in the gnome-xml package.        </P><P>          Gnome-xml offers several features that make it a powerful,          flexible interface for dealing with XML. You can read an XML          document from memory or from a file. For smaller documents,          you can parse the entire document in one fell swoop, before          interacting with it. For larger documents, or for perfor-          mance-intensive applications, you can use gnome-xml's Simple          API for XML (SAX) interface, an event-based approach that          triggers actions as it reads through the document, rather          than waiting until the end. When you're done with an XML          document, you can save it back to disk or to a memory          buffer.  Gnome-xml can also use compression when you're          loading from and saving to files.        </P><P>          Gnome-xml supports many important standards, where possible,          as declared by the World Wide Web Consortium          (http://www.w3.org), including the XML specification itself,          the Document Object Model (DOM), and XPath. DOM is an API          for accessing structured SGML documents; XPath is a          specification for addressing parts of an XML document in a          standardized manner. Gnome-xml also supports XML          namespaces. For more information on gnome-xml, go to its Web          site at http://xmlsoft.org.        </P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="gtk.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="gnome-build.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">GTK+</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="gtk-gnome-intro.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">The GNOME Build Environment</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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