#include <window.h>
Public Attributes | |
int(* | getInnerHeight )() |
int(* | getInnerWidth )() |
int(* | getOuterHeight )() |
int(* | getOuterWidth )() |
void(* | blur )() |
Struct containing state and OO-like behavior similar to that of the globally available 'window' DOM object in JavaScript. Functions do not require a first parameter identifying the HTMLWindow itself because it is assumed that this code is executing in only a single window, and we'll just use that one.
This struct should not be instantiated, but rather created and accessed (as a Singleton) via the Window() function.
I find this struct most useful in conjunction with the canvas for expanding the canvas dimensions to be as large as the entire window.
For example:
HTMLCanvasElement *canvas = createCanvas("bigCanvas"); // not big yet canvas->setHeight(canvas, Window()->getInnerHeight()); canvas->setWidth(canvas, Window()->getInnerWidth()); freeCanvas(canvas); freeWindow(Window());