Contents Up Previous Next

wxCanvas is-a wxWindow

A subwindow used for drawing arbitrary graphics. It must be the child of a wxFrame.

wxCanvas dc
wxCanvas create
wxCanvas set-scrollbars
wxCanvas scroll
wxCanvas on-char
wxCanvas on-event
wxCanvas on-paint
wxCanvas on-size


wxCanvas dc

wxCanvasDC dc

The device context handle belonging to the canvas. The device context must be retrieved before anything can be drawn on the canvas. If your drawing function is parameterized by a device context, you will be able to pass other types of device context to your drawing routine, such as PostScript and Windows metafile device contexts.


wxCanvas create

bool ( canvas-create)

Creates a canvas for drawing graphics on. The following slots may be initialized.

The value of style can be a bit list of the following values:

wxBORDER Gives the canvas a thin border (Windows 3 and Motif only).
wxRETAINED Gives the canvas a wxWindows-implemented backing store, making repainting much faster but at a potentially costly memory premium (XView and Motif only).
wxBACKINGSTORE Gives the canvas an X-implemented backing store (XView and Motif only). The X server may choose to ignore this request, whereas wxRETAINED is always implemented under X.


wxCanvas set-scrollbars

bool ( set-scrollbars long x-unit-size long y-unit-size
long x-length long y-length long x-page-length long y-page-length)

Set the scrollbars for the given canvas. The first argument pair specifies the number of pixels per logical scroll unit, that is, the number of pixels to scroll when a scroll arrow is clicked. If either is zero or less, that scrollbar will not appear. The second pair specifies the size of the virtual canvas in logical scroll units. The third pair of arguments specify the number of scroll units per page, that is, the amount to scroll by when the scrollbar is page-scrolled (usually by clicking either side of the scrollbar handle).


wxCanvas scroll

bool ( scroll long x-position long y-position)

Scroll the canvas programmatically to the given scroll position. To convert from pixel position to scroll position, divide the pixel position by the scroll unit size you passed to set-scrollbars.


wxCanvas on-char

void ( on-char wxKeyEvent event)

Allows interception of key events. See also wxKeyEvent.


wxCanvas on-event

void ( on-event wxMouseEventevent)

Allows interception of mouse events. See also wxMouseEvent.


wxCanvas on-paint

void ( on-paint)

Override this handler to respond to paint events (sent when the canvas needs repainting).


wxCanvas on-size

void ( on-size long width longheight)

The function is called with the canvas width and height when the canvas is resized.