package stk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Stk.MenuSource

Menus and menubars.

Sourcetype item_menu_state =
  1. | Folded
  2. | Unfolded

A menu item with a menu attached can be either Folded or Unfolded.

Sourceval item_menu_state_wrapper : item_menu_state Ocf.Wrapper.t
Sourceval item_menu_state : item_menu_state Props.prop

Property "item_menu_state" for menu state. Default is Folded.

Keyboard "shortcut" property for a menu.

Associating menuitem and callback_id to menu's children. Parameter is a widget since menu and menuitem classes are recursive, we cannot define this constructor after menuitem but before menu.

Sourceclass menuitem : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> unit -> object ... end

An entry in a menu. The child of the entry is displayed in the menu. A (sub)menu can be attached to the item. In this case, when the item is unfolded, its attached menu is displayed.

Sourceclass menu : ?classes:string list option -> ?name:string option -> ?orientation: Props.orientation option -> ?props:Props.t option -> ?wdata:Widget.wdata option -> unit -> object ... end

Menu widget.

Sourceclass menubar : ?classes:string list option -> ?name:string option -> ?orientation: Props.orientation option -> ?props:Props.t option -> ?wdata:Widget.wdata option -> unit -> object ... end

Menubar widget.

Sourcetype Widget.widget_type +=
  1. | Menuitem of menuitem
  2. | Menu of menu
  3. | Menubar of menubar
Sourceval menubar : ?classes:string list -> ?name:string -> ?orientation:Props.orientation -> ?props:Props.t -> ?wdata:Widget.wdata -> ?pack:(Widget.widget -> unit) -> unit -> menubar

Convenient function to create a menubar. Optional argument orientation defines vertical or horizontal orientation; default is Horizontal. See Widget arguments for other arguments.

Sourceval menuitem : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?shortcut:Key.keystate -> ?pack:(menuitem -> unit) -> unit -> menuitem

Convenient function to create a menuitem. Optional argument shortcut defines keyboard shortcut. See Widget arguments for other arguments.

Sourceval label_menuitem : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?text:string -> ?shortcut:Key.keystate -> ?pack:(menuitem -> unit) -> unit -> menuitem * Text.label

Convenient function to create a menuitem with a horizontal Box.box child. Two label widgets are added to the box. The first one is the label of the item (with initial text if provided). Optional argument shortcut defines keyboard shortcut and it is displayed in the second label (which has class "menuitem_shortcut"). See Widget arguments for other arguments. The function returns the menu item and the first label (the one for the menu item text).

Sourceval check_menuitem : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?shortcut:Key.keystate -> ?active:bool -> ?pack:(menuitem -> unit) -> ?group:< add : Widget.widget -> 'a ; set_active : Widget.widget -> unit.. > -> < as_widget : Widget.widget.. > -> menuitem
Sourceval label_check_menuitem : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?shortcut:Key.keystate -> ?active:bool -> ?text:string -> ?group:< add : Widget.widget -> 'a ; set_active : Widget.widget -> unit.. > -> ?pack:(menuitem -> unit) -> unit -> menuitem * Text.label
Sourceval radio_menuitem : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?shortcut:Key.keystate -> ?active:bool -> ?pack:(menuitem -> unit) -> < add : Widget.widget -> 'a ; set_active : Widget.widget -> unit.. > -> < as_widget : Widget.widget.. > -> menuitem
Sourceval label_radio_menuitem : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?shortcut:Key.keystate -> ?active:bool -> ?text:string -> ?pack:(menuitem -> unit) -> < add : Widget.widget -> 'a ; set_active : Widget.widget -> unit.. > -> menuitem * Text.label
Sourceval menu : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?pack:(menu -> unit) -> unit -> menu

Convenient function to create a menu. Optional argument orientation defines vertical or horizontal orientation; default is Vertical. See Widget arguments for other arguments.

Utilities for popup menus

Sourcetype menu_entry = [
  1. | `I of string * (unit -> unit)
  2. | `C of string * bool * (bool -> unit)
  3. | `R of (string * bool * (bool -> unit)) list
  4. | `M of string * menu_entry list
]

Menu entry description:

  • `I (text, cb) is a label item with text, and cb is called when item is activated.
  • `C (text, init, cb) is a checkbox item with text; init indicates whether the box is checked and cb is called with state when item is activated.
  • `R [(text1, init1, cb1) ; ...] is same as `C but describes a list of radiobuttons.
  • `M (text, entries) describes a submenu with text for the menu item and a list of entries.
Sourceval popup_menu_entries : menu_entry list -> unit

popup_menu_entries entries create a menu according to the entries description and pops it up. The menu is closed when an item is activated (or an event occurs closing menu windows). This function is typically used for contextual menus.

OCaml

Innovation. Community. Security.