home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ctdemo.zip / classes / @CLSLIB1.ZIP / cls / iclui / ahellowi.cpp < prev    next >
C/C++ Source or Header  |  1994-10-07  |  4KB  |  189 lines

  1. #ifndef INCL_AHELLOWINDOW
  2. #define INCL_AHELLOWINDOW
  3.  
  4. #ifndef __FIRST__
  5. #define __FIRST__
  6. #define __IMPL__AHELLOWINDOW
  7. #endif
  8.  
  9. /////V AHelloWindow PCM f:\cls_ibm\cls\iclui 0 PM 20.10.94 19:37:12
  10.  
  11. /*
  12. /////H 
  13. 20.10.94 19:37 PM 0 copied from: AHelloWindow TOS f:\cls_ibm\cls\iclui 0 PM 20.10.94 00:51:07
  14. 30.03.95 10:34 PM 0 archived: AHelloWindow PCM f:\cls_ibm\cls\iclui 0 PM 20.10.94 19:37:12
  15. /////
  16. */
  17.  
  18. /////1
  19. #undef inline
  20.  
  21. #include <bsa.h>
  22.  
  23. /////I iapp.hpp @ @ @ @ pre 
  24. #include <iapp.hpp>
  25.  
  26. /////I istattxt.hpp @ @ @ @ pre 
  27. #include <istattxt.hpp>
  28.  
  29. /////I iinfoa.hpp @ @ @ @ pre 
  30. #include <iinfoa.hpp>
  31.  
  32. /////I imenubar.hpp @ @ @ @ pre 
  33. #include <imenubar.hpp>
  34.  
  35. /////I ifont.hpp @ @ @ @ pre 
  36. #include <ifont.hpp>
  37.  
  38. /////I ahellow3.h @ @ @ @ pre 
  39. #include <ahellow3.h>
  40.  
  41. /////I iframe.hpp @ @ @ @ pre 
  42. #include <iframe.hpp>
  43.  
  44. /////I icmdhdr.hpp @ @ @ @ pre 
  45. #include <icmdhdr.hpp>
  46.  
  47.  
  48. #ifndef __INLINE__
  49. #define inline
  50. #endif
  51.  
  52. /////C AHelloWindow @ @ app define:_PM_ 
  53. class AHelloWindow :
  54.  
  55. /////B IFrameWindow @ @ visible extern 
  56. public                 IFrameWindow,
  57.  
  58. /////B ICommandHandler @ @ visible extern 
  59. public                 ICommandHandler
  60.  
  61. {
  62.  
  63. private:
  64. /////D hello @  @ instance private 
  65.     IStaticText   *     hello;
  66.  
  67. /////D infoArea @  @ instance private 
  68.     IInfoArea     *     infoArea;
  69.  
  70. /////D menuBar @  @ instance private 
  71.     IMenuBar      *     menuBar;
  72.  
  73. /////D statusLine @  @ instance private 
  74.     IStaticText   *     statusLine;
  75.  
  76.  
  77. protected:
  78.     Boolean    command (ICommandEvent&);
  79. public:
  80.     AHelloWindow (unsigned long);
  81. };
  82.  
  83.     void     main ();
  84.  
  85. /////2
  86. #undef inline
  87.  
  88.  
  89. #if (defined __INLINE__) || (defined __IMPL__AHELLOWINDOW)
  90.  
  91. #ifndef __INLINE__
  92. #define inline
  93. #endif
  94.  
  95. /////
  96. #endif
  97.  
  98. /////3
  99. #undef inline
  100.  
  101. #ifdef __IMPL__AHELLOWINDOW
  102. /////F AHelloWindow @ @ instance public 
  103. AHelloWindow :: AHelloWindow(unsigned long windowId)
  104.   : IFrameWindow (
  105.     IFrameWindow::defaultStyle()
  106.     | IFrameWindow::minimizedIcon,
  107.     windowId)
  108. {
  109.   hello=new IStaticText(WND_HELLO,
  110.     this, this);
  111.   hello->setText(STR_HELLO);
  112.   hello->setAlignment(
  113.     IStaticText::centerCenter);
  114.   setClient(hello);
  115.  
  116.   infoArea=new IInfoArea(this);
  117.   infoArea->setInactiveText(STR_INFO);
  118.  
  119.   statusLine=new IStaticText
  120.     (WND_STATUS, this, this);
  121.   statusLine->setText(STR_CENTER);
  122.   addExtension(statusLine,
  123.     IFrameWindow::aboveClient,
  124.     IFont(statusLine).maxCharHeight());
  125.  
  126.   handleEventsFor(this);
  127.   menuBar=new IMenuBar(WND_MAIN, this);
  128.   menuBar->checkItem(MI_CENTER);
  129.  
  130.   sizeTo(ISize(400,300));
  131.   setFocus();
  132.   show();
  133.  
  134. }
  135.  
  136. /////F command @ @ instance protected 
  137. Boolean AHelloWindow :: command(ICommandEvent & cmdEvent)
  138. {
  139.   switch (cmdEvent.commandId()) {
  140.  
  141.     case MI_CENTER:
  142.       hello->setAlignment(
  143.         IStaticText::centerCenter);
  144.       statusLine->setText(STR_CENTER);
  145.       menuBar->checkItem(MI_CENTER);
  146.       menuBar->uncheckItem(MI_LEFT);
  147.       menuBar->uncheckItem(MI_RIGHT);
  148.       return(true);
  149.       break;
  150.  
  151.     case MI_LEFT:
  152.       hello->setAlignment(
  153.         IStaticText::centerLeft);
  154.       statusLine->setText(STR_LEFT);
  155.       menuBar->uncheckItem(MI_CENTER);
  156.       menuBar->checkItem(MI_LEFT);
  157.       menuBar->uncheckItem(MI_RIGHT);
  158.       return(true);
  159.       break;
  160.  
  161.     case MI_RIGHT:
  162.       hello->setAlignment(
  163.         IStaticText::centerRight);
  164.       statusLine->setText(STR_RIGHT);
  165.       menuBar->uncheckItem(MI_CENTER);
  166.       menuBar->uncheckItem(MI_LEFT);
  167.       menuBar->checkItem(MI_RIGHT);
  168.       return(true);
  169.       break;
  170.  
  171.   } 
  172.  
  173.   return(false);
  174. }
  175.  
  176. /////F main @ @ global 
  177. void main()
  178. {
  179.  
  180.   AHelloWindow mainWindow (WND_MAIN);
  181.  
  182.   IApplication::current().run();
  183. }
  184.  
  185. /////
  186. #endif
  187.  
  188. #endif
  189.