package bogue

  1. Overview
  2. Docs

Various types of menus

Dependency graph

type t
type simple_entry = {
  1. text : string;
  2. action : unit -> unit;
}
type mutable_text = {
  1. mutable text : string;
  2. action : string -> unit;
    (*

    The text can be modified by the action

    *)
}
type check_entry = {
  1. mutable state : bool;
    (*

    A check box before the label, and the text is modifiable

    *)
  2. mutable text : string;
  3. action : string -> bool -> unit;
}
type layout_entry = {
  1. layout : Layout.t;
  2. selected : bool Var.t;
  3. action : Layout.t -> unit;
  4. submenu : t option;
}
type label =
  1. | Label of simple_entry
  2. | Dynamic of mutable_text
  3. | Check of check_entry
  4. | Layout of layout_entry
type entry = {
  1. label : label;
  2. submenu : entry list option;
}
val create_menu : ?depth:int -> layout_entry array -> bool -> t

The depth indicates the level of submenu. By default depth=0. The bool parameter indicate whether the menu should be initially shown.

val create : ?hide:bool -> ?name:string -> ?background:Layout.background -> ?select_bg:Layout.background -> dst:Layout.t -> t -> Layout.t

By default, hide=false. The dst layout will contain the submenus.

  • returns

    the layout of the main menu. This is generic menu construction function, it does not compute the positions of the entries. See example41.

val bar : ?background:Layout.background -> ?name:string -> Layout.t -> entry list -> Layout.t

A menu bar, with drop-down submenus. bar dst entries creates a layout which contains the menu bar on top of the dst layout. The dst layout should be big enough to contain the submenus. Any item flowing out of dst will not get focus. The system will automatically try to shift the submenus if they are too wide, or add a scrollbar if they are too tall.

OCaml

Innovation. Community. Security.