/*
** $Filename: progbar.h $
** $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
*/

#ifndef PROG_BAR_H
#define PROG_BAR_H

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

#ifndef INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif

/* ----------------------------------------------------------------------- */

#define PB_Dummy        TAG_USER+0x60000

/* Tags for CreateProgBar() and SetProgBarAttrs() */

#define PB_LeftEdge        PB_Dummy+1           /* X pos */
#define PB_TopEdge         PB_Dummy+2           /* Y pos */
#define PB_Width           PB_Dummy+3           /* Width */
#define PB_Height          PB_Dummy+4           /* Height */
#define PB_Direction       PB_Dummy+5           /* Direction of Expansion */
#define PB_BarColour       PB_Dummy+6           /* Bar colour */
#define PB_BarBackColour   PB_Dummy+7           /* Bar Background colour */
#define PB_BarSize         PB_Dummy+8           /* Value of full Bar */
#define PB_BarValue        PB_Dummy+9           /* Value of filled Bar */
#define PB_BorderType      PB_Dummy+10          /* Type of Border */

#define PB_TextMode        PB_Dummy+11          /* Actual Value or %age */
#define PB_TextPosition    PB_Dummy+12          /* Position to display text */
#define PB_TextColour      PB_Dummy+13          /* Text Colour */
#define PB_TextBackColour  PB_Dummy+14          /* Text BackGround Colour */
#define PB_TextFont        PB_Dummy+15          /* Font for text (*TextAttr) */

/* Options for PB_Direction */

#define PBDE_RIGHT         0        /* From Left to Right  ( default ) */
#define PBDE_LEFT          1        /* From Right to Left */
#define PBDE_UP            2        /* From Bottom to Top */
#define PBDE_DOWN          3        /* From Top to Bottom */

/* Options for PB_BorderType */

#define PBBT_NONE          10       /* No Border */
#define PBBT_PLAIN         11       /* Plain Black Box  ( default )*/
#define PBBT_RECESSED      12       /* Recessed Box */
#define PBBT_RAISED        13       /* Raised Box */
#define PBBT_RIDGE         14       /* Raised Ridge */

/* Options for Text Mode */

#define PBTM_NONE          20       /* No Text  ( default ) */
#define PBTM_PERCENT       21       /* Display Value as a %age */
#define PBTM_VALUE         22       /* Display Value as "Value/Total" */

/* Options for Text Position */

#define PBTP_BELOW         30       /* Text centred below Bar  ( default ) */
#define PBTP_ABOVE         31       /* Text centred above Bar */
#define PBTP_LEFT          32       /* Text to left of Bar */
#define PBTP_RIGHT         33       /* Text to right of Bar */
#define PBTP_CENTRE        34       /* Text centred inside Bar */

/* Structure Definition */

struct P_Bar {

   /* 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. */

   struct Window *   pbr_Wnd;              /* Window to render Bar in */
   struct RastPort * pbr_RPort;            /* RastPort used for rendering */
   APTR              pbr_Vis_Info;         /* VisualInfo for Bar */
   struct IntuiText  pbr_Bar_IText;        /* Used to display the Text */
   char              pbr_Bar_Text[16];     /* 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() */

   UWORD             pbr_LeftEdge;         /* Column Number for Left Edge */
   UWORD             pbr_TopEdge;          /* Row Number for Top Edge */
   UWORD             pbr_Width;            /* Total Width  ( including Border ) */
   UWORD             pbr_Height;           /* Total Height ( including Border ) */

   UBYTE             pbr_Direction;        /* Direction for Bar Expansion */
   UBYTE             pbr_Border_Type;      /* Type of Border */

   UBYTE             pbr_Bar_Colour;       /* Pen Number for rendering Bar */
   UBYTE             pbr_Bar_Background;   /* Pen Number for Bar Background */
   UWORD             pbr_Bar_Size;         /* Value for full bar */
   UWORD             pbr_Bar_Value;        /* Current Value for Bar */

   UBYTE             pbr_Text_Mode;        /* Mode for text display */
   UBYTE             pbr_Text_Position;    /* Placement for Text */

   /* The following fields are working variables for the functions and
      should not be used or altered by your program. */

   UWORD             pbr_T_Width;          /* Width of text in pixels */
   UWORD             pbr_T_Height;         /* Height of text in pixels */
   UWORD             pbr_MT_Width;         /* Max Text Width in Pixels */
   UWORD             pbr_MT_Left;          /* Left coordinate of longest text */
   UWORD             pbr_MT_Top;           /* Top coordinate of longest text */
   UWORD             pbr_B_LeftEdge;       /* LeftEdge of Bar ( No Border ) */
   UWORD             pbr_B_RightEdge;      /* RightEdge of Bar ( No Border ) */
   UWORD             pbr_B_TopEdge;        /* TopEdge of Bar ( No Border ) */
   UWORD             pbr_B_BottomEdge;     /* BottomEdge of Bar ( No Border ) */
   UWORD             pbr_B_Length;         /* Bar Length in pixels ( No Border ) */
   UWORD             pbr_B_Value;          /* Number of pixels to fill */
   UBYTE             pbr_B_Percent;        /* Percentage of Bar filled */
   };

typedef struct P_Bar       PBAR;


/* Function Prototypes */

PBAR *CreateProgBarA ( struct Window *Wnd, UWORD Left, UWORD Top, UWORD Width,
                       UWORD Height, UWORD Size, struct TagList *taglist );
PBAR *CreateProgBar  ( struct Window *Wnd, UWORD Left, UWORD Top, UWORD Width,
                       UWORD Height, UWORD Size, Tag First_Tag, ... );
void SetProgBarAttrsA ( PBAR *PB, struct TagList *taglist );
void SetProgBarAttrs ( PBAR *PB, Tag First_Tag, ... );
void FreeProgBar ( PBAR *PB );
void RefreshProgBar ( PBAR *PB );
void UpdateProgBar ( PBAR *PB, UWORD Value );
void ResetProgBar ( PBAR *PB );
void ClearProgBar ( PBAR *PB );
void ClearBar ( PBAR *PB );
void ClearText ( PBAR *PB );

#endif
