Module Bogue.Popup

module Popup: sig .. end

Put layouts on top of others.

Warning: For all functions in this module, the destination layout must be a house, not a single resident.

Dependency graph

val add_screen : ?color:Draw.color -> Layout.t -> Layout.t

Add a screen on top of the layout. This can be useful to make the whole layout clickable as a whole.

val attach : ?bg:Draw.color ->
?show:bool -> Layout.t -> Layout.t -> Layout.t

Generic modal type popup

attach house layout adds two layers on top of the house: one for the screen to hide the house, one for the layout on top of the screen.

val info : ?w:int ->
?h:int ->
?button_w:int ->
?button_h:int -> ?button:string -> string -> Layout.t -> unit

Add to the layout a modal popup with a text and a close button. By default, button="Close". Use the optional parameters w,h to impose the size of the button.

val yesno : ?w:int ->
?h:int ->
?button_w:int ->
?button_h:int ->
?yes:string ->
?no:string ->
yes_action:(unit -> unit) ->
no_action:(unit -> unit) -> string -> Layout.t -> unit

Add to the layout a modal popup with two yes/no buttons. By default, yes="Yes" and no="No". Use the optional parameters w,h to impose the common size of the two buttons.

val one_button : ?w:int ->
?h:int ->
?on_close:(unit -> unit) ->
button:string -> dst:Layout.t -> Layout.t -> unit

Here the optional parameters w and h set the width and height of the button.

val two_buttons : ?w:int ->
?h:int ->
label1:string ->
label2:string ->
action1:(unit -> unit) ->
action2:(unit -> unit) -> content:Layout.t -> Layout.t -> unit
type position = 
| LeftOf
| RightOf
| Above
| Below
| Mouse
val tooltip : ?background:Layout.background ->
?position:position ->
string -> target:Layout.t -> Widget.t -> Layout.t -> unit

tooltip text ~target widget layout adds a tooltip which will appear on layout, next to target (which should be a sublayout of layout), when the widget gets mouse focus and mouse is idle for some time on it. A tooltip it not a modal popup, it does not prevent from interacting with the rest of the layout.