GTK+ / Gnome Application Development | |||
---|---|---|---|
<<< Previous | Home | Next >>> |
Widgets are the reason for GTK+'s existence. Widgets are subclasses of GtkWidget, which is in turn a subclass of GtkObject. A widget represents a rectangular region on the screen, and may be purely decorative, an interactive control, or a container controlling the arrangement of child widgets. the chapter called GTK+ Basics introduces GTK+ and thus widgets; the chapter called Writing a GtkWidget covers widget implementation and concepts in more detail.
GTK+
gtk/gtkwidget.h
GtkWidget is the parent class of all widgets. Chapters the chapter called GTK+ Basics and the chapter called Writing a GtkWidget describe widgets in general terms.
GtkWidget is an abstract base class.
GTK+
gtk/gtkcontainer.h
GtkContainer is the abstract base class for widgets that can contain other widgets. the section called Containers And Widget Layout in the chapter called GTK+ Basics describes containers in some detail; the chapter called Writing a GtkWidget includes information on container widget implementation.
GTK+
gtk/gtkbin.h
GtkBin is an abstract base class for containers with one child. It provides default implementions of the GtkContainer interface, so it is very easy to subclass. the chapter called Writing a GtkWidget describes how to implement a GtkBin subclass.
GTK+
gtk/gtkwindow.h
GtkWindow represents a toplevel dialog or application window. As the primary toplevel widget in GTK+, it has many special responsibilities; for example, it maintains the current keyboard focus and determines its own size allocation (rather than receiving one from a parent widget).
Gnome applications typically use GnomeApp for main application windows, to take advantage of its added features; for dialogs, you should use GnomeDialog with Gnome and GtkDialog with GTK+. Of course there are several specialized dialog subclasses available as well. If none of GtkWindow's subclasses seem appropriate to your application, GtkWindow can also be used directly.
A danger worthy of note: GtkWindow is automatically destroyed if it receives a "delete_event" signal. To prevent this, you must install the last signal handler to run, and your signal handler must return TRUE. This is a very common GTK+ programming mistake; see the section called Window Change Events in the chapter called GDK Basics for details. GnomeDialog will help you handle this situation; see the chapter called User Communication: Dialogs.
It is a good idea to make GtkWindow the last container you call gtk_widget_show() on. Most widgets are not actually mapped (placed onscreen) until their parent container is; but GtkWindow has no parent, and appears immediately. So if you show its children after you've shown the window, you will see some flicker.
Gnome
libgnomeui/gnome-dialog.h
GnomeDialog (or a subclass) should be used for all dialogs in a Gnome program. the chapter called User Communication: Dialogs describes the GnomeDialog interface.
If you aren't using Gnome, GnomeDialog is still useful --- because it implements all the basic features a dialog really must have. Studying the GnomeDialog source is highly recommended (you can even cut-and-paste if your application is under the GPL).
Gnome
libgnomeui/gnome-about.h
GnomeAbout is an about dialog, giving Gnome about dialogs a consistent look-and-feel. the section called GnomeAbout in the chapter called User Communication: Dialogs covers the interface.
Gnome
libgnomeui/gnome-messagebox.h
GnomeMessageBox is simply a GnomeDialog with a label and a small icon pre-packed inside. The icon corresponds to a "message box type," such as a warning message, an error, or a question. This helps users rapidly determine the dialog's purpose. the section called GnomeMessageBox in the chapter called User Communication: Dialogs explains the use of this widget.
Gnome
libgnomeui/gnome-propertybox.h
GnomePropertyBox is a dialog for application preferences or the properties of some user-visible object in your program. It has "apply", "OK", "close", and "help" buttons; "OK" is equivalent to "apply" followed by "close." the section called GnomePropertyBox in the chapter called User Communication: Dialogs describes it in more detail.
Gnome
libgnomeui/gnome-scores.h
GnomeScores keeps track of and displays a high scores list. Most Gnome games use it.
Gnome
libgnomeui/gnome-app.h
GnomeApp is a GtkWidget subclass specialized for main application windows. It has spaces for an optional toolbar, menubar, and statusbar. The application's "document" goes in a special slot in the center of the widget. the section called The GnomeApp Widget in the chapter called The Main Window: GnomeApp describes this widget.
GTK+
gtk/gtkdialog.h
GtkDialog is a GtkWindow with three widgets pre-packed: a GtkVBox for the dialog contents, a GtkSeparator, and a GtkHBox for the dialog's buttons. GtkDialog is not very useful; all Gnome programs should use GnomeDialog instead.
Gnome
libgnomeui/gnome-font-selector.h
GnomeFontSelector is an obsolete font selection dialog, replaced by GtkFontSelectionDialog. GtkFontSelectionDialog contains a GtkFontSelection. Gnome programs should really use a GtkFontSelection inside a GnomeDialog, because GtkFontSelectionDialog does not use GnomeDialog and thus its look-and-feel is slightly wrong. GnomeFontSelector should not be used.
GTK+
gtk/gtkinputdialog.h
GtkInputDialog is a dialog for selecting and setting up devices that use the X Input Extension (such as drawing tablets). It predates Gnome and is not a GnomeDialog so it looks a little funny in Gnome applications, but there is no reasonable workaround without rewriting the widget.
GTK+
gtk/gtkcolorsel.h
GtkColorSelectionDialog is a dialog containing a GtkColorSelection. Gnome applications should manually place the GtkColorSelection in a GnomeDialog, or use GnomeColorPicker.
GTK+
gtk/gtkfilesel.h
GtkFileSelection is a file selection dialog (unlike most of the other widgets ending in "Selection", which are composite widgets meant to be placed inside a dialog). Unfortunately, there is no Gnome replacement for this dialog, so Gnome applications typically use it, despite its somewhat inconsistent look.
GTK+
gtk/gtkfontsel.h
GtkFontSelectionDialog is a dialog containing a GtkFontSelection. Gnome applications should use a GnomeDialog containing a GtkFontSelection instead.
GTK+
gtk/gtkplug.h
GtkPlug is a toplevel window that can be embedded in a GtkSocket widget running in a separate application. In other words, GtkSocket is a "hole" in one process that can contain a GtkPlug widget from another.
GTK+
gtk/gtkbutton.h
GtkButton is a simple rectangular button. It's a container with one child; usually it contains text or a pixmap, but it can contain any widget.
Gnome
libgnomeui/gnome-color-picker.h
GnomeColorPicker is a button containing a small colored square indicating the currently selected color. When clicked, it creates a color selection dialog to change the selected color.
Gnome
libgnomeui/gnome-font-picker.h
GnomeFontPicker is analagous to GnomeColorPicker; it's a button showing the currently selected font, which pops up a font selection dialog when clicked.
Gnome
libgnomeui/gnome-href.h
GnomeHRef is a borderless button with a hyperlink displayed on it. When the button is clicked, Gnome points the user's browser at the hyperlink's target URL, or launches a new browser instance. The command used to go to the URL is globally configurable from the Gnome control center.
GTK+
gtk/gtktogglebutton.h
GtkToggleButton looks much like a regular GtkButton. However, it is intended to reflect a toggleable state; when the toggle is "active," the button appears to be depressed. GtkCheckButton should often be used instead of the toggle button; the check button usually looks nicer than GtkToggleButton, and gives the user a better idea that the button represents a toggleable state.
GTK+
gtk/gtkcheckbutton.h
The GtkCheckButton widget works just like the GtkToggleButton, but looks different (it looks like a label with a small button to the left). In most cases, the check button is a better choice than the toggle button, because the toggle button does not give the user a visual hint that it represents a toggleable state.
GTK+
gtk/gtkradiobutton.h
A radio button represents one of several mutually-exclusive options. Radio buttons are placed in "groups"; only one button in a group can be active at a given time. GtkOptionMenu can also be used to represent mutually exclusive options; an option menu is typically a better choice if there are more than a few options. A GtkList or GtkCList might be appropriate if there are a truly large number of options.
GTK+
gtk/gtkoptionmenu.h
GtkOptionMenu displays the currently active item from among a number of options; when clicked, it pops up a menu to allow the user to make a new item active. The option menu is slightly broken; it does not take the size of the menu items into account when requesting its size. If you have menu items containing labels in the option menu, the labels will often be truncated. The best workaround is to give the option menu more space than it requests, by setting appropriate options on its parent container.
Gnome
libgnomeui/gnome-dock-item.h
GnomeDockItem is a container that allows its child to appear on a GnomeDock. Dock items can be detached from their parent window and placed anywhere on the desktop; they can also be moved around within the dock. GnomeDock lets users rearrange Gnome toolbars. GnomeDockItem provides the "handle" for dragging its child. GnomeApp uses GnomeDock internally, so Gnome toolbars are all repositionable.
GTK+
gtk/gtkalignment.h
GtkAlignment is an invisible container used to align a child widget within some space. It lets you set two factors, each in both the X and Y direction; the alignment is 0.0 for left-justified (or top-justified) and 1.0 for right-justified (or bottom-justified). An alignment of 0.5 centers the child in that direction. The scale factor determines how the child fills extra space it did not request; if 0.0, the child fills only its requisition. A scale of 1.0 means that the child always expands to fill all the available space. (Clearly, a 1.0 scale factor makes the alignment factor irrelevant.)
GTK+
gtk/gtkframe.h
The frame widget draws a decorative frame around its child. It has an optional title describing the contents of the frame. To turn off the title, set it to NULL. It also has a configurable shadow style; the four possibilities are shown in Figure 10. GTK_SHADOW_NONE is a fifth acceptable value for the shadow type; it turns the shadow off.
GTK+
gtk/gtkaspectframe.h
GtkAspectFrame is used to control the aspect ratio of its child. It also allows you to justify the child in both directions, similar to GtkAlignment. You can specify an aspect ratio, or require that the ratio of the child's size request be preserved. Visually, GtkAspectFrame looks exactly like GtkFrame.
GTK+
gtk/gtkitem.h
GtkItem is an abstract base class for list items, tree items, and menu items. Items are widgets that can be "selected," "deselected," and "toggled."
GTK+
gtk/gtkmenuitem.h
A menu item is an invisible container; it is the only kind of widget that can appear in a GtkMenu. Typically, a label or a label and a pixmap are placed in the menu item to indicate its function. If a menu item has no child widget, it draws a separator line instead. This saves the overhead of adding a GtkSeparator to the menu item.
GTK+
gtk/gtkcheckmenuitem.h
GtkCheckMenuItem is a menu item that works like a GtkCheckButton; it has a small button next to its child widget, which is either "active" or "inactive." Because it's a subclass of GtkMenuItem, it can appear in menus.
GTK+
gtk/gtkradiomenuitem.h
A radio menu item works like GtkRadioButton; it allows the user to choose from a set of mutually exclusive options. Because it's a subclass of GtkMenuItem, it can appear in menus.
Gnome
libgnomeui/gtkpixmapmenuitem.h
GtkPixmapMenuItem is a Gnome widget despite its name. This widget solves a very specific problem: namely, if a menu contains check or radio menu items, GTK+ indents the child widget of all the menu items in the menu to make room for the check or radio buttons. Gnome uses pixmaps next to some menu items; GtkPixmapMenuItem indents pixmaps in the same way GTK+ indents check or radio buttons. If you simply added a pixmap and a label to a GtkMenuItem, the pixmap would be incorrectly aligned with the plain labels in other menu items. This widget is not really pixmap-specific; any widget can be placed in the unindented "pixmap" slot. Usually GtkPixmapMenuItem is created implicitly with the Gnome menu creation functions.
GTK+
gtk/gtktearoffmenuitem.h
GtkTearoffMenuItem is a "perforation" representing a spot where a menu can be "torn off" (kept visible in a toplevel window for easy access). Gnome menus all include a tearoff menu item by default, but users can globally disable them using the Gnome control center.
GTK+
gtk/gtklistitem.h
GtkListItem is an invisible container that allows its child to appear in a GtkList. That is, only list items can appear in a list.
GTK+
gtk/gtktreeitem.h
GtkTreeItem is an invisible container that gives its child the ability to appear in a GtkTree. Only tree items can be placed in the tree widget.
GTK+
gtk/gtkeventbox.h
The event box widget may be the simplest container in GTK+; its only purpose is to have a GdkWindow. Certain operations only work on widgets with windows (such as setting the background color, or capturing events); if you want to perform these operations on a windowless widget, you can place the widget in an event box and perform the operations on the event box, achieving much the same effect.
GTK+
gtk/gtkhandlebox.h
The handle box widget can be adds a handle to a child widget; by dragging on the handle, the child can be removed from the window and positioned elsewhere on the user's desktop. The handle box is often used for toolbars. GnomeDock and GnomeDockItem offer a more flexible (but more elaborate) alternative.
GTK+
gtk/gtkscrolledwindow.h
GtkScrolledWindow provides horizontal and vertical scrollbars for its child widget. Optionally, the scrollbars are hidden when the entire child is visible. If a child widget has a set_scroll_adjustments_signal in its GtkWidgetClas (see the section called Overridable Signals in the chapter called Writing a GtkWidget), the scrolled window uses them as the adjustments for the scrollbars. Otherwise, the scrolled window scrolls the entire widget using a GtkViewport. (Consider GtkCList for example; the column titles aren't scrolled, only the list contents. Thus GtkCList provides scroll adjustment signals.)
GTK+
gtk/gtkviewport.h
GtkViewport is more or less an implementation detail of GtkScrolledWindow. It contains a widget that does not provide a set_scroll_adjustments_signal, and provides such a signal on the child widget's behalf. See GtkScrolledWindow for more details.
GTK+
gtk/gtkbox.h
GtkBox is an abstract base class for GtkVBox, GtkHBox, and GtkButtonBox. It's an invisible layout container; the chapter called GTK+ Basics describes it in some detail.
GTK+
gtk/gtkhbox.h
GtkHBox is a GtkBox that packs widgets from left to right. The left side is considered the "start" of the box.
Gnome
libgnomeui/gnome-appbar.h
GnomeAppBar is a simple status bar with an optional progress meter. It does not have "contexts" like GtkStatusbar. the section called GnomeAppBar in the chapter called The Main Window: GnomeApp gives more details.
Gnome
libgnomeui/gnome-dateedit.h
GnomeDateEdit allows the user to edit a date and time. The time-editing part can be turned off if you are only interested in the date.
GTK+
gtk/gtkcombo.h
GtkCombo is a text entry box with a drop-down menu "quick choices." If you want to limit the user to a fixed set of options, a GtkOptionMenu is more appropriate. GtkCombo allows the user to type in anything, but offers some suggestions as well. GnomeEntry is a combo box that adds items the user types in to the list of choices in the drop-down menu, and automatically remembers the list from session to session.
Gnome
libgnomeui/gnome-entry.h
GnomeEntry is a GtkCombo extension that uses the drop-down menu as a history. If the user types something which isn't in the history already, GnomeEntry adds it and saves it in a configuration file to be loaded next time the application starts up.
Gnome
libgnomeui/gnome-file-entry.h
GnomeFileEntry is a GnomeEntry that keeps file names in its history. It also has a "Browse" button which pops up a GtkFileSelection. It has a "directories only" mode as well.
Gnome
libgnomeui/gnome-number-entry.h
GnomeNumberEntry allows the user to enter a number; it keeps a history of numbers entered in its drop-down menu. It also has a "Calculator" button to pop up a GnomeCalculator.
Gnome
libgnomeui/gnome-procbar.h
GnomeProcBar is used in a Gnome panel applet that displays CPU and memory load, and in the GTop application (a graphical top clone). It displays a colored bar that can change length; it could be used to display any kind of constantly-changing value.
GTK+
gtk/gtk.h
GtkStatusbar is described in the section called GtkStatusbar in the chapter called The Main Window: GnomeApp. It's a status bar widget; it displays a line of text at the bottom of a window.
GTK+
gtk/gtkvbox.h
GtkVBox is a GtkBox that packs widgets from top to bottom. The top is considered the "start" of the box.
Gnome
libgnomeui/gnome-calculator.h
GnomeCalculator is a simple calculator, implemented as a GtkWidget.
Gnome
libgnomeui/gnome-guru.h
GnomeGuru was an attempt to implement a "wizard" widget (a series of pages representing steps in a task that the user can step through). It is an immature interface and should not be used; at press time, it appears that a new widget called GnomeDruid will replace it in the next version of Gnome. GnomeDruide will most likely be available as an add-on module before that, so look for it if you need a wizard widget.
Gnome
libgnomeui/gnome-icon-entry.h
GnomeIconEntry is similar to GnomeColorPicker and GnomeFontPicker. It's a button displaying a currently-selected icon; when the button is clicked, an icon browser dialog allows the user to set a new icon. The widget used to have a text entry for typing an icon filename, thus it is called GnomeIconEntry rather than GnomeIconPicker.
Gnome
libgnomeui/gnome-icon-sel.h
GnomeIconSelection browses icon files; it's used by GnomeIconEntry but can also be used directly.
Gnome
libgnomeui/gnome-less.h
GnomeLess is a simple extension of GtkText that loads text from a file or file descriptor and displays it. It is probably a good idea to avoid this widget; because it isn't very useful, it is likely to disappear from future versions of Gnome.
Gnome
libgnomeui/gnome-paper-selector.h
GnomePaperSelector is another widget worth avoiding; in the 1.0 release, it is strictly experimental. It allows the user to select the paper size for printing.
Gnome
libgnomeui/gnome-pixmap-entry.h
GnomePixmapEntry has essentially the same purpose as GnomeIconEntry; it allows the user to select a pixmap. The only reason you might prefer one to the other is that GnomeIconEntry scales images to the standard Gnome icon size.
Gnome
libgnomeui/gnome-spell.h
GnomeSpell is a spell-checker interface; it uses the ispell program internally. This widget should be considered experimental and avoided in production code.
GTK+
gtk/gtkcolorsel.h
GtkColorSelection allows the user to specify a color, using a color wheel or sliders. It makes up the contents of GtkColorSelectionDialog (Figure 1 in the section called Description).
GTK+
gtk/gtkgamma.h
GtkGammaCurve allows the user to edit a curve; it's a very specialized widget used in the Gimp. Few applications will have a use for it.
GTK+
gtk/gtkbbox.h
GtkButtonBox is a special kind of GtkBox designed to store the buttons of a dialog. It has horizontal and vertical variants. GnomeDialog creates a button box for you, so there is no need to use this widget directly when programming with Gnome.
GTK+
gtk/gtkhbbox.h
GtkHButtonBox is the horizontal variant of GtkButtonBox.
GTK+
gtk/gtk.h
GtkVButtonBox is the vertical variant of GtkButtonBox.
GTK+
gtk/gtklayout.h
GtkLayout creates the illusion of a container with infinite size. Because X windows are limited to 32,768 pixels in size (2^15), most widgets also have a 32,768-pixel size limit (and child widgets must be positioned within the parent's X window). Naive widgets scroll by simply moving their GdkWindow. GtkLayout is more intelligent about this.
Gnome
libgnomeui/gnome-canvas.h
GnomeCanvas is extensively discussed in the chapter called GnomeCanvas. It renders flicker-free structured graphics, and is ideal for custom displays.
Gnome
libgnomeui/gnome-icon-list.h
GnomeIconList is used in the Gnome file manager. It displays icons and their names; users can select groups of icons by rubberbanding.
Gnome
libgnomeui/gnome-dock-band.h
GnomeDockBand contains one row or column of GnomeDockItems; a GnomeDock in turn contains one or more GnomeDockBands. See the GnomeDockItem entry for details and a screenshot.
Gnome
libgnomeui/gnome-dock.h
GnomeDock collects GnomeDockBands which in turn hold GnomeDockItems. GnomeDock allows users to reposition toolbars and other application components. See the GnomeDockItem entry for details and a screenshot.
GTK+
gtk/gtkclist.h
GtkCList is a list-with-columns widget; it is also the base class for GtkCTree. GtkCList displays text and/or a pixmap in each cell; it cannot hold child widgets in its cells. GtkCList is only a container because it uses widgets for the column headings. You may prefer GtkList, which can have child widgets as list items, but is less efficient and has a maximum list size of 32,768 pixels.
GTK+
gtk/gtkctree.h
GtkCTree is similar to GtkCList, but (unsurprisingly) displays a tree with expandable nodes instead of a simple list. GtkTree is a more flexible tree widget (it can have arbitrary widgets in the tree cells), but it is less efficient and limited to 32,768 pixels.
GTK+
gtk/gtkfixed.h
The GtkFixed container allows you to position child widgets at absolute coordinates, and always gives child widgets exactly their requested size. This widget is for masochists; it doesn't do anything automatically. You should almost always use another layout widget instead (if you think you need the fixed widget, consider asking for help; most likely a real layout widget can be made to work better).
GTK+
gtk/gtknotebook.h
A notebook widget presents the user with several "pages"; the user can move a page to the top by selecting its "tab." Each child added to GtkNotebook becomes a page; you can also specify widgets to use for the tab labels. It is generally considered bad practice to have more than a single row of tabs, but GtkNotebook does allow it. It is also possible to position the tabs on the left, right, or bottom of the notebook, but you should always leave them on top for interface consistency.
GTK+
gtk/gtkfontsel.h
GtkFontSelection is a composite widget that allows the user to select a font from among the fonts available on the system. GtkFontSelectionDialog contains an instance of GtkFontSelection. Gnome applications should place a GtkFontSelection in a GnomeDialog.
GTK+
gtk/gtkpaned.h
The GtkPaned widget divides an area into two user-resizable sections. It has horizontal and vertical variants.
GTK+
gtk/gtkhpaned.h
GtkHPaned is the horizontal variant of GtkPaned; it allows the user to divide a horizontal space between the GtkHPaned's two child widgets.
GTK+
gtk/gtkvpaned.h
GtkVPaned is the vertical variant of GtkPaned; it allows the user to divide a vertical space between the GtkVPaned's two child widgets.
GTK+
gtk/gtklist.h
GtkList displays a list of items. Each item is a GtkListItem; GtkListItem is a container that can hold any kind of widget. The size of a GtkList is limited, because list items are placed at fixed coordinates in the list's GdkWindow, and scrolling is achieved by moving the GdkWindow; GdkWindow has a maximum size of 32,768 pixels, and any list item positioned outside that range is invisible. GtkCList overcomes this limitation, but is unable to contain arbitrary widgets.
GTK+
gtk/gtkmenushell.h
GtkMenuShell is an abstract base class for widgets that contain GtkMenuItems. Its two subclasses are GtkMenu and GtkMenuBar.
GTK+
gtk/gtkmenubar.h
GtkMenuBar is a menu bar. It contains one or more menu items; normally, each menu item will have a submenu (i.e., a GtkMenu with more menu items). For example, the menu bar might have a menu item called "File," with a submenu containing the menu items "Open" and "Quit."
GTK+
gtk/gtkmenu.h
GtkMenu contains menu items. GtkMenu is unique because it should not be shown (with gtk_widget_show()) by the programmer; menus are popped up in response to user actions.
GTK+
gtk/gtkpacker.h
GtkPacker is a layout container inspired by the Tk toolkit. If you're familiar with that toolkit, you may find it easier to use than the standard GTK+ layout containers.
GTK+
gtk/gtksocket.h
GtkSocket is a "hole" in one application that allows a GtkPlug from a second application to be embedded.
GTK+
gtk/gtktable.h
the section called GtkTable in the chapter called GTK+ Basics desribes GtkTable in some detail. It's one of the most important GTK+ layout widgets.
Gnome
libgnomeui/gtk-ted.h
GtkTed is a relic from the early days of Gnome; "ted" stands for "table editor." It's a kind of primitive GUI builder. There are at least two advanced projects to write good GUI builders (Glade and GLE), so this widget should be ignored and will disappear in a future version of libgnomeui.
GTK+
gtk/gtktoolbar.h
No surprises here: GtkToolbar is a toolbar widget. Gnome applications will usually use the Gnome helper functions instead of creating a toolbar directly, as described in the chapter called The Main Window: GnomeApp.
GTK+
gtk/gtktree.h
GtkTree is to GtkCTree as GtkList is to GtkCList. That is, GtkTree is more flexible than GtkCTree---tree items can contain any widget--- but it's also a bit slower than GtkCTree and holds only a limited number of items. The maximum number of items depends on the height of the rows; the total row height must fit inside a GdkWindow, which means 32,768 pixels.
Gnome
libgnomeui/gnome-animator.h
GnomeAnimator displays a series of images, creating an animation. It has a "loop mode" and a "play once" mode. The GnomeAnimator API is marked "immature" in Gnome 1.0 and may change incompatibly in future versions; this is an experimental widget.
Gnome
libgnomeui/gnome-pixmap.h
GnomePixmap should be preferred to GtkPixmap, though it has the same purpose. GnomePixmap is a bit smarter about visuals. It can also load images from many different formats, using Imlib, so it's more convenient to use.
Gnome
libgnomeui/gnome-stock.h
GnomeStock is a container that wraps a GnomePixmap; it automatically creates "insensitive" and "focused" copies of the pixmap to reflect the widget state. It can be set to one of the Gnome stock pixmap macros, such as GNOME_STOCK_PIXMAP_CUT (small picture of scissors), GNOME_STOCK_PIXMAP_PRINT (a little printer), etc. You can also register new stock pixmaps specific to your application at runtime. Gnome uses this widget internally when creating menus and toolbars using a GnomeUIInfo template (see the section called Menus and Toolbars with GnomeUIInfo in the chapter called The Main Window: GnomeApp).
GTK+
gtk/gtkmisc.h
The descriptively-named (or not) GtkMisc abstract base class allows you to set the "alignment" and "padding" of its subclasses. Alignment is a float between 0.0 and 1.0, where 0.0 is left-justified, 0.5 is centered, and 1.0 is right-justified. Alignment only matters if a GtkMisc receives a size allocation larger than its size request; the alignment locates the natural bounding box of the widget within its actual bounding box. Padding is a number of pixels to add to the widget's size request. The widget will then leave those pixels blank.
Widgets that do not derive from GtkMisc can be made "alignable" in the same way by placing them in a GtkAlignment container.
GTK+
gtk/gtklabel.h
GtkLabel simply displays a text string. If the text string contains newlines, GtkLabel displays multiple lines. Labels honor the alignment parameter from their parent class (GtkMisc); you can use this to center the text, or move it to the left or right. Alignment is not the same as justification. Justification defines the position of multiple lines with respect to each other. Left-justified means each line starts in the same place, right-justified means each ends in the same place, center-justified means each is centered around the same imaginary line. Justification has no meaning for one-line labels. Alignment set with gtk_misc_set_alignment() positions the entire block of text within its size allocation; alignment only matters if the label receives more space than it requested (it will request just enough to hold the text block). Labels are GTK_NO_WINDOW widgets (which means they don't receive events and draw on their parent's background).
GTK+
gtk/gtkaccellabel.h
GtkAccelLabel is associated with some other widget, and displays the accelerator key for that widget as part of the label.
Gnome
libgnomeui/gtk-clock.h
GtkClock is a label that displays a time. It can optionally update the time periodically (just like a clock!).
GTK+
gtk/gtktipsquery.h
GtkTipsQuery is a label that displays tooltips. It also has "What's This?" functionality. You call gtk_tips_query_start() to switch to "query mode." In query mode, the cursor is changed to a question mark; as the mouse moves over widgets in the application, the GtkTipsQuery displays their tooltips. GtkTipsQuery emits a "widget_selected" signal if the user clicks on a widget; you can use this to display more extensive help for that widget. You might store the more extensive help as the "private" component of a GtkTooltip, or you might use gtk_object_set_data() to store some kind of application-specific help information.
GTK+
gtk/gtkarrow.h
GtkArrow displays an arrow. It's a very simple GTK_NO_WINDOW widget and doesn't even receive events. In the default theme, an arrow is simply a triangle.
GTK+
gtk/gtkimage.h
GtkImage displays a GdkImage in a widget. It's only useful if you already have a GdkImage; to display a fixed image you usually want GnomePixmap.
GTK+
gtk/gtkpixmap.h
GtkPixmap displays a GdkPixmap. If you're using Gnome, prefer GnomePixmap for the reasons given in its description.
GTK+
gtk/gtkcalendar.h
GtkCalendar displays a calendar page (one month). It allows users to select a date. GnomeDateEdit uses GtkCalendar in a popup menu.
GTK+
gtk/gtkdrawingarea.h
GtkDrawingArea is a thin wrapper around GdkWindow; it gives you a blank area to draw on. Normally, you would connect to its "configure_event" signal to catch changes in the size of the area, and do your drawing in an "expose_event" handler. To eliminate flicker, you might keep a GdkPixmap equal in size to the drawing area, and draw to the pixmap; in your "expose_event" handler, simply copy the exposed region from the pixamp to the drawing area.
For high-level graphics, GnomeCanvas can be much more convenient to use.
GTK+
gtk/gtkcurve.h
GtkCurve is used to display the curve in the GtkGammaCurve widget. It's a drawing area extension with curve-drawing abilities. Most likely you won't find a use for this widget.
GTK+
gtk/gtkdial.h
GtkDial is a "speedometer" display. By default, the user can drag the "needle" around, changing the dial's value. GtkDial also has a "view only" mode.
GTK+
gtk/gtkeditable.h
GtkEditable is an abstract base class for widgets that allow the user to edit text. The base class interface allows cursor positioning, retrieving characters, and so on. It also includes the "changed" signal, which you can use to detect user input.
GTK+
gtk/gtkentry.h
GtkEntry allows the user to enter a single line of text. It has a "password" mode; in "password" mode the text in the entry is replaced by asterisks.
GTK+
gtk/gtkspinbutton.h
GtkSpinButton is a GtkEntry customized to allow the user to enter a number. Spin buttons add up and down arrows to the entry, so the user can rapidly spin through the possible values.
GTK+
gtk/gtktext.h
GtkText is a text widget. It can display text, and offers simple text-editing facilities.
Two questions about the text widget are very frequently asked on the GTK+ mailing lists. These are:
Does the text widget support horizontal scrolling?
The text widget doesn't seem to be very powerful. Are there plans to replace it?
The text widget does not support horizontal scrolling; instead, it wraps lines. It is not very powerful, and the code is difficult to maintain; it will most likely be replaced in Gtk 1.4 as part of the move to Unicode.
GTK+
gtk/gtkruler.h
GtkRuler is an abstract base class for the horizontal and vertical ruler widgets. The ruler widgets are used in the GIMP to display image dimensions.
GTK+
gtk/gtkrange.h
GtkRange is an abstract base class for "slider" widgets. These widgets modify some numeric value as a "slider" is moved in a "trough." The two subclasses of GtkRange are GtkScale, used to allow the user to enter a numeric value, and GtkScrollbar, the GTK+ scrollbar widget.
GTK+
gtk/gtkscale.h
GtkScale allows the user to enter a numeric value by moving a slider. It can display the current value above the slider; you can turn this off if the exact value isn't relevant, or you want to provide feedback in some other way. GtkScale is an abstract base class; you must instantiate its vertical or horizontal variant.
GTK+
gtk/gtkhscale.h
GtkHScale is the horizontal variant of GtkScale.
GTK+
gtk/gtkvscale.h
GtkVScale is the vertical variant of GtkScale.
GTK+
gtk/gtkscrollbar.h
GtkScrollbar is an abstract base class, giving horizontal and vertical scrollbars a common interface.
GTK+
gtk/gtkseparator.h
The GtkSeparator widget is a divider line you can use to make your interface more attractive. For example, a GtkHSeparator is used to divide the contents of a GnomeDialog from its buttons.
GTK+
gtk/gtkpreview.h
GtkPreview displays an RGB image; the GIMP uses it to display a preview of the effects of an image transformation.
GTK+
gtk/gtkprogress.h
GtkProgress is an abstract base class for progress displays. In GTK+ 1.2 only one concrete subclass exists (GtkProgressBar). Future versions of GTK+ may add additional progress widgets.
GTK+
gtk/gtkprogressbar.h
GtkProgressBar is a flexible progress bar widget. It can display text over the progress bar, and has an "activity" mode to indicate "activity, but unknown total task size." In "activity" mode a small block moves back and forth. GtkProgressBar is probably excessively configurable; you should try to use its default look-and-feel, for consistency with other applications.
Zvt
zvt/zvtterm.h
ZvtTerm comes with gnome-libs but is not in libgnomeui. It's in a separate libzvt. ZvtTerm is simply a terminal emulator; you can spawn a child process to run inside the widget and interact with the user. ZvtTerm provides all the functionality of the gnome-terminal program that comes with the Gnome desktop environment.