## 4.30 Ruler

A ruler is controled by the following parameters:

- `tick unit`, the number of pixels between tick marks (default is 5).

- `tick scale`, length represented by 10 tick units (default is 10).

- `tick length`, the length of the longest tick marker (default is 16).

- `offset`, initial ruler offset (default is 0).

- `position`, location of the ruler. Default value is `EZ_TOP` for horizontal rulers and `EZ_LEFT` for vertical rulers.

- `display value`, a flag indicates whether or not to display numerical tick marks.

### Widget Info

Symbolic widget type | EZ_WIDGET_HORIZONTAL_RULER
Default class name | "HorizontalRuler"
Default instance name | "horizontalRuler"

Symbolic widget type | EZ_WIDGET_VERTICAL_RULER
Default class name | "VerticalRuler"
Default instance name | "verticalRuler"

### Widget Interface Routines

`void EZ_WidgetNotifyRuler(EZ_Widget *ruler, int x, int y,`

`EZ_Widget *sourceWidget );`

Notify ruler the position of the mouse pointer, relative to the window of `srcWidget`.

`void EZ_XWindowNotifyRuler(EZ_Widget *ruler, int x, int y,`

`Window window);`

Notify ruler the position of the mouse pointer, relative to `window`.

`void EZ_WidgetMarkRuler(EZ_Widget *ruler, int x, int y,`

`EZ_Widget *sourceWidget );`

Set one of the two marks on the ruler.

`void EZ_XWindowMarkRuler(EZ_Widget *ruler, int x, int y,`

`Window window);`

Set one of the two marks on the ruler.

`void EZ_SetRulerOffset(EZ_Widget *ruler, int offset);`

Sets ruler offset in pixels. The origin of the ruler window will be treated as -`offset` pixels from the imaginary ruler origin.

`void void EZ_SetupRuler(EZ_Widget *ruler, int tickUnit, int tickLength,`

`int numScale, int offset)`

Sets all control parameters. `tickUnit` is distance between tick marks; `tickLength` is the length of the longest tick marks; `numScale` represents the value corresponds to 10 tick units and `offset` is the ruler offset.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"HorizontalRuler"`
|  | or `"VerticalRuler"` EZ_NAME | name | `"horizontalRuler"`
|  | or `"verticalRuler"`

EZ_X | x |
EZ_Y | y |
EZ_WIDTH | width |
EZ_HEIGHT | height |

EZ_LOCATION | location |
EZ_SIZE | size |
EZ_GEOMETRY | geometry |

EZ_WIDTH_HINT | widthHint |
EZ_HEIGHT_HINT | heightHint |
EZ_SIZE_HINT | sizeHint |

EZ_BORDER_WIDTH | borderWidth | `0` or `2`
EZ_BORDER_TYPE | borderType | `none` or `sunken`

EZ_EXPAND | expand | `false`
EZ_PROPAGATE | propagate | `true`
EZ_TRANSIENT | transient | `false`

EZ_FONT_ID | fontID | `5`
EZ_FONT_NAME | fontName | `"5x7"`

EZ_CURSOR | cursor | `"XC_left_ptr"`
EZ_BUBBLE_STRING | bubbleString | `null`

EZ_FOREGROUND | foreground | `"black"`
EZ_BACKGROUND | background | `"gray74`
EZ_BG_IMAGE_FILE | bgImageFile | `null`
EZ_BG_PIXMAP | N/A | `none`

EZ_CLIENT_PTR_DATA | N/A | `null`
EZ_CLIENT_INT_DATA | clientIntData | `0`

EZ_RULER_DISPLAY_VALUE | rulerDisplayValue | `True`
EZ_RULER_TICK_UNIT | rulerTickUnit | `5`
EZ_RULER_TICK_LENGTH | rulerTickLength | `16`
EZ_RULER_TICK_SCALE | rulerTickScale | `10`
EZ_RULER_TICK_OFFSET | rulerTickOffset | `0`
EZ_RULER_POSITION | rulerposition | `top`
|  | or `"left"`

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