Class Ledgrid.led_light


class led_light : ?default:bool -> ?x:int -> ?y:int -> off_pixmap:#GDraw.pixmap -> on_pixmap:#GDraw.pixmap -> packing:(GObj.widget -> unit) -> unit -> object .. end
A LED light is a widget mimicking a single physical LED light, whose state at any given moment can be on or off: its state is represented as a boolean value, and by convention 'true' means 'on'. A LED light keeps its default state until its state is explitly changed by the user. The user can simply set the object's state, or can set its state *also changing the default*. As soon as the current state changes the widget's appearance on screen is updated. A LED light can be also 'flashed', i.e. set to its non-default value for a short time, after which it automatically reverts to its default state, or 'blinked', i.e. ordered to repeatedly toggle its state very fast for a short time, before automatically reverting to its default state. Flashing and blinking are *asynchronous* operations: when the user requests them they are scheduled to be executed in background, and the user is immediately given back control. This allows to use concurrency in an extremely simple way, without even exposing a thread interface. LED lights can be used in isolation, but they are mainly intended to be arranged within a grid, allowing for more complex behaviour. Note that already initialized Gtk+ pixmap objects of type GDraw.pixmap (and *not* widgets) must be explicitly supplied at construction time. Pixmaps can and should be shared among differnet LED lights.

val notebook : GPack.notebook
A notebook with hidden tabs and border is the main widget: it contains two pages with the 'on' and 'off' pixmaps, and can easily change state by 'going' to a different page:
val default : bool Pervasives.ref
Default state and current state; see above:
val state : bool Pervasives.ref
method get_default : bool
Return the current default state:
method set_default : bool -> unit
Update the default state *and also the current state*; this changes the widget's appearance if the new value is different from the current state:
method get : bool
Return the current state:
method set : bool -> unit
Update the current state, possibly changing the widget's appearance:
method reset : unit
Set the widget current state to be equal to its default. This may change the widget's appearance:
method toggle : unit
Set the widget current state to be on if it's currently off, or vice-versa. This always changes the widget's appearance:
method get_position : int * int
Return the widget position as it was set at creation time, or (-1, -1) if it was not set:
method get_widget : GPack.notebook
Return the main Gtk+ widget making up the LED light:
method flash : unit
Order the LED light to flash (see above) for the established time, and return immediately:
method private blink_this_number_of_times : int -> unit
Schedule the LED light to blink 'times' times, then to reset itself. This is internally used to implement blinking:
method blink : unit
Order the LED light to blink (see above) for the established time, and return immediately: