home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / prog_bar.lha / prog_bar / C / prog_bar.h < prev   
Encoding:
C/C++ Source or Header  |  1997-01-12  |  6.1 KB  |  152 lines

  1. /*
  2. ** $Filename: progbar.h $
  3. ** $Release: 1.0 $
  4. ** $Revision: 36.1 $
  5. ** $Date: 18/11/96 $
  6. **
  7. ** Prog_Bar definitions, a progress bar system
  8. **
  9. ** (C) Copyright 1996 by Allan Savage
  10. ** All Rights Reserved
  11. */
  12.  
  13. #ifndef PROG_BAR_H
  14. #define PROG_BAR_H
  15.  
  16. #ifndef EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. #ifndef UTILITY_TAGITEM_H
  21. #include <utility/tagitem.h>
  22. #endif
  23.  
  24. #ifndef INTUITION_INTUITION_H
  25. #include <intuition/intuition.h>
  26. #endif
  27.  
  28. /* ----------------------------------------------------------------------- */
  29.  
  30. #define PB_Dummy        TAG_USER+0x60000
  31.  
  32. /* Tags for CreateProgBar() and SetProgBarAttrs() */
  33.  
  34. #define PB_LeftEdge        PB_Dummy+1           /* X pos */
  35. #define PB_TopEdge         PB_Dummy+2           /* Y pos */
  36. #define PB_Width           PB_Dummy+3           /* Width */
  37. #define PB_Height          PB_Dummy+4           /* Height */
  38. #define PB_Direction       PB_Dummy+5           /* Direction of Expansion */
  39. #define PB_BarColour       PB_Dummy+6           /* Bar colour */
  40. #define PB_BarBackColour   PB_Dummy+7           /* Bar Background colour */
  41. #define PB_BarSize         PB_Dummy+8           /* Value of full Bar */
  42. #define PB_BarValue        PB_Dummy+9           /* Value of filled Bar */
  43. #define PB_BorderType      PB_Dummy+10          /* Type of Border */
  44.  
  45. #define PB_TextMode        PB_Dummy+11          /* Actual Value or %age */
  46. #define PB_TextPosition    PB_Dummy+12          /* Position to display text */
  47. #define PB_TextColour      PB_Dummy+13          /* Text Colour */
  48. #define PB_TextBackColour  PB_Dummy+14          /* Text BackGround Colour */
  49. #define PB_TextFont        PB_Dummy+15          /* Font for text (*TextAttr) */
  50.  
  51. /* Options for PB_Direction */
  52.  
  53. #define PBDE_RIGHT         0        /* From Left to Right  ( default ) */
  54. #define PBDE_LEFT          1        /* From Right to Left */
  55. #define PBDE_UP            2        /* From Bottom to Top */
  56. #define PBDE_DOWN          3        /* From Top to Bottom */
  57.  
  58. /* Options for PB_BorderType */
  59.  
  60. #define PBBT_NONE          10       /* No Border */
  61. #define PBBT_PLAIN         11       /* Plain Black Box  ( default )*/
  62. #define PBBT_RECESSED      12       /* Recessed Box */
  63. #define PBBT_RAISED        13       /* Raised Box */
  64. #define PBBT_RIDGE         14       /* Raised Ridge */
  65.  
  66. /* Options for Text Mode */
  67.  
  68. #define PBTM_NONE          20       /* No Text  ( default ) */
  69. #define PBTM_PERCENT       21       /* Display Value as a %age */
  70. #define PBTM_VALUE         22       /* Display Value as "Value/Total" */
  71.  
  72. /* Options for Text Position */
  73.  
  74. #define PBTP_BELOW         30       /* Text centred below Bar  ( default ) */
  75. #define PBTP_ABOVE         31       /* Text centred above Bar */
  76. #define PBTP_LEFT          32       /* Text to left of Bar */
  77. #define PBTP_RIGHT         33       /* Text to right of Bar */
  78. #define PBTP_CENTRE        34       /* Text centred inside Bar */
  79.  
  80. /* Structure Definition */
  81.  
  82. struct P_Bar {
  83.  
  84.    /* The following fields are set up when the Progress Bar is created.
  85.       They are simply quick reference points for the information needed
  86.       to display the Progress Bar.  DO NOT CHANGE THE VALUES STORED HERE. */
  87.  
  88.    struct Window *   Wnd;              /* Window to render Bar in */
  89.    struct RastPort * RPort;            /* RastPort used for rendering */
  90.    APTR              Vis_Info;         /* VisualInfo for Bar */
  91.    struct IntuiText  Bar_IText;        /* Used to display the Text */
  92.    char              Bar_Text[16];     /* Used to store the Text */
  93.  
  94.    /* The following fields are used to store the current settings for the
  95.       Progress Bar.  They should not be changed directly, but can be altered
  96.       using SetProgBarAttrs() */
  97.  
  98.    UWORD             LeftEdge;         /* Column Number for Left Edge */
  99.    UWORD             TopEdge;          /* Row Number for Top Edge */
  100.    UWORD             Width;            /* Total Width  ( including Border ) */
  101.    UWORD             Height;           /* Total Height ( including Border ) */
  102.  
  103.    UBYTE             Direction;        /* Direction for Bar Expansion */
  104.  
  105.    UBYTE             Bar_Colour;       /* Pen Number for rendering Bar */
  106.    UBYTE             Bar_Background;   /* Pen Number for Bar Background */
  107.    UWORD             Bar_Size;         /* Value for full bar */
  108.    UWORD             Bar_Value;        /* Current Value for Bar */
  109.  
  110.    UBYTE             Border_Type;      /* Type of Border */
  111.  
  112.    UBYTE             Text_Mode;        /* Mode for text display */
  113.    UBYTE             Text_Position;    /* Placement for Text */
  114.  
  115.    /* The following fields are working variables for the functions and
  116.       should not be used or altered by your program. */
  117.  
  118.    UWORD             B_LeftEdge;       /* LeftEdge of Bar ( No Border ) */
  119.    UWORD             B_RightEdge;      /* RightEdge of Bar ( No Border ) */
  120.    UWORD             B_TopEdge;        /* TopEdge of Bar ( No Border ) */
  121.    UWORD             B_BottomEdge;     /* BottomEdge of Bar ( No Border ) */
  122.    UWORD             B_Length;         /* Bar Length in pixels ( No Border ) */
  123.    UWORD             B_Value;          /* Number of pixels to fill */
  124.    UBYTE             B_Percent;        /* Percentage of Bar filled */
  125.    UWORD             T_Width;          /* Width of text in pixels */
  126.    UWORD             T_Height;         /* Height of text in pixels */
  127.    UWORD             MT_Width;         /* Max Text Width in Pixels */
  128.    UWORD             MT_Left;          /* Left coordinate of longest test */
  129.    UWORD             MT_Top;           /* Top coordinate of longest text */
  130.    };
  131.  
  132. typedef struct P_Bar       PBAR;
  133.  
  134.  
  135. /* Function Prototypes */
  136.  
  137. PBAR *CreateProgBarA ( struct Window *Wnd, UWORD Left, UWORD Top, UWORD Width,
  138.                        UWORD Height, UWORD Size, struct TagList *taglist );
  139. PBAR *CreateProgBar  ( struct Window *Wnd, UWORD Left, UWORD Top, UWORD Width,
  140.                        UWORD Height, UWORD Size, Tag First_Tag, ... );
  141. void SetProgBarAttrsA ( PBAR *PB, struct TagList *taglist );
  142. void SetProgBarAttrs ( PBAR *PB, Tag First_Tag, ... );
  143. void FreeProgBar ( PBAR *PB );
  144. void RefreshProgBar ( PBAR *PB );
  145. void UpdateProgBar ( PBAR *PB, UWORD Value );
  146. void ResetProgBar ( PBAR *PB );
  147. void ClearProgBar ( PBAR *PB );
  148. void ClearBar ( PBAR *PB );
  149. void ClearText ( PBAR *PB );
  150.  
  151. #endif
  152.