"Fossies" - the Fresh Open Source Software archive 
The appearance of a display item is controlled by a set of
attributes. For example, the text attribute controls the text
string displayed on the item and the font attribute specifies
what font should be used.
Usually, each of the attributes falls into one of two categroies:
``individual'' or ``collective''. For example, each of
the items inside a TixTList widget may display a different text
string; therefore we call the text string an individual
attribute. However, in most cases, the items share the same color,
font and spacing and we call these collective attributes.
One question concerns where we keep the collective attribute for the
display items. Certainly, we can keep a font attribute for each
item, but this is not really an efficient solution. In fact, if all the
items have the same font, we would be keeping a duplicated copy of the
same font for each of the items we create. Since a host widget may have
many thousands of items, keeping thousands of dupilcated copys of the
same font, or any other collective attributes, would be very wasteful.
To avoid the unnecessary duplication of resources, Tix stores the
collective attributes in special objects called display styles. The
relationship between display items and their styles is depicted in figure
3-4. Each item holds its own copy of the individual
attributes, such as text. However, the collective attributes are
stored in the style objects. Each item has a special style
attribute that tells it which style it should use. In figure 3-4
, since items a and b are assigned the same
style, therefore, they share the same font and color. Item c is
assigned a different style, thus, it uses a different font than a
and b.
Next: Creating Display Items
Up: Display Items
Previous: Advantages of Display
Display Items and Display Styles