PopupMenu.PopupMenu

PopupMenu.PopupMenu — An actual popup menu

Functions

Properties

St.Bin actor  
boolean animating  
number slidePosition  

Object Hierarchy

    Object
    ╰── PopupMenu.PopupMenu
  

Functions

_init ()


_init (St.Widget   sourceActor,
       St.Side     orientation);

Parameters

sourceActor

the actor that owns the popup menu

 

orientation

the side of the menu that will be attached to sourceActor. See setOrientation() for details

 

setArrowSide ()


setArrowSide (St.Side   side);

Sets the orientation of the sourceActor with respect to the menu. This function is deprecated and kept for compatibility with older code. Please use setOrientation instead.

Parameters

side

The new side of the menu

 

setOrientation ()


setOrientation (St.Side   orientation);

Sets the orientation of the sourceActor with respect to the menu. For example, if you use St.Side.TOP, the menu will try to place itself below the sourcActor unless there is not enough room for it.

Parameters

orientation

The new orientation of the menu

 

setCustomStyleClass ()


setCustomStyleClass (string   className);

Adds a custom class name to the menu which allows it to be styled separately from other menus.

Parameters

className

the custom class name to add

 

setSourceAlignment ()


setSourceAlignment (real   alignment);

Since the boxpointer was removed from the menu, this function now does nothing. Please do not use this function in new code.

Parameters

alignment

the position of the arrow relative to the source actor.

 

open ()


open (boolean   animate);

Opens the popup menu

Parameters

animate

whether to animate the open effect or not

 

close ()


close (boolean   animate);

Closes the popup menu.

Parameters

animate

whether to animate the close effect or not

 

shiftToPosition ()


shiftToPosition (number   slidePosition);

This function specifies a new position at which to center the menu. The position is given in coordinates relative to the sourceActor, and as such should always be positive. This is useful if, for example, you want the menu to open at the location of a mouse click rather than at the center of the actor. This function only moves the menu along one axis as determined by the orientation of the menu, so that the menu is always attached to the sourceActor. For example, if the orientation is set to St.Side.TOP, this function will move the center along the x axis. If you have set the slidePosition using this function and then wish to return to centering the menu on the center of the sourceActor, you can do so by setting it to -1.

Parameters

slidePosition

Position relative to the sourceActor of the menu upon which the menu will be centered (if possible). If -1, the menu will be centered on the sourceActor.

 

setMaxHeight ()


setMaxHeight ();

This function is called internally to set the max-height and max-width properties of the popup menu such that it does not grow to a size larger than the monitor. Individual popup menus can override this method to change the max height/width if they really want to.

Note that setting the max-height won't do any good if the minimum height of the menu is higher then the screen; it's useful if part of the menu is scrollable so the minimum height is smaller than the natural height.

Property Details

The “actor” property

  “actor”                    St.Bin

The actor of the popup menu.


The “animating” property

  “animating”                boolean

Whether the popup menu is currently performing the open/close animation.


The “slidePosition” property

  “slidePosition”            number

Position relative to the sourceActor of the menu upon which the menu will be centered (if possible). If -1, the menu will be centered on the sourceActor. See shiftToPosition for more details.