PopupMenu.PopupMenuBase

PopupMenu.PopupMenuBase — The base class of all popup menus

Functions

_init ()
PopupMenu.PopupMenuItem addAction ()
PopupMenu.PopupMenuItem addSettingsAction ()
PopupMenu.PopupMenuItem addCommandlineAction ()
isChildMenu ()
addChildMenu ()
removeChildMenu ()
addMenuItem ()
getColumnWidths ()
setColumnWidths ()
removeAll ()
toggle ()
toggle_with_options ()
destroy ()

Properties

St.Widget sourceActor  
St.BoxLayout box  
boolean isOpen  
boolean blockSourceEvents  
boolean passEvents  
PopupMenu.PopupBaseMenuItem firstMenuItem  
int numMenuItems  

Signals

Object Hierarchy

    Object
    ╰── PopupMenu.PopupMenuBase
  

Description

This is a base popup menu class for more sophisticated popup menus to inherit. This cannot be instantiated.

Functions

_init ()


_init (St.Widget   sourceActor,
       string      styleClass);

Parameters

sourceActor

the actor that owns the popup menu

 

styleClass

(optional) the style class of the popup menu

 

addAction ()

PopupMenu.PopupMenuItem
addAction (string     title,
           function   callback);

Adds a PopupMenuItem with label title to the menu. When the item is clicked, callback will be called.

Parameters

title

the text to display on the item

 

callback

the function to call when clicked

 

Returns

the menu item created.


addSettingsAction ()

PopupMenu.PopupMenuItem
addSettingsAction (string   title,
                   string   module);

Adds a PopupMenuItem with label title to the menu. When the item is clicked, Cinnamon Settings will be launched with the module module activated.

Parameters

title

the text to display on the item

 

module

the module to launch

 

Returns

the menu item created.


addCommandlineAction ()

PopupMenu.PopupMenuItem
addCommandlineAction (string   title,
                      string   cmd);

Adds a PopupMenuItem with label title to the menu. When the item is clicked, the command cmd will be executed.

Parameters

title

the text to display on the item

 

cmd

the command to call

 

Returns

the menu item created.


isChildMenu ()


isChildMenu (PopupMenu.PopupMenuBase   menu);

Parameters

menu

the menu of interest

 

Returns

whether menu is a submenu of this menu.


addChildMenu ()


addChildMenu (PopupMenu.PopupMenuBase   menu);

Makes menu a submenu of this menu.

Parameters

menu

the menu of interest

 

removeChildMenu ()


removeChildMenu (PopupMenuBase   menu);

Removes menu from the current menu if it is a child.

Parameters

menu

the menu of interest

 

addMenuItem ()


addMenuItem (PopupMenu.PopupBaseMenuItem   menuItem,
             int                           position);

Adds the menuItem to the menu.

Parameters

menuItem

the item to include (can also be a PopupMenuSection)

 

position

(optional) position to add the item at (empty for end of menu)

 

getColumnWidths ()


getColumnWidths ();

Gets the width of each column this thing has. In popup menus, everything is put into columns, and the columns of all items align. This is used internally and shouldn't be fiddled with unless you are implementing other popup menu items.


setColumnWidths ()


setColumnWidths (array   widths);

Sets the widths of each column according to widths so that things can align.

Parameters

widths

the widths of each column

 

removeAll ()


removeAll ();

Clears everything inside the menu.


toggle ()


toggle ();

Toggles the open/close state of the menu.


toggle_with_options ()


toggle_with_options (boolean    animate,
                     function   onComplete);

Toggles the open/close state of the menu with extra parameters

Parameters

animate

whether or not to animate the open/close.

 

onComplete

the function to call when the toggle action completes.

 

destroy ()


destroy ();

Destroys the popup menu completely.

Property Details

The “sourceActor” property

  “sourceActor”              St.Widget

The actor that owns the popup menu


The “box” property

  “box”                      St.BoxLayout

The box containing the popup menu widgets.


The “isOpen” property

  “isOpen”                   boolean

Whether the popup menu is open.


The “blockSourceEvents” property

  “blockSourceEvents”        boolean

If set, we don't send events (including crossing events) to the source actor for the menu which causes its prelight state to freeze


The “passEvents” property

  “passEvents”               boolean

Can be set while a menu is up to let all events through without special menu handling useful for scrollbars in menus, and probably not otherwise.


The “firstMenuItem” property

  “firstMenuItem”            PopupMenu.PopupBaseMenuItem

The first item in the popup menu


The “numMenuItems” property

  “numMenuItems”             int

The number of items in the popup menu.

Signal details

The “child-menu-added” signal

user_function (PopupMenu.PopupMenuBase   menu);

Emitted when an menu is added as a submenu.

Parameters

menu

The menu added

 

The “child-menu-removed” signal

user_function (PopupMenu.PopupMenuBase   menu);

Emitted when an submenu is removed.

Parameters

menu

The menu removed

 

The “activate” signal

user_function (PopupBaseMenuItem   menuItem,
          boolean             keepMenu);

Emitted when an item of the menu is activated.

Parameters

menuItem

the item activated

 

keepMenu

whether the menu should remain opened

 

The “active-changed” signal

user_function (PopupBaseMenuItem   menuItem);

Emitted when the active item of menu is changed.

Parameters

menuItem

the current active item (possibly null)

 

The “destroy” signal

user_function ();

Emitted when the menu is destroyed.