home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / HELLO6 / ANOTEBW6.CPP < prev    next >
C/C++ Source or Header  |  1995-04-07  |  32KB  |  408 lines

  1. /*****************************************************************************
  2. * HELLO WORLD SAMPLE PROGRAM - Version 6: Class Implementation (anotebw6.cpp)*
  3. *                                                                            *
  4. * COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. *
  5. *                                                                            *
  6. * DISCLAIMER OF WARRANTIES:                                                  *
  7. *   The following [enclosed] code is sample code created by IBM              *
  8. *   Corporation.  This sample code is not part of any standard IBM product   *
  9. *   and is provided to you solely for the purpose of assisting you in the    *
  10. *   development of your applications.  The code is provided "AS IS",         *
  11. *   without warranty of any kind.  IBM shall not be liable for any damages   *
  12. *   arising out of your use of the sample code, even if they have been       *
  13. *   advised of the possibility of such damages.                              *
  14. *****************************************************************************/
  15. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  16.  
  17. //Include User Interface Class Library class headers:                         V6
  18. #ifndef _IBASE_                         //Make sure ibase.hpp is included
  19.   #include <ibase.hpp>                  //  since that is where IC_<environ>
  20. #endif                                  //  is defined.
  21. #include <ireslib.hpp>                  //Include IResourceId class header    V6
  22.  
  23. #include "anotebw6.hpp"                 //Include ANotebookWindow class headerV6
  24. #include "ahellow6.h"                   //Include symbolic definitions        V6
  25. /**************************************************************************   V6
  26. * ANotebookWindow :: ANotebookWindow                                      *   V6
  27. *   Construct a secondary frame window to contain the Hello World         *   V6
  28. *     settings notebook.                                                  *   V6
  29. *   The ISlider object, layersSlider, is created with,                    *   V6
  30. *     4 tick marks (4ul),                                                 *   V6
  31. *     spacing between ticks of 45 pixels (45ul),                          *   V6
  32. *     no padding at the bottom (alignBottom),                             *   V6
  33. *     a digital arm (snapToTickMark),                                     *   V6
  34. *     a primary scale,                                                    *   V6
  35. *     a horizontal bar with home on the left (horizontal & homeLeft),     *   V6
  36. *     arrow buttons on the right, and as a visible control.               *   V6
  37. **************************************************************************/ //V6
  38. ANotebookWindow :: ANotebookWindow(unsigned long windowId,                  //V6
  39.                                         AHelloWindow * ownerWnd)            //V6
  40.   : IFrameWindow(IResourceId(windowId), ownerWnd)                           //V6
  41.    ,helloSettingsNotebook(WND_NOTEBOOK, this, this)                         //V6
  42.      ,earthPage(WND_EARTHPAGE,&helloSettingsNotebook,&helloSettingsNotebook)//V6
  43.        ,earthPageHeading(WND_EARTHPAGEHEADING, &earthPage, &earthPage)      //V6
  44.        ,starsHeading(WND_STARSHEADING, &earthPage, &earthPage)              //V6
  45.        ,starsSettings(WND_STARSSETTINGS, &earthPage, &earthPage)            //V6
  46.          ,twinkleBox(WND_TWINKLEBOX, &starsSettings, &starsSettings)        //V6
  47.          ,brightBox(WND_BRIGHTBOX, &starsSettings, &starsSettings)          //V6
  48.        ,layersHeading(WND_LAYERSHEADING, &earthPage, &earthPage)            //V6
  49.        ,layersSlider(WND_LAYERSSPIN, &earthPage, &earthPage,                //V6
  50.               IRectangle(), 4ul, 45ul,                                      //V6
  51.               IProgressIndicator::alignBottom   |                           //V6
  52.               IProgressIndicator::snapToTickMark|                           //V6
  53.               IProgressIndicator::primaryScale1 |                           //V6
  54.               IProgressIndicator::horizontal    |                           //V6
  55.               IProgressIndicator::homeLeft      |                           //V6
  56.               ISlider::buttonsRight |                                       //V6
  57.               IWindow::visible)                                             //V6
  58.        ,earthColorHeading(WND_EARTHCOLORHEADING, &earthPage, &earthPage)    //V6
  59.        ,earthColorSettings(WND_EARTHCOLORSETTINGS, &earthPage, &earthPage)  //V6
  60.          ,cyanButton(WND_CYANBUTTON, &earthColorSettings,                   //V6
  61.                                      &earthColorSettings)                   //V6
  62.          ,greenButton(WND_GREENBUTTON, &earthColorSettings,                 //V6
  63.                                        &earthColorSettings)                 //V6
  64.          ,whiteButton(WND_WHITEBUTTON, &earthColorSettings,                 //V6
  65.                                        &earthColorSettings)                 //V6
  66.          ,yellowButton(WND_YELLOWBUTTON, &earthColorSettings,               //V6
  67.                                        &earthColorSettings)                 //V6
  68.        ,earthPageButtons(WND_EARTHPAGEBUTTONS, &earthPage, &earthPage)      //V6
  69.          ,earthApplyButton(DID_EARTHAPPLY, &earthPageButtons,               //V6
  70.                                            &earthPageButtons)               //V6
  71.          ,earthResetButton(DID_EARTHRESET, &earthPageButtons,               //V6
  72.                                            &earthPageButtons)               //V6
  73.          ,earthCloseButton(DID_NOTEBOOKCLOSE, &earthPageButtons,            //V6
  74.                                               &earthPageButtons)            //V6
  75.      ,dateTimePage(WND_DATETIMEPAGE, &helloSettingsNotebook,                //V6
  76.                                      &helloSettingsNotebook)                //V6
  77.        ,dateTimePageHeading(WND_DATETIMEPAGEHEADING, &dateTimePage,         //V6
  78.                                                      &dateTimePage)         //V6
  79.        ,dateHeading(WND_DATEHEADING, &dateTimePage, &dateTimePage)          //V6
  80.        ,dateSettings(WND_DATESETTINGS, &dateTimePage, &dateTimePage)        //V6
  81.          ,dateLongButton(WND_DATELONGBOX, &dateSettings, &dateSettings)     //V6
  82.          ,dateShortButton(WND_DATESHORTBOX, &dateSettings, &dateSettings)   //V6
  83.          ,dateLongExample(WND_DATELONGEXAMPLE, &dateSettings, &dateSettings)//V6
  84.          ,dateShortExample(WND_DATESHORTEXAMPLE,&dateSettings,&dateSettings)//V6
  85.        ,timeHeading(WND_TIMEHEADING, &dateTimePage, &dateTimePage)          //V6
  86.        ,timeSettings(WND_TIMESETTINGS, &dateTimePage, &dateTimePage)        //V6
  87.          ,timeLongButton(WND_TIMELONGBOX, &timeSettings, &timeSettings)     //V6
  88.          ,timeShortButton(WND_TIMESHORTBOX, &timeSettings, &timeSettings)   //V6
  89.          ,timeLongExample(WND_TIMELONGEXAMPLE, &timeSettings, &timeSettings)//V6
  90.          ,timeShortExample(WND_TIMESHORTEXAMPLE,&timeSettings,&timeSettings)//V6
  91.        ,dateTimePageButtons(WND_DATETIMEPAGEBUTTONS, &dateTimePage,         //V6
  92.                                                      &dateTimePage)         //V6
  93.          ,dateTimeApplyButton(DID_DATETIMEAPPLY, &dateTimePageButtons,      //V6
  94.                                                  &dateTimePageButtons)      //V6
  95.          ,dateTimeResetButton(DID_DATETIMERESET, &dateTimePageButtons,      //V6
  96.                                                  &dateTimePageButtons)      //V6
  97.          ,dateTimeCloseButton(DID_NOTEBOOKCLOSE, &dateTimePageButtons,      //V6
  98.                                                  &dateTimePageButtons)      //V6
  99.    , notebookCommandHandler(this)                                           //V6
  100. {                                                                           //V6
  101. /*------------------------ Setup Text Values -----------------------------|   V6
  102. | Load text strings from the resource file and set alignment where needed.|   V6
  103. |------------------------------------------------------------------------*/ //V6
  104.   earthPageHeading.setText(IResourceId(STR_EARTHPAGEHEADING))               //V6
  105.         .setAlignment(IStaticText::centerCenter);                           //V6
  106.   starsHeading.setText(IResourceId(STR_STARSHEADING));                      //V6
  107.   twinkleBox.setText(IResourceId(STR_TWINKLEBOX));                          //V6
  108.   brightBox.setText(IResourceId(STR_BRIGHTBOX));                            //V6
  109.   layersHeading.setText(IResourceId(STR_LAYERSHEADING));                    //V6
  110.   earthColorHeading.setText(IResourceId(STR_EARTHCOLORHEADING));            //V6
  111.   cyanButton.setText(IResourceId(STR_CYAN));                                //V6
  112.   greenButton.setText(IResourceId(STR_GREEN));                              //V6
  113.   whiteButton.setText(IResourceId(STR_WHITE));                              //V6
  114.   yellowButton.setText(IResourceId(STR_YELLOW));                            //V6
  115.   earthApplyButton.setText(IResourceId(STR_APPLY));                         //V6
  116.   earthResetButton.setText(IResourceId(STR_RESET));                         //V6
  117.   earthCloseButton.setText(IResourceId(STR_CLOSE));                         //V6
  118.  
  119.   dateTimePageHeading.setText(IResourceId(STR_DATETIMEPAGEHEADING))         //V6
  120.         .setAlignment(IStaticText::centerCenter);                           //V6
  121.   dateHeading.setText(IResourceId(STR_DATEHEADING));                        //V6
  122.   dateLongButton.setText(IResourceId(STR_DATELONGBOX));                     //V6
  123.   dateShortButton.setText(IResourceId(STR_DATESHORTBOX));                   //V6
  124.   dateLongExample.setText(IResourceId(STR_DATELONGEXAMPLE))                 //V6
  125.         .setAlignment(IStaticText::centerLeft);                             //V6
  126.   dateShortExample.setText(IResourceId(STR_DATESHORTEXAMPLE))               //V6
  127.         .setAlignment(IStaticText::centerLeft);                             //V6
  128.   timeHeading.setText(IResourceId(STR_TIMEHEADING));                        //V6
  129.   timeLongButton.setText(IResourceId(STR_TIMELONGBOX));                     //V6
  130.   timeShortButton.setText(IResourceId(STR_TIMESHORTBOX));                   //V6
  131.   timeLongExample.setText(IResourceId(STR_TIMELONGEXAMPLE))                 //V6
  132.         .setAlignment(IStaticText::centerLeft);                             //V6
  133.   timeShortExample.setText(IResourceId(STR_TIMESHORTEXAMPLE))               //V6
  134.         .setAlignment(IStaticText::centerLeft);                             //V6
  135.   dateTimeApplyButton.setText(IResourceId(STR_APPLY));                      //V6
  136.   dateTimeResetButton.setText(IResourceId(STR_RESET));                      //V6
  137.   dateTimeCloseButton.setText(IResourceId(STR_CLOSE));                      //V6
  138.  
  139. /*---------------------------- Setup the Slider --------------------------|   V6
  140. | Set the width and value for each tick mark on the slider.               |   V6
  141. |------------------------------------------------------------------------*/ //V6
  142.   layersSlider.setTickLength(5).                                            //V6
  143.              setTickText(0,"0").                                            //V6
  144.              setTickText(1,"1").                                            //V6
  145.              setTickText(2,"2").                                            //V6
  146.              setTickText(3,"3");                                            //V6
  147.  
  148. /*----------------------- Setup the Color Button Canvas ------------------|   V6
  149. | Place the color buttons in the colors canvas.                           |   V6
  150. |   Start with column 2 to get a left margin.                             |   V6
  151. |------------------------------------------------------------------------*/ //V6
  152.   earthColorSettings.addToCell(&cyanButton,  2,1);                          //V6
  153.   earthColorSettings.addToCell(&greenButton, 2,2);                          //V6
  154.   earthColorSettings.addToCell(&whiteButton, 3,1);                          //V6
  155.   earthColorSettings.addToCell(&yellowButton,3,2);                          //V6
  156.  
  157. /*----------------------- Setup the Earth Page Canvas --------------------|   V6
  158. | Organize the Earth settings page on the earthPage multicell canvas.     |   V6
  159. |   Start with column 2 to get a left margin.                             |   V6
  160. |   The headings span 2 columns to prevent stretching of the controls.    |   V6
  161. |------------------------------------------------------------------------*/ //V6
  162.   earthPage.addToCell(&earthPageHeading,   2, 1,2,1);                       //V6
  163.   earthPage.addToCell(&starsHeading,       2, 4,2,1);                       //V6
  164.   earthPage.addToCell(&starsSettings,      2, 5,1,1);                       //V6
  165.   earthPage.addToCell(&layersHeading,      2, 8,2,1);                       //V6
  166.   earthPage.addToCell(&layersSlider,       2, 9,1,2);                       //V6
  167.   earthPage.addToCell(&earthColorHeading,  2,13,2,1);                       //V6
  168.   earthPage.addToCell(&earthColorSettings, 2,14,1,2);                       //V6
  169.   earthPage.addToCell(&earthPageButtons,   2,18,2,1);                       //V6
  170.  
  171. /*----------------------- Set Earth Page Initial Values ------------------|   V6
  172. | Call the function that sets the earth page values from the source       |   V6
  173. |   AEarthWindow.                                                         |   V6
  174. |------------------------------------------------------------------------*/ //V6
  175.   resetEarthSettings();                                                     //V6
  176.   twinkleBox.enableTabStop();                                               //V6
  177.   layersSlider.enableTabStop();                                             //V6
  178.   cyanButton.enableTabStop();                                               //V6
  179.   earthApplyButton.enableTabStop();                                         //V6
  180.  
  181. /*----------------- Setup the Date & Time Settings Canvas ----------------|   V6
  182. | Organize the date & time radio buttons and examples on the              |   V6
  183. |   dateTimeSettings multicell canvas.                                    |   V6
  184. |   Start with column 2 to get a left margin.                             |   V6
  185. |   The controls are placed in column 2 and the examples in column 3.     |   V6
  186. |   The setAlignment(IStaticText::centerLeft) functions used when setting |   V6
  187. |     the text values cause the examples to align vertically.             |   V6
  188. |------------------------------------------------------------------------*/ //V6
  189.   dateSettings.addToCell(&dateLongButton,  2, 1);                           //V6
  190.   dateSettings.addToCell(&dateLongExample, 3, 1);                           //V6
  191.   dateSettings.addToCell(&dateShortButton, 2, 2);                           //V6
  192.   dateSettings.addToCell(&dateShortExample,3, 2);                           //V6
  193.   timeSettings.addToCell(&timeLongButton,  2, 1);                           //V6
  194.   timeSettings.addToCell(&timeLongExample, 3, 1);                           //V6
  195.   timeSettings.addToCell(&timeShortButton, 2, 2);                           //V6
  196.   timeSettings.addToCell(&timeShortExample,3, 2);                           //V6
  197.  
  198. /*------------------- Setup the Date & Time Page Canvas ------------------|   V6
  199. | Organize the date & time settings page on the dateTimePage canvas.      |   V6
  200. |   Start with column 2 to get a left margin.                             |   V6
  201. |   The headings span 2 columns to prevent stretching of the controls.    |   V6
  202. |   The settings canvases contained in the page canvas is assigned to an  |   V6
  203. |     area that is two columns by two rows.                               |   V6
  204. |------------------------------------------------------------------------*/ //V6
  205.   dateTimePage.addToCell(&dateTimePageHeading,2, 1,2,1);                    //V6
  206.   dateTimePage.addToCell(&dateHeading,        2, 4,2,1);                    //V6
  207.   dateTimePage.addToCell(&dateSettings,       2, 5,2,2);                    //V6
  208.   dateTimePage.addToCell(&timeHeading,        2, 9,1,1);                    //V6
  209.   dateTimePage.addToCell(&timeSettings,       2,10,2,2);                    //V6
  210.   dateTimePage.addToCell(&dateTimePageButtons,2,14,2,1);                    //V6
  211.  
  212. /*------------------- Set Date & Time Page Initial Values ----------------|   V6
  213. | Call the function that sets the date & time page values from the source |   V6
  214. |   AHelloWindow.                                                         |   V6
  215. |------------------------------------------------------------------------*/ //V6
  216.   resetDateTimeSettings();                                                  //V6
  217.   dateLongButton.enableTabStop();                                           //V6
  218.   timeLongButton.enableTabStop();                                           //V6
  219.   dateTimeApplyButton.enableTabStop();                                      //V6
  220.  
  221. /*-------------------- Setup the Settings Notebook -----------------------|   V6
  222. | Create the notebook page settings with attributes for a major tab and   |   V6
  223. |   automatic page size.                                                  |   V6
  224. | Set tab text to the Earth tab text from the resource file.              |   V6
  225. | Use the earthPage canvas and the notebook settings to add a page to the |   V6
  226. |   beginning of the notebook.                                            |   V6
  227. | Reset the tab text to the date and time tab text from the resource file.|   V6
  228. | Use the dateTimePage canvas and the notebook settings to add a page to  |   V6
  229. |   the end of the notebook.                                              |   V6
  230. | The Motif release of the User Interface Class Library automatically     |   V6
  231. |    sizes the major tab. For other releases, manually resize the tabs.   |   V6
  232. |------------------------------------------------------------------------*/ //V6
  233.   INotebook::PageSettings                                                   //V6
  234.         helloSettings(INotebook::PageSettings::majorTab|                    //V6
  235.                       INotebook::PageSettings::autoPageSize);               //V6
  236.   helloSettings.setTabText(IResourceId(STR_EARTHTAB));                      //V6
  237.   helloSettingsNotebook.addFirstPage(helloSettings,&earthPage);             //V6
  238.   helloSettings.setTabText(IResourceId(STR_DATETIMETAB));                   //V6
  239.   helloSettingsNotebook.addLastPage(helloSettings,&dateTimePage);           //V6
  240. #ifndef IC_MOTIF                                                            //V6
  241.   helloSettingsNotebook.setMajorTabSize(ISize(100,30));                     //V6
  242. #endif                                                                      //V6
  243.  
  244. /*-----------------------------------------------------------------------------
  245. | When a page is added to a notebook and using the autoPageSize style,        |
  246. | the pages are automatically resized to the current notebook size.           |
  247. | Therefore, we need to resize the notebook pages to their minimum size       |
  248. | so that the notebook can properly calculate it's minimum size.              |
  249. -----------------------------------------------------------------------------*/
  250.   earthPage.sizeTo( earthPage.minimumSize() );                            //V6
  251.   dateTimePage.sizeTo( dateTimePage.minimumSize() );                      //V6
  252.  
  253. /*-------------------- Complete Setup of the Frame -----------------------|   V6
  254. | Place the notebook into the client portion of the ANotebookWindow frame.|   V6
  255. | Start processing command events for all the controls in the notebook.   |   V6
  256. |------------------------------------------------------------------------*/ //V6
  257.   setClient(&helloSettingsNotebook);                                        //V6
  258.   notebookCommandHandler.handleEventsFor(&helloSettingsNotebook);           //V6
  259.  
  260. /*-----------------------------------------------------------------------------
  261. | Resize the notebook frame window based on the minimum size of the notebook  |
  262. -----------------------------------------------------------------------------*/
  263. #ifndef IC_MOTIF                                                            //V6
  264.   moveSizeToClient( IRectangle( position(),                                 //V6
  265.                     helloSettingsNotebook.minimumSize() ) );                //V6
  266. #else                                                                       //V6
  267.   moveSizeTo( IRectangle( position(),                                       //V6
  268.               helloSettingsNotebook.minimumSize() ) );                      //V6
  269. #endif                                                                      //V6
  270.  
  271. } /* end ANotebookWindow :: ANotebookWindow(...) */                         //V6
  272.  
  273. /**************************************************************************   V6
  274. * ANotebookWindow :: ~ANotebookWindow - Destructor for the notebook window*   V6
  275. *   Stop handling events for the notebook.                                *   V6
  276. **************************************************************************/ //V6
  277. ANotebookWindow :: ~ANotebookWindow()                                       //V6
  278. {                                                                           //V6
  279.   notebookCommandHandler.stopHandlingEventsFor(&helloSettingsNotebook);     //V6
  280. } /* end ANotebookWindow :: ~ANotebookWindow() */                           //V6
  281.  
  282. /**************************************************************************   V6
  283. * ANotebookWindow :: applyEarthSettings                                   *   V6
  284. *   Apply earth settings changes to the owner's earth window.             *   V6
  285. **************************************************************************/ //V6
  286. ANotebookWindow                                                             //V6
  287.   &ANotebookWindow :: applyEarthSettings()                                  //V6
  288. {                                                                           //V6
  289.   AHelloWindow *helloWindow = (AHelloWindow *)owner();                      //V6
  290.   helloWindow->earth()->enableTwinkle(twinkleBox.isSelected());             //V6
  291.   helloWindow->earth()->enableBright(brightBox.isSelected());               //V6
  292.   helloWindow->earth()->setLayers(layersSlider.armTickOffset());            //V6
  293.   if (cyanButton.isSelected())                                              //V6
  294.     helloWindow->earth()->setEarthColor(IColor::cyan);                      //V6
  295.   if (greenButton.isSelected())                                             //V6
  296.     helloWindow->earth()->setEarthColor(IColor::green);                     //V6
  297.   if (whiteButton.isSelected())                                             //V6
  298.     helloWindow->earth()->setEarthColor(IColor::white);                     //V6
  299.   if (yellowButton.isSelected())                                            //V6
  300.     helloWindow->earth()->setEarthColor(IColor::yellow);                    //V6
  301.                                                                             //V6
  302.   return (*this);                                                           //V6
  303. } /* end ANotebookWindow :: applyEarthSettings() */                         //V6
  304.                                                                             //V6
  305. /**************************************************************************   V6
  306. * ANotebookWindow :: resetEarthSettings                                   *   V6
  307. *   Reset local earth settings to the current settings from the           *   V6
  308. *     owner's earth window.                                               *   V6
  309. **************************************************************************/ //V6
  310. ANotebookWindow                                                             //V6
  311.   &ANotebookWindow :: resetEarthSettings()                                  //V6
  312. {                                                                           //V6
  313.   AHelloWindow *helloWindow = (AHelloWindow *)owner();                      //V6
  314.   helloWindow->earth()->isTwinkling()  ? twinkleBox.select()                //V6
  315.                                         : twinkleBox.deselect();            //V6
  316.   helloWindow->earth()->isBright()     ? brightBox.select()                 //V6
  317.                                         : brightBox.deselect();             //V6
  318.   layersSlider.moveArmToTick(helloWindow->earth()->layers());               //V6
  319.   if (helloWindow->earth()->earthColor().value()==IColor::cyan)             //V6
  320.     cyanButton.select();                                                    //V6
  321.   if (helloWindow->earth()->earthColor().value()==IColor::green)            //V6
  322.     greenButton.select();                                                   //V6
  323.   if (helloWindow->earth()->earthColor().value()==IColor::white)            //V6
  324.     whiteButton.select();                                                   //V6
  325.   if (helloWindow->earth()->earthColor().value()==IColor::yellow)           //V6
  326.     yellowButton.select();                                                  //V6
  327.                                                                             //V6
  328.   return (*this);                                                           //V6
  329. } /* end ANotebookWindow :: resetEarthSettings() */                         //V6
  330.  
  331. /**************************************************************************   V6
  332. * ANotebookWindow :: applyDateTimeSettings                                *   V6
  333. *   Apply date and time settings changes to the owner's window.           *   V6
  334. **************************************************************************/ //V6
  335. ANotebookWindow                                                             //V6
  336.   &ANotebookWindow :: applyDateTimeSettings()                               //V6
  337. {                                                                           //V6
  338.   AHelloWindow *helloWindow = (AHelloWindow *)owner();                      //V6
  339.   helloWindow->enableDateLong(dateLongButton.isSelected());                 //V6
  340.   helloWindow->enableTimeLong(timeLongButton.isSelected());                 //V6
  341.                                                                             //V6
  342.   return (*this);                                                           //V6
  343. } /* end ANotebookWindow :: applyDateTimeSettings() */                      //V6
  344.                                                                             //V6
  345. /************************************************************************** //V6
  346. * ANotebookWindow :: resetDateTimeSettings                                * //V6
  347. *   Reset local date and time settings to current settings from the       * //V6
  348. *     owner's window.                                                     * //V6
  349. **************************************************************************/ //V6
  350. ANotebookWindow                                                             //V6
  351.   &ANotebookWindow :: resetDateTimeSettings()                               //V6
  352. {                                                                           //V6
  353.   AHelloWindow *helloWindow = (AHelloWindow *)owner();                      //V6
  354.   helloWindow->isDateLong() ? dateLongButton.select()                       //V6
  355.                             : dateShortButton.select();                     //V6
  356.   helloWindow->isTimeLong() ? timeLongButton.select()                       //V6
  357.                             : timeShortButton.select();                     //V6
  358.                                                                             //V6
  359.   return (*this);                                                           //V6
  360. } /* end ANotebookWindow :: resetDateTimeSettings() */                      //V6
  361.                                                                             //V6
  362. /**************************************************************************   V6
  363. * ANotebookCommandHandler :: ANotebookCommandHandler - constructor        *   V6
  364. *       Construct the command handler from a pointer to the               *   V6
  365. *       ANotebookWindow for which events will be handled.                 *   V6
  366. **************************************************************************/ //V6
  367. ANotebookCommandHandler :: ANotebookCommandHandler(ANotebookWindow *nbFrame)//V6
  368. {                                                                           //V6
  369.    frame=nbFrame;                        //Save frame to be handled           V6
  370. } /* end ANotebookCommandHandler :: ANotebookCommandHandler(...) */         //V6
  371.  
  372. /************************************************************************** //V6
  373. * ANotebookCommandHandler :: command                                      * //V6
  374. *   Process command events for ANotebookWindow.                           * //V6
  375. **************************************************************************/ //V6
  376. IBase::Boolean                                                              //V6
  377.   ANotebookCommandHandler :: command(ICommandEvent & cmdEvent)              //V6
  378. {                                                                           //V6
  379.   Boolean eventProcessed(true);         //Assume event will be processed    //V6
  380.  
  381. /*--------------------- Process command events ---------------------------| //V6
  382. |  Depending on the command event ID,                                     | //V6
  383. |    update or reset local settings to the Hello World settings.          | //V6
  384. |  Regardless of the page, if the close button is pressed, close notebook.| //V6
  385. |------------------------------------------------------------------------*/ //V6
  386.   switch (cmdEvent.commandId()) {                                           //V6
  387.     case DID_EARTHAPPLY:                                                    //V6
  388.       frame->applyEarthSettings();                                          //V6
  389.       break;                                                                //V6
  390.     case DID_EARTHRESET:                                                    //V6
  391.       frame->resetEarthSettings();                                          //V6
  392.       break;                                                                //V6
  393.     case DID_DATETIMEAPPLY:                                                 //V6
  394.       frame->applyDateTimeSettings();                                       //V6
  395.       break;                                                                //V6
  396.     case DID_DATETIMERESET:                                                 //V6
  397.       frame->resetDateTimeSettings();                                       //V6
  398.       break;                                                                //V6
  399.     case DID_NOTEBOOKCLOSE:                                                 //V6
  400.       frame->close();                                                       //V6
  401.       break;                                                                //V6
  402.     default:                            //Otherwise,                        //V6
  403.       eventProcessed=false;             //  the event wasn't processed      //V6
  404.   } /* end switch */                                                        //V6
  405.                                                                             //V6
  406.   return(eventProcessed);                                                   //V6
  407. } /* end ANotebookCommandHandler :: command(...) */                         //V6
  408.