Documentation from toolbar.h

ROV

Introduction

[top]

ROV - Easy applications from C

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

Contributing authors - Jason Tribbeck

File - toolbar.h

Type - subsystem

Description

The toolbar subsystem provides a toolbar system, where a canvas can have a number of toolbars attached to it in different locations, moving with the main canvas. The toolbar subsystem also provides toolbar contexts, where a toolbar can change context, such as context sensitive tools. Context sensitive tool windows are achieved by scrolling them for each of the contexts.

There are also a number of built-in icons for use with the toolbar system, arranged in such a way as to only build in the icons that are in use.

Jut to add to the confusion, a window that allows toolbars is classed a toolbar. A window inside a toolbar is a toolwin.

Built in icons

[top]
extern char toolspr_bass[],
	 toolspr_bin[],
	 toolspr_bold[],
	 toolspr_copy[],
	 toolspr_crochet[],
	 toolspr_cross[],
	 toolspr_cut[],
	 toolspr_down[],
	 toolspr_end[],
	 toolspr_erase[],
	 toolspr_ffwd[],
	 toolspr_flat[],
	 toolspr_insert[],
	 toolspr_italic[],
	 toolspr_left[],
	 toolspr_lips[],
	 toolspr_mail[],
	 toolspr_minus[],
	 toolspr_paste[],
	 toolspr_phone[],
	 toolspr_play[],
	 toolspr_plus[],
	 toolspr_pointer[],
	 toolspr_print[],
	 toolspr_quaver[],
	 toolspr_record[],
	 toolspr_redo[],
	 toolspr_resize[],
	 toolspr_right[],
	 toolspr_rotate[],
	 toolspr_rwnd[],
	 toolspr_save[],
	 toolspr_send[],
	 toolspr_sharp[],
	 toolspr_start[],
	 toolspr_stop[],
	 toolspr_sum[],
	 toolspr_text[],
	 toolspr_tick[],
	 toolspr_treble[],
	 toolspr_underline[],
	 toolspr_undo[],
	 toolspr_up[],
	 toolspr_write[],
	 toolspr_zoom[];

toolbar_redrawp (function pointer)

[top]

Definition of the toolbar redraw event handler

Parameters:

 - void *win - the tool window
 - int x0 - the (canvas) left hand coordinate.
 - int y0 - the (canvas) bottom coordinate.
 - int x1 - the (canvas) right hand coordinate.
 - int y1 - the (canvas) top coordinate.

typedef void (*toolbar_redrawp)(void *win,
				int x0,
				int y0,
				int x1,
				int y1);

toolbar (type definition)

[top]

The definition of a toolbar.

typedef void * toolbar;

toolwin (type definition)

[top]

The definition of a tool window.

typedef void * toolwin;

toolbar_make

[top]

Make a toolbar into a window.

Parameters:

 - toolbar tb - the toolbar to make.

void toolbar_make(toolbar tb);

toolbar_makeatlocation

[top]

Make a toolbar at a particular location.

Parameters:

 - toolbar tb - the toolbar to make.
 - int x - the (screen) left hand coordinate.
 - int y - the (screen) right hand coordinate.

void toolbar_makeatlocation(toolbar tb,
			    int x,
			    int y);

See also: toolbar_makeatlocation(), toolbar_makeatlocationsize()

toolbar_makeatlocationsize

[top]

Make a toolbar in a given bounding box.

Parameters:

 - toolbar tb - the toolbar to make.
 - int x0 - the (screen) left hand coordinate.
 - int y0 - the (screen) bottom coordinate.
 - int x1 - the (screen) right hand coordinate.
 - int y1 - the (screen) top coordinate.

void toolbar_makeatlocationsize(toolbar tb,
				int x0,
				int y0,
				int x1,
				int y1);

See also: toolbar_make(), toolbar_makeatlocation()

toolbar_window

[top]

Create a tool window on a toolbar.

Parameters:

 - toolbar tb - the toolbar to create the tool window on.
 - int flags - the tool window flags.
 - int size - the size of the toolbar (zero makes a standard width toolbar).

Returns:

 -  the created tool window.

Note - The tool window is not turned into a window until it has been made.

toolwin toolbar_window(toolbar tb,
		       int flags,
		       int size);

See also: Tool window flags, Tool window shortcuts, toolbar_winmake()

toolbar_winmake

[top]

Make a tool window a window

Parameters:

 - toolwin tw - the tool window.

void toolbar_winmake(toolwin tw);

toolbar_winhandle

[top]

Get the canvas for a tool window.

Parameters:

 - toolwin tw - the tool window.

Returns:

 -  the canvas.

Note - Do not claim any handlers for this canvas, and do not use the canvas ID handle.

canvas toolbar_winhandle(toolwin tw);

toolbar_handle

[top]

Get the canvas for a toolbar.

Parameters:

 - toolbar tb - the toolbar.

Returns:

 -  the canvas.

Note - Do not claim any handlers for this canvas, and do not use the canvas ID handle.

canvas toolbar_handle(toolbar tb);

toolbar_winredraw

[top]

Claim redraw handlers for a tool window.

Parameters:

 - toolwin tw - the tool window.
 - toolbar_redrawp pre_handler - the handler called before the toolbar system performs it redrawing.
 - toolbar_redrawp post_handler - the handler called after the toolbar system performs its redrawing.

void toolbar_winredraw(toolwin tw,
		       toolbar_redrawp pre_handler,
		       toolbar_redrawp post_handler);

See also: toolbar_redrawp

toolbar_addicon

[top]

Add a sprite to the toolbar, and move the current position on.

Parameters:

 - toolwin tw - the tool window.
 - int flags - the tool icon flags.
 - int ctx - the context to which this icon belongs.
 - void *spr_area - the pointer to the sprite area.
 - char *spr_name - the name of the sprite.

Returns:

 -  the generated icon.

Note - if the sprite name is called "abc", then the sprite "abc0" is the 1x1 aspect sprite, "pabc0" is the 1x1 aspect pressed sprite, "abc1" is the 1x2 aspect sprite, and "pabc1" is the 1x2 aspect preseed sprite.

icon toolbar_addicon(toolwin tw,
		     int flags,
		     int ctx,
		     void *spr_area,
		     char *spr_name);

toolbar_leavegap

[top]

Leave a gap for the next icon in the tool window context.

Parameters:

 - toolwin tw - the tool window.
 - int ctx - the context.
 - int w - the width of the gap.

void toolbar_leavegap(toolwin tw,
		      int ctx,
		      int w);

See also: toolbar_leavedefaultgap()

toolbar_leavedefaultgap (definition)

[top]

Leave a default gap of 12 OS units.

Parameters:

 - aaa - the tool window.
 - bbb - the context.

#define toolbar_leavedefaultgap(aaa,bbb) toolbar_leavegap(aaa, bbb, 12)

See also: toolbar_leavegap()

toolbar_setsize

[top]

Set the size of a toolbar.

Parameters:

 - toolbar tb - the toolbar.
 - int x0 - the minimum x coordinate.
 - int y0 - the minimum y coordinate.
 - int x1 - the maximum x coordinate.
 - int y1 - the maximum y coordinate.

void toolbar_setsize(toolbar tb,
		     int x0,
		     int y0,
		     int x1,
		     int y1);

toolbar_reopen

[top]

Reopen a toolbar at the top of the window stack in its current coordinates.

Parameters:

 - toolbar tb - the toolbar.

void toolbar_reopen(toolbar tb);

See also: toolbar_fullopen(), toolbar_open(), toolbar_opencentre(), toolbar_scrollopen(), toolbar_wimpopen()

toolbar_fullopen

[top]

Open a toolbar to its fullest extent.

Parameters:

 - toolbar tb - the toolbar.

void toolbar_fullopen(toolbar tb);

See also: toolbar_open(), toolbar_opencentre(), toolbar_reopen(), toolbar_scrollopen(), toolbar_wimpopen()

toolbar_opencentre

[top]

Open a toolbar at the top of the window stack in the centre of the screen.

Parameters:

 - toolbar tb - the toolbar.

void toolbar_opencentre(toolbar tb);

See also: toolbar_fullopen(), toolbar_open(), toolbar_reopen(), toolbar_scrollopen(), toolbar_wimpopen()

toolbar_open

[top]

Open a toolbar at the top of the window stack using given coordinates.

Parameters:

 - toolbar tb - the toolbar.
 - int x - the (screen) left hand coordinate.
 - int y - the (screen) bottom coordinate.

void toolbar_open(toolbar tb,
		  int x,
		  int y);

See also: toolbar_fullopen(), toolbar_opencentre(), toolbar_reopen(), toolbar_scrollopen(), toolbar_wimpopen()

toolbar_wimpopen

[top]

Open a toolbar using given canvas open parameters.

Parameters:

 - toolbar tb - the toolbar.
 - canvas_openstr *open_str - the canvas open window buffer.

void toolbar_wimpopen(toolbar tb,
		      canvas_openstr *open_str);

See also: toolbar_fullopen(), toolbar_open(), toolbar_opencentre(), toolbar_reopen(), toolbar_scrollopen()

toolbar_scrollopen

[top]

Cause a toolbar to change scroll location.

Parameters:

 - toolbar tb - the toolbar.
 - canvas_openstr *open_str - the canvas open window buffer.

Note - Unlike toolbar_wimopen(), this does not move any windows around - it is only used to change the scroll locations, and as a result is much faster.

void toolbar_scrollopen(toolbar tb,
			canvas_openstr *open_str);

See also: toolbar_fullopen(), toolbar_open(), toolbar_opencentre(), toolbar_reopen(), toolbar_wimpopen()

toolbar_pagescroll

[top]

Scroll a toolbar around.

Parameters:

 - toolbar tb - the toolbar.
 - int lr - the left/right movement.
 - int ud - the up/down movement.

void toolbar_pagescroll(toolbar tb,
			int lr,
			int ud);

toolbar_coordinate

[top]

Get the coordinate of the context.

Parameters:

 - toolwin tw - the window.
 - int ctx - the context.

Returns:

 -  the x or y coordinate of the base of a context.

Note - The returned value depends on whether it is a horizontal or vertical tool window.

Note - This location is used to allow you to create your own icons instead of the standard toolbar icon system.

int toolbar_coordinate(toolwin tw,
		       int ctx);

toolbar_setcontext

[top]

Set the current toolbar context

Parameters:

 - toolbar tb - the toolbar.
 - int ctx - the context to use

void toolbar_setcontext(toolbar tb,
			int ctx);

toolbar_close

[top]

Close a toolbar.

Parameters:

 - toolbar tb - the toolbar to close.

void toolbar_close(toolbar tb);

toolbar_winvisible

[top]

Make a tool window invisible.

Parameters:

 - toolwin tw - the tool window.
 - int flag - non-zero is visible, zero is invisible.

Note - This is used to make tool windows that appear when necessary, such as an attachement tool window in an email system that only appears if attachements are present in a message.

void toolbar_winvisible(toolwin tw,
			int flag);

toolbar_addhandler

[top]

Add a handler to a toolbar.

Parameters:

 - toolbar tb - the toolbar.
 - int code - the toolbar handler event type
 - ... - the handler function pointer.

void toolbar_addhandler(toolbar tb,
			int code,
			...);

See also: Toolbar event types, toolbar_closehandler(), toolbar_resizehandler()

toolbar_removehscroll

[top]

Remove the horizontal scroll bar from a toolbar.

Parameters:

 - toolbar tb - the toolbar.

Note - This must be done before the toolbar is made.

void toolbar_removehscroll(toolbar tb);

See also: toolbar_removevscroll()

toolbar_removevscroll

[top]

Remove the vertical scroll bar from a toolbar.

Parameters:

 - toolbar tb - the toolbar.

Note - This must be done before the toolbar is made.

void toolbar_removevscroll(toolbar tb);

See also: toolbar_removehscroll()

Tool window flags

[top]
#define TOOL_TOP	(0x00) /* Tool window at top */
#define TOOL_RIGHT	(0x01) /* Tool window at right */
#define TOOL_BOTTOM	(0x02) /* Tool window at bottom */
#define TOOL_LEFT	(0x03) /* Tool window at left */
#define TOOL_STATIC	(0x00) /* Tool window does not scroll with main window */
#define TOOL_SCROLL	(0x04) /* Tool window scrolls with main window */
#define TOOL_NOCONTEXT	(0x00) /* Tool window is context insensitive */
#define TOOL_CONTEXT	(0x08) /* Tool window is context sensitive */
#define TOOL_NOVSCROLL	(0x00) /* Tool window has no vertical scroll bar */
#define TOOL_VSCROLL	(0x10) /* Tool window has vertical scroll bar */
#define TOOL_NOHSCROLL	(0x00) /* Tool window has no horizontal scroll bar */
#define TOOL_HSCROLL	(0x20) /* Tool window has horizontal scroll bar */

Tool window shortcuts

[top]
#define TOOL_SCROLLTOP    (TOOL_TOP|TOOL_SCROLL)
#define TOOL_SCROLLRIGHT  (TOOL_RIGHT|TOOL_SCROLL)
#define TOOL_SCROLLBOTTOM (TOOL_BOTTOM|TOOL_SCROLL)
#define TOOL_SCROLLLEFT   (TOOL_LEFT|TOOL_SCROLL)
#define TOOL_STATICTOP    (TOOL_TOP|TOOL_STATIC)
#define TOOL_STATICRIGHT  (TOOL_RIGHT|TOOL_STATIC)
#define TOOL_STATICBOTTOM (TOOL_BOTTOM|TOOL_STATIC)
#define TOOL_STATICLEFT   (TOOL_LEFT|TOOL_STATIC)

Tool window icon types

[top]
#define TOOL_CLICK        (0x00)
#define TOOL_TOGGLE	  (0x01)

Toolbar event types

[top]
#define TOOLBAR_RESIZEHANDLER		(0)
#define TOOLBAR_CLOSEHANDLER		(1)

toolbar_resizehandler (function pointer)

[top]

Definition of a toolbar resize handler.

Parameters:

 - toolbar tb - the toolbar.
 - int w - the new width.
 - int h - the new height.

typedef void (*toolbar_resizehandler)(toolbar tb
				      int w,
				      int h);

toolbar_closehandler (function pointer)

[top]

Definition of a toolbar close handler.

Parameters:

 - toolbar tb - the toolbar.

typedef void (*toolbar_closehandler)(toolbar tb);

Tool sprites shortcuts

[top]

Note - to use this, call toolbar_addicon() with the required icon in place of the last two parameters.

#define TOOL_BASS	toolspr_bass, "bass"
#define TOOL_BIN	toolspr_bin, "bin"
#define TOOL_COPY	toolspr_copy, "copy"
#define TOOL_CROSS	toolspr_cross, "cross"
#define TOOL_CUT	toolspr_cut, "cut"
#define TOOL_FLAT	toolspr_flat, "flat"
#define TOOL_PASTE	toolspr_paste, "paste"
#define TOOL_POINTER	toolspr_pointer, "pointer"
#define TOOL_PRINT	toolspr_print, "print"
#define TOOL_QUAVER	toolspr_quaver, "quaver"
#define TOOL_RECORD	toolspr_record, "record"
#define TOOL_REDO	toolspr_redo, "redo"
#define TOOL_RESIZE	toolspr_resize, "resize"
#define TOOL_ROTATE	toolspr_rotate, "rotate"
#define TOOL_SAVE	toolspr_save, "save"
#define TOOL_SEND	toolspr_send, "send"
#define TOOL_SHARP	toolspr_sharp, "sharp"
#define TOOL_SUM	toolspr_sum, "sum"
#define TOOL_TEXT	toolspr_text, "text"
#define TOOL_TICK	toolspr_tick, "tick"
#define TOOL_TREBLE	toolspr_treble, "treble"
#define TOOL_UNDO	toolspr_undo, "undo"
#define TOOL_WRITE	toolspr_write, "write"
#define TOOL_ZOOM	toolspr_zoom, "zoom"
#define TOOL_BOLD	toolspr_bold, "bold"
#define TOOL_DOWNI	toolspr_down, "down"
#define TOOL_END	toolspr_end, "end"
#define TOOL_ERASE	toolspr_erase, "erase"
#define TOOL_FFWD	toolspr_ffwd, "ffwd"
#define TOOL_INSERT	toolspr_insert, "insert"
#define TOOL_ITALIC	toolspr_italic, "italic"
#define TOOL_LEFTI	toolspr_left, "left"
#define TOOL_PLAY	toolspr_play, "play"
#define TOOL_RIGHTI	toolspr_right, "right"
#define TOOL_RWND	toolspr_rwnd, "rwnd"
#define TOOL_START	toolspr_start, "start"
#define TOOL_STOP	toolspr_stop, "stop"
#define TOOL_UPI	toolspr_up, "up"
#define TOOL_UNDERLINE	toolspr_underline, "underline"
#define TOOL_PLUS	toolspr_plus, "plus"
#define TOOL_MINUS	toolspr_minus, "minus"
#define TOOL_MAIL	toolspr_mail, "mail"
#define TOOL_PHONE	toolspr_phone, "phone"
#define TOOL_LIPS	toolspr_lips, "lips"

See also: toolbar_addicon()


Generated Thu Feb 7 23:22:52 2002