Applet.Applet: Cinnamon Javascript Reference Manual

## Applet.Applet Applet.Applet — Base applet class |

## Functions

| _init ()
| set_applet_tooltip ()
| set_applet_enabled ()
| on_applet_clicked ()
| on_applet_middle_clicked ()
| on_applet_instances_changed ()
| on_applet_added_to_panel ()
| on_applet_removed_from_panel ()
| on_applet_reloaded ()
| setOrientationInternal ()
| setOrientation ()
| setAllowedLayout ()
Applet.AllowedLayout | getAllowedLayout ()
| on_orientation_changed ()
| on_panel_height_changed_internal ()
| on_panel_height_changed ()
| on_panel_icon_size_changed ()
| highlight ()

## Properties

St.BoxLayout | actor |
int | instance_id |
string | _uuid |
St.BoxLayout | _panelLocation |
Panel.Panel | panel |
JSON | _meta |
int | _order |
Dnd._Draggable | _draggable |
Tooltips.PanelItemTooltip | _applet_tooltip |
PopupMenu.PopupMenuManager | _menuManager |
Applet.AppletContextMenu | _applet_context_menu |
string | _applet_tooltip_text |
Applet.AllowedLayout | _allowedLayout |

## Object Hierarchy

        Object
        ╰── Applet.Applet

## Description

Base applet class that other applets can inherit

## Functions

### _init ()

    _init (St.Side   orientation,
           int       panelHeight,
           int       instance_id);

#### Parameters

orientation | orientation of the applet; Orientation of panel containing the actor |
panelHeight | height of the panel containing the applet |
instance_id | instance id of the applet |

### set_applet_tooltip ()

    set_applet_tooltip (string    text,
                        boolean   use_markup);

Sets the tooltip of the applet

#### Parameters

text | the tooltip text to be set |
use_markup | parse the text as markup if true |

### set_applet_enabled ()

    set_applet_enabled (boolean   enabled);

Sets whether the applet is enabled or not. A disabled applet sets its padding to 0px and doesn't react to clicks

#### Parameters

enabled | whether this applet is enabled or not |

### on_applet_clicked ()

    on_applet_clicked (Clutter.Event   event);

This function is called when the applet is clicked.

This is meant to be overridden in individual applets.

#### Parameters

event | the event object |

### on_applet_middle_clicked ()

    on_applet_middle_clicked (Clutter.Event   event);

This function is called when the applet is clicked with the middle mouse button.

This is meant to be overridden in individual applets.

#### Parameters

event | the event object |

### on_applet_instances_changed ()

    on_applet_instances_changed ();

`instance` (Applet) the instance that was changed

This function is called when an applet of the same uuid is added or removed from the panels. It is intended to assist in delegation of responsibilities between duplicate applet instances.

Applets should not create any references to `instance`, since that could impede garbage collection.

This is meant to be overridden in individual applets

### on_applet_added_to_panel ()

    on_applet_added_to_panel ();

This function is called by appletManager when the applet is added to the panel.

This is meant to be overridden in individual applets.

### on_applet_removed_from_panel ()

    on_applet_removed_from_panel ();

This function is called by appletManager when the applet is removed from the panel.

This is meant to be overridden in individual applets.

### on_applet_reloaded ()

    on_applet_reloaded ();

This function is called by appletManager when the applet is reloaded.

This is meant to be overridden in individual applets.

### setOrientationInternal ()

    setOrientationInternal (St.Side   orientation);

Sets the orientation of the St.BoxLayout.

#### Parameters

orientation | the orientation |

### setOrientation ()

    setOrientation (St.Side   orientation);

Sets the orientation of the applet.

This function should only be called by appletManager

#### Parameters

orientation | the orientation |

### setAllowedLayout ()

    setAllowedLayout (AllowedLayout   layout);

Sets the layout allowed by the applet. Possible values are AllowedLayout.HORIZONTAL, AllowedLayout.VERTICAL, and AllowedLayout.BOTH.

#### Parameters

layout | the allowed layout |

### getAllowedLayout ()

    Applet.AllowedLayout
    getAllowedLayout ();

Retrieves the type of layout an applet is allowed to have.

#### Returns

The allowed layout of the applet

### on_orientation_changed ()

    on_orientation_changed (St.Side   orientation);

This function is called when the applet is changes orientation.

This is meant to be overridden in individual applets.

#### Parameters

orientation | new orientation of the applet |

### on_panel_height_changed_internal ()

    on_panel_height_changed_internal ();

This function is called when the panel containing the applet changes height

### on_panel_height_changed ()

    on_panel_height_changed ();

This function is called when the panel containing the applet changes height

This is meant to be overridden in individual applets.

### on_panel_icon_size_changed ()

    on_panel_icon_size_changed (number   size);

This function is called when the icon size preference for the panel zone containing this applet is changed.

This is meant to be overridden in individual applets.

#### Parameters

size | new icon size |

### highlight ()

    highlight (boolean   highlight);

Turns on/off the highlight of the applet

#### Parameters

highlight | whether to turn on or off |

## Property Details

### The `“actor”` property

      “actor”                    St.BoxLayout

Actor of the applet

### The `“instance_id”` property

      “instance_id”              int

Instance id of the applet

### The `“_uuid”` property

      “_uuid”                    string

UUID of the applet. This is set by appletManager after the applet is loaded.

### The `“_panelLocation”` property

      “_panelLocation”           St.BoxLayout

Panel sector containing the applet. This is set by appletManager after the applet is loaded.

### The `“panel”` property

      “panel”                    Panel.Panel

The panel object containing the applet. This is set by appletManager after the applet is loaded.

### The `“_meta”` property

      “_meta”                    JSON

The metadata of the applet. This is set by appletManager after the applet is loaded.

### The `“_order”` property

      “_order”                   int

The order of the applet within a panel location This is set by appletManager after the applet is loaded.

### The `“_draggable”` property

      “_draggable”               Dnd._Draggable

The draggable object of the applet

### The `“_applet_tooltip”` property

      “_applet_tooltip”          Tooltips.PanelItemTooltip

The tooltip of the applet

### The `“_menuManager”` property

      “_menuManager”             PopupMenu.PopupMenuManager

The menu manager of the applet

### The `“_applet_context_menu”` property

      “_applet_context_menu”     Applet.AppletContextMenu

The context menu of the applet

### The `“_applet_tooltip_text”` property

      “_applet_tooltip_text”     string

Text of the tooltip

### The `“_allowedLayout”` property

      “_allowedLayout”           Applet.AllowedLayout

The allowed layout of the applet. This determines the type of panel an applet is allowed in. By default this is set to Applet.AllowedLayout.HORIZONTAL