Legend:
Library
Module
Module type
Parameter
Class
Class type
The base widget class. It contains methods to be called by children widgets, event if the base class does not handle child widgets.
Setting and getting property values should be done by using get_... and set_... methods. When a property has no set_... method, it should not be modified from out of the class (but can be set by inheriting classes).
Inner geometry, relative to top-left corner of the widget. This is the rectangle used by widget after removing border widths and paddings from its allocated geometry.
method to_desktop_coords : x:int ->y:int -> int * int
w#desktop_coords ~x ~y converts the given coordinates relative to widget top-left corner to desktop coordinates.
method to_top_window_coords : x:int ->y:int -> int * int
w#to_top_window_coords ~x ~y converts the given coordinates relative to widget top-left corner to coordinates relative to top widget's top window.
Freezing and resizing
A frozen widget will not ask for rendering (but can render). This is useful when a lot of computations are performed and each may require rendering. Freezing a widget will block rendering request from children widgets, until all is ready. They unfreezing the widget will ask for its rendering.
method freeze : unit
method unfreeze : unit
A widget may require a resizing, i.e. ask its parent to compute its allocated geometry, typically because its size constraints changed. A widget can ignore its own requests for resizing or the ones from its children, for example when doing some updates that will need many resizings it is more performant to do one resizing when everything is computed. The Flex.flex widget uses this.
method ignore_need_resize : unit
Ignore requests for resizing.
method handle_need_resize : unit
Do not ignore requests for resizing.
Properties
method selected : bool
method set_selected : bool -> unit
A Props.selected widget will render differently, using different background and foreground colors.
w#grab_focus() make widget v tries to grab focus. The widget must be visible and sensitive, with Props.can_focus and Props.focusable set to true. The last optional argument is used internally by some widgets containing various children. Returns true if the focus could be grabbed, else false.
method focus_next : bool
Give focus to next focusable widget.
method focus_prev : bool
Give focus to previous focusable widget.
Misc
method set_handle_hovering : bool -> unit
w#set_handle_hovering b sets handling hovering to b. Handling hovering means that mouse cursor motions are tracked to trigger Mouse_enter and Mouse_leave events. Default is to ignore hovering to avoid computations. It is used for some wigets, like menu item or buttons for which such a visual feedback is important. Mouse cursor hovering affect the background, foreground and border colors of a widget.