Applet.PopupResizeHandler: Cinnamon Javascript Reference Manual

## Applet.PopupResizeHandler Applet.PopupResizeHandler — Class that allows an applet to be resized using the mouse. |

## Functions

| constructor ()

## Properties

Boolean | inhibit_resizing |
Boolean | resizingInProgress |

## Object Hierarchy

        Object
        ╰── Applet.PopupResizeHandler

## Description

Example usage:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    this.menu = new Applet.AppletPopupMenu(this, this.orientation);
    this.settings.bind("popup-width", "popup_width");
    this.settings.bind("popup-height", "popup_height");

    this._resizer = new Applet.PopupResizeHandler(
            this.menu.actor,
            () => this.orientation,
            (w,h) => this._onBoxResized(w,h),
            () => this.popup_width * global.ui_scale,
            () => this.popup_height * global.ui_scale);

    ...

    _onBoxResized(width, height) {
        this.menu.actor.set_width(width);
        this.menu.actor.set_height(height);
        if (!this._resizer.resizingInProgress) {
            this.settings.popup_width = width / global.ui_scale;
            this.settings.popup_height = height / global.ui_scale;
        }
    }

## Functions

### constructor ()

    constructor (ClutterActor   actor,
                 Function       get_orientation,
                 Function       resized_callback,
                 Function       get_user_width,
                 Function       get_user_height);

#### Parameters

actor | The actor to be resized |
get_orientation | Function that returns the current orientation of the applet. (St.Side) |
resized_callback | Function that is called while resizing is in progress with the new width and height as parameters. This function should actually change the applet size. This is also called once when resizing has ended (resizingInProgress == false) so that the applet can store the final size instead of doing so continuously whilst resizing is in progress. |
get_user_width | Function that returns the current applet width. This function is not called while resizing is in progress so it only has to return the correct width when resizing is not in progress. Note: This value does not necessarily have to be the applet width. It could be the width of a container inside the applet used for sizing the applet. |
get_user_height | As get_user_width but for height |

## Property Details

### The `“inhibit_resizing”` property

      “inhibit_resizing”         Boolean

Set to true to prevent resizing from starting.

### The `“resizingInProgress”` property

      “resizingInProgress”       Boolean

True when resizing is in progress