WindowHandler

Handles windows as well as PopUpElements.

class WindowHandler : InputListener, MouseListener, PopUpHandler {}

Constructors

this
this(int sW, int sH, int rW, int rH, ISpriteLayer sl)

Creates an instance of WindowHandler.

Members

Aliases

PopUpSet
alias PopUpSet = LinkedList!(PopUpElement, false, "a is b")
Undocumented in source.
WindowSet
alias WindowSet = LinkedList!(Window, false, "a is b")
Undocumented in source.

Functions

addBackground
void addBackground(ABitmap b)

Adds a background to the spritelayer without disrupting window priorities.

addPopUpElement
void addPopUpElement(PopUpElement p)

Adds a popup element into the environment and moves it to the current cursor position.

addPopUpElement
void addPopUpElement(PopUpElement p, int x, int y)

Adds a pop-up element into the environment and moves it to the given location.

addWindow
void addWindow(Window w)

Adds a window to the handler, then sets it to top and hands over the focus to it.

axisEvent
void axisEvent(uint id, BindingCode code, uint timestamp, float value)

Called when an axis is being operated. The id should be generated from a string, usually the name of the binding. code is a duplicate of the code used for fast lookup of the binding, which also contains other info (deviceID, etc). timestamp is the time lapsed since the start of the program, can be used to measure time between keypresses. value is the current position of the axis normalized between -1.0 and +1.0 for joysticks, and 0.0 and +1.0 for analog triggers.

closePopUp
void closePopUp(PopUpElement p)

Removes the given popup element.

closeWindow
void closeWindow(Window sender)

Removes the window from the list of windows, essentially closing it.

endPopUpSession
void endPopUpSession(PopUpElement p)

Ends the current pop-up session.

getCursor
CursorType getCursor()

Returns the current cursor type.

getDefaultStyleSheet
StyleSheet getDefaultStyleSheet()

Returns the default stylesheet (popup).

getRasterSizes
int[2] getRasterSizes()
Undocumented in source. Be warned that the author may not have intended to support it.
getStyleSheet
StyleSheet getStyleSheet()

Returns the default stylesheet, either one that has been set locally to this handler, or the global one.

initDragEvent
void initDragEvent(MouseEventReceptor dragEventSrc)

Initializes mouse drag event. Used to avoid issues from stray mouse release, etc.

keyEvent
void keyEvent(uint id, BindingCode code, uint timestamp, bool isPressed)

Called when a keybinding event is generated. The id should be generated from a string, usually the name of the binding. code is a duplicate of the code used for fast lookup of the binding, which also contains other info (deviceID, etc). timestamp is the time lapsed since the start of the program, can be used to measure time between keypresses. NOTE: Hat events on joysticks don't generate keyReleased events, instead they generate keyPressed events on release.

message
void message(dstring title, dstring message, int width)

Adds a DefaultDialog as a message box.

mouseClickEvent
void mouseClickEvent(MouseEventCommons mec, MouseClickEvent mce)

Called on mouse click events.

mouseMotionEvent
void mouseMotionEvent(MouseEventCommons mec, MouseMotionEvent mme)

Called on mouse motion events.

mouseWheelEvent
void mouseWheelEvent(MouseEventCommons mec, MouseWheelEvent mwe)

Called on mouse wheel events.

refreshWindow
void refreshWindow(Window sender)

Replaces the window's old sprite in the spritelayer's display list with the new one.

setBaseWindow
Window setBaseWindow(Window w)

Sets the BaseWindow to the given object.

setCursor
CursorType setCursor(CursorType type)

Sets the cursor to the given type.

setWindowToTop
void setWindowToTop(Window w)

Sets sender to be top priority, and hands focus to it.

updateSpriteOrder
void updateSpriteOrder()

Updates the sprite order by removing everything, then putting them back again.

updateWindowCoord
void updateWindowCoord(Window sender)

Updates the window's coordinates. DUPLICATE FUNCTION OF refreshWindow! REMOVE IT BY RELEASE VERSION OF 0.10.0, AND REPLACE IT WITH AN ALIAS!

whichWindow
int whichWindow(Window w)

Returns the window priority or -1 if the window can't be found.

Variables

background
ABitmap background;
Undocumented in source.
baseWindow
Window baseWindow;

A window that is used for top-level stuff, like elements in the background, or an integrated window.

cursor
CursorType cursor;

The type of the current cursor

defaultStyle
StyleSheet defaultStyle;

Sets the default style for the windowhandler. If null, the global default will be used instead.

dragEventSrc
MouseEventReceptor dragEventSrc;
Undocumented in source.
mouseConvX
double mouseConvX;
mouseConvY
double mouseConvY;
mouseX
int mouseX;
mouseY
int mouseY;
moveX
int moveX;
moveY
int moveY;
Undocumented in source.
popUpElements
PopUpSet popUpElements;
rasterHeight
int rasterHeight;
rasterWidth
int rasterWidth;
screenHeight
int screenHeight;
Undocumented in source.
screenWidth
int screenWidth;
Undocumented in source.
sdlCursor
SDL_Cursor* sdlCursor;

SDL cursor pointer to operate it

windows
WindowSet windows;
Undocumented in source.

Meta