Window

Basic window. All other windows are inherited from this class.

public
class Window : ElementContainer, Focusable, MouseEventReceptor {}

Constructors

this
this(Box size, Text title, ISmallButton[] smallButtons, StyleSheet customStyle)
this(Box size, dstring title, ISmallButton[] smallButtons, StyleSheet customStyle)

Custom constructor. "size" sets both the initial position and the size of the window. Buttons in the header can be set through the smallButtons parameter

this
this(Box size, Text title, StyleSheet customStyle)
this(Box size, dstring title, StyleSheet customStyle)

Default constructor. "size" sets both the initial position and the size of the window. Adds a close button to the header.

Members

Aliases

CWSet
alias CWSet = LinkedList!(Window, false, "a is b")
Undocumented in source.
FocusableSet
alias FocusableSet = LinkedList!(Focusable, false, "a is b")
Undocumented in source.
SBSet
alias SBSet = LinkedList!(ISmallButton, false, "a is b")
Undocumented in source.
WESet
alias WESet = LinkedList!(WindowElement, false, "a is b")
Undocumented in source.

Functions

addChildWindow
void addChildWindow(Window w)

Adds a child window to the current window.

addElement
void addElement(WindowElement we)

Adds an element to the window.

addHandler
void addHandler(WindowHandler wh)

Adds a WindowHandler to the window.

addHeaderButton
void addHeaderButton(ISmallButton sb)

Adds a smallbutton to the header.

addPopUpElement
void addPopUpElement(PopUpElement p)

Puts a PopUpElement on the GUI.

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

Puts a PopUpElement on the GUI at the given position.

bitBLT
void bitBLT(Point target, ABitmap source)

Pastes a bitmap to the given point using blitter, which threats color #0 as transparency.

bitBLT
void bitBLT(Point target, ABitmap source, Coordinate slice)

Pastes a slice of a bitmap to the given point using blitter, which threats color #0 as transparency.

bitBLTPattern
void bitBLTPattern(Coordinate target, ABitmap pattern)

Pastes a repeated bitmap pattern over the specified area.

clearArea
void clearArea(Coordinate target)

Clears the area within the target

close
void close(Event ev)
void close()

Closes the window by calling the WindowHandler's closeWindow function.

closePopUp
void closePopUp(PopUpElement p)

Closes a single popup element.

cycleFocus
int cycleFocus(int direction)

Cycles the focus on a single element. Returns -1 if end is reached, or the number of remaining elements that are cycleable in the direction.

draw
void draw(bool drawHeaderOnly)

Draws the window. Intended to be used by the WindowHandler.

drawBox
void drawBox(Coordinate target, ubyte color)

Draws an empty rectangle.

drawBoxPattern
void drawBoxPattern(Coordinate target, ubyte[] pattern)

Draws an empty rectangle with line patterns.

drawFilledBox
void drawFilledBox(Coordinate target, ubyte color)

Draws a filled rectangle with a specified color,

drawHeader
void drawHeader()

Draws the header.

drawLine
void drawLine(Point from, Point to, ubyte color)

Draws a line.

drawLinePattern
void drawLinePattern(Point from, Point to, ubyte[] pattern)

Draws a line pattern.

drawTextML
void drawTextML(Coordinate target, Text text, Point offset)

Draws a multi line text within the given prelimiter.

drawTextSL
void drawTextSL(Coordinate target, Text text, Point offset)

Draws a single line text within the given prelimiter.

endPopUpSession
void endPopUpSession(PopUpElement p)

Ends the popup session and closes all popups.

fill
void fill(Point target, ubyte color, ubyte background)

Fills an area with the specified color.

focusGiven
void focusGiven()

Called when an object receives focus.

focusTaken
void focusTaken()

Called when an object loses focus.

getAbsolutePosition
Coordinate getAbsolutePosition(WindowElement sender)
Undocumented in source. Be warned that the author may not have intended to support it.
getChildWindows
CWSet getChildWindows()

Returns the child windows.

getPosition
Box getPosition()

Returns the window's position.

getStyleSheet
StyleSheet getStyleSheet()

If the current window doesn't contain a custom StyleSheet, it gets from it's parent.

getTitle
Text getTitle()

Returns the title of the window

move
void move(int x, int y)

Moves the window to the exact location.

passKey
void passKey(uint keyCode, ubyte mod)

Passes key events to the focused element when not in text editing mode.

passMCE
void passMCE(MouseEventCommons mec, MouseClickEvent mce)

Passes mouse click event

passMME
void passMME(MouseEventCommons mec, MouseMotionEvent mme)

Passes mouse move event

passMWE
void passMWE(MouseEventCommons mec, MouseWheelEvent mwe)

Passes mouse scroll event

relMove
void relMove(int x, int y)

Moves the window by the given values.

removeChildWindow
void removeChildWindow(Window w)

Removes a child window from the current window.

removeElement
void removeElement(WindowElement we)

Removes the WindowElement if 'we' is found within its ranges, does nothing otherwise.

removeHeaderButton
void removeHeaderButton(ISmallButton sb)

Removes a smallbutton from the header.

requestCursor
void requestCursor(CursorType type)

Sets the cursor to the given type on request.

requestFocus
void requestFocus(WindowElement sender)

Gives focus to the windowelement requesting it.

resize
void resize(int width, int height)

Sets the size of the window, also issues a redraw.

setPosition
Box setPosition(Box newPos)

Sets the new position for the window.

setTitle
void setTitle(Text s)
void setTitle(dstring s)

Sets the title of the window

xorBitBLT
void xorBitBLT(Coordinate target, ABitmap pattern)

XOR blits a repeated bitmap pattern over the specified area.

xorBitBLT
void xorBitBLT(Coordinate target, ubyte color)

XOR blits a color index over a specified area.

Properties

active
bool active [@property getter]

Returns true if the window is focused

active
bool active [@property setter]

Sets the IS_ACTIVE flag to the given value

getOutput
ABitmap getOutput [@property getter]

Returns the outputted bitmap. Can be overridden for 32 bit outputs.

isMoved
bool isMoved [@property getter]

Returns whether the window is moved or not

isMoved
bool isMoved [@property setter]

Sets whether the window is moved or not

Static functions

closeButton
SmallButton closeButton(StyleSheet ss)

Generates a generic close button

Static variables

HEADER_UPDATE
enum HEADER_UPDATE;
Undocumented in source.
IS_ACTIVE
enum IS_ACTIVE;
Undocumented in source.
IS_MOVED
enum IS_MOVED;
Undocumented in source.
IS_RESIZABLE_BY_MOUSE
enum IS_RESIZABLE_BY_MOUSE;
Undocumented in source.
IS_RESIZED
enum IS_RESIZED;
Undocumented in source.
IS_RESIZED_B
enum IS_RESIZED_B;
Undocumented in source.
IS_RESIZED_L
enum IS_RESIZED_L;
Undocumented in source.
IS_RESIZED_R
enum IS_RESIZED_R;
Undocumented in source.
IS_RESIZED_T
enum IS_RESIZED_T;
Undocumented in source.
NEEDS_FULL_UPDATE
enum NEEDS_FULL_UPDATE;
Undocumented in source.
onDrawUpdate
void delegate() onDrawUpdate;

Called if not null after every draw update

Variables

children
CWSet children;

Stores child windows

customStyle
StyleSheet customStyle;

Custom stylesheet for this window

elements
WESet elements;

Stores all window elements here

flags
uint flags;

Stores various flags

focusables
FocusableSet focusables;

All focusable objects belonging to the window

focusedElement
sizediff_t focusedElement;

The index of the currently focused element, or -1 if none

handler
WindowHandler handler;

The handler of the window

lastMouseEventTarget
WindowElement lastMouseEventTarget;

Used for mouse move and wheel events

lastMousePos
Point lastMousePos;

Stores the last mouse position.

moveX
int moveX;
Undocumented in source.
moveY
int moveY;

Relative x and y coordinates for drag events

onClose
void delegate() onClose;

Called when the window is closed

output
BitmapDrawer output;

Graphics output of the window

parent
Window parent;

Stores reference to the parent

position
Box position;

Position of the window

smallButtons
SBSet smallButtons;

Contains the icons of the extra buttons. Might be replaced with a WindowElement in the future

title
Text title;

Title of the window

Meta