# Module: `drawable`

Low-level API to allow Cairo to draw on clients and wiboxes.

### Info:

- Copyright: 2012 Uli Schlachter
- Originally authored by: Uli Schlachter <psychon@znc.in>
  (Full contributors list available on our github project)

## Static module functions

drawable.instances () -> () | Get the number of instances. |
drawable.disconnect_signal (name, func) | Disconnect from a signal. |
drawable.emit_signal (name, ...) | Emit a signal. |
drawable.connect_signal (name, func) | Connect to a signal. |

## Object properties

image | image | Drawable object. |

## Object methods

:refresh () | Refresh a drawable's content. |
:geometry () -> table | Get drawable geometry. |

## Signals

button::press |  |
button::release |  |
mouse::enter |  |
mouse::leave |  |
mouse::move |  |
property::geometry |  |
property::height |  |
property::width |  |
property::x |  |
property::y |  |
property::surface |  |

## Static module functions

🔗 drawable.instances () -> ()
  Get the number of instances.

  ### Returns:

  The number of drawable objects alive.
🔗 drawable.disconnect_signal (name, func)
  Disconnect from a signal.

  ### Parameters:

  Name |  | Type(s) | Description
  --- | --- | --- | ---
  name |  | string | The name of the signal.
  func |  | function | The callback that should be disconnected.

🔗 drawable.emit_signal (name, ...)
  Emit a signal.

  ### Parameters:

  Name |  | Type(s) | Description
  --- | --- | --- | ---
  name |  | string | The name of the signal.
  ... |  |  | Extra arguments for the callback functions. Each connected function receives the object as first argument and then any extra arguments that are given to emit_signal().

🔗 drawable.connect_signal (name, func)
  Connect to a signal.

  ### Parameters:

  Name |  | Type(s) | Description
  --- | --- | --- | ---
  name |  | string | The name of the signal.
  func |  | function | The callback to call when the signal is emitted.

## Object properties

🔗 image image
  Drawable object.

  ### Constraints:

  Default value | : Autogenerated.
  Type description:
  string | : Interpreted as a path to an image file.
  string | : A valid SVG content.
  cairo | : A cairo image surface: Directly used as-is.
  librsvg | : A librsvg handle object: Directly used as-is.
  nil | : Unset the image.

## Object methods

🔗 :refresh ()
  Refresh a drawable's content. This has to be called whenever some drawing to the drawable's surface has been done and should become visible.
🔗 :geometry () -> table
  Get drawable geometry. The geometry consists of x, y, width and height.

  ### Returns:

  table A table with drawable coordinates and geometry.

## Signals

🔗 button::press
🔗 button::release
🔗 mouse::enter
🔗 mouse::leave
🔗 mouse::move
🔗 property::geometry
🔗 property::height
🔗 property::width
🔗 property::x
🔗 property::y
🔗 property::surface

generated by LDoc 1.5.0