1
) function: toString 2
) function: isSet 3
) function: setAnchor 4
) function: adjustAnchorX 5
) function: adjustAnchorY 6
) function: adjustAnchor
Object : Anchor
Object Description:
The 'Anchor' class is used to anchor one object to some position
inside another object. It seemed like a simple alternative to
implementing a layout manager. Though it is more limited...
Notes:
Each Class that inherits from CGUI contains an anchor object.
Example:
For instance, you can add a button to a frame then anchor the
button to the bottom left corner of the frame.
| Constructor: Anchor
Parameter : parent - anchor need to know about it's parent
Method: toString
Description: Produce a string representation of this anchor.
useful for debugging.
Method: isSet
Description: Check to see if this anchor has been set
Method: setAnchor
Description: Set this anchor.
Parameter : target - the object to anchor to.
Parameter : ax - "left" "center" "right", the horizontal anchor position
Parameter : offsetx - the offset ('+':right '-':left) from the ax position
Parameter : ay - "top" "center" "bottom", the vertical anchor position
Parameter : offsety - the offset ('+':down '-':up) from the ay position
Example:
Continuing the setAnchor (frame, "left", "15", "bottom", "-15")
would anchor the object(the button)
Method: adjustAnchorX
Description: Adjust the X position of this anchor
Parameter : ax - "left" "center" "right", the horizontal anchor position
Parameter : offsetx - the offset ('+':right '-':left) from the ax position
Example:
Continuing from setAnchor: adjustAnchor ("right", "-15")
would move the object to the right side, where it was on the left
and it would now be offset 15 to the left of the right edge.
Method: adjustAnchorY
Description: adjust the Y position of this anchor
Parameter : ay - "top" "center" "bottom", the vertical anchor position
Parameter : offsety - the offset ('+':down '-':up) from the ay position
Example:
Continuing from setAnchor: adjustAnchor ("top", "15")
would move the object to the top edge, where it was on the bottom
and it would now be offset 15 down from the top edge.
Method: adjustAnchor
Description: adjust this anchor.
Example:
The adjustAnchor method goes through and resets the x and y
coordinates of the anchors parent so that it is now in the right
position relative to the anchorTo object.
- so it adjusts the buttons x,y values so that the button is
now in the appropriate position relative to the Frame.
|
|