mkv.MyGUI
Class MyGUIStyle

java.lang.Object
  extended bymkv.MyGUI.MyGUIStyle

public class MyGUIStyle
extends java.lang.Object

MyGUIStyle is a simple collection of colours and a font(s) that is used to give a constant look and feel to all elements drawn through processing.

Version: 0.01
Created by John Beech
Website: http://mkv25.net/

MyGUIStyle objects contain many variables used by almost all MyGUI elements. Each of the variables are public and can be accessed by . syntax, for example:
MyGUIStyle style1 = new MyGUIStyle(this);
PApplet.color back = style1.background;

In the list below, variable names are inside the (brackets).


Field Summary
 int background
           
 int buttonFace
           
 int buttonHighlight
           
 int buttonShadow
           
 int buttonText
           
 int disabled
           
 int face
           
 processing.core.PFont font
           
 int fontSize
           
 int highlight
           
 int highlightText
           
 int icon
           
 int padding
           
 int scrollBar
           
 int shadow
           
 int strokeWeight
           
 
Constructor Summary
MyGUIStyle(processing.core.PApplet root)
          The most basic constructor for MyGUIStyle objects.
MyGUIStyle(processing.core.PApplet root, int tint)
          This constructor lets you specify a shade to tint all the colours to.
MyGUIStyle(processing.core.PApplet root, processing.core.PFont font, int fontSize, int buttonFace, int buttonHighlight, int buttonShadow, int buttonText)
          This constructor takes inputs for a custom (preloaded) font and a selection of the colours as PApplet.color() values.
MyGUIStyle(processing.core.PApplet root, processing.core.PFont font, int fontSize, int background, int buttonFace, int buttonHighlight, int buttonShadow, int buttonText, int icon, int face, int highlight, int shadow, int disabled, int highlightText, int scrollBar)
          This constructor takes inputs for a custom (preloaded) font and all of the colours as PApplet.color() values.
 
Method Summary
 MyGUIStyle copy()
           
 void setDefaultColors()
          This method sets the colours of this style to the defaults, essentially resetting to a blue layout.
 void setFont(processing.core.PFont newFont)
           
 void setFont(processing.core.PFont newFont, int newFontSize)
           
 void setPadding(int pad)
          Sets the padding value used to add a spacer between the edge of a MyGUI component such as a button and the internal contents such as text or an icon.
 void setStrokeWeight(int weight)
          Sets the stroke weights of all lines drawn, this may have the effect of 'beefing up' buttons and causing vector drawn icons to be more chunky then intended.
 void setTransparency(float a)
          Set transparency sets the value of all the colours used in MyGUI style.
 void setTransparency(int a)
          Set transparency sets the value of all the colours used in MyGUI style.
 void tintColor(int c)
          This tint method alters all the colours used in this style based off the hue/shade of the specified color value (c).
 int tintColor(int c, int tint)
          This tint method tints a color value based off another color value using the full saturation of the tint colour.
 int tintColor(int c, int tint, float str)
          This tint method tints a color value based off another color value using a custom (strength) of the tint colour.
 void tintDefault(int c)
          This tint method resets all the colours to the default value and then alters them based off the hue/shade of the specified color value (c).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

font

public processing.core.PFont font

fontSize

public int fontSize

strokeWeight

public int strokeWeight

padding

public int padding

background

public int background

buttonFace

public int buttonFace

buttonHighlight

public int buttonHighlight

buttonShadow

public int buttonShadow

buttonText

public int buttonText

icon

public int icon

highlight

public int highlight

face

public int face

shadow

public int shadow

disabled

public int disabled

highlightText

public int highlightText

scrollBar

public int scrollBar
Constructor Detail

MyGUIStyle

public MyGUIStyle(processing.core.PApplet root)
The most basic constructor for MyGUIStyle objects. Sets the default colours and loads the font ArialNarrow-48.vlw. MyGUIStyle like all MyGUI objects need a reference to a processing PApplet object so that they can call load and draw methods.

Parameters:
root - root points back to the processing PApplet used to call the MyGUI library.

MyGUIStyle

public MyGUIStyle(processing.core.PApplet root,
                  int tint)
This constructor lets you specify a shade to tint all the colours to. Sets the default colours, tints them based off the provided color and loads the font ArialNarrow-48.vlw.

Parameters:
root - points back to the processing PApplet used to call the MyGUI library.
tint - specifies the color value used to shade the default colours.
See Also:
tintColor(int c)

MyGUIStyle

public MyGUIStyle(processing.core.PApplet root,
                  processing.core.PFont font,
                  int fontSize,
                  int background,
                  int buttonFace,
                  int buttonHighlight,
                  int buttonShadow,
                  int buttonText,
                  int icon,
                  int face,
                  int highlight,
                  int shadow,
                  int disabled,
                  int highlightText,
                  int scrollBar)
This constructor takes inputs for a custom (preloaded) font and all of the colours as PApplet.color() values. The constructor completely ignores the default colours and lets you set custom values.

Parameters:
root - points back to the processing PApplet used to call the MyGUI library.
font - preloaded PFont reference to define the font used for text.
fontSize - the size of font to use for elements.
background - the color of background elements.
buttonFace - the color for button faces.
buttonHighlight - the color for highlights on buttons.
buttonShadow - the color for shadows/alternate colours on buttons.
buttonText - the color for text on buttons.
icon - the color for class specific icons.
face - a generic face color.
highlight - a generic highlight color.
shadow - a generic shadow color.
disabled - a color for disabled elements.
highlightText - the color for highlighted text.
scrollBar - the color for the backing of a scroll bar

MyGUIStyle

public MyGUIStyle(processing.core.PApplet root,
                  processing.core.PFont font,
                  int fontSize,
                  int buttonFace,
                  int buttonHighlight,
                  int buttonShadow,
                  int buttonText)
This constructor takes inputs for a custom (preloaded) font and a selection of the colours as PApplet.color() values. The constructor automatically assigns similar values to 'duplicate' colours, cutting down the number of individual colour values that you need to assign.

Parameters:
root - points back to the processing PApplet used to call the MyGUI library.
font - preloaded PFont reference to define the font used for text.
fontSize - the size of font to use for elements.
buttonFace - the color for button faces.
buttonHighlight - the color for highlights on buttons.
buttonShadow - the color for shadows/alternate colours on buttons.
buttonText - the color for text on buttons.
Method Detail

setDefaultColors

public void setDefaultColors()
This method sets the colours of this style to the defaults, essentially resetting to a blue layout. The method is usually called in one of the two basic constructors. Note: This method always sets the colours to shades of blue, regardless of the more specific constructors that may have been used.


setFont

public void setFont(processing.core.PFont newFont)

setFont

public void setFont(processing.core.PFont newFont,
                    int newFontSize)

setStrokeWeight

public void setStrokeWeight(int weight)
Sets the stroke weights of all lines drawn, this may have the effect of 'beefing up' buttons and causing vector drawn icons to be more chunky then intended. The default weight is 1.

Parameters:
weight - the new line weight to be set.

setPadding

public void setPadding(int pad)
Sets the padding value used to add a spacer between the edge of a MyGUI component such as a button and the internal contents such as text or an icon. The specific usage and effect of increasing padding is not defined here and may alter or be ignored in certain classes. The default padding value is 1.

Parameters:
pad - the new padding value to use.

tintColor

public void tintColor(int c)
This tint method alters all the colours used in this style based off the hue/shade of the specified color value (c). The tint method attemps to preserve the contrast of the original colours (usually the default blue colours).

Parameters:
c - the color value to use for tinting.

tintDefault

public void tintDefault(int c)
This tint method resets all the colours to the default value and then alters them based off the hue/shade of the specified color value (c). The tint method attempts to preserve the constrast of the original colours.


tintColor

public int tintColor(int c,
                     int tint)
This tint method tints a color value based off another color value using the full saturation of the tint colour. You should compare this to the other tint method below.

Parameters:
c - the base colour that will be tinted.
tint - the colour used for tinting.
Returns:
the new tinted color value
See Also:
tintColor(int c, int tint, float str)

tintColor

public int tintColor(int c,
                     int tint,
                     float str)
This tint method tints a color value based off another color value using a custom (strength) of the tint colour. For example, using a strength of 0.5f will apply half the tint colour to the base colour. This may be useful for applying a mild tint to another colour based off a stronger more saturated colour.

Parameters:
c - the base colour that will be tinted.
tint - the colour used for tinting.
str - the strength of saturation to be used when tinting.
Returns:
the new tinted color value
See Also:
tintColor(int c, int tint, float str)

setTransparency

public void setTransparency(float a)
Set transparency sets the value of all the colours used in MyGUI style. It accepts a floating value usually between 0.0f and 1.0f.

Parameters:
a - alpha / transparency for all colours.

setTransparency

public void setTransparency(int a)
Set transparency sets the value of all the colours used in MyGUI style. It accepts an integer value usually between 0 and 255.

Parameters:
a - alpha / transparency for all colours.

copy

public MyGUIStyle copy()