## Panel.Panel Panel.Panel — A panel object on the monitor |

## Functions

| updatePosition ()
| addContextMenuToPanel ()
| addPanelStyleClass ()
| destroy ()
| highlight ()
| isHideable ()
| _getProperty ()
| _getJSONProperty ()
| _updatePanelBarriers ()
| _getScaledPanelHeight ()
| _setClipRegion ()
| _moveResizePanel ()
array | _calcBoxSizes ()
| _panelHasOpenMenus ()
| _updatePanelVisibility ()
| _queueShowHidePanel ()
| disable ()
| enable ()
| _showPanel ()
| _hidePanel ()

## Properties

int | panelId |
int | monitorIndex |
int | toppanelHeight |
int | bottompanelHeight |
array | drawcorner |
Meta.Rectangle | monitor |
integer | panelPosition |
Cinnamon.GenericContainer | actor |
St.BoxLayout | _leftBox |
St.BoxLayout | _centerBox |
St.BoxLayout | _rightBox |
boolean | _hidden |
boolean | _disabled |
boolean | _panelEditMode |
Panel.PanelContextMenu | _context_menu |

## Object Hierarchy

        Object
        ╰── Panel.Panel

## Description

This represents a panel on the screen.

## Functions

### updatePosition ()

    updatePosition (monitorIndex);

Moves the panel to the monitor `monitorIndex` and position `panelPosition`

#### Parameters

monitorIndex | integer, index of monitor `panelPosition`, integer, where the panel should be placed |

### addContextMenuToPanel ()

    addContextMenuToPanel ();

`panelPosition`, integer

Adds a context menu to the panel

### addPanelStyleClass ()

    addPanelStyleClass ();

`panelPosition`, integer

Adds the panel style class. NB the original `panel` style class is kept

### destroy ()

    destroy (boolean   removeIconSizes);

Destroys the panel

#### Parameters

removeIconSizes | (optional) whether to remove zone icon size settings. Default value is true. |

### highlight ()

    highlight (boolean   highlight);

Turns on/off the highlight of the panel

#### Parameters

highlight | whether to turn on or off |

### isHideable ()

    isHideable ();

#### Returns

whether the panel can be hidden (auto-hide or intellihide)

### _getProperty ()

    _getProperty (string   key,
                  string   type);

Gets the desired property of the panel from gsettings

#### Parameters

key | name of gsettings key |
type | (optional) type of data requested. "b" for boolean, "i" for integer. Default value is string |

#### Returns

property required

### _getJSONProperty ()

    _getJSONProperty (string   key);

Gets the desired JSON encoded property of the panel from gsettings

#### Parameters

key | name of gsettings key |

#### Returns

property required

### _updatePanelBarriers ()

    _updatePanelBarriers ();

https://cgit.freedesktop.org/cgit/?url=xorg/proto/fixesproto/plain/fixesproto.txt

### _getScaledPanelHeight ()

    _getScaledPanelHeight ();

Function to calculate the desired panel height

returns : panelheight

### _setClipRegion ()

    _setClipRegion (hidden,
                    offset);

If `hidden` is true the clip region is set to the one exposed strip of pixels adjacent to the monitor edge. Otherwise, the clip region is set to the panel size plus the shadow on the side of the panel opposite the monitor edge.

`offset` is only used during tweens. If provided, it is used to offset the current position in order to calculate the exposed size.

#### Parameters

hidden | whether the panel should be clipped for hide |
offset | (optional): x or y position offset |

### _moveResizePanel ()

    _moveResizePanel ();

Function to update the panel position, size, and clip region according to settings values. Note that this is also called when the style changes.

### _calcBoxSizes ()

    array
    _calcBoxSizes (real      allocWidth,
                   real      allocHeight,
                   boolean   vertical);

Given the minimum and natural width requested by each box, this function calculates how much width should actually allocated to each box. The function returns two variables [`leftBoundary`, `rightBoundary`]

The expected outcome of the code is as follows:

Horizontal panels: Assuming that the centerBox is filled, the primary objective is to center the centerBox whenever possible. This will be done all the time unless doing so requires some box's width to go under its minimum width.

If we are centering the centerBox, there are two possible scenarios. Firstly, if the centerBox can be perfectly centered while everything takes their natural size, then everything will be allocated at least their natural size such that the centerBox is centered, leftBox is left aligned, rightBox is right aligned.

Otherwise, we first allocate the minWidth to every box, and then distribute the remaining space proportional to how much more space each box wants. This is done in a way that ensures the leftWidth and rightWidth are equal.

If it is not possible to center the centerBox, but there is enough space to just allocate the boxes, the centerBox will be made as centered as possible without making things go under their minWidth. This is achieved by making the shorter box go to their min width, and distributing the remaining space among the two other boxes.

Finally, if there isn't even enough space to just put the things, the width allocated is just proportional to the minimum width.

In the cases where the centerBox is not occupied, a similar mechanism is employed. If there is enough space for everything to get their natural width, this will happen. Otherwise, we first allocate the minimum width and then distribute the remaining space proportional to how much more space each box wants. In the scenario where the isn't enough space to just allocate the minimum width, we just allocate proportional to the minimum width.

FIXME: consider replacing all of this with clutter constraints. Fundamentally we have three boxes constrained to be butted up against each other and to stretch over the whole panel. If the centre box is populated then it needs to be centred. Any field has to be given a minimum size in edit mode to allow drag and drop.

#### Parameters

allocWidth | allocated total width |
allocHeight | allocated total height |
vertical | if on vertical panel |

#### Returns

The left and right widths to be allocated.

### _panelHasOpenMenus ()

    _panelHasOpenMenus ();

Checks if panel has open menus in the global.menuStack `returns`

### _updatePanelVisibility ()

    _updatePanelVisibility ();

Checks whether the panel should show based on the autohide settings and position of mouse/active window. It then calls the _queueShowHidePanel function to show or hide the panel as necessary.

true = autohide, false = always show, intel = Intelligent

### _queueShowHidePanel ()

    _queueShowHidePanel ();

Makes the panel show or hide after a delay specified by panels-show-delay and panels-hide-delay.

### disable ()

    disable ();

Disables the panel by settings the opacity to 0 and hides if autohide is enable. The actor is then hidden after the animation.

### enable ()

    enable ();

Reverses the effects of the disable function.

### _showPanel ()

    _showPanel ();

A function to force the panel to show. This has no effect if the panel is disabled.

### _hidePanel ()

    _hidePanel ();

This hides the panel.

## Property Details

### The `“panelId”` property

      “panelId”                  int

the id of the panel

### The `“monitorIndex”` property

      “monitorIndex”             int

the index of the monitor containing the panel

### The `“toppanelHeight”` property

      “toppanelHeight”           int

the height already taken on the screen by a top panel

### The `“bottompanelHeight”` property

      “bottompanelHeight”        int

the height already taken on the screen by a bottom panel

### The `“drawcorner”` property

      “drawcorner”               array

[left, right] whether to draw corners alongside the panel

### The `“monitor”` property

      “monitor”                  Meta.Rectangle

the geometry (bounding box) of the monitor

### The `“panelPosition”` property

      “panelPosition”            integer

where the panel is on the screen

### The `“actor”` property

      “actor”                    Cinnamon.GenericContainer

the actor of the panel

### The `“_leftBox”` property

      “_leftBox”                 St.BoxLayout

the box containing all the applets in the left region

### The `“_centerBox”` property

      “_centerBox”               St.BoxLayout

the box containing all the applets in the center region

### The `“_rightBox”` property

      “_rightBox”                St.BoxLayout

the box containing all the applets in the right region

### The `“_hidden”` property

      “_hidden”                  boolean

whether the panel is currently hidden

### The `“_disabled”` property

      “_disabled”                boolean

whether the panel is disabled

### The `“_panelEditMode”` property

      “_panelEditMode”           boolean

whether the panel edit mode is on

### The `“_context_menu”` property

      “_context_menu”            Panel.PanelContextMenu

the context menu of the panel