package bogue

  1. Overview
  2. Docs

Various types of menus

The generic create function produces menus whose entries can be arbitrary layouts located at arbitrary places. But for usual entries, it is enough to provide a string for the entry label, and the layout will be constructed automatically.

The specialized bar function will produce a familiar menu bar with drop-down submenus.

Dependency graph
type t
type action = unit -> unit
type label =
  1. | Text of string
  2. | Layout of Layout.t
type entry = {
  1. label : label;
  2. content : content;
}
and content =
  1. | Action of action
  2. | Flat of entry list
    (*

    A Flat content will produce a horizontal menu

    *)
  3. | Tower of entry list
    (*

    A Tower content will produce a vertical menu

    *)
  4. | Custom of entry list
    (*

    In a Custom content, only Layout labels should be used, and their position should be defined before creating the menu.

    *)
  5. | Separator
    (*

    Currently only used for inserting separator lines in Tower menus.

    *)
val create : ?dst:Layout.t -> content -> t

Generic menu creation, inserted in the dst layout.

val add_bar : dst:Layout.t -> entry list -> unit

Creation of a menu bar in the dst layout, with drop-down submenus. bar dst entries inserts a layout which contains the menu bar into the top of the dst layout (so, some room should be provided). The dst layout should be big enough to contain the submenus. Any item flowing out of dst will not get focus.

val bar : entry list -> Layout.t

Return a menu layout that will be installed with add_bar into the top house at startup.

val separator : entry
OCaml

Innovation. Community. Security.