home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / MEMSZ210.ZIP / ITEMS.H < prev    next >
C/C++ Source or Header  |  1993-07-27  |  7KB  |  328 lines

  1. /******************************************************************** ITEMS.H
  2.  *                                        *
  3.  *               Display Item Class Definition                *
  4.  *                                        *
  5.  ****************************************************************************/
  6.  
  7. #ifndef ITEMS_H
  8. #define ITEMS_H
  9.  
  10. class Item
  11. {
  12.   private:
  13.     USHORT Id ;          // Item ID.
  14.     BOOL   Flag ;         // Flag: Show this item at this time?
  15.     BYTE   Name [80] ;         // Text for items profile name.
  16.     BYTE   Label [80] ;      // Text to display on left part of line.
  17.     BYTE   MenuOption [80] ;     // Text to display in system menu.
  18.  
  19.   protected:
  20.     ULONG  Value ;         // Current value.
  21.  
  22.   public:
  23.     Item ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption )
  24.     {
  25.       Id = id ;
  26.       Flag = TRUE ;
  27.       strcpy ( PCHAR(Name), PCHAR(pName) ) ;
  28.       strcpy ( PCHAR(Label), PCHAR(pLabel) ) ;
  29.       strcpy ( PCHAR(MenuOption), PCHAR(pMenuOption) ) ;
  30.       Value = 0 ;
  31.     }
  32.  
  33.     USHORT QueryId     ( void ) { return ( Id    ) ; }
  34.     BOOL   QueryFlag   ( void ) { return ( Flag ) ; }
  35.     PBYTE  QueryName   ( void ) { return ( Name ) ; }
  36.     PBYTE  QueryLabel  ( void ) { return ( Label ) ; }
  37.     PBYTE  QueryOption ( void ) { return ( MenuOption ) ; }
  38.     ULONG  QueryValue  ( void ) { return ( Value ) ; }
  39.  
  40.     VOID SetFlag   ( void ) { Flag = TRUE ; }
  41.     VOID ResetFlag ( void ) { Flag = FALSE ; }
  42.  
  43.     VOID Paint
  44.     (
  45.       HPS hPS,
  46.       RECTL &Rectangle,
  47.       COLOR TextColor,
  48.       COLOR BackColor,
  49.       PSZ Text,
  50.       ULONG NewValue
  51.     ) ;
  52.  
  53.     virtual ULONG NewValue ( void )
  54.     {
  55.       return ( 0 ) ;
  56.     }
  57.  
  58.     virtual VOID Repaint
  59.     (
  60.       HPS hPS,
  61.       RECTL &Rectangle,
  62.       COLOR TextColor,
  63.       COLOR BackColor,
  64.       BOOL Mandatory
  65.     )
  66.     {
  67.       return ;
  68.     }
  69. } ;
  70.  
  71. class Clock : public Item
  72. {
  73.   private:
  74.     COUNTRYINFO CountryInfo ;
  75.  
  76.   public:
  77.     Clock ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo )
  78.       : Item ( id, pName, pLabel, pMenuOption )
  79.     {
  80.       CountryInfo = countryinfo ;
  81.     }
  82.  
  83.     ULONG NewValue ( void ) ;
  84.  
  85.     VOID Repaint
  86.     (
  87.       HPS hPS,
  88.       RECTL &Rectangle,
  89.       COLOR TextColor,
  90.       COLOR BackColor,
  91.       BOOL Mandatory
  92.     ) ;
  93. } ;
  94.  
  95. class ElapsedTime : public Item
  96. {
  97.   private:
  98.     COUNTRYINFO CountryInfo ;
  99.     ResourceString *Day ;
  100.     ResourceString *Days ;
  101.  
  102.   public:
  103.     ElapsedTime ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, class ResourceString *day, class ResourceString *days )
  104.       : Item ( id, pName, pLabel, pMenuOption )
  105.     {
  106.       CountryInfo = countryinfo ;
  107.       Day = day ;
  108.       Days = days ;
  109.     }
  110.  
  111.     ULONG NewValue ( void ) ;
  112.  
  113.     VOID Repaint
  114.     (
  115.       HPS hPS,
  116.       RECTL &Rectangle,
  117.       COLOR TextColor,
  118.       COLOR BackColor,
  119.       BOOL Mandatory
  120.     ) ;
  121. } ;
  122.  
  123. class MemoryFree : public Item
  124. {
  125.   private:
  126.     COUNTRYINFO CountryInfo ;
  127.     class SwapFree *SwapFree ;
  128.  
  129.   public:
  130.     MemoryFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, class SwapFree *swapfree )
  131.       : Item ( id, pName, pLabel, pMenuOption )
  132.     {
  133.       CountryInfo = countryinfo ;
  134.       SwapFree = swapfree ;
  135.     }
  136.  
  137.     ULONG NewValue ( void ) ;
  138.  
  139.     VOID Repaint
  140.     (
  141.       HPS hPS,
  142.       RECTL &Rectangle,
  143.       COLOR TextColor,
  144.       COLOR BackColor,
  145.       BOOL Mandatory
  146.     ) ;
  147. } ;
  148.  
  149. class SwapSize : public Item
  150. {
  151.   private:
  152.     COUNTRYINFO CountryInfo ;
  153.     PSZ SwapPath ;
  154.  
  155.   public:
  156.     SwapSize ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO countryinfo, PSZ swappath )
  157.       : Item ( id, pName, pLabel, pMenuOption )
  158.     {
  159.       CountryInfo = countryinfo ;
  160.       SwapPath = new BYTE [ strlen(PCHAR(swappath)) + 1 ] ;
  161.       strcpy ( PCHAR(SwapPath), PCHAR(swappath) ) ;
  162.     }
  163.  
  164.     ~SwapSize ( void )
  165.     {
  166.       delete [] SwapPath ;
  167.     }
  168.  
  169.     ULONG NewValue ( void ) ;
  170.  
  171.     VOID Repaint
  172.     (
  173.       HPS hPS,
  174.       RECTL &Rectangle,
  175.       COLOR TextColor,
  176.       COLOR BackColor,
  177.       BOOL Mandatory
  178.     ) ;
  179. } ;
  180.  
  181. class SwapFree : public Item
  182. {
  183.   private:
  184.     COUNTRYINFO CountryInfo ;
  185.     PSZ SwapPath ;
  186.     ULONG MinFree ;
  187.  
  188.   public:
  189.     SwapFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, PSZ swappath, ULONG minfree )
  190.       : Item ( id, pName, pLabel, pMenuOption )
  191.     {
  192.       CountryInfo = countryinfo ;
  193.       SwapPath = new BYTE [ strlen(PCHAR(swappath)) + 1 ] ;
  194.       strcpy ( PCHAR(SwapPath), PCHAR(swappath) ) ;
  195.       MinFree = minfree ;
  196.     }
  197.  
  198.     ~SwapFree ( void )
  199.     {
  200.       delete [] SwapPath ;
  201.     }
  202.  
  203.     ULONG NewValue ( void ) ;
  204.  
  205.     VOID Repaint
  206.     (
  207.       HPS hPS,
  208.       RECTL &Rectangle,
  209.       COLOR TextColor,
  210.       COLOR BackColor,
  211.       BOOL Mandatory
  212.     ) ;
  213. } ;
  214.  
  215. class SpoolSize : public Item
  216. {
  217.   private:
  218.     COUNTRYINFO CountryInfo ;
  219.     PSZ SpoolPath ;
  220.  
  221.   public:
  222.     SpoolSize ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, PSZ spoolpath )
  223.       : Item ( id, pName, pLabel, pMenuOption )
  224.     {
  225.       CountryInfo = countryinfo ;
  226.       SpoolPath = new BYTE [ strlen(PCHAR(spoolpath)) + 1 ] ;
  227.       strcpy ( PCHAR(SpoolPath), PCHAR(spoolpath) ) ;
  228.     }
  229.  
  230.     ~SpoolSize ( void )
  231.     {
  232.       delete [] SpoolPath ;
  233.     }
  234.  
  235.     ULONG NewValue ( void ) ;
  236.  
  237.     VOID Repaint
  238.     (
  239.       HPS hPS,
  240.       RECTL &Rectangle,
  241.       COLOR TextColor,
  242.       COLOR BackColor,
  243.       BOOL Mandatory
  244.     ) ;
  245. } ;
  246.  
  247. class CpuLoad : public Item
  248. {
  249.   private:
  250.     PULONG IdleCount ;
  251.     ULONG MaxCount ;
  252.  
  253.   public:
  254.     CpuLoad ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, ULONG maxcount, PULONG idlecount )
  255.       : Item ( id, pName, pLabel, pMenuOption )
  256.     {
  257.       MaxCount = maxcount ;
  258.       IdleCount = idlecount ;
  259.     }
  260.  
  261.     ULONG NewValue ( void ) ;
  262.  
  263.     VOID Repaint
  264.     (
  265.       HPS hPS,
  266.       RECTL &Rectangle,
  267.       COLOR TextColor,
  268.       COLOR BackColor,
  269.       BOOL Mandatory
  270.     ) ;
  271. } ;
  272.  
  273. class TaskCount : public Item
  274. {
  275.   private:
  276.     HAB Anchor ;
  277.  
  278.   public:
  279.     TaskCount ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, HAB anchor )
  280.       : Item ( id, pName, pLabel, pMenuOption )
  281.     {
  282.       Anchor = anchor ;
  283.     }
  284.  
  285.     ULONG NewValue ( void ) ;
  286.  
  287.     VOID Repaint
  288.     (
  289.       HPS hPS,
  290.       RECTL &Rectangle,
  291.       COLOR TextColor,
  292.       COLOR BackColor,
  293.       BOOL Mandatory
  294.     ) ;
  295. } ;
  296.  
  297. class DriveFree : public Item
  298. {
  299.   private:
  300.     COUNTRYINFO CountryInfo ;
  301.     class ResourceString *DriveError ;
  302.     USHORT DriveNumber ;
  303.     BOOL Error ;
  304.  
  305.   public:
  306.     DriveFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, USHORT drivenumber, class ResourceString *driveerror )
  307.       : Item ( id, pName, pLabel, pMenuOption )
  308.     {
  309.       CountryInfo = countryinfo ;
  310.       DriveError = driveerror ;
  311.       DriveNumber = drivenumber ;
  312.       Error = FALSE ;
  313.     }
  314.  
  315.     ULONG NewValue ( void ) ;
  316.  
  317.     VOID Repaint
  318.     (
  319.       HPS hPS,
  320.       RECTL &Rectangle,
  321.       COLOR TextColor,
  322.       COLOR BackColor,
  323.       BOOL Mandatory
  324.     ) ;
  325. } ;
  326.  
  327. #endif
  328.