home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / clsam3j / wincl.cp_ / WINCL.CPP
Encoding:
C/C++ Source or Header  |  1992-09-11  |  5.0 KB  |  98 lines

  1. /**************************************************************************/
  2. /* Sample Program for IBMCLASS - Client Classes implementation            */
  3. /*                                                                        */
  4. /* Change History:                                                        */
  5. /* Rel Programmer        Stamp Date     Description                       */
  6. /* --- ----------------- ----- -------- --------------------------------- */
  7. /* 3.1 Philippe Gregoire PHG   10/09/92 Creation for demo                 */
  8. /**************************************************************************/
  9.  
  10. // include IBMCLASS classes definitions
  11. #include <irect.hpp>          // IRectangle
  12. #include <ireslib.hpp>        // IResourceLibrary/IResourceId
  13.  
  14. // include our own class definitions
  15. #include "wincl.hpp"
  16. #include "win.h"
  17.  
  18. /**************************************************************************/
  19. /* MyClientWindow :: MyClientWindow                             PHG 10/09 */
  20. /*   Construct our client window                                          */
  21. /**************************************************************************/
  22. MyClientWindow :: MyClientWindow(unsigned long windowId,
  23.                                  const IWindow* parowWindow) :
  24.                   IStaticText(windowId,parowWindow,parowWindow,IRectangle())
  25. {unsigned long ulX=20;
  26.  ISize sizStat=ISize(100,20);
  27.  ISize sizEF=ISize(200,20);
  28.  
  29.   // create our subcomponents
  30.   psttxtName    = new IStaticText(ST_NAME,    this, this, IRectangle(IPoint(20, 190),sizStat));
  31.   pefName       = new IEntryField(EF_NAME,    this, this, IRectangle(IPoint(130,190),sizEF));
  32.   psttxtNumber  = new IStaticText(ST_NUMBER,  this, this, IRectangle(IPoint(20, 150),sizStat));
  33.   pefNumber     = new IEntryField(EF_NUMBER,  this, this, IRectangle(IPoint(130,150),sizEF));
  34.   pgbxAddress   = new IGroupBox(  GB_ADDRESS, this, this, IRectangle(IPoint(10, 50),ISize(340,90)));
  35.   psttxtAddress = new IStaticText(ST_ADDRESS, this, this, IRectangle(IPoint(20, 90),sizStat));
  36.   pefAddress    = new IEntryField(EF_ADDRESS, this, this, IRectangle(IPoint(130,90),sizEF));
  37.   psttxtState   = new IStaticText(ST_STATE,   this, this, IRectangle(IPoint(20, 60),ISize(50,20)));
  38.   pefState      = new IEntryField(EF_STATE,   this, this, IRectangle(IPoint(80, 60),ISize(50,20)));
  39.   psttxtZip     = new IStaticText(ST_ZIP,     this, this, IRectangle(IPoint(140, 60),ISize(100,20)));
  40.   pefZip        = new IEntryField(EF_ZIP,     this, this, IRectangle(IPoint(250, 60),ISize(50,20)));
  41.  
  42.   // set labels text
  43.   psttxtName->setText(IResourceId(STR_NAMELAB));
  44.   psttxtNumber->setText(IResourceId(STR_NUMBERLAB));
  45.   pgbxAddress->setText(IResourceId(STR_ADDRESSLAB));
  46.   psttxtAddress->setText(IResourceId(STR_STREETLAB));
  47.   psttxtState->setText(IResourceId(STR_STATELAB));
  48.   psttxtZip->setText(IResourceId(STR_ZIPLAB));
  49.  
  50. }/* end MyClientWindow :: MyClientWindow(...) */
  51.  
  52. /**************************************************************************/
  53. /* MyClientWindow :: setCustomer                                PHG 10/09 */
  54. /*   Set a customer from resource                                         */
  55. /**************************************************************************/
  56. long MyClientWindow :: setCustomer(long lCustomer)
  57. {
  58.   if(lCustomer<MIN_CUST) lCustomer=MIN_CUST;
  59.   if(lCustomer>MAX_CUST) lCustomer=MAX_CUST;
  60.  
  61.   pefName->setText(IResourceId(STR_CUSTBASE+MULT_CUST*lCustomer+NAM_CUST));
  62.   pefNumber->setText(IResourceId(STR_CUSTBASE+MULT_CUST*lCustomer+NUM_CUST));
  63.   pefAddress->setText(IResourceId(STR_CUSTBASE+MULT_CUST*lCustomer+ADD_CUST));
  64.  
  65.   return(lCustomer);
  66. }/* end MyClientWindow :: setCustomer(...) */
  67.  
  68. /**************************************************************************/
  69. /* MyClientWindow :: nextCustomer                               PHG 11/09 */
  70. /*                                                                        */
  71. /**************************************************************************/
  72. IString MyClientWindow :: nextCustomer()
  73. {
  74.   lCurCustomer=setCustomer(++lCurCustomer);
  75.   return(statCust());
  76. }/* end MyClientWindow :: nextCustomer(...) */
  77.  
  78. /**************************************************************************/
  79. /* MyClientWindow :: previousCustomer                           PHG 11/09 */
  80. /*                                                                        */
  81. /**************************************************************************/
  82. IString MyClientWindow :: previousCustomer()
  83. {
  84.   lCurCustomer=setCustomer(--lCurCustomer);
  85.   return(statCust());
  86. }/* end MyClientWindow :: previousCustomer(...) */
  87.  
  88. /**************************************************************************/
  89. /* MyClientWindow :: statCust                                   PHG 11/09 */
  90. /*   Returns the customer status                                          */
  91. /**************************************************************************/
  92. IString MyClientWindow :: statCust() const
  93. {
  94.   return(IString(lCurCustomer)+" / "+IString(MAX_CUST));
  95.  
  96. }/* end MyClientWindow :: statCust(...) */
  97.  
  98.