public class

Box

extends Object
java.lang.Object
   ↳ net.pierrox.lightning_launcher.script.api.Box

Class Overview

The Box object allows access to the corresponding item and folder window box properties. A box is made of several areas: margins, borders, padding, content. Size of margins, borders and padding is configurable, not content (this is the remaining space). Colors of borders, and content is configurable, not margins and padding (always transparent). Methods of the box object use a code to identify each area:

  • Margin left:ml
  • Margin top:mt
  • Margin right:mr
  • Margin bottom:mb
  • Border left:bl
  • Border top:bt
  • Border right:br
  • Border bottom:bb
  • Padding left:pl
  • Padding top:pt
  • Padding right:pr
  • Padding bottom:pb
  • Content:c
Example of using the Box object to change item properties:
 var color = 0xff00ff00; // pure green
 var editor = item.getProperties().edit();
 var box = editor.getBox("i.box");
 
 box.setColor("c", "ns", color); // set background color, for normal and selected states
 
 box.setColor("bl,br,bt,bb", "ns", color); // set all borders color for normal and selected states.
 
 editor.getBox("f.box").setColor("c", "n", color); // set folder background color
 
 editor.commit();

Summary

Public Methods
String getAlignmentH()
Returns the box horizontal alignment.
String getAlignmentV()
Returns the box vertical alignment.
Object getBox()
Access to the internal box data.
int getColor(String area, String mode)
Returns the color of one area.
int getSize(String area)
Returns the size of one area.
void setAlignment(String h, String v)
Set the horizontal and vertical box alignment.
void setColor(String areas, String modes, long color)
Set the color of a given list of areas.
void setSize(String areas, int size)
Set the size of a given list of areas.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public String getAlignmentH ()

Returns the box horizontal alignment.

public String getAlignmentV ()

Returns the box vertical alignment.

public Object getBox ()

Access to the internal box data. To be used with LLPreferenceBox.

public int getColor (String area, String mode)

Returns the color of one area.

Parameters
area
mode one of "n" for normal, "s" for selected, or "f" for focused
Returns
  • a color corresponding to the given area, or an unspecified color if area or mode is invalid

public int getSize (String area)

Returns the size of one area.

Parameters
area
Returns
  • the size in pixel of the given area, or 0 if area is not valid

public void setAlignment (String h, String v)

Set the horizontal and vertical box alignment.

Parameters
h horizontal alignment, one of LEFT, CENTER, RIGHT
v vertical alignment, one of TOP, MIDDLE, BOTTOM

public void setColor (String areas, String modes, long color)

Set the color of a given list of areas.

Parameters
areas one or more areas as a list of comma separated area codes. @see Box for areas color codes.
modes a combination of "n" for normal, "s" for selected, and "f" for focused.
color argb color value

public void setSize (String areas, int size)

Set the size of a given list of areas.

Parameters
areas one or more areas as a list of comma separated area codes. @see Box for areas color codes.
size in pixel