Overview

XXX: There are also two more layouts if there is no ../GtkCellView. Someone needs to investigate when they are hit. The difference then is that the in the appears-as-list = 0 case the button only contains the arrow. In the other case, the frame with the cellview is missing. (So both modes should look the same, except for the different popups.)

../GtkComboBox allows the user to select different items from a list. This is an anoying widget, as it has two different layouts which can be controlled by a style property. The ../GtkComboBox does not do any drawing itself, but it contains a ../GtkButton and may contain a ../GtkFrame. The data is displayed inside a ../GtkCellView. (It gets even better with ../GtkComboBoxEntry ;-))

screenshot.png

Style Properties

Name

Type

Default

Nick

Description

appears-as-list

boolean

FALSE

Appears as list

Whether combobox dropdowns should look like lists rather than menus

Geometry

appears-as-list = 0

In this case the combobox consists of a button. In this button there is the ../GtkCellView with the data, then a ../GtkVSeperator and a ../GtkButton packed. Please refere to the documentation of these widgets for more information. (I would just have to repeat everything here, which doesn't make much sense, right?)

The popup is a ../GtkMenu, you can refere to its documentation for more information.

appears-as-list = 1

This case is a little different. The ../GtkButton contains only a ../GtkArrow. Next to it is a ../GtkFrame with the ../GtkCellView and the content. The shadow of this frame is either IN or NONE depending on the "has-frame" property of the ../GtkComboBox (I have no idea why applications might want to modify this ...).

The popup contains a ../GtkTreeView in this case.

Drawing

The arrow is drawn with a shadow of NONE. For everything else please refere to the documentation of the different widgets.

Popup Widget

As of GTK+ 2.10.something it is possible to theme the popup widget of the combobox. This is done by setting a name on the poped up menu. (bug gnomebug:414975)

The widget paths are:

combobox menu

GtkWindow.gtk-combobox-popup-menu

combobox list (appears as list)

gtk-combobox-popup-window.GtkFrame.GtkScrolledWindow.GtkTreeView
It seems like the frame is going to be removed from this (gnomebug:435471)

Bugs

Currently the combobox always renders text with the text color instead of foreground. This is cause by bug gnomebug:382646. The same applies to the menu it pops up.

The workaround is to keep the text color in sync with the fg color for the combobox and menu. The best thing is probably to match on the button instead of combobox here, as that way you shouldn't get problems with the combobox entry or comboboxes in appears-as-list mode.

Please have a look at the Clearlooks gtkrc for ways to work around this bug.

GTK+ API Documentation

http://library.gnome.org/devel/gtk/stable/GtkComboBox.html

Attic/GnomeArt/Tutorials/GtkThemes/GtkComboBox (last edited 2013-11-27 14:33:54 by WilliamJonMcCann)