Documentation from canvas.h

ROV

Introduction

[top]

ROVLib - Easy applications from C

Copyright - © Jason Tribbeck / 7th ARM 1994-2001

Contributing authors - Jason Tribbeck

File - canvas.h

Type - core

Description

The canvas core system maintains windows, performing all common functions while allowing overrides for many of them.

The core system will translate all WIMP (screen) coordinates into offsets from the canvas origin, so if a mouse click event occurs, the mouse click handler is called with the coordinates changed so that they are relative to the canvas origin. This also filters through to the drawing subsystem so that during a canvas update or redraw, all drawing is relative to the canvas origin. This saves a lot of repetitive calculation.

The normal steps in creating and displaying a canvas are as follows:
 -  create the canvas
 -  set the canvas colours
 -  set the canvas flags
 -  set the canvas handlers
 -  make the canvas into a window
 -  display the canvas

In addition, WIMP window handles are translated into canvas handles where it is appropriate.

Note that the icon core system requires the canvas core system in order to function.

canvas_openstr (type definition)

[top]

Definition of a canvas open event (similar to the Wimp_OpenWindow event).

Fields:

 - int x0 - the left hand (screen) coordinate of the canvas.
 - int y0 - the bottom (screen) coordinate of the canvas.
 - int x1 - the right hand (screen) coordinate of the canvas.
 - int y1 - the top (screen) coordinate of the canvas (excluding the title bar).
 - int scx - the scroll bar x position.
 - int scy - the scroll bar y position.
 - int behind - the WIMP window handle of the window that this canvas is behind.
 - int flags - the canvas flags.

typedef struct {
  canvas c;
  int x0;
  int y0;
  int x1;
  int y1;
  int scx;
  int scy;
  int behind;
  int flags;
} canvas_openstr;

See also: Canvas flags

canvas_redrawstr (type definition)

[top]

Definition of a canvas redraw event (similar to the Wimp_GetRectangle response).

Fields:

 - canvas c - the canvas being redrawn
 - int x0 - the left hand (screen) coordinate of the canvas.
 - int y0 - the bottom (screen) coordinate of the canvas.
 - int x1 - the right hand (screen) coordinate of the canvas.
 - int y1 - the top (screen) coordinate of the canvas (excluding the title bar).
 - int scx - the scroll bar x position.
 - int scy - the scroll bar y position.
 - int gx0 - the left hand (canvas) coordinate of the area being redrawn.
 - int gy0 - the bottom (canvas) coordinate of the area being redrawn.
 - int gx1 - the right hand (canvas) coordinate of the area being redrawn.
 - int gy1 - the left (canvas) coordinate of the area being redrawn.

typedef struct {
  canvas c;
  int x0;
  int y0;
  int x1;
  int y1;
  int scx;
  int scy;
  int gx0;
  int gy0;
  int gx1;
  int gy1;
} canvas_redrawstr;

canvas_mousestr (type definition)

[top]

Definition of a canvas mouse event (similar to the Wimp_MouseClick event).

Fields:

 - int x - the (canvas) x coordinate of the mouse event.
 - int y - the (canvas) y coordinate of the mouse event.
 - int b - the mouse buttons being pressed.
 - int w - the WIMP window handle.
 - int i - the WIMP icon handle.

typedef struct {
  int x;
  int y;
  int b;
  int w;
  int i;
} canvas_mousestr;

canvas_caretstr (type definition)

[top]

Definition of a canvas caret event (similar to the Wimp_Caret event).

Fields:

 - int w - the WIMP window handle.
 - int i - the WIMP icon handle.
 - int x - the (canvas) x coordinate.
 - int y - the (canvas) y coordinate.
 - int flags - the caret flags.
 - int index - the index into the character string.

typedef struct {
  int w;
  int i;
  int x;
  int y;
  int flags;
  int index;
} canvas_caretstr;

canvas_keystr (type definition)

[top]

Definition of a canvas key event (similar to the Wimp_Key event).

Fields:

 - int w - the WIMP window handle.
 - int i - the WIMP icon handle.
 - int x - the (canvas) x coordinate.
 - int y - the (canvas) y coordinate.
 - int flags - the caret flags.
 - int index - the index into the character string.
 - int chcode - the character code.

typedef struct {
  int w;
  int i;
  int x;
  int y;
  int flags;
  int index;
  int chcode;
} canvas_keystr;

canvas_init

[top]

Initialises the canvas core system. This must be done before any canvasses are initialised.

void canvas_init(void);

canvas_create

[top]

Create a canvas giving width and height and title

Parameters:

 - int width - the width (in OS units).
 - int height - the height (in OS units).
 - char *title - the title of the canvas.

Returns:

 -  the created canvas.

Note - By default, the origin is bottom left. However, if the width is negative, the origin changes from the left to the right. Likewise, if the height is negative, the origin changes from the bottom to the top.

Note - This only creates the canvas structure in memory, but does not turn it into a WIMP window. This allows colours and certain attributes to be changed that must be changed before the window has been created.

canvas canvas_create(int width,
		     int height,
		     char *title);

canvas_createallocated

[top]

Create a canvas using a pre-created, but uninitialised canvas.

Parameters:

 - int width - is the width
 - int height - is the height
 - char *title - is the title.
 - canvas c - is the canvas.

Returns:

 -  the created canvas.

Note - This isn't designed for use by user programs.

canvas canvas_createallocated(int width,
			      int height,
			      char *title,
			      canvas c);

See also: canvas_create(), canvas_removeallocated()

canvas_find

[top]

Finds a canvas based on the WIMP window handle.

Parameters:

 - int handle - is the window handle

Returns:

 -  the canvas to which it refers, or NULL if not found.

canvas canvas_find(int handle);

uint (definition)

[top]

Definition of uint

#define uint unsigned int

canvas_colour

[top]

Sets the colour of a canvas

Parameters:

 - canvas c - the canvas to set the colour of.
 - int col - the colour (WIMP colour number, 255 = 'transparent').

Note - The canvas must not have been made into a window.

void canvas_colour(canvas c,
		   int col);

See also: canvas_setcaretcolour(), canvas_setoutlinecolour()

canvas_setoutlinecolour

[top]

Sets the outline colour of a canvas

Parameters:

 - canvas c - the canvas to set the outline colour of.
 - int col - the colour (WIMP colour number, 255 = 'none').

Note - The canvas must not have been made into a window.

void canvas_setoutlinecolour(canvas c,
			     int col);

See also: canvas_colour(), canvas_setcaretcolour()

canvas_setcaretcolour

[top]

Sets the canvas highlighted colour.

Parameters:

 - canvas c - the canvas to set the highlighted colour
 - int col - the colour to set it to (WIMP colour number).

Note - The canvas must not have been made into a window.

void canvas_setcaretcolour(canvas c,
			   int col);

See also: canvas_colour(), canvas_setoutlinecolour()

canvas_setflags

[top]

Sets the window flags of the canvas

Parameters:

 - canvas c - the canvas to set the flags
 - uint bic - the inverse AND value of the flags
 - uint eor - the EOR value of the flags

Note - The flags is changed according to the following algorihtm: new = (old AND NOT (bic)) EOR eor.

Note - The canvas click style flags are held in bits 16 to 19.

Note - The canvas must not have been made into a window.

void canvas_setflags(canvas c,
		     uint bic,
		     uint eor);

See also: Canvas click styles, Canvas flags

canvas_setspritearea

[top]

Sets the sprite area pointer of the canvas.

Parameters:

 - canvas c - the canvas to set the sprite area of.
 - void *spr_area - the pointer to the sprite area

Note - The canvas must not have been made into a window.

void canvas_setspritearea(canvas c,
			  void *spr_area);

canvas_make

[top]

Makes the canvas into a window.

Parameters:

 - canvas c - the canvas to make into a window

void canvas_make(canvas c);

See also: canvas_makeatlocation(), canvas_makeatlocationsize()

canvas_makeatlocation

[top]

Makes the canvas into a window, giving a default start location.

Parameters:

 - canvas c - the canvas to make into a window.
 - int x - the left hand x coordinate of the window (in screen coordinates).
 - int y - the bottom x coordinate of the window (in screen coordinates).

Note - This is primarily used to allow the resize-to-full icon to position the window at certain coordinates if the window has always been full size.

void canvas_makeatlocation(canvas c,
			   int x,
			   int y);

See also: canvas_make(), canvas_makeatlocationsize(), canvas_reopen()

canvas_makeatlocationsize

[top]

Makes the canvas into a window, giving a default start location and size.

Parameters:

 - canvas c - the canvas to make into a window.
 - int x - the left hand x coordinate of the window (in screen coordinates).
 - int y - the bottom x coordinate of the window (in screen coordinates).
 - int w - the width of the window.
 - int h - the height of the window.

void canvas_makeatlocationsize(canvas c,
			       int x,
			       int y,
			       int w,
			       int h);

See also: canvas_make(), canvas_makeatlocation(), canvas_reopen()

canvas_settitlelocation

[top]

Sets the pointer to the canvas title to your own area, rather than the canvas system's own allocated area.

Parameters:

 - canvas c - the canvas to set the title pointer.
 - char *title - the text pointer of the canvas title.

Note - This allows you to extend the memory used to over the 64 bytes that is reserved for each canvas. However, it means that the canvas_settitle() function will not change your memory's text, but you can still use the function to redraw the title.

void canvas_settitlelocation(canvas c,
			     char *title);

See also: canvas_settitle()

canvas_setminsize

[top]

Sets the canvas' minimum size.

Parameters:

 - canvas c - the canvas.
 - int width - the minimum width.
 - int height - the maximum height.

Note - The canvas must not have been made into a window.

void canvas_setminsize(canvas c,
		       int width,
		       int height);

See also: canvas_setfullsize(), canvas_setsize()

canvas_handle

[top]

Gets the WIMP window handle of the canvas.

Parameters:

 - canvas c - the canvas to get the handle.

Returns:

 -  the WIMP window handle.

int canvas_handle(canvas c);

canvas_setsize

[top]

Sets the maximum size of the canvas.

Parameters:

 - canvas c - the canvas to set the size.
 - int width - the width to set it to.
 - int height - the height to set it to.

Note - If the canvas has not been created, then scrollbars are automatically added to the canvas.

void canvas_setsize(canvas c,
		    int width,
		    int height);

See also: canvas_setfullsize(), canvas_setminsize()

canvas_setfullsize

[top]

Sets the maximum size of the canvas, giving all bounds.

Parameters:

 - canvas c - the canvas to set the size.
 - int x0 - the left hand x coordinate.
 - int y0 - the bottom y coordinate.
 - int x1 - the right hand x coordinate.
 - int y1 - the top y coordinate

Note - If the canvas has not been created, then scrollbars are automatically added to the canvas.

void canvas_setfullsize(canvas c,
			int x0,
			int y0,
			int x1,
			int y1);

See also: canvas_setminsize(), canvas_setsize()

canvas_open

[top]

Opens a canvas with the given open paramters.

Parameters:

 - canvas c - the canvas to open.
 - canvas_openstr *open_str - the open parameters structure.

void canvas_open(canvas c,
		 canvas_openstr *open_str);

See also: canvas_opencentre(), canvas_opencentrebottom(), canvas_opentop(), canvas_reopen(), typedef struct canvas_openstr

canvas_close

[top]

Closes a canvas.

Parameters:

 - canvas c - the canvas to close

void canvas_close(canvas c);

canvas_remove

[top]

Closes a canvas, and removes it from the WIMP, and frees the memory used.

Parameters:

 - canvas c - the canvas to remove.

void canvas_remove(canvas c);

canvas_removeallocated

[top]

Closes a canvas, removes it from the WIMP, but does not remove the memory. It is the removal of canvas_createallocated().

Parameters:

 - canvas c - the canvas to create.

void canvas_removeallocated(canvas c);

See also: canvas_createallocated()

canvas_forceredraw

[top]

Forces the redraw of the canvas' display.

Parameters:

 - canvas c - the canvas to redraw

void canvas_forceredraw(canvas c);

canvas_redraw

[top]

Redraws a section of the canvas' display.

Parameters:

 - canvas c - the canvas to redraw.
 - int x0 - the left hand coordinate.
 - int y0 - the bottom coordinate.
 - int x1 - the right hand coordinate.
 - int y1 - the top coordinate.

void canvas_redraw(canvas c,
		   int x0,
		   int y0,
		   int x1,
		   int y1);

See also: canvas_forceredraw(), canvas_forceupdate(), canvas_redrawhandler(), canvas_update()

canvas_forceupdate

[top]

Forces the update of the canvas' display.

Parameters:

 - canvas c - the canvas to redraw
 - ... - [proc] the function to call to do the update.

Note - The function is normally defined as: void update_func(canvas c, int x0, int y0, int x1, int y1); but can have a short cut of void update_func();

Note - The canvas system calls Wimp_UpdateWindow and Wimp_GetRectangle for you, and calls the function with each of the rectangles.

void canvas_forceupdate(canvas c,
			...);

See also: canvas_forceredraw(), canvas_redraw(), canvas_redrawhandler(), canvas_update()

canvas_update

[top]

Updates the section of the canvas' display.

Parameters:

 - canvas c - the canvas to redraw.
 - int x0 - the left hand coordinate.
 - int y0 - the bottom coordinate.
 - int x1 - the right hand coordinate.
 - int y1 - the top coordinate.
 - ... - [proc] the function to call to do the update.

Note - The function is normally defined as: void update_func(canvas c, int x0, int y0, int x1, int y1); but can have a short cut of void update_func();

Note - The canvas system calls Wimp_UpdateWindow and Wimp_GetRectangle for you, and calls the function with each of the rectangles.

void canvas_update(canvas c,
		   int x0,
		   int y0,
		   int x1,
		   int y1,
		   ...);

See also: canvas_forceredraw(), canvas_forceupdate(), canvas_redraw(), canvas_redrawhandler()

canvas_opencentre

[top]

Opens a canvas in the centre of the screen, at the top of the stack.

Parameters:

 - canvas c - the canvas to open.

void canvas_opencentre(canvas c);

See also: canvas_open(), canvas_opencentrebottom(), canvas_opentop(), canvas_reopen()

canvas_opentop

[top]

Opens a canvas at the top of the stack, using the given coordinates.

Parameters:

 - canvas c - the canvas to open.
 - int x - the left hand screen coordinate.
 - int y - the bottom screen coordinate.

void canvas_opentop(canvas c,
		    int x,
		    int y);

See also: canvas_open(), canvas_opencentre(), canvas_opencentrebottom(), canvas_reopen()

canvas_opencentrebottom

[top]

Opens a canvas in the centre of the screen, at the bottom of the stack.

Parameters:

 - canvas c - the canvas to open.

void canvas_opencentrebottom(canvas c);

See also: canvas_open(), canvas_opencentre(), canvas_opentop(), canvas_reopen()

canvas_reopen

[top]

Opens a canvas at its current position, but at the top of the stack.

Parameters:

 - canvas c - the canvas to open.

Note - If the canvas has not been opened before, then it is opened at its 'default' position, which you can set using canvas_makeatlocation() and canvas_makeatlocationsize().

void canvas_reopen(canvas c);

See also: canvas_makeatlocation(), canvas_makeatlocationsize(), canvas_open(), canvas_opencentre(), canvas_opencentrebottom(), canvas_opentop()

canvas_settitle

[top]

Sets the title of the canvas, and redraws it (if the window is open).

Parameters:

 - canvas c - the canvas to redraw.
 - char *title - the title to set it to.

void canvas_settitle(canvas c,
		     char *title);

See also: canvas_settitlelocation()

canvas_getcanvasstate

[top]

Gets the state of the canvas.

Parameters:

 - canvas c - the canvas.
 - canvas_openstr *open_str - the block to store the information.

void canvas_getcanvasstate(canvas c,
			   canvas_openstr *open_str);

canvas_getpointerlocation

[top]

Gets the coordinates of the mouse.

Parameters:

 - canvas c - the canvas.
 - int *xp - the pointer to the integer to fill in with the x coordinate.
 - int *yp - the pointer to the integer to fill in with the y coordinate.

void canvas_getpointerlocation(canvas c,
			       int *xp,
			       int *yp);

See also: canvas_getlocation(), canvas_getorigin(), canvas_getrawmouse()

canvas_getlocation

[top]

Converts screen coordinates into canvas coordinates.

Parameters:

 - canvas c - the canvas.
 - int *xp - the pointer to the x coordinate to convert.
 - int *yp - the pointer to the y coordinate to convert.

void canvas_getlocation(canvas c,
			int *xp,
			int *yp);

See also: canvas_getorigin(), canvas_getpointerlocation()

canvas_getorigin

[top]

Gets the origin of the canvas as screen coordinates.

Parameters:

 - canvas c - the canvas.
 - int *xp - the pointer to the integer to fill in with the x coordinate.
 - int *yp - the pointer to the integer to fill in with the y coordinate.

void canvas_getorigin(canvas c,
		      int *xp,
		      int *yp);

See also: canvas_getlocation(), canvas_getpointerlocation()

canvas_claimcaret

[top]

Gets the canvas to claim the caret.

Parameters:

 - canvas c - the canvas to claim the caret.

void canvas_claimcaret(canvas c);

canvas_getrawmouse

[top]

Gets the raw mouse coordinates (i.e. screen coordinates, not canvas coordinates)

Parameters:

 - canvas_mousestr *mouse_str - the pointer to the block to fill in the coordinates

void canvas_getrawmouse(canvas_mousestr *mouse_str);

See also: canvas_getpointerlocation()

canvas_idhandle

[top]

Gets the unique ID handle of a canvas.

Parameters:

 - canvas c - the canvas to get the handle of.

Returns:

 -  the unique ID handle.

Note - This can be a pointer cast as an integer to the information that is used to display the canvas.

int canvas_idhandle(canvas c);

See also: canvas_setidhandle()

canvas_setidhandle

[top]

Sets the unique ID handle of a canvas.

Parameters:

 - canvas c - the canvas to set the handle of.
 - int id - the unique ID handle

Note - This can be a pointer cast as an integer to the information that is used to display the canvas.

void canvas_setidhandle(canvas c,
			int id);

See also: canvas_idhandle()

canvas_templateopen

[top]

Opens a template file

Parameters:

 - char *file - the name of the template file.

Returns:

 -  status - 0 for failure, 1 for success.

Note - This is experimental, and has not been fully debugged.

int canvas_templateopen(char *file);

See also: canvas_templatecanvas(), canvas_templatesetspritearea()

canvas_templatecanvas

[top]

Creates a canvas from a template file.

Parameters:

 - char *name - the name of the template in the template file

Note - This is experimental, and has not been fully debugged.

canvas canvas_templatecanvas(char *name);

See also: canvas_templateopen(), canvas_templatesetspritearea()

canvas_templatesetspritearea

[top]

Sets the sprite area for subsequent template creation.

Parameters:

 - void *spr_area - the pointer to the sprite area.

Note - This is experimental, and has not been fully debugged.

void canvas_templatesetspritearea(void *spr_area);

See also: canvas_setspritearea(), canvas_templatecanvas(), canvas_templateopen()

canvas_getcaretstate

[top]

Gets the state of the caret

Parameters:

 - canvas_caretstr *caret_str - the pointer to the block to hold the caret state.

void canvas_getcaretstate(canvas_caretstr *caret_str);

canvas_windowptr

[top]

Gets the raw window information of the canvas.

Parameters:

 - canvas c - the canvas to get the information of.

Returns:

 -  the pointer to the window informaton.

Note - This is only used internally.

void * canvas_windowptr(canvas c);

canvas_redrawmode (external variable)

[top]

This indicates what the current redraw mode is. 0 means it is a redraw, 1 means it is an update.

Note - This is normally used by redraw functions to determine how the redraw should be performed.

extern int canvas_redrawmode;

canvas_addhandler

[top]

This adds a handler to the particular canvas event.

Parameters:

 - canvas c - the canvas to add the handler to
 - int event_id - the event ID
 - ... - the function

Returns:

 -  the old handler function pointer.

void * canvas_addhandler(canvas c,
			 int event_id,
			 ...);

See also: Canvas handler values, canvas_carethandler(), canvas_clickhandler(), canvas_closehandler(), canvas_helphandler(), canvas_keyhandler(), canvas_loadhandler(), canvas_menuhandler(), canvas_openhandler(), canvas_pointerhandler(), canvas_redrawhandler(), canvas_savehandler(), canvas_scrollhandler()

canvas_iconbar (external variable)

[top]

This is the icon bar canvas. It is a static area of memory holding the handlers for the icon bar.

Note - Do not use. Use CANVAS_ICONBAR instead.

extern void * canvas_iconbar;

See also: CANVAS_ICONBAR

canvas_iconbarright (external variable)

[top]

This is the icon bar canvas. It is a static area of memory holding the handlers for the icon bar, but with a different window handle (for creating icons).

Note - Do not use. Use CANVAS_ICONBARRIGHT instead.

extern void * canvas_iconbarright;

See also: CANVAS_ICONBARRIGHT

CANVAS_ICONBAR (definition)

[top]

The canvas for the icon bar.

#define CANVAS_ICONBAR ((canvas)(&canvas_iconbar))

See also: CANVAS_ICONBARRIGHT

CANVAS_ICONBARRIGHT (definition)

[top]

The canvas for the right hand side of the icon bar (used to create icons)

Note - This basically is the same as CANVAS_ICONBAR, except the window handle is -2.

#define CANVAS_ICONBARRIGHT ((canvas)(&canvas_iconbarright))

See also: CANVAS_ICONBAR

ctrl (definition)

[top]

Definition of control codes 'A' thru 'Z'

Parameters:

 - j - the ASCII uppercase character to get the control code for.

Note - To use this, use if(k->chcode == ctrl('F'))...

#define ctrl(j)	(j - 64)

canvas_null (definition)

[top]

The null canvas

#define canvas_null	(0)

canvas_redrawhandler (function pointer)

[top]

CANVAS_REDRAWHANDLER - called when the canvas needs redrawing.

Parameters:

 - canvas c - the canvas needing to be redrawn.
 - int x0 - the left hand (canvas) coordinate.
 - int y0 - the bottom (canvas) coordinate.
 - int x1 - the right hand (canvas) coordinate.
 - int y1 - the top (canvas) coordinate.

Note - The canvas system calls Wimp_RedrawWindow and Wimp_GetRectangle for you, and calls this function for each of the rectangles.

Note - The default is not to perform any redrawing.

Note - This must be called before the canvas is made into a window. The Wimp_Redraw flags of the window is automatically set.

typedef void (* canvas_redrawhandler)(canvas c,
				      int x0,
				      int y0,
				      int x1,
				      int y1);

See also: CANVAS_REDRAWHANDLER, canvas_addhandler()

canvas_openhandler (function pointer)

[top]

CANVAS_OPENHANDLER - called when the canvas needs opening (moving, resizing).

Parameters:

 - canvas c - the canvas that is being opened/moved.
 - canvas_openstr *open_str - the block of information where it is being moved to.

Note - The default is to open the canvas for you. Only override this default if your canvas needs special movement rules.

typedef void (* canvas_openhandler)(canvas c,
				    canvas_openstr *open_str);

See also: CANVAS_OPENHANDLER, canvas_addhandler()

canvas_closehandler (function pointer)

[top]

CANVAS_CLOSEHANDLER - called when the canvas needs closing.

Parameters:

 - canvas c - the canvas being closed.

Note - The default is to close the canvas for you. Only override this default if your canvas needs special closing rules.

typedef void (* canvas_closehandler)(canvas c);

See also: CANVAS_CLOSEHANDLER, canvas_addhandler()

canvas_pointerhandler (function pointer)

[top]

CANVAS_POINTERHANDLER - called when the canvas enters or leaves the window.

Parameters:

 - canvas c - the canvas with the pointer entering or leaving.
 - int enter - gives whether the pointer is entering or leaving the canvas. Non-zero indicates entering the canvas.

Note - The default is to do nothing.

typedef void (* canvas_pointerhandler)(canvas c,
				       int enter);

See also: CANVAS_POINTERHANDLER, Pointer event values, canvas_addhandler()

canvas_clickhandler (function pointer)

[top]

CANVAS_CLICKHANDLER - called when SELECT or ADJUST is clicked on the window.

Parameters:

 - canvas c - the canvas with the click event.
 - canvas_mousestr *mouse_str - the block of information holding the click event.

Note - The default is to do nothing.

typedef void (* canvas_clickhandler)(canvas c,
				     canvas_mousestr *mouse_str);

See also: CANVAS_CLICKHANDLER, canvas_addhandler()

canvas_keyhandler (function pointer)

[top]

CANVAS_KEYHANDLER - called when the canvas is issued a key event from the WIMP.

Parameters:

 - canvas c - the canvas with the key event.
 - canvas_keystr *key_str - the block of information holding the key event.

Note - The default is to do nothing.

typedef void (* canvas_keyhandler)(canvas c,
				   canvas_keystr *key_str);

See also: CANVAS_KEYHANDLER, canvas_addhandler()

canvas_menuhandler (function pointer)

[top]

CANVAS_MENUHANDLER - called when MENU is clicked on the window

Parameters:

 - canvas c - the canvas with MENU being pressed in it.
 - canvas_mousestr *mouse_str - the block of information holding the click event.

Note - The default is to do nothing.

typedef void (* canvas_menuhandler)(canvas c,
				    canvas_mousestr *mouse_str);

See also: CANVAS_MENUHANDLER, canvas_addhandler()

canvas_carethandler (function pointer)

[top]

CANVAS_CARETHANDLER - called when the caret is gained or lost.

Parameters:

 - canvas c - the canvas with the caret event.
 - canvas_caretstr *caret_str - the block of information holding the caret event.
 - int gain - gives whether the canvas is gaining or losing the caret. Non-zero indicates gaining the caret.

Note - The default is to do nothing.

typedef void (* canvas_carethandler)(canvas c,
				     canvas_caretstr *caret_str,
				     int gain);

See also: CANVAS_CARETHANDLER, Caret event values, canvas_addhandler()

canvas_loadhandler (function pointer)

[top]

CANVAS_LOADHANDLER - called when the canvas is asked to load a file (typically when a user drops a file onto it from the filer).

Parameters:

 - canvas c - the canvas being asked to load a file.
 - char *file_name - the name of the file.
 - int file_type - the type of the file.
 - int file_size - the size of the file.

Note - The default is to do nothing.

typedef void (* canvas_loadhandler)(canvas c,
				    char *file_name,
				    int file_type,
				    int file_size);

See also: CANVAS_LOADHANDLER, canvas_addhandler()

canvas_savehandler (function pointer)

[top]

CANVAS_SAVEHANDLER - called when the canvas is asked to save a file (typically when a user drops a file onto it from another application).

Parameters:

 - canvas c - the canvas being asked to save a file.
 - char *file_name - the name of the file.
 - int file_type - the type of the file.
 - int file_size - the size of the file.

Note - The default is to do nothing.

typedef void (* canvas_savehandler)(canvas c,
				    char *file_name,
				    int file_type,
				    int file_size);

See also: CANVAS_SAVEHANDLER, canvas_addhandler()

canvas_helphandler (function pointer)

[top]

CANVAS_HELPHANDLER - called when !Help requires text to display.

Parameters:

 - canvas c - the canvas being requested for help.
 - canvas_mousestr *mouse_str - the block of information holding the help request event.

Note - The default is to do nothing.

typedef void (* canvas_helphandler)(canvas c,
				    canvas_mousestr *mouse_str);

See also: CANVAS_HELPHANDLER, canvas_addhandler()

canvas_scrollhandler (function pointer)

[top]

CANVAS_SCROLLHANDLER - called when scrolling window, and the CANVAS_SCROLLREQUEST flag has been set.

Parameters:

 - canvas c - the canvas being requested for scrolling.
 - canvas_openstr *open_str - the block of information holding the next open event.
 - int xdir - the scroll event x direction.
 - int ydir - the scroll event y direction.

Note - The default is to do nothing.

typedef void (* canvas_scrollhandler)(canvas c,
				      canvas_openstr *open_str,
				      int xdir,
				      int ydir);

See also: CANVAS_SCROLLHANDLER, Canvas scroll directions, canvas_addhandler()

Pointer event values

[top]
#define CANVAS_POINTERLEFT	(0)
#define CANVAS_POINTERENTERED	(1)

See also: canvas_pointerhandler()

Caret event values

[top]
#define CANVAS_LOSTCARET	(0)
#define CANVAS_GAINEDCARET	(1)

See also: canvas_carethandler()

Canvas flags

[top]
#define CANVAS_OLDTITLEBAR      (1<<0)
#define CANVAS_MOVEABLE		(1<<1)
#define CANVAS_OLDVSCROLL	(1<<2)
#define CANVAS_OLDHSCROLL	(1<<3)
#define CANVAS_AUTOREDRAW	(1<<4)
#define CANVAS_PANE		(1<<5)
#define CANVAS_DRAGOFFSCREEN	(1<<6)
#define CANVAS_OLDNOBACKCLOSE	(1<<7)
#define CANVAS_SCROLLREQUEST	(1<<8)
#define CANVAS_SCROLLNOREPEAT	(1<<9)
#define CANVAS_USEGCOL		(1<<10)
#define CANVAS_MAKEWINDOWBOTTOM	(1<<11)
#define CANVAS_GENERATEHOTKEYS	(1<<12)
#define CANVAS_FORCEONSCREEN	(1<<13)
#define CANVAS_IGNORERHEXTENT	(1<<14)
#define CANVAS_IGNOREBOTEXTENT	(1<<15)
#define CANVAS_OPENED		(1<<16)
#define CANVAS_FULLYVISIBLE	(1<<17)
#define CANVAS_OPENEDFULLSIZE	(1<<18)
#define CANVAS_TOGGLESIZED	(1<<19)
#define CANVAS_HASINPUTFOCUS	(1<<20)
#define CANVAS_FORCEDONSCREEN	(1<<21)
#define CANVAS_BACK		(1<<24)
#define CANVAS_CLOSE		(1<<25)
#define CANVAS_TITLEBAR		(1<<26)
#define CANVAS_TOGGLE		(1<<27)
#define CANVAS_VSCROLL		(1<<28)
#define CANVAS_RESIZE		(1<<29)
#define CANVAS_HSCROLL		(1<<30)
#define CANVAS_NEWFLAGS		(1<<31)
#define CANVAS_CONTROLSFLAGS	(0xff000000U)

See also: canvas_setflags()

Canvas click styles

[top]
#define CANVAS_NOCLICKS		(0x00000)
#define CANVAS_CONTINUOUS	(0x10000)
#define CANVAS_AUTOREPEAT	(0x20000)
#define CANVAS_CLICK		(0x30000)
#define CANVAS_RELEASE		(0x40000)
#define CANVAS_DOUBLECLICK	(0x50000)
#define CANVAS_CLICKDRAG	(0x60000)
#define CANVAS_RELEASEDRAG	(0x70000)
#define CANVAS_DOUBECLICKDRAG	(0x80000)
#define CANVAS_CLICKDOUBLEDRAG	(0xa0000)
#define CANVAS_GAININPUT	(0xf0000)
#define CANVAS_MOUSEFLAGS	(0xf0000)

See also: canvas_setflags()

Canvas handler values

[top]
#define CANVAS_REDRAWHANDLER	(0)
#define CANVAS_OPENHANDLER	(1)
#define CANVAS_CLOSEHANDLER	(2)
#define CANVAS_POINTERHANDLER	(3)
#define CANVAS_CLICKHANDLER	(4)
#define CANVAS_KEYHANDLER	(5)
#define CANVAS_MENUHANDLER	(6)
#define CANVAS_CARETHANDLER	(7)
#define CANVAS_LOADHANDLER	(8)
#define CANVAS_SAVEHANDLER	(9)
#define CANVAS_HELPHANDLER	(10)
#define CANVAS_SCROLLHANDLER	(11)

See also: canvas_addhandler()

Canvas scroll directions

[top]
#define CANVAS_SCROLLPAGELEFT	(-2)
#define CANVAS_SCROLLLEFT	(-1)
#define CANVAS_SCROLLNULL	(0)
#define CANVAS_SCROLLRIGHT	(1)
#define CANVAS_SCROLLPAGERIGHT	(2)
#define CANVAS_SCROLLPAGEDOWN	(-2)
#define CANVAS_SCROLLDOWN	(-1)
#define CANVAS_SCROLLNULL	(0)
#define CANVAS_SCROLLUP		(1)
#define CANVAS_SCROLLPAGEUP	(2)

See also: canvas_scrollhandler()


Generated Thu Feb 7 23:22:51 2002