mkv.MyGUI
Class MyGUI2

java.lang.Object
  extended bymkv.MyGUI.MyGUIObject
      extended bymkv.MyGUI.MyGUIGroup
          extended bymkv.MyGUI.MyGUI2

public class MyGUI2
extends MyGUIGroup

MyGUI a collection of compatable user inteface objects designed to work with processing.

Current features include:

Since the introduction of MyGUIGroup, MyGUI has changed from being a full controller, to more of a relay passing methods through to MyGUIGroup. This is to make efficient code reuse, as MyGUIGroups contain MyGUIObjects even instances of MyGUIGroups. It made sense to central the management code for this in one place (in MyGUIGroup), while still making it appear that MyGUI had identical features.

Version:
0007
Author:
John Beech

Field Summary
 
Fields inherited from class mkv.MyGUI.MyGUIGroup
_actionCommand, _disabled, _height, _id, _root, _rotation, _scale, _style, _visible, _width, _x, _y
 
Constructor Summary
MyGUI2(processing.core.PApplet parent)
          Default class constructor.
MyGUI2(processing.core.PApplet parent, int size)
          Class constructor where the size of the element array can be specified.
MyGUI2(processing.core.PApplet parent, int size, MyGUIStyle style)
          Class constructor where the size of the element array can be specified as well as a reference to a MyGUIStyle object.
MyGUI2(processing.core.PApplet parent, MyGUIStyle style)
          Class constructor with a reference to a custom MyGUIStyle object.
 
Method Summary
 boolean isDisabled()
          Returns the enabled or disabled state of this object.
 void keyEvent(java.awt.event.KeyEvent e)
          Recalls Key events based on type.
 void mouseEvent(java.awt.event.MouseEvent e)
          Recalls Mouse events based on type.
 void updateLocalMouse()
          Based on check for hit code, this calculates the local mouse coordinates after rotations.
 
Methods inherited from class mkv.MyGUI.MyGUIGroup
add, checkForHit, disable, draw, drawStates, enable, get, getFocused, getFocusIndex, getStyle, hasFocus, isDragged, isEmpty, isFull, keyPressed, keyReleased, keyTyped, mouseDragged, mousePressed, mouseReleased, remove, rotateDegrees, rotateRadians, setActionCommand, setID, setMouseCoords, setParent, setStyle, useCustomMouse
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyGUI2

public MyGUI2(processing.core.PApplet parent)
Default class constructor. The default size of the element array will be set to 25, and have x,y coordinates 0,0. This constructor registers Draw, MouseEvent and KeyEvent with the parent processing PApplet.


MyGUI2

public MyGUI2(processing.core.PApplet parent,
              int size)
Class constructor where the size of the element array can be specified. The x,y coordinates will be set to 0,0. This constructor registers Draw, MouseEvent and KeyEvent with the parent processing PApplet.

Parameters:
parent - the processing PApplet where all elements will be drawn to
size - size of element array. If you are using more then 25 MyGUI elements in a single group then you will need to specify this value.

MyGUI2

public MyGUI2(processing.core.PApplet parent,
              int size,
              MyGUIStyle style)
Class constructor where the size of the element array can be specified as well as a reference to a MyGUIStyle object. Alternatively you can call one of the above default constructors and then use MyGUI.getStyle() to return the current style in use and modify it from there.

Parameters:
parent - the processing PApplet where all elements will be drawn to
size - size of element array. If you are using more then 25 MyGUI elements in a single group then you will need to specify this value.
style - the style object used by all MyGUI elements when they draw themselves

MyGUI2

public MyGUI2(processing.core.PApplet parent,
              MyGUIStyle style)
Class constructor with a reference to a custom MyGUIStyle object. Alternatively you can call one of the above default constructors and then use MyGUI.getStyle() to return the current style in use and modify it from there.

Parameters:
parent - the processing PApplet where all elements will be drawn to
style - the style object used by all MyGUI elements when they draw themselves
Method Detail

mouseEvent

public void mouseEvent(java.awt.event.MouseEvent e)
Recalls Mouse events based on type. This method will recall mousePressed, mouseReleased and mouseDragged events when a MouseEvent is detected in the parent PApplet.


keyEvent

public void keyEvent(java.awt.event.KeyEvent e)
Recalls Key events based on type. This method will recall keyPressed, keyReleased and keyTyped events when a KeyEvent is detected in the parent PApplet.


isDisabled

public boolean isDisabled()
Returns the enabled or disabled state of this object. Because MyGUI objects do not have MyGUIObject parents, this method overides the MyGUIObject version.

Returns:
returns true if the object is disabled, false if it is enabled

updateLocalMouse

public void updateLocalMouse()
Based on check for hit code, this calculates the local mouse coordinates after rotations.
Because the MyGUI controller is considered a parent object that sits above all others then it has a customized updateLocalMouse() method that takes mouseX, mouseY instead of _parent.tmouseX, _parent.tmouseY.