Widget Class Reference

Base class of widget. More...

Inheritance diagram for Widget:
AnimationImageBox BusyIndicator Button CheckBox ContainerWidget DatePicker EditableText ImageBox Label LiveFlipPanel LiveListPanel LiveSphere PagePanel PopupList ProgressBar ScrollBar Slider TimePicker

List of all members.

Public Member Functions

 Widget ()
 Constructor.
void Dispose ()
 Frees the unmanaged resources held by this widget and child widgets.
virtual void SetPosition (float x, float y)
 Sets the position in the parent coordinate system.
virtual void SetSize (float width, float height)
 Sets the size.
void SetFocus (bool active)
 Places focus on self.
virtual bool HitTest (Vector2 screenPoint)
 Obtains whether this widget hits with the specified coordinates.
Vector2 ConvertScreenToLocal (Vector2 screenPoint)
 Converts the specified coordinates from the screen coordinate system to the local coordinate system.
Vector2 ConvertScreenToLocal (float screenX, float screenY)
 Converts the specified coordinates from the screen coordinate system to the local coordinate system.
Vector2 ConvertLocalToScreen (Vector2 localPoint)
 Converts the specified coordinates from the local coordinate system to the screen coordinate system.
Vector2 ConvertLocalToScreen (float localX, float localY)
 Converts the specified coordinates from the local coordinate system to the screen coordinate system.
Vector2 ConvertLocalToOtherWidget (Vector2 localPoint, Widget targetWidget)
 Converts the specified coordinates from the local coordinate system of itself to the local coordinate system of another widget.
Vector2 ConvertLocalToOtherWidget (float x, float y, Widget targetWidget)
 Converts the specified coordinates from the local coordinate system of itself to the local coordinate system of another widget.
void RenderToTexture (Texture2D texture)
 Renders to the texture.
void RenderToTexture (Texture2D texture, Matrix4 transform)
 Renders to the texture.
void RenderToFrameBuffer (FrameBuffer frameBuffer)
 Renders to the frame buffer.
void RenderToFrameBuffer (FrameBuffer frameBuffer, Matrix4 transform)
 Renders to the frame buffer.
bool AddGestureDetector (GestureDetector gestureDetector)
 Adds a gesture detection mechanism.
bool RemoveGestureDetector (GestureDetector gestureDetector)
 Deletes the gesture detection mechanism.
override string ToString ()
 Returns a character string.

Protected Member Functions

virtual void Dispose (bool disposing)
 Frees the unmanaged resources held by this widget and child widgets.
virtual void DisposeSelf ()
 Frees the unmanaged resources held by this widget.
void AddChildFirst (Widget child)
 Adds the child widget to the beginning.
void AddChildLast (Widget child)
 Adds the child widget to the end.
void InsertChildBefore (Widget child, Widget nextChild)
 Inserts it immediately in front of the specified child widget.
void InsertChildAfter (Widget child, Widget prevChild)
 Inserts it immediately after the specified child widget.
void RemoveChild (Widget child)
 Deletes the specified child widget.
virtual internal void OnTouchEvent (TouchEventCollection touchEvents)
 Touch event handler.
virtual internal void OnKeyEvent (KeyEvent keyEvent)
 Key event handler.
virtual internal void OnPreviewKeyEvent (KeyEvent keyEvent)
 Advance key event handler.
internal Widget SearchNextFocus (FourWayDirection direction)
 Searches for the widget in focus next.
internal Widget SearchNextFocusFromChild (FourWayDirection direction, Widget currentFocusWidget)
 Searches for the widget in focus next from among own child widgets (including descendants)
virtual internal void OnMotionEvent (MotionEvent motionEvent)
 Motion event handler.
virtual internal void OnResetState ()
 Status reset handler.
virtual void OnUpdate (float elapsedTime)
 Update processing.
virtual internal void Render ()
 Renders a scene graph.
internal void ResetState (bool includeSelf)
 Resets the status of all widgets for under self.
virtual internal void SetupFinalAlpha ()
 Calculates the final alpha value.
internal virtual void OnFocusChanged (FocusChangedEventArgs args)
 Called when this widget obtains or loses focus.
virtual void OnPressStateChanged (PressStateChangedEventArgs e)
 Called when the press status changes.

Properties

String Name [get, set]
 Obtains and sets the name of the widget.
internal RootUIElement RootUIElement [get]
 Obtains the root of the element tree.
virtual float X [get, set]
 Obtains and sets the X coordinate in the parent coordinate system.
virtual float Y [get, set]
 Obtains and sets the Y coordinate in the parent coordinate system.
virtual float Width [get, set]
 Obtains and sets the width.
virtual float Height [get, set]
 Obtains and sets the height.
virtual Matrix4 Transform3D [get, set]
 Obtains and sets the transformation matrix to the parent coordinate system.
virtual float Alpha [get, set]
 Obtains and sets the transparency.
virtual PivotType PivotType [get, set]
 Obtains and sets the origin of the widget.
virtual bool ZSort [get, set]
 Obtains and sets whether to Z sort.
virtual float ZSortOffset [get, set]
 Obtains and sets the Z-sort offset.
virtual Anchors Anchors [get, set]
 Obtains and sets the area to fix when resizing the parent.
virtual bool Visible [get, set]
 Obtains and sets whether to display.
virtual bool TouchResponse [get, set]
 Obtains and sets whether to respond to the touch event including the child widget.
internal bool Clip [get, set]
 Obtains and sets whether to clip the child element (Widget, UIElement).
internal bool HookChildTouchEvent [get, set]
 Obtains and sets whether to hook the touch event of the child widget.
Widget Parent [get]
 Obtains the parent widget.
IEnumerable< WidgetChildren [get]
 Obtains the child widget.
bool Focused [get]
 Obtains whether the focus is currently placed on self.
Matrix4 LocalToWorld [get]
 Obtains the matrix to be converted from the local coordinate system to the world coordinate system.
virtual bool PriorityHit [get, set]
 Obtains and sets whether to prioritize and respond to a touch.
virtual bool Focusable [get, set]
 Obtains and sets whether to set the focus.
virtual FocusCustomSettings FocusCustomSettings [get, set]
 Obtains and sets the focus setting information.
FocusStyle FocusStyle [get, set]
 Obtains and sets the focus display style.
bool Pressable [get, set]
 Obtains and sets whether it can be pressed by a touch or key.
virtual PressState PressState [get, set]
 Obtains and sets the status for whether or not this widget is pressed.
PressStateTouchLeaveBehavior TouchLeaveBehavior [get, set]
 Obtains and sets the behavior of the press status when the touch is moved from the inside of the area to the outside.
virtual bool Enabled [get, set]
 Obtains and sets whether to enable the feature.

Events

EventHandler< TouchEventArgsTouchEventReceived
 Handler called when a touch event is received.
EventHandler< KeyEventArgsKeyEventReceived
 Handler called when a key event is received.
EventHandler< KeyEventArgsPreviewKeyEventReceived
 Handler called when an advance key event is received.
EventHandler< MotionEventArgsMotionEventReceived
 Handler called when a motion event is received.
EventHandler
< FocusChangedEventArgs
FocusChanged
 Event called when this widget obtains or loses focus.

Detailed Description

Base class of widget.


Member Function Documentation

void AddChildFirst ( Widget  child) [protected]

Adds the child widget to the beginning.

Parameters:
childChild widget to be added

Moves it to the beginning if it has already been added.

Reimplemented in ContainerWidget, LiveScrollPanel, LiveSpringPanel, and ScrollPanel.

void AddChildLast ( Widget  child) [protected]

Adds the child widget to the end.

Parameters:
childChild widget to be added

Moves it to the end if it has already been added.

Reimplemented in ContainerWidget, LiveScrollPanel, LiveSpringPanel, and ScrollPanel.

bool AddGestureDetector ( GestureDetector  gestureDetector)

Adds a gesture detection mechanism.

Parameters:
gestureDetectorGesture detection mechanism
Exceptions:
ArgumentNullExceptionGestureDetector is null
Returns:
Whether addition was possible or not
Vector2 ConvertLocalToOtherWidget ( Vector2  localPoint,
Widget  targetWidget 
)

Converts the specified coordinates from the local coordinate system of itself to the local coordinate system of another widget.

Returns:
Coordinates converted to the targetWidget local coordinate system
Parameters:
targetWidgetConversion destination widget
localPointSelf local coordinate system coordinates
Vector2 ConvertLocalToOtherWidget ( float  x,
float  y,
Widget  targetWidget 
)

Converts the specified coordinates from the local coordinate system of itself to the local coordinate system of another widget.

Returns:
Coordinates converted to the targetWidget local coordinate system
Parameters:
targetWidgetConversion destination widget
xSelf local coordinate system coordinate X
ySelf local coordinate system coordinate Y
Vector2 ConvertLocalToScreen ( Vector2  localPoint)

Converts the specified coordinates from the local coordinate system to the screen coordinate system.

Returns:
Coordinates converted to the screen coordinate system
Parameters:
localPointLocal coordinate system coordinates
Vector2 ConvertLocalToScreen ( float  localX,
float  localY 
)

Converts the specified coordinates from the local coordinate system to the screen coordinate system.

Returns:
Coordinates converted to the screen coordinate system
Parameters:
localXLocal coordinate system coordinate X
localYLocal coordinate system coordinate Y
Vector2 ConvertScreenToLocal ( Vector2  screenPoint)

Converts the specified coordinates from the screen coordinate system to the local coordinate system.

Returns:
Coordinates converted to the local coordinate system
Parameters:
screenPointScreen coordinate system coordinates
Vector2 ConvertScreenToLocal ( float  screenX,
float  screenY 
)

Converts the specified coordinates from the screen coordinate system to the local coordinate system.

Returns:
Coordinates converted to the local coordinate system
Parameters:
screenXScreen coordinate system coordinate X
screenYScreen coordinate system coordinate Y
virtual void Dispose ( bool  disposing) [protected, virtual]

Frees the unmanaged resources held by this widget and child widgets.

Deletes itself from a parent widget and recursively calls DisposeSelf() for child widgets. When implementing Dispose with a derivative class, override DisposeSelf().

Parameters:
disposingtrue when called from Dispose()
void Dispose ( )

Frees the unmanaged resources held by this widget and child widgets.

Recursively frees this widget and all widgets in and below its tree as well as all UIElements that belong to the RootUIElement tree of each. Once Dispose() has been called for a widget, it cannot be reused. If widgets/UIElements that do not belong to a tree and other objects that require Dispose have been created with widget derivative classes, DisposeSelf() must be overridden and Dispose must be called for them.

virtual void DisposeSelf ( ) [protected, virtual]

Frees the unmanaged resources held by this widget.

This method is recursively called from Dispose() for the child widgets. If widgets/UIElements that do not belong to a tree and other objects that require Dispose have been created with widget derivative classes, this method must be overridden and Dispose must be called for them.

Reimplemented in BusyIndicator, Button, CheckBox, Dialog, EditableText, Label, ListPanelItem, LiveFlipPanel, LiveScrollPanel, MessageDialog, PagePanel, PopupList, ProgressBar, ScrollBar, Slider, and UIAnimationPlayer.

virtual bool HitTest ( Vector2  screenPoint) [virtual]

Obtains whether this widget hits with the specified coordinates.

Parameters:
screenPointPosition in the screen coordinate system
Returns:
If hit, then true. If not hit, then false.

Reimplemented in DatePicker, RootWidget, and TimePicker.

void InsertChildAfter ( Widget  child,
Widget  prevChild 
) [protected]

Inserts it immediately after the specified child widget.

Parameters:
childChild widget to be inserted
prevChildChild widget immediately in front of the inserted child widget

Moves it immediately after the specified child widget if it has already been added.

Reimplemented in ContainerWidget, LiveScrollPanel, LiveSpringPanel, and ScrollPanel.

void InsertChildBefore ( Widget  child,
Widget  nextChild 
) [protected]

Inserts it immediately in front of the specified child widget.

Parameters:
childChild widget to be inserted
nextChildChild widget immediately after the inserted child widget

Moves it immediately in front of the specified child widget if it has already been added.

Reimplemented in ContainerWidget, LiveScrollPanel, LiveSpringPanel, and ScrollPanel.

virtual internal void OnKeyEvent ( KeyEvent  keyEvent) [protected, virtual]

Key event handler.

Parameters:
keyEventKey event
virtual internal void OnMotionEvent ( MotionEvent  motionEvent) [protected, virtual]

Motion event handler.

Parameters:
motionEventMotion event

Reimplemented in LiveSpringPanel.

virtual void OnPressStateChanged ( PressStateChangedEventArgs  e) [protected, virtual]

Called when the press status changes.

Parameters:
eEvent argument

Reimplemented in Button, CheckBox, EditableText, ListPanelItem, and PopupList.

virtual internal void OnPreviewKeyEvent ( KeyEvent  keyEvent) [protected, virtual]

Advance key event handler.

Parameters:
keyEventKey event

Reimplemented in GridListPanel, ListPanel, LiveListPanel, PagePanel, ScrollPanel, and Slider.

virtual internal void OnTouchEvent ( TouchEventCollection  touchEvents) [protected, virtual]

Touch event handler.

Parameters:
touchEventsTouch event

Reimplemented in GridListPanel, ListPanel, LiveFlipPanel, LiveListPanel, LiveScrollPanel, LiveSphere, PagePanel, Panel, and ScrollPanel.

virtual void OnUpdate ( float  elapsedTime) [protected, virtual]

Update processing.

Parameters:
elapsedTimeElapsed time from previous update (ms)

Reimplemented in AnimationImageBox, Button, EditableText, GridListPanel, ListPanel, LiveFlipPanel, LiveJumpPanel, LiveListPanel, LiveScrollPanel, LiveSphere, LiveSpringPanel, PagePanel, ProgressBar, and ScrollPanel.

void RemoveChild ( Widget  child) [protected]

Deletes the specified child widget.

Parameters:
childChild widget to be deleted

Reimplemented in ContainerWidget, LiveScrollPanel, LiveSpringPanel, and ScrollPanel.

bool RemoveGestureDetector ( GestureDetector  gestureDetector)

Deletes the gesture detection mechanism.

Parameters:
gestureDetectorGesture detection mechanism
Exceptions:
ArgumentNullExceptionGestureDetector is null
Returns:
Whether deletion was possible or not
void RenderToFrameBuffer ( FrameBuffer  frameBuffer)

Renders to the frame buffer.

Parameters:
frameBufferFrameBuffer
void RenderToFrameBuffer ( FrameBuffer  frameBuffer,
Matrix4  transform 
)

Renders to the frame buffer.

Parameters:
frameBufferFrameBuffer
transformConversion matrix
void RenderToTexture ( Texture2D  texture)

Renders to the texture.

Parameters:
texture2D texture
void RenderToTexture ( Texture2D  texture,
Matrix4  transform 
)

Renders to the texture.

Parameters:
texture2D texture
transformConversion matrix
internal void ResetState ( bool  includeSelf) [protected]

Resets the status of all widgets for under self.

Parameters:
includeSelfIf self is reset, then true. If self is not reset, then false.
internal Widget SearchNextFocus ( FourWayDirection  direction) [protected]

Searches for the widget in focus next.

Parameters:
directionDirection of directional buttons
Returns:
If not found, null.
internal Widget SearchNextFocusFromChild ( FourWayDirection  direction,
Widget  currentFocusWidget 
) [protected]

Searches for the widget in focus next from among own child widgets (including descendants)

Self is excluded from the search target.

Parameters:
directionDirection of directional buttons
currentFocusWidgetWidget currently in focus
Returns:
If not found, null.
void SetFocus ( bool  active)

Places focus on self.

Parameters:
activetrue: Enables focus false: Keeps the status

Sets the focus regardless of the Focusable, Visible, and Enabled properties and whether it is within the display range. If an affiliated scene is not the target focus scene, focus does not become active even when active is set to true.

virtual void SetPosition ( float  x,
float  y 
) [virtual]

Sets the position in the parent coordinate system.

Parameters:
xX coordinate in the parent coordinate system
yY coordinate in the parent coordinate system
virtual void SetSize ( float  width,
float  height 
) [virtual]

Sets the size.

Parameters:
widthWidth
heightHeight

Reimplemented in LiveSphere.

override string ToString ( )

Returns a character string.

Returns:
Character string of "Name: model name" (when Name property is set)

Property Documentation

virtual float Alpha [get, set]

Obtains and sets the transparency.

(0 - 1) Multiplies the transparency by all child widgets and displays it.

IEnumerable<Widget> Children [get, protected]

Obtains the child widget.

Returns the enumerator that repetitively handles the collection.

Reimplemented in ContainerWidget, LiveScrollPanel, and ScrollPanel.

internal bool Clip [get, set, protected]

Obtains and sets whether to clip the child element (Widget, UIElement).

Calculates the clip area as a 2D coordinate.

Reimplemented in Panel.

virtual bool Focusable [get, set]

Obtains and sets whether to set the focus.

If the child widget is true, the child widget may have focus even when the parent widget is false.

Reimplemented in PagePanel, and ScrollPanel.

String Name [get, set]

Obtains and sets the name of the widget.

This property can be used arbitrarily with applications.

virtual PivotType PivotType [get, set]

Obtains and sets the origin of the widget.

The point that serves as the center when moving, rotating, and scaling.

PressStateTouchLeaveBehavior TouchLeaveBehavior [get, set, protected]

Obtains and sets the behavior of the press status when the touch is moved from the inside of the area to the outside.

This value is enabled only when the Pressable property is true.