home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Frameworks / SCAPI 0.85 / Cross-platform code / MySCAPIWindow2.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-02  |  2.5 KB  |  117 lines  |  [TEXT/CWIE]

  1. #include "MySCAPIWindow2.h"
  2. #include "SCAPIListItem.h"
  3. #include "SCAPIMessageBox.h"
  4.  
  5. // Contructor - Destructor
  6.  
  7. MySCAPIWindow2::MySCAPIWindow2(    SCAPIApp*    inAppP,
  8.                                 char*        inTitle,
  9.                                 int            inOriginx,
  10.                                 int         inOriginy,
  11.                                 int            inWidth,
  12.                                 int            inHeight        )
  13.                                 
  14.                 : SCAPIWindow(                inAppP,
  15.                                             inTitle,
  16.                                             inOriginx,
  17.                                             inOriginy,
  18.                                             inWidth,
  19.                                             inHeight        )
  20. {
  21.     int        i;
  22.     
  23.     mMenuBarP = (MySCAPIMenuBar2*) new MySCAPIMenuBar2();
  24.     AssociateMenuBar(mMenuBarP);
  25.     
  26.     mListP = (SCAPIList*) new SCAPIList(    this,
  27.                                             50,
  28.                                             50,
  29.                                             100,
  30.                                             100        );
  31.                                         
  32.     mListP->Add( new SCAPIListItem("one") );
  33.     mListP->Add( new SCAPIListItem("two") );
  34.     mListP->Add( new SCAPIListItem("three") );
  35.     mListP->Add( new SCAPIListItem("four"));
  36.     mListP->Add( new SCAPIListItem("five") );
  37.     mListP->Add( new SCAPIListItem("six") );
  38.     mListP->Add( new SCAPIListItem("seven") );
  39.     mListP->Add( new SCAPIListItem("eight") );
  40.     mListP->Add( new SCAPIListItem("nine") );
  41.     mListP->Add( new SCAPIListItem("ten") );
  42.     
  43.     mListP->Delete(0);
  44.     mListP->Delete(3);
  45.     mListP->Delete(mListP->GetLength() - 1);
  46.     
  47.     mListP->Add( new SCAPIListItem("youpi"), 5 );
  48.     
  49.     mListP->Select(0);
  50.     mListP->Unselect(1);
  51.     mListP->Select(2);
  52.     
  53.     for (i = 0; i < mListP->GetLength(); i++)
  54.     {
  55.         if ( mListP->IsSelected(i) )
  56.             mListP->Unselect(i);
  57.         else
  58.             mListP->Select(i);
  59.     }
  60.     
  61.     mStaticP = (SCAPIStatic*) new SCAPIStatic(    "Static",
  62.                                                 this,
  63.                                                 50,
  64.                                                 15            );
  65.                                                 
  66.     mTextFieldP = (SCAPITextField*) new SCAPITextField(    this,
  67.                                                         200,
  68.                                                         50        );
  69.     
  70.     mTextFieldP->SetMaxNumChars(5);        
  71.     mTextFieldP->Set("34.6");
  72.     
  73.     mTextFieldP2 = (SCAPITextField*) new SCAPITextField(    this,
  74.                                                             200,
  75.                                                             85        );
  76.                                         
  77.     mTextFieldP3 = (SCAPITextField*) new SCAPITextField(    this,
  78.                                                             200,
  79.                                                             120        );
  80.     
  81.     char*    youpi = mTextFieldP->Get();
  82. }
  83.  
  84. MySCAPIWindow2::~MySCAPIWindow2()
  85. {
  86.     delete mMenuBarP;
  87.     delete mListP;
  88.     delete mStaticP;
  89.     delete mTextFieldP;
  90.     delete mTextFieldP2;
  91.     delete mTextFieldP3;
  92. }
  93.  
  94.  
  95. // Member functions
  96.  
  97. void    MySCAPIWindow2::ExecuteCommand(int    inCommand)
  98. {
  99.     switch (inCommand)
  100.     {
  101.         case 1500:
  102.             SCAPIMessageBox::Info("Hello, this is an info message.");
  103.             break;
  104.             
  105.         case 1501:
  106.             SCAPIMessageBox::Question("Do you want to close this window?");
  107.             break;
  108.             
  109.         case 1502:
  110.             SCAPIMessageBox::Caution("Going further will erase your harddisk...");
  111.             break;
  112.             
  113.         case 1503:
  114.             SCAPIMessageBox::Alert("An error occured.");
  115.             break;
  116.     }
  117. }