home *** CD-ROM | disk | FTP | other *** search
- 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. *)
-
- Wnd : WindowPtr; (* Window to render Bar in *)
- RPort : RastPortPtr; (* RastPort used for rendering *)
- Vis_Info : VisualInfoPtr; (* VisualInfo for Bar *)
- Bar_IText : IntuiText; (* Used to display the Text *)
- 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() *)
-
- LeftEdge : CARDINAL; (* Column Number for Left Edge *)
- TopEdge : CARDINAL; (* Row Number for Top Edge *)
- Width : CARDINAL; (* Total Width ( including Border ) *)
- Height : CARDINAL; (* Total Height ( including Border ) *)
-
- Direction : SHORTCARD; (* Direction for Bar Expansion *)
-
- Bar_Colour : SHORTCARD; (* Pen Number for rendering Bar *)
- Bar_Background : SHORTCARD; (* Pen Number for Bar Background *)
- Bar_Size : CARDINAL; (* Value for full bar *)
- Bar_Value : CARDINAL; (* Current Value for Bar *)
-
- Border_Type : SHORTCARD; (* Type of Border *)
-
- Text_Mode : SHORTCARD; (* Mode for text display *)
- 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. *)
-
- B_LeftEdge : CARDINAL; (* LeftEdge of Bar ( No Border ) *)
- B_RightEdge : CARDINAL; (* RightEdge of Bar ( No Border ) *)
- B_TopEdge : CARDINAL; (* TopEdge of Bar ( No Border ) *)
- B_BottomEdge : CARDINAL; (* BottomEdge of Bar ( No Border ) *)
- B_Length : CARDINAL; (* Bar Length in pixels ( No Border ) *)
- B_Value : CARDINAL; (* Number of pixels to fill *)
- B_Percent : SHORTCARD; (* Percentage of Bar filled *)
- T_Width : CARDINAL; (* Width of text in pixels *)
- T_Height : CARDINAL; (* Height of text in pixels *)
- MT_Width : CARDINAL; (* Max Text Width in Pixels *)
- MT_Left : CARDINAL; (* Left coordinate of longest test *)
- MT_Top : CARDINAL; (* Top coordinate of longest text *)
- 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.
-