net.ctdp.rfdynhud.properties
Class Size

java.lang.Object
  extended by net.ctdp.rfdynhud.values.AbstractSize
      extended by net.ctdp.rfdynhud.properties.Size

public class Size
extends AbstractSize


Constructor Summary
protected Size(Widget widget, boolean isGlobalSize, float width, boolean widthPercent, float height, boolean heightPercent)
           
 
Method Summary
 void bake()
           
 boolean equalsEffective(int width, int height)
           
 Size flipHeightPercentagePx()
           
 Size flipHeightSign()
           
 Size flipWidthPercentagePx()
           
 Size flipWidthSign()
           
 int getEffectiveHeight()
          Gets the effective Widget's height.
 int getEffectiveWidth()
          Gets the effective Widget's width.
 PosSizeProperty getHeightProperty(java.lang.String name)
           
 PosSizeProperty getHeightProperty(java.lang.String name, java.lang.String nameForDisplay)
           
 PosSizeProperty getWidthProperty(java.lang.String name)
           
 PosSizeProperty getWidthProperty(java.lang.String name, java.lang.String nameForDisplay)
           
 boolean isBaked()
           
 boolean isGlobalSize()
           
 boolean isNegativeHeight()
           
 boolean isNegativeWidth()
           
static Size newGlobalSize(Widget widget, float width, boolean widthPercent, float height, boolean heightPercent)
          Create a new size property for global positions on the whole screen area.
static Size newLocalSize(Widget widget, float width, boolean widthPercent, float height, boolean heightPercent)
          Create a new size property for sizes local to a Widget's area.
protected  void onHeightPropertySet(float height)
           
protected  void onWidthPropertySet(float width)
           
static float parseValue(java.lang.String value, boolean defaultPerc)
           
 boolean setEffectiveSize(int width, int height)
          Sets this Widget's size in absolute pixel coordinates.
 Size setHeightToPercents()
           
 Size setHeightToPixels()
           
 void setTo(Size size)
          Sets the Size to the values of the given Size.
 Size setWidthToPercents()
           
 Size setWidthToPixels()
           
 void unbake()
           
static java.lang.String unparseValue(float value)
           
 
Methods inherited from class net.ctdp.rfdynhud.values.AbstractSize
getAspect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Size

protected Size(Widget widget,
               boolean isGlobalSize,
               float width,
               boolean widthPercent,
               float height,
               boolean heightPercent)
Method Detail

isGlobalSize

public final boolean isGlobalSize()

isNegativeWidth

public final boolean isNegativeWidth()

isNegativeHeight

public final boolean isNegativeHeight()

setTo

public void setTo(Size size)
Sets the Size to the values of the given Size.

Parameters:
size -

setEffectiveSize

public final boolean setEffectiveSize(int width,
                                      int height)
Sets this Widget's size in absolute pixel coordinates. (only works for non-fixed-sized Widgets)

Parameters:
width - the new absolute pixel width
height - the new absolute pixel height
Returns:
changed?

getEffectiveWidth

public final int getEffectiveWidth()
Gets the effective Widget's width. If getWidth() returns a negative number, the effective width is (screen_width - width).

Specified by:
getEffectiveWidth in class AbstractSize
Returns:
the effective Widget's width.

getEffectiveHeight

public final int getEffectiveHeight()
Gets the effective Widget's height. If getHeight() returns a negative number, the effective height is (screen_height - height).

Specified by:
getEffectiveHeight in class AbstractSize
Returns:
the effective Widget's height.

equalsEffective

public final boolean equalsEffective(int width,
                                     int height)

unbake

public void unbake()

bake

public void bake()

isBaked

public boolean isBaked()

setWidthToPercents

public Size setWidthToPercents()

setWidthToPixels

public Size setWidthToPixels()

flipWidthPercentagePx

public Size flipWidthPercentagePx()

setHeightToPercents

public Size setHeightToPercents()

setHeightToPixels

public Size setHeightToPixels()

flipHeightPercentagePx

public Size flipHeightPercentagePx()

flipWidthSign

public Size flipWidthSign()

flipHeightSign

public Size flipHeightSign()

parseValue

public static float parseValue(java.lang.String value,
                               boolean defaultPerc)

unparseValue

public static java.lang.String unparseValue(float value)

onWidthPropertySet

protected void onWidthPropertySet(float width)
Parameters:
width - the new width

getWidthProperty

public PosSizeProperty getWidthProperty(java.lang.String name,
                                        java.lang.String nameForDisplay)

getWidthProperty

public PosSizeProperty getWidthProperty(java.lang.String name)

onHeightPropertySet

protected void onHeightPropertySet(float height)
Parameters:
height - the new height

getHeightProperty

public PosSizeProperty getHeightProperty(java.lang.String name,
                                         java.lang.String nameForDisplay)

getHeightProperty

public PosSizeProperty getHeightProperty(java.lang.String name)

newLocalSize

public static final Size newLocalSize(Widget widget,
                                      float width,
                                      boolean widthPercent,
                                      float height,
                                      boolean heightPercent)
Create a new size property for sizes local to a Widget's area.

Parameters:
widget - the owning Widget.
width - the new width value
widthPercent - interpret 'width' as percents?
height - the new height value
heightPercent - interpret 'height' as percents?
Returns:
the new Size.

newGlobalSize

public static final Size newGlobalSize(Widget widget,
                                       float width,
                                       boolean widthPercent,
                                       float height,
                                       boolean heightPercent)
Create a new size property for global positions on the whole screen area.

Parameters:
widget - the owning Widget.
width - the new width value
widthPercent - interpret 'width' as percents?
height - the new height value
heightPercent - interpret 'height' as percents?
Returns:
the new Size.