(* ** $Filename: progbar.def $ ** $Release: 1.04 $ ** $Revision: 36.1 $ ** $Date: 10/10/97 $ ** ** Prog_Bar definitions, a progress bar system ** ** (C) Copyright 1996-97 by Allan Savage ** All Rights Reserved *) DEFINITION FOR C MODULE prog_bar; FROM Utility IMPORT TAG_USER, TagItemPtr, Tag; FROM Intuition IMPORT WindowPtr, IntuiText; FROM Graphics IMPORT RastPortPtr; FROM GadTools IMPORT VisualInfoPtr; CONST PB_Dummy = TAG_USER+60000H; (* Tags for CreateProgBar() and SetProgBarAttrs() *) CONST PB_LeftEdge = PB_Dummy+1; (* X pos *) CONST PB_TopEdge = PB_Dummy+2; (* Y pos *) CONST PB_Width = PB_Dummy+3; (* Width *) CONST PB_Height = PB_Dummy+4; (* Height *) CONST PB_Direction = PB_Dummy+5; (* Direction of Expansion *) CONST PB_BarColour = PB_Dummy+6; (* Bar colour *) CONST PB_BarBackColour = PB_Dummy+7; (* Bar Background colour *) CONST PB_BarSize = PB_Dummy+8; (* Value of full Bar *) CONST PB_BarValue = PB_Dummy+9; (* Value of filled Bar *) CONST PB_BorderType = PB_Dummy+10; (* Type of Border *) CONST PB_TextMode = PB_Dummy+11; (* Actual Value or %age *) CONST PB_TextPosition = PB_Dummy+12; (* Position to display text *) CONST PB_TextColour = PB_Dummy+13; (* Text Colour *) CONST PB_TextBackColour = PB_Dummy+14; (* Text BackGround Colour *) CONST PB_TextFont = PB_Dummy+15; (* Font for text (TextAttrPtr) *) (* Options for PB_Direction *) CONST PBDE_RIGHT = 0; (* From Left to Right ( default ) *) CONST PBDE_LEFT = 1; (* From Right to Left *) CONST PBDE_UP = 2; (* From Bottom to Top *) CONST PBDE_DOWN = 3; (* From Top to Bottom *) (* Options for PB_BorderType *) CONST PBBT_NONE = 10; (* No Border *) CONST PBBT_PLAIN = 11; (* Plain Black Box ( default )*) CONST PBBT_RECESSED = 12; (* Recessed Box *) CONST PBBT_RAISED = 13; (* Raised Box *) CONST PBBT_RIDGE = 14; (* Raised Ridge *) (* Options for Text Mode *) CONST PBTM_NONE = 20; (* No Text ( default ) *) CONST PBTM_PERCENT = 21; (* Display Value as a %age *) CONST PBTM_VALUE = 22; (* Display Value as "Value/Total" *) (* Options for Text Position *) CONST PBTP_BELOW = 30; (* Text centred below Bar ( default ) *) CONST PBTP_ABOVE = 31; (* Text centred above Bar *) CONST PBTP_LEFT = 32; (* Text to left of Bar *) CONST PBTP_RIGHT = 33; (* Text to right of Bar *) CONST PBTP_CENTRE = 34; (* Text centred inside Bar *) (* Structure Definition *) TYPE PBarPtr = POINTER TO PBar; PBar = RECORD (* The following fields are set up when the Progress Bar is created. They are simply quick reference points for the information needed to display the Progress Bar. DO NOT CHANGE THE VALUES STORED HERE. *) pbr_Wnd : WindowPtr; (* Window to render Bar in *) pbr_RPort : RastPortPtr; (* RastPort used for rendering *) pbr_Vis_Info : VisualInfoPtr; (* VisualInfo for Bar *) pbr_Bar_IText : IntuiText; (* Used to display the Text *) pbr_Bar_Text : ARRAY [0..15] OF CHAR; (* Used to store the Text *) (* The following fields are used to store the current settings for the Progress Bar. They should not be changed directly, but can be altered using SetProgBarAttrs() *) pbr_LeftEdge : CARDINAL; (* Column Number for Left Edge *) pbr_TopEdge : CARDINAL; (* Row Number for Top Edge *) pbr_Width : CARDINAL; (* Total Width ( including Border ) *) pbr_Height : CARDINAL; (* Total Height ( including Border ) *) pbr_Direction : SHORTCARD; (* Direction for Bar Expansion *) pbr_Border_Type : SHORTCARD; (* Type of Border *) pbr_Bar_Colour : SHORTCARD; (* Pen Number for rendering Bar *) pbr_Bar_Background : SHORTCARD; (* Pen Number for Bar Background *) pbr_Bar_Size : CARDINAL; (* Value for full bar *) pbr_Bar_Value : CARDINAL; (* Current Value for Bar *) pbr_Text_Mode : SHORTCARD; (* Mode for text display *) pbr_Text_Position : SHORTCARD; (* Placement for Text *) (* The following fields are working variables for the functions and should not be used or altered by your program. *) pbr_T_Width : CARDINAL; (* Width of text in pixels *) pbr_T_Height : CARDINAL; (* Height of text in pixels *) pbr_MT_Width : CARDINAL; (* Max Text Width in Pixels *) pbr_MT_Left : CARDINAL; (* Left coordinate of longest text *) pbr_MT_Top : CARDINAL; (* Top coordinate of longest text *) pbr_B_LeftEdge : CARDINAL; (* LeftEdge of Bar ( No Border ) *) pbr_B_RightEdge : CARDINAL; (* RightEdge of Bar ( No Border ) *) pbr_B_TopEdge : CARDINAL; (* TopEdge of Bar ( No Border ) *) pbr_B_BottomEdge : CARDINAL; (* BottomEdge of Bar ( No Border ) *) pbr_B_Length : CARDINAL; (* Bar Length in pixels ( No Border ) *) pbr_B_Value : CARDINAL; (* Number of pixels to fill *) pbr_B_Percent : SHORTCARD; (* Percentage of Bar filled *) END; (* Function Prototypes *) PROCEDURE CreateProgBarA ( Wnd : WindowPtr; Left, Top, Width, Height, Size : CARDINAL; taglist : TagItemPtr ) : PBarPtr; PROCEDURE CreateProgBar ( Wnd : WindowPtr; Left, Top, Width, Height, Size : CARDINAL; First_Tag : Tag; .. ) : PBarPtr; PROCEDURE SetProgBarAttrsA ( PB : PBarPtr; taglist : TagItemPtr ); PROCEDURE SetProgBarAttrs ( PB : PBarPtr; First_Tag : Tag; .. ); PROCEDURE FreeProgBar ( PB : PBarPtr ); PROCEDURE RefreshProgBar ( PB : PBarPtr ); PROCEDURE UpdateProgBar ( PB : PBarPtr; Value : CARDINAL ); PROCEDURE ResetProgBar ( PB : PBarPtr ); PROCEDURE ClearProgBar ( PB : PBarPtr ); PROCEDURE ClearBar ( PB : PBarPtr ); PROCEDURE ClearText ( PB : PBarPtr ); END prog_bar.