EZwgl (5.20 Overriding the Default Attributes)

## 5.20 Overriding the Default Attributes

There are a few global attributes for the EZ widget library. They affect the appearance and the behavior of EZ widgets. Some of these attributes can be modified at the initialization time.

Note: all the global attributes can be altered via resources. Procedures listed in this section take procedence over resources.

It is recommended you use resource files to override these default attributes instead of hardcoding them by calling routines described in this section.

### 5.20.1 Setting the Default Background

The EZ Widget library provides a function to set the default background color for all widgets in an application.

`int EZ_SetGlobalBackground(char *colorName);`

The resource that sets the default background color

`application.background: color`

This function alters the five color entires allocated for widget background and borders. The RGB intensities for `colorName` should be in the middle range of the interval [0,255].

This function has no effect if the `-bg` command line option is properly set. Neither does it have effects on widgets whose background or their ancestors' background are hard coded.

### 5.20.2 Setting the Default Fonts

EZwgl uses three default fonts to display text.

      "-Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*",
      "-*-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*"
      "-Adobe-Times-Bold-I-Normal--*-120-*-*-*-*-*-*",

The first one (bold) is used for displaying textual labels; the second one (fixed width) is used for displaying text in text widgets and input fields and the last one (bold italic) font is used for displaying menu titles. One can override these default fonts by the following set of functions. All these functions overrides the corresponding resources set by the application default file.

`void EZ_SetDefaultLabelFont(char *fontName);`

`void EZ_SetDefaultEntryTextFont(char *fontName);`

`void EZ_SetDefaultMenuTitleFont(char *fontName);`

The resources that set these default fonts are:

    application.labelFont:     font_name
    application.textFont:      font_name
    application.menuTitleFont: font_name

### 5.20.3 Disable Button Highlighting/Offseting

By default, a button type widget lights up when the pointer is over it; and its label shifts a little bit to the right when it is pressed. You can control these behavior via the following two pair of functions.

`void EZ_DisableHighlight(void);`

`void EZ_EnableHighlight(void);`

`void EZ_DisableLabelOffset(void);`

`void EZ_EnableLabelOffset(void);`

The relevent resources are

    application.highlight:     boolean
    application.labelOffset:   boolean

### 5.20.4 Disable Slider Depression

The default behavior of a slider/scrollbar is that when the slider button is pressed, it depresses, gives you the illusion of being pressed, just like a button. You can control the behavior by the following two functions.

`void EZ_DisableSliderDepression(void);`

`void EZ_EnableSliderDepression(void);`

The corresponding resource is

    application.sliderDepression:     boolean

### 5.20.5 Set Keyboard Focus Highlight Color

The keyboard focus highlight color is controled by

`void EZ_SetKbdHighlightColor(char *color_name);`

The equivalent resource is:

    application.focusHighlightColor:     color_name

### 5.20.6 Miscellaneous

The next three functions may be used to slide open/close a toplevel widget. The toplevel widget should have the `EZ_TRANSIENT` or `EZ_OVERRIDE_REDIRECT` resource set in order for them to work properly. Parameters are `x,y` the initial origin of the widget window, relative to the origin of the root window; `direction` the direction to slide open/close the widget window, values are one of `EZ_NORTH`, `EZ_NORTHEAST`, `EZ_EAST`, `EZ_SOUTHEAST`, `EZ_SOUTH`, `EZ_SOUTHWEST`, `EZ_WEST`, `EZ_NORTHWEST` or `-1`; `speed` is the number of pixels to slide over one step.

    void EZ_SlideOpenWidget(EZ_Widget *w, int x, int y,
                            int direction, int speed);

    void EZ_SlideOpenWidgetRelativeTo(EZ_Widget *widget, EZ_Widget *rel,
                                      int direction, int speed);

    void EZ_SlideCloseWidget(EZ_Widget *widget, int direction, int speed);

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`