Drag[en]gine Script Module DragonScript Script API  1.0
Widget Class Reference
Inheritance diagram for Widget:
Container DisplayCanvas DisplayImage DisplayRotatingImage DisplayStyledText DisplayVideo Label ProgressBar TextArea TextField WorldRenderer

Classes

class  RepeatKeyEventTimer
 

Public Member Functions

void addDragListener (DragListener listener)
 
void addFocusListener (FocusListener listener)
 Add focus listener. More...
 
void addKeyListener (KeyListener listener)
 
void addMouseListener (MouseListener listener)
 
void addStateChangeListener (StateChangeListener listener)
 Add state change listener. More...
 
void addWidgetListener (WidgetListener listener)
 Add widget listener. More...
 
bool canGrabFullFocus ()
 
void captureMouse ()
 
void dispose ()
 
Widget findFocusableWidget ()
 
Widget findLastFocusableWidget ()
 
CanvasCreator getBackgroundCanvasCreator ()
 Background canvas creator or null to use background color. More...
 
Color getBackgroundColor ()
 
Border getBorder ()
 
BorderSize getBorderSize ()
 
RectArea getBoundary ()
 Rectangulare boundary of the widget. More...
 
RectArea getBoundaryWithBorder ()
 Rectangulare boundary of the widget including border. More...
 
bool getCanFocus ()
 
CanvasView getCanvasBackground ()
 
CanvasView getCanvasContent ()
 
CanvasView getCanvasWidget ()
 
ColorMatrix getColorTransformation ()
 Color transformation. More...
 
Desktop getDesktop ()
 
Point getDesktopPosition ()
 Widget position in desktop coordinates. More...
 
bool getEnabled ()
 
MousePointer getFirstMousePointer ()
 
Font getFont ()
 
Color getForegroundColor ()
 
GuiTheme getGuiTheme ()
 
bool getHasFocus ()
 
int getHeight ()
 Height of widget. More...
 
RangeModel getHorizontalRangeModel ()
 Horizontal range model for viewports to synchronize the horizontal scrollbar. More...
 
Point getMinimumSize ()
 
Point getMinimumSizeForHeight (int height)
 Minimum size of widget using reference widget height and variable width. More...
 
Point getMinimumSizeForHeightWithBorder (int height)
 Minimum size of widget with border using reference widget height and variable width. More...
 
Point getMinimumSizeForWidth (int width)
 Minimum size of widget using reference widget width and variable height. More...
 
Point getMinimumSizeForWidthWithBorder (int width)
 Minimum size of widget with border using reference widget width and variable height. More...
 
Point getMinimumSizeWithBorder ()
 
MousePointer getMousePointer ()
 
Container getParent ()
 
Point getPosition ()
 Position of the widget. More...
 
Point getRelativePosition (Container parent)
 Widget position in parent widget coordinates. More...
 
Point getScreenPosition ()
 Widget position in screen coordinates. More...
 
RectArea getScreenRectArea ()
 
Point getSetMinimumSize ()
 
Point getSize ()
 Size of the widget. More...
 
float getTotalTransparency ()
 
TexMatrix2 getTransformation ()
 
float getTransparency ()
 
RangeModel getVerticalRangeModel ()
 Vertical range model for viewports to synchronize the vertical scrollbar. More...
 
bool getVisible ()
 
Widget getWidgetAt (Point position)
 Widget at coordinates or null if not found. More...
 
int getWidth ()
 Width of widget. More...
 
Window getWindow ()
 
Point getWindowPosition ()
 Widget position in window coordinates. More...
 
int getX ()
 X position of widget. More...
 
int getY ()
 Y position of widget. More...
 
void grabFocus ()
 
bool hasParent (Container container)
 
bool isBackgroundColorSet ()
 
bool isFontSet ()
 
bool isForegroundColorSet ()
 
bool isGuiThemeSet ()
 
bool isMinimumSizeSet ()
 
bool isMouseInside ()
 Mouse is hovering over this widget. More...
 
bool isPointInside (Point position)
 
bool isTransformationSet ()
 
void layoutParent ()
 
Widget new ()
 
Widget new (int x, int y, int width, int height)
 
Widget nextFocusWidget ()
 Find next widget in the focus cycle that can grab the focus. More...
 
void notifyBorderParametersChanged ()
 
void onButtonPress (MouseEvent event)
 
void onButtonRelease (MouseEvent event)
 
void onDispose (WidgetEvent event)
 Window is disposing. More...
 
void onDragDrop (DragEvent event)
 
void onDragEnter (DragEvent event)
 
void onDragLeave (DragEvent event)
 
void onDragOver (DragEvent event)
 
void onFocusLost (FocusEvent event)
 Widget lost focus. More...
 
void onFocusReceived (FocusEvent event)
 Widget received focus. More...
 
void onGuiThemeChanged ()
 
void onHidden (WidgetEvent event)
 Widget has been hidden. More...
 
void onKeyPress (KeyEvent event)
 
void onKeyRelease (KeyEvent event)
 
void onKeyType (KeyEvent event)
 
void onMouseEnter (MouseEvent event)
 
void onMouseLeave (MouseEvent event)
 
void onMouseMove (MouseEvent event)
 
void onReposition (WidgetEvent event)
 Position changed. More...
 
void onResize (WidgetEvent event)
 Size changed. More...
 
void onSetBackgroundColor ()
 
void onSetFont ()
 
void onSetForegroundColor ()
 
void onShown (WidgetEvent event)
 Widget has been shown. More...
 
void onStateChanged (StateChangeEvent event)
 State changed. More...
 
Widget prevFocusWidget ()
 Find previous widget in the focus cycle that can grab the focus. More...
 
void processEvent (Event event)
 
void releaseMouse ()
 
void removeDragListener (DragListener listener)
 
void removeFocusListener (FocusListener listener)
 Remove focus listener. More...
 
void removeKeyListener (KeyListener listener)
 
void removeMouseListener (MouseListener listener)
 
void removeStateChangeListener (StateChangeListener listener)
 Remove state change listener. More...
 
void removeWidgetListener (WidgetListener listener)
 Remove widget listener. More...
 
void requestGrabFocus (Widget widget)
 
void sendEvent (Event event)
 
void sendEventToListeners (Event event, bool sendToParent)
 Send event to all appropriate listeners for events of its kind. More...
 
void setBackgroundCanvasCreator (CanvasCreator creator)
 Set background canvas creator or null to use background color. More...
 
void setBackgroundColor (Color color)
 
void setBorder (Border border)
 
void setCanFocus (bool canFocus)
 
void setColorTransformation (ColorMatrix transformation)
 Set color transformation. More...
 
void setEnabled (bool enabled)
 
void setFont (Font font)
 
void setForegroundColor (Color color)
 
void setGuiTheme (GuiTheme theme)
 
void setHasFocus (bool hasFocus)
 
void setHeight (int height)
 Set height of widget. More...
 
void setMinimumSize (Point size)
 
void setMousePointer (MousePointer mousePointer)
 
void setParent (Container parent)
 
void setPosition (Point position)
 Set position of widget. More...
 
void setSize (Point size)
 Set size of widget. More...
 
void setTransformation (TexMatrix2 transformation)
 
void setTransparency (float transparency)
 
void setVisible (bool visible)
 
void setWidth (int width)
 Set width of widget. More...
 
void setX (int x)
 Set X position of widget. More...
 
void setY (int y)
 Set Y Position of widget. More...
 
void stopRepeatEventTimer ()
 
void updateCanvasBackground ()
 Update background canvas content. More...
 

Detailed Description

Widget base class. Represents a graphical screen component.

Author
Roland Pl├╝ss
Version
1.0

Member Function Documentation

§ addDragListener()

void addDragListener ( DragListener  listener)

Add drag listener.

§ addFocusListener()

void addFocusListener ( FocusListener  listener)

Add focus listener.

§ addKeyListener()

void addKeyListener ( KeyListener  listener)

Add key listener.

§ addMouseListener()

void addMouseListener ( MouseListener  listener)

Add mouse listener.

§ addStateChangeListener()

void addStateChangeListener ( StateChangeListener  listener)

Add state change listener.

§ addWidgetListener()

void addWidgetListener ( WidgetListener  listener)

Add widget listener.

§ canGrabFullFocus()

bool canGrabFullFocus ( )

Determines if a widget can grab the full focus. Full focus means that all parents above the widget are visible and enabled

§ captureMouse()

void captureMouse ( )

Captures the mouse if not already captured by another widget.

§ dispose()

void dispose ( )

Disposes of the widget cleaning references.

§ findFocusableWidget()

Widget findFocusableWidget ( )

Find first widget that can grab the focus or null if none exists.

§ findLastFocusableWidget()

Widget findLastFocusableWidget ( )

Find last widget that can grab the focus or null if none exists.

§ getBackgroundCanvasCreator()

CanvasCreator getBackgroundCanvasCreator ( )

Background canvas creator or null to use background color.

§ getBackgroundColor()

Color getBackgroundColor ( )

Retrieve background color of widget.

§ getBorder()

Border getBorder ( )

Retrieves the border or null if not set.

§ getBorderSize()

BorderSize getBorderSize ( )

Get border size. If no border is set an empty border size is returned.

§ getBoundary()

RectArea getBoundary ( )

Rectangulare boundary of the widget.

§ getBoundaryWithBorder()

RectArea getBoundaryWithBorder ( )

Rectangulare boundary of the widget including border.

§ getCanFocus()

bool getCanFocus ( )

Retrieve if widget can get the focus.

§ getCanvasBackground()

CanvasView getCanvasBackground ( )

Canvas view for the widget background.

§ getCanvasContent()

CanvasView getCanvasContent ( )

Canvas view for the widget content.

§ getCanvasWidget()

CanvasView getCanvasWidget ( )

Canvas view for the entire widget.

§ getColorTransformation()

ColorMatrix getColorTransformation ( )

Color transformation.

§ getDesktop()

Desktop getDesktop ( )

Retrieves the desktop or null if this widget is not part of a desktop. The default implementation forwards the request to the parent with the Desktop or a subclass thereof intercepting.

§ getDesktopPosition()

Point getDesktopPosition ( )

Widget position in desktop coordinates.

§ getEnabled()

bool getEnabled ( )

Retrieve if widget is enabled.

§ getFirstMousePointer()

MousePointer getFirstMousePointer ( )

Retrieves the first assigned mouse pointer. If the Widget has a MousePointer this one is returned otherwise the one of the parent. This can be null if no widget up to the top most one has an assigned mouse pointer.

§ getFont()

Font getFont ( )

Retrieve font of widget.

§ getForegroundColor()

Color getForegroundColor ( )

Retrieve foreground color of widget.

§ getGuiTheme()

GuiTheme getGuiTheme ( )

Retrieves the Gui Theme object. If this widget has no explicit theme assigned the parent is ask for it.

§ getHasFocus()

bool getHasFocus ( )

Retrieve if widget has the focus.

§ getHeight()

int getHeight ( )

Height of widget.

§ getHorizontalRangeModel()

RangeModel getHorizontalRangeModel ( )

Horizontal range model for viewports to synchronize the horizontal scrollbar.

If this widget has no reasonable horizontal range model it should return null.

§ getMinimumSize()

Point getMinimumSize ( )

Retrieve the minimal size of widget.

§ getMinimumSizeForHeight()

Point getMinimumSizeForHeight ( int  height)

Minimum size of widget using reference widget height and variable width.

Default implementation uses getMinimumSize().

§ getMinimumSizeForHeightWithBorder()

Point getMinimumSizeForHeightWithBorder ( int  height)

Minimum size of widget with border using reference widget height and variable width.

§ getMinimumSizeForWidth()

Point getMinimumSizeForWidth ( int  width)

Minimum size of widget using reference widget width and variable height.

Default implementation uses getMinimumSize().

§ getMinimumSizeForWidthWithBorder()

Point getMinimumSizeForWidthWithBorder ( int  width)

Minimum size of widget with border using reference widget width and variable height.

§ getMinimumSizeWithBorder()

Point getMinimumSizeWithBorder ( )

Retrieve the minimal size of widget including the border size if one is set.

§ getMousePointer()

MousePointer getMousePointer ( )

Retrieve the MousePointer assigned to this widget. If the Widget has no MousePointer the parent MousePointer is used.

§ getParent()

Container getParent ( )

Retrieves the parent of widget or null if there is none.

§ getPosition()

Point getPosition ( )

Position of the widget.

§ getRelativePosition()

Point getRelativePosition ( Container  parent)

Widget position in parent widget coordinates.

§ getScreenPosition()

Point getScreenPosition ( )

Widget position in screen coordinates.

§ getScreenRectArea()

RectArea getScreenRectArea ( )

Retrieves the rect area on the screen of the widget.

§ getSetMinimumSize()

Point getSetMinimumSize ( )

Retrieve the set minimal size of widget or null.

§ getSize()

Point getSize ( )

Size of the widget.

§ getTotalTransparency()

float getTotalTransparency ( )

Retrieve total transparency of widget. This is the transparency of this widget multiplied by the total transparency of the parent.

§ getTransformation()

TexMatrix2 getTransformation ( )

Transformation or null if not set.

§ getTransparency()

float getTransparency ( )

Retrieve transparency of widget.

§ getVerticalRangeModel()

RangeModel getVerticalRangeModel ( )

Vertical range model for viewports to synchronize the vertical scrollbar.

If this widget has no reasonable vertical range model it should return null.

§ getVisible()

bool getVisible ( )

Retrieve if widget is visible.

§ getWidgetAt()

Widget getWidgetAt ( Point  position)

Widget at coordinates or null if not found.

§ getWidth()

int getWidth ( )

Width of widget.

§ getWindow()

Window getWindow ( )

Retrieves the window or null if this widget is not part of a window. The default implementation forwards the request to the parent with the Window or a subclass thereof intercepting.

§ getWindowPosition()

Point getWindowPosition ( )

Widget position in window coordinates.

§ getX()

int getX ( )

X position of widget.

§ getY()

int getY ( )

Y position of widget.

§ grabFocus()

void grabFocus ( )

Makes the widget grab the focus if possible.

§ hasParent()

bool hasParent ( Container  container)

Determines if this widget is parent directly or indirectly to a given container.

§ isBackgroundColorSet()

bool isBackgroundColorSet ( )

Determines if the background color is set explicitly.

§ isFontSet()

bool isFontSet ( )

Determines if the font is explicitly set.

§ isForegroundColorSet()

bool isForegroundColorSet ( )

Determines if the foreground color is set explicitly.

§ isGuiThemeSet()

bool isGuiThemeSet ( )

Determines if this widget has the theme set explicitly.

§ isMinimumSizeSet()

bool isMinimumSizeSet ( )

Determines if the minimal size is set explicitly.

§ isMouseInside()

bool isMouseInside ( )

Mouse is hovering over this widget.

Tests if the hover widget of the parent desktop is this widget.

§ isPointInside()

bool isPointInside ( Point  position)

Determines if the given point lies inside the widget. This returns true if the x and y coordinates are bigger or equal 0 and are less tha width or height of the widget.

§ isTransformationSet()

bool isTransformationSet ( )

Transformation is set.

§ layoutParent()

void layoutParent ( )

Layout parent if existing. Call if a change potentially alters the size requirements.

§ new() [1/2]

Widget new ( )

Creates a new widget. The Widget is located at (0,0) with size (1,1).

§ new() [2/2]

Widget new ( int  x,
int  y,
int  width,
int  height 
)

Creates a new widget. The Widget is located at (x,y) with the given size.

§ nextFocusWidget()

Widget nextFocusWidget ( )

Find next widget in the focus cycle that can grab the focus.

§ notifyBorderParametersChanged()

void notifyBorderParametersChanged ( )

Notify border about changes to the widget parameters potentially affecing the border.

§ onButtonPress()

void onButtonPress ( MouseEvent  event)

Notification that a mouse button has been pressed. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onButtonRelease()

void onButtonRelease ( MouseEvent  event)

Notification that a mouse button has been released. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onDispose()

void onDispose ( WidgetEvent  event)

Window is disposing.

Sends event to listeners.

§ onDragDrop()

void onDragDrop ( DragEvent  event)

Notification that a drag operation ends with a drop on the widget. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onDragEnter()

void onDragEnter ( DragEvent  event)

Notification that a drag operation enters the widget. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onDragLeave()

void onDragLeave ( DragEvent  event)

Notification that a drag operation leaves the widget. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onDragOver()

void onDragOver ( DragEvent  event)

Notification that a drag operatio is in progress over the widget. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onFocusLost()

void onFocusLost ( FocusEvent  event)

Widget lost focus.

Sends event to listeners.

§ onFocusReceived()

void onFocusReceived ( FocusEvent  event)

Widget received focus.

Sends event to listeners.

§ onGuiThemeChanged()

void onGuiThemeChanged ( )

Notification that the gui theme changed. Attention! You have to super-call this method since it is used a bit differently than the other callback methods.

§ onHidden()

void onHidden ( WidgetEvent  event)

Widget has been hidden.

Sends event to listeners.

§ onKeyPress()

void onKeyPress ( KeyEvent  event)

Notification that a key on the keyboard has been pressed. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onKeyRelease()

void onKeyRelease ( KeyEvent  event)

Notification that a key on the keyboard has been released. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onKeyType()

void onKeyType ( KeyEvent  event)

Notification that a key on the keyboard has been typed. This usually happens if a key is released. If the key is not a displayble character or the typed character is not complete no typed event is send. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onMouseEnter()

void onMouseEnter ( MouseEvent  event)

Notification that the mouse entered the widget. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onMouseLeave()

void onMouseLeave ( MouseEvent  event)

Notification that the mouse left the widget. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onMouseMove()

void onMouseMove ( MouseEvent  event)

Notification that the mouse has moved. The default behaviour is to send the message to all registered listeners or propagate it back to the parent if allowed.

§ onReposition()

void onReposition ( WidgetEvent  event)

Position changed.

Sends event to listeners.

§ onResize()

void onResize ( WidgetEvent  event)

Size changed.

Sends event to listeners.

§ onSetBackgroundColor()

void onSetBackgroundColor ( )

Background color changed.

§ onSetFont()

void onSetFont ( )

Notification that the widget font changed.

§ onSetForegroundColor()

void onSetForegroundColor ( )

Foreground color changed.

§ onShown()

void onShown ( WidgetEvent  event)

Widget has been shown.

Sends event to listeners.

§ onStateChanged()

void onStateChanged ( StateChangeEvent  event)

State changed.

Sends event to listeners.

§ prevFocusWidget()

Widget prevFocusWidget ( )

Find previous widget in the focus cycle that can grab the focus.

§ processEvent()

void processEvent ( Event  event)

Process an event. This allows the widget to be used as the root widget in a game. Using this function you can implement your own desktop management routines or use no windows at all. An event is send to the root widget using this function. No other widget has to get an event sent through this function. Use the sendEvent function to further dispatch events through all widgets.
The default implementation is to send the event to yourself. Overwrite this behaviour to implement Desktop Widgets.

§ releaseMouse()

void releaseMouse ( )

Release mouse capture.

§ removeDragListener()

void removeDragListener ( DragListener  listener)

Remove a drag listener.

§ removeFocusListener()

void removeFocusListener ( FocusListener  listener)

Remove focus listener.

§ removeKeyListener()

void removeKeyListener ( KeyListener  listener)

Remove key listener.

§ removeMouseListener()

void removeMouseListener ( MouseListener  listener)

Remove mouse listener.

§ removeStateChangeListener()

void removeStateChangeListener ( StateChangeListener  listener)

Remove state change listener.

§ removeWidgetListener()

void removeWidgetListener ( WidgetListener  listener)

Remove widget listener.

§ requestGrabFocus()

void requestGrabFocus ( Widget  widget)

Request to focus the specified widget.

§ sendEvent()

void sendEvent ( Event  event)

Sends an event to the widget. The Widget will check for focus grab and other situations and sends the event to all registered listeners.

§ sendEventToListeners()

void sendEventToListeners ( Event  event,
bool  sendToParent 
)

Send event to all appropriate listeners for events of its kind.

If there are no listeners the event is send to the parent if sendToParent is true.

§ setBackgroundCanvasCreator()

void setBackgroundCanvasCreator ( CanvasCreator  creator)

Set background canvas creator or null to use background color.

§ setBackgroundColor()

void setBackgroundColor ( Color  color)

Set new background color of widget or null for transparent.

§ setBorder()

void setBorder ( Border  border)

Sets the border or null if not set.

§ setCanFocus()

void setCanFocus ( bool  canFocus)

Sets if widget can get the focus.

§ setColorTransformation()

void setColorTransformation ( ColorMatrix  transformation)

Set color transformation.

§ setEnabled()

void setEnabled ( bool  enabled)

Sets if widget is enabled.

§ setFont()

void setFont ( Font  font)

Sets new font of widget or null to use the gui theme one.

§ setForegroundColor()

void setForegroundColor ( Color  color)

Sets new foreground color of widget or null for transparent.

§ setGuiTheme()

void setGuiTheme ( GuiTheme  theme)

Sets the gui theme for this widget.

§ setHasFocus()

void setHasFocus ( bool  hasFocus)

Sets if widget has the focus.

§ setHeight()

void setHeight ( int  height)

Set height of widget.

§ setMinimumSize()

void setMinimumSize ( Point  size)

Sets the minimum size of widget or null if there is no limit.

§ setMousePointer()

void setMousePointer ( MousePointer  mousePointer)

Sets the MousePointer assigned to this widget. If null the Widget has no MousePointer assigned and the parent one will be used.

§ setParent()

void setParent ( Container  parent)

Sets the parent of widget. Use this function with caution. It should only be used by widgets which can contain other widgets to set their parent widget.

§ setPosition()

void setPosition ( Point  position)

Set position of widget.

§ setSize()

void setSize ( Point  size)

Set size of widget.

§ setTransformation()

void setTransformation ( TexMatrix2  transformation)

Set transformation or null if not set.

§ setTransparency()

void setTransparency ( float  transparency)

Sets transparency of widget.

§ setVisible()

void setVisible ( bool  visible)

Sets if widget is visible.

§ setWidth()

void setWidth ( int  width)

Set width of widget.

§ setX()

void setX ( int  x)

Set X position of widget.

§ setY()

void setY ( int  y)

Set Y Position of widget.

§ stopRepeatEventTimer()

void stopRepeatEventTimer ( )

Stops the repeat key event timer.

§ updateCanvasBackground()

void updateCanvasBackground ( )

Update background canvas content.

Sets the content of the background canvas to a rectangle shape with the background color and ontop of it the canvas created by a canvas creator if existing. Widget calls this method if the background color, background canvas creator or gui theme changed.


The documentation for this class was generated from the following file: