Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

Canvas Class Reference

Inherits Control.

Inherited by GroupBox, and ListBox.

List of all members.


Detailed Description

A user-drawn object.

You are responsible for deleting the background.


Primitive Emulators

These methods draw primitives as they would be drawn by other OS/skin-specific controls.

enum  DB { ThinSunken, ThinRaised, Focus }
 The type of boxes that can be drawn with drawbox. More...

void listboxColumnHeaderDraw (int sx, int sy, int ex, int ey, bit highlight, bit pressed, char[] name)
 Draw a listbox column header item.

void listboxColumnArrowDraw (int sx, int sy, int ex, int ey, bit down)
 Draw the listbox column header sorting arrow.

void listboxItemDraw (int sx, int sy, int ex, int ey, bit sortColumn)
 Draw a listbox item.

void spinnerDraw (int sx, int sy, int ex, int ey, bit upPressed, bit downPressed, bit upHighlight, bit downHighlight)
 Draw a spinner button.

void buttonDraw (int sx, int sy, int ex, int ey, bit down, bit focus)
 Draw a button border.

void buttonBorder (out int width, out int height)
 Get the button border size.

void buttonClientRegion (inout int sx, inout int sy, inout int ex, inout int ey)
 Get the button client region from the input.

void buttonPressedOffset (inout int x, inout int y)
 Add the content offset when the button is pressed.

void groupboxDraw (int sx, int sy, int ex, int ey, char[] caption)
 Draw a group box.

void groupboxBorder (out int width, out int height)
 Get the group box border size.

void groupboxClientRegion (inout int sx, inout int sy, inout int ex, inout int ey)
 Get the groupbox client region from the input.

void drawbox (int sx, int sy, int ex, int ey, DB type, bit filled)
 Draw a box using a given type.

void drawboxBorder (out int width, out int height, DB type)
 Get the border size of the drawbox.

void drawboxClientRegion (inout int sx, inout int sy, inout int ex, inout int ey, DB type)
 Get the client region of a certain type.

void statusbarBackgroundDraw (int sx, int sy, int ex, int ey)
 Draw a status bar background.

void statusbarPaneDraw (int sx, int sy, int ex, int ey)
 Draw a status bar pane, which either surrounds or delimits entries in the status bar.

void treeBoxCrossDraw (int x, int y, bit opened)
 Draw a tree box control cross.

void treeBoxCrossSize (out int width, out int height, bit opened)
 Retrieve the size in pixels of the control cross.

int treeBoxCrossWidth (bit opened)
 Return the width in pixels of the control cross.

int treeBoxCrossHeight (bit opened)
 Return the height in pixels of the control cross.


Public Types


Public Member Functions

 this (Control parent)
 Register itself in the parent and then create a window.

 ~this ()
 Destroy the canvas.

void beginPaint ()
 Start painting - only allowed in response to an onPaint message.

void endPaint ()
 Finish painting.

bit doubleBuffer ()
 Get the current double-buffering value.

void doubleBuffer (bit value)
 Set double-buffering.

Text Printing
void textPrint (int x, int y, char[] string)
 Print out a line of text.

void textFormat (int x, int y, char[] format,...)
 Print out some formatted text.

void textFormat (int x, int y, char[] format, va_list args)
 Print out some formatted text.

void textPrintEllipses (int x, int y, int w, int mark, char[] string)
 Print text in a region, using ellipses at the start and end of the text to remove what does not fit.

int textWidthEllipses (int w, int mark, char string[])
 Return the width in pixels of ellipses-printed text.

void textAlign (char[] value)
 Text alignment; can be '<' for left (default), '|' for center, '>' for right, '^' for vertical top (default), 'v' for vertical bottom, 'b' for vertical baseline.

void textColor (int r, int g, int b)
 Set the text color.

void textColor (Color c)
 Set the text color.

int textWidth (char[] text)
 Get the width in pixels of a string of text.

int textHeight ()
 The height in pixels of the current font.

Pen Parameters
void penWidth (int value)
 Change the width of the pen in pixels.

void penStyle (char value[])
 Set the style of the pen, one of:.

void penClear ()
 Set to no pen.

void penColor (int r, int g, int b)
 Set the pen color.

void penColor (Color c)
 Set the pen color.

Brush Parameters
void brushClear ()
 Set to a clear brush.

void brushColor (int r, int g, int b)
 Set to a solid color brush.

void brushColor (Color c)
 Set to a solid color brush.

Drawing Operations
void circle (int x, int y, int radius)
 Draw a circle using the pen in the outline and the brush to fill.

void circle (int x, int y, int width, int height)
 Draw a centered ellipse using the pen in the outline and the brush to fill.

void clear (int r, int g, int b)
 Clear the whole region to a single color.

void clear (Color c)
 Clear to a single color.

void ellipse (int sx, int sy, int ex, int ey)
 Draw an ellipse using the pen to outline and the brush to fill.

void line (int sx, int sy, int ex, int ey)
 Draw a line using the current pen.

void line (int[] points)
 Draw a series of lines using the current pen; each point is an x, y pair.

void polygon (int[] points)
 Draw a polygon using the current pen and fill it with the current brush; each point is an x, y pair.

void polygon (int ax, int ay, int bx, int by, int cx, int cy)
 Draw a triangle using the current pen and fill it with the current brush.

void roundRect (int left, int top, int right, int bottom, int diameter)
 Draw a rounded rectangle outlined with the current pen and filled using the current brush.

void roundRect (int left, int top, int right, int bottom, int width, int height)
 Draw a rounded rectangle outlined with the current pen and filled using the current brush.

void rect (int left, int top, int right, int bottom)
 Draw a rectangle outlined with the current pen and filled using the current brush.


Static Public Member Functions

 this ()
 Setup the window class for instances.


Member Enumeration Documentation

enum Canvas::DB
 

The type of boxes that can be drawn with drawbox.

Enumeration values:
ThinSunken  A thin inset border, as seen with Windows status bars.
ThinRaised  A thin raised border.
Focus  A keyboard focus border.


Member Function Documentation

void Canvas.doubleBuffer bit  value  ) 
 

Set double-buffering.

When true (the default), painting first goes to a temporary bitmap that is then blitted on endPaint. This removes flicker, but is more expensive than single-buffering.

void Canvas.penStyle char  value[]  ) 
 

Set the style of the pen, one of:.


null - Invisible.
"---" - Solid (default).
"- -" - Dash. The width is set to one.
"..." - Dotted. The width is set to one.
"-.-" - Alternating dashes and dots. The width is set to one.
"-.." - Alternating dashes and double-dots. The width is set to one.

void Canvas.textPrintEllipses int  x,
int  y,
int  w,
int  mark,
charstring  []
 

Print text in a region, using ellipses at the start and end of the text to remove what does not fit.

It centers these ellipses on the mark, so a mark of zero always displays the start of the text, a mark of string length always displays the end, and a mark in the middle shows that area. w is the width of the region.

int Canvas.textWidthEllipses int  w,
int  mark,
char  string[]
 

Return the width in pixels of ellipses-printed text.

Parameters:
w The maximum width of the region.
mark The center to base ellipses around.
string The text to measure.

void Canvas.treeBoxCrossDraw int  x,
int  y,
bit  opened
 

Draw a tree box control cross.

Parameters:
x The starting horizontal coordinate.
y The starting vertical coordinate.
opened Whether the cross is opened (true) or closed (false).


The documentation for this class was generated from the following file:
Generated on Thu Sep 4 13:12:51 2003 for dig by doxygen 1.3.2