home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / tbar2 / tbar2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  25.1 KB  |  602 lines

  1. /******************************************************************************
  2. * .FILE:         tbar2.cpp                                                    *
  3. *                                                                             *
  4. * .DESCRIPTION:  Tool Bar Sample Program Version 2:    Class Implementation   *
  5. *                                                                             *
  6. * .CLASSES:      Editor                                                       *
  7. *                EditorCommandHandler                                         *
  8. *                FontSelectHandler                                            *
  9. *                EditorMLE                                                    *
  10. *                ToolBarNotebook                                              *
  11. *                ToolBarPage                                                  *
  12. *                PageHandler                                                  *
  13. *                                                                             *
  14. * .COPYRIGHT:                                                                 *
  15. *    Licensed Material - Program-Property of IBM                              *
  16. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  17. *                                                                             *
  18. * .DISCLAIMER:                                                                *
  19. *   The following [enclosed] code is sample code created by IBM               *
  20. *   Corporation.  This sample code is not part of any standard IBM product    *
  21. *   and is provided to you solely for the purpose of assisting you in the     *
  22. *   development of your applications.  The code is provided 'AS IS',          *
  23. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  24. *   arising out of your use of the sample code, even if they have been        *
  25. *   advised of the possibility of such damages.                               *
  26. *                                                                             *
  27. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  28. *                                                                             *
  29. ******************************************************************************/
  30. #include <ibase.hpp>
  31. #include <iapp.hpp>
  32. #include <iframe.hpp>
  33. #include <ifont.hpp>
  34. #include <itbar.hpp>
  35. #include <itbarbut.hpp>
  36. #include <imle.hpp>
  37. #include <icmdhdr.hpp>
  38. #include <imenubar.hpp>
  39. #include <iflytext.hpp>
  40. #include <istattxt.hpp>
  41. #include <iflyhhdr.hpp>
  42. #include <icombobx.hpp>
  43. #include <iselhdr.hpp>
  44. #include <idmhndlr.hpp>
  45. #include <isubmenu.hpp>
  46. #include <ifontdlg.hpp>
  47. #include <inotebk.hpp>
  48. #include <ititle.hpp>
  49. #include <imcelcv.hpp>
  50. #include <iradiobt.hpp>
  51. #include <icheckbx.hpp>
  52. #include <igroupbx.hpp>
  53. #include <ifiledlg.hpp>
  54. #include <icolor.hpp>
  55. #include <icoordsy.hpp>
  56. #include "tbar2.hpp"
  57. #include "tbar2.h"
  58.  
  59. /******************************************************************************
  60. * main -  creates and shows the editor window                                 *
  61. ******************************************************************************/
  62.  
  63. int main()
  64. {
  65.   ICoordinateSystem::setApplicationOrientation(
  66.           ICoordinateSystem::originLowerLeft );
  67.    Editor editor;
  68.    editor.show();
  69.    editor.setFocus();
  70.    IApplication::current().run();
  71.    return 0;
  72. }
  73.  
  74. /******************************************************************************
  75. * Class Editor::Editor - Constructor for the editor window                    *
  76. ******************************************************************************/
  77. Editor::Editor ()
  78.   : IFrameWindow(ID_MAIN_WINDOW)
  79.   , title(this)
  80.   , fileToolBar(ID_FILE, this)
  81.   , editToolBar(ID_EDIT, &fileToolBar, true)
  82.   , fontToolBar(ID_FONT, &editToolBar, true)
  83.   , flyText(ID_FLYTEXT, this)
  84.   , infoText(ID_INFOTEXT, this, this)
  85.   , flyHelpHandler(&flyText, &infoText, 0, 0)
  86.   , editWindow(ID_EDITOR, *this)
  87.   , commandHandler(*this)
  88.   , fontSelectHandler(*this)
  89.   , openButton(IC_ID_OPEN,&fileToolBar, &fileToolBar)
  90.   , saveButton(IC_ID_SAVE,&fileToolBar, &fileToolBar)
  91.   , cutButton(IC_ID_CUT,&editToolBar, &editToolBar)
  92.   , copyButton(IC_ID_COPY,&editToolBar, &editToolBar)
  93.   , pasteButton(IC_ID_PASTE,&editToolBar, &editToolBar)
  94.   , boldButton(IC_ID_BOLD,&fontToolBar, &fontToolBar,
  95.                IRectangle(), IToolBarButton::defaultStyle() |
  96.                IToolBarButton::noDragDelete )
  97.   , italicButton(IC_ID_ITALIC,     &fontToolBar, &fontToolBar,
  98.                  IRectangle(), IToolBarButton::defaultStyle() |
  99.                  IToolBarButton::noDragDelete )
  100.   , underscoreButton(IC_ID_UNDERSCORE, &fontToolBar, &fontToolBar,
  101.                      IRectangle(), IToolBarButton::defaultStyle() |
  102.                      IToolBarButton::noDragDelete )
  103.   , fontCombo(ID_FONTCOMBO, &fontToolBar, &fontToolBar, IRectangle(),
  104.               IComboBox::classDefaultStyle &~IComboBox::simpleType |
  105.               IComboBox::readOnlyDropDownType)
  106.   , menu(ID_MAIN_WINDOW,this)
  107.   , editFont()
  108. {
  109. /*-----------------------------------------------------------------------------|
  110. | Set the icon and the title                                                                |
  111. ------------------------------------------------------------------------------*/
  112.    setIcon( id() );
  113.    title.setTitleText(ID_MAIN_WINDOW);
  114.  
  115. /*-----------------------------------------------------------------------------|
  116. | Add buttons to the file toolbar                                              |
  117. ------------------------------------------------------------------------------*/
  118.    fileToolBar.addAsLast(&openButton,true)
  119.               .addAsLast(&saveButton);
  120.  
  121. /*-----------------------------------------------------------------------------|
  122. | Add buttons to the edit toolbar                                              |
  123. ------------------------------------------------------------------------------*/
  124.    editToolBar.addAsLast(&cutButton,true)
  125.               .addAsLast(©Button)
  126.               .addAsLast(&pasteButton);
  127.  
  128. /*-----------------------------------------------------------------------------|
  129. | Add buttons to the font toolbar                                              |
  130. ------------------------------------------------------------------------------*/
  131.    fontToolBar.addAsLast(&boldButton,true)
  132.               .addAsLast(&italicButton)
  133.               .addAsLast(&underscoreButton)
  134.               .addAsLast(&fontCombo,true);
  135.  
  136. /*-----------------------------------------------------------------------------|
  137. | Set up the latchabable style for font property buttons                       |
  138. ------------------------------------------------------------------------------*/
  139.    boldButton.enableLatching();
  140.    italicButton.enableLatching();
  141.    underscoreButton.enableLatching();
  142.  
  143. /*-----------------------------------------------------------------------------|
  144. | Load up front combo box with face names                                      |
  145. ------------------------------------------------------------------------------*/
  146.    fontCombo.setLimit(10);
  147.    IFont::FaceNameCursor fontCursor;
  148.    for ( fontCursor.setToFirst(); fontCursor.isValid(); fontCursor.setToNext())
  149.    {
  150.      IString faceName = IFont::faceNameAt(fontCursor);
  151.      fontCombo.addAsLast(faceName);
  152.      if (faceName.length() > fontCombo.limit())
  153.        fontCombo.setLimit(faceName.length());
  154.    }
  155.    updateFontToolBar();
  156.  
  157. /*-----------------------------------------------------------------------------|
  158. | Set up titles for toolbars when floating                                     |
  159. ------------------------------------------------------------------------------*/
  160.    fileToolBar.setFloatingTitle(ID_FILE);
  161.    editToolBar.setFloatingTitle(ID_EDIT);
  162.    fontToolBar.setFloatingTitle(ID_FONT);
  163.  
  164. /*-----------------------------------------------------------------------------|
  165. | Setup the editor                                                             |
  166. ------------------------------------------------------------------------------*/
  167.    setClient(&editWindow);
  168.    editWindow.setFont(editFont);
  169.    editWindow.importFromFile("toolbar2.not");
  170.    editWindow.setTop(1);
  171.  
  172. /*-----------------------------------------------------------------------------|
  173. | Add the info frame extension                                                 |
  174. ------------------------------------------------------------------------------*/
  175.    addExtension(&infoText, IFrameWindow::belowClient);
  176.  
  177. /*-----------------------------------------------------------------------------|
  178. | Set up and add the help handler                                              |
  179. ------------------------------------------------------------------------------*/
  180.    flyHelpHandler.setLongStringTableOffset(OFFSET_INFOTEXT);
  181.    flyHelpHandler.setDefaultText("\0");
  182.    flyHelpHandler.handleEventsFor(&fileToolBar);
  183.    flyHelpHandler.handleEventsFor(&editToolBar);
  184.    flyHelpHandler.handleEventsFor(&fontToolBar);
  185.  
  186. /*-----------------------------------------------------------------------------|
  187. | Attach the Command Handler to frame and toolbar                              |
  188. ------------------------------------------------------------------------------*/
  189.    commandHandler.handleEventsFor(this);
  190.    commandHandler.handleEventsFor(&fileToolBar);
  191.    commandHandler.handleEventsFor(&editToolBar);
  192.    commandHandler.handleEventsFor(&fontToolBar);
  193.  
  194. /*-----------------------------------------------------------------------------|
  195. | Add the handler to change the font                                           |
  196. ------------------------------------------------------------------------------*/
  197.    fontSelectHandler.handleEventsFor(&fontCombo);
  198.  
  199. /*-----------------------------------------------------------------------------|
  200. | Set up drag from menu                                                        |
  201. ------------------------------------------------------------------------------*/
  202.    fileSubmenu = new ISubmenu( menu.menuItem(ID_FILE).submenuHandle() );
  203.    IDMHandler::enableDragFrom( fileSubmenu );
  204.    editSubmenu = new ISubmenu( menu.menuItem(ID_EDIT).submenuHandle() );
  205.    IDMHandler::enableDragFrom( editSubmenu );
  206.  
  207.    moveSizeToClient(IRectangle(IPoint(100,100),
  208.                                ISize(editFont.avgCharWidth()*80,
  209.                                      editFont.maxCharHeight()*15)));
  210. }
  211.  
  212. /******************************************************************************
  213. * EditorCommandHandler::command - Handle user menu bar selections             *
  214. ******************************************************************************/
  215. IBase::Boolean EditorCommandHandler::command(ICommandEvent &event)
  216. {
  217.    switch (event.commandId())
  218.    {
  219.      case IC_ID_OPEN:
  220.      {
  221.         ITitle title(&editorFrame);
  222.         IFileDialog::Settings settings;
  223.         settings.setOpenDialog();
  224.         IFileDialog openDlg(IWindow::desktopWindow(),&editorFrame,settings);
  225.         if ( openDlg.pressedOK() )
  226.         {
  227.            editorFrame.disableUpdate();
  228.            editorFrame.editorWindow().removeAll();
  229.            editorFrame.editorWindow().importFromFile(openDlg.fileName());
  230.            editorFrame.enableUpdate();
  231.            editorFrame.editorWindow().setTop(1);
  232.            title.setText(openDlg.fileName());
  233.         }
  234.         break;
  235.      }
  236.      case IC_ID_SAVE:
  237.      {
  238.         ITitle title(&editorFrame);
  239.         IFileDialog::Settings settings;
  240.         settings.setSaveAsDialog();
  241.         IFileDialog saveDlg(IWindow::desktopWindow(),&editorFrame,settings);
  242.         if ( saveDlg.pressedOK() )
  243.         {
  244.            editorFrame.editorWindow().exportToFile(saveDlg.fileName());
  245.            title.setText(saveDlg.fileName());
  246.         }
  247.         break;
  248.      }
  249.      case IC_ID_CUT:
  250.      {
  251.          if(editorFrame.editorWindow().hasSelectedText())
  252.             editorFrame.editorWindow().cut();
  253.          break;
  254.      }
  255.      case IC_ID_COPY:
  256.      {
  257.          if(editorFrame.editorWindow().hasSelectedText())
  258.             editorFrame.editorWindow().copy();
  259.          break;
  260.      }
  261.      case IC_ID_PASTE:
  262.      {
  263.          if(editorFrame.editorWindow().clipboardHasTextFormat())
  264.             editorFrame.editorWindow().paste();
  265.          break;
  266.      }
  267.      case IC_ID_BOLD:
  268.      {
  269.          editorFrame.editorFont().setBold(!editorFrame.editorFont().isBold());
  270.          editorFrame.editorWindow().setFont(editorFrame.editorFont());
  271.          break;
  272.      }
  273.      case IC_ID_ITALIC:
  274.      {
  275.          editorFrame.editorFont().setItalic(!editorFrame.editorFont().isItalic());
  276.          editorFrame.editorWindow().setFont(editorFrame.editorFont());
  277.          break;
  278.      }
  279.      case IC_ID_UNDERSCORE:
  280.      {
  281.          editorFrame.editorFont().setUnderscore(!editorFrame.editorFont().isUnderscore());
  282.          editorFrame.editorWindow().setFont(editorFrame.editorFont());
  283.          break;
  284.      }
  285.      case ID_FONT:
  286.      {
  287.          IFontDialog::Settings settings(&editorFrame.editorFont());
  288.  
  289.          IFontDialog dlg(IWindow::desktopWindow(),&editorFrame,settings);
  290.          if ( dlg.pressedOK() )
  291.          {
  292.            editorFrame.updateFontToolBar();
  293.            editorFrame.editorWindow().setFont(editorFrame.editorFont());
  294.          }
  295.          break;
  296.      }
  297.      case ID_TOOLBARS:
  298.      {
  299.          ToolBarNotebook nbk(editorFrame);
  300.          break;
  301.      }
  302.    }
  303.    return true;
  304. }
  305.  
  306. //-------------------------------------------------------------------
  307. // Update font toolbar to reflect the current font
  308. //-------------------------------------------------------------------
  309. Editor& Editor::updateFontToolBar()
  310. {
  311. /*-----------------------------------------------------------------------------|
  312. |                                                                              |
  313. ------------------------------------------------------------------------------*/
  314.    // Update toolbar buttons (if they have not been dragged to the shredder)
  315.    if (boldButton.isValid())
  316.      boldButton.latch(editFont.isBold());
  317.    if (italicButton.isValid())
  318.      italicButton.latch(editFont.isItalic());
  319.    if (underscoreButton.isValid())
  320.      underscoreButton.latch(editFont.isUnderscore());
  321.  
  322. /*-----------------------------------------------------------------------------|
  323. |                                                                              |
  324. ------------------------------------------------------------------------------*/
  325.    // Update the combo box with the correct face name
  326.    fontCombo.select(fontCombo.locateText(editFont.name()));
  327.    return *this;
  328. }
  329.  
  330. //-------------------------------------------------------------------
  331. // Get the toolbar
  332. //-------------------------------------------------------------------
  333. IToolBar& Editor::toolBar ( unsigned long id )
  334. {
  335.    if ( id == ID_FILE )
  336.       return fileToolBar;
  337.    if ( id == ID_EDIT )
  338.       return editToolBar;
  339.    return fontToolBar;
  340. }
  341.  
  342. //-------------------------------------------------------------------
  343. // Handle combo box selections
  344. //-------------------------------------------------------------------
  345. IBase::Boolean FontSelectHandler::enter( IControlEvent& event)
  346. {
  347.   IString fontChoice =  ((IComboBox*)event.controlWindow())->text();
  348.   if(fontChoice.length())
  349.   {
  350.      // Set the new font
  351.      editorFrame.editorFont().setName(fontChoice);
  352.      editorFrame.editorWindow().setFont(editorFrame.editorFont());
  353.   }
  354.   return true;
  355. }
  356.  
  357. //-------------------------------------------------------------------
  358. // If the user drops a font onto the MLE from the system's font palette,
  359. // update the MLE.  This is only necessary for OS/2 PM MLEs since they
  360. // have their own presentation space.
  361. //-------------------------------------------------------------------
  362. ITextControl& EditorMLE::setLayoutDistorted ( unsigned long layoutAttributesOn,
  363.                                               unsigned long layoutAttributesOff )
  364. {
  365. #ifdef IC_PM
  366.    IMultiLineEdit::setLayoutDistorted(layoutAttributesOn,layoutAttributesOff);
  367.    if ( layoutAttributesOn & IWindow::fontChanged )
  368.    {
  369.      IFont newFont(editorFrame.editorWindow().presSpace());
  370.      editorFrame.editorFont() = newFont;
  371.      editorFrame.updateFontToolBar();
  372.      editorFrame.editorWindow().setFont(editorFrame.editorFont());
  373.    }
  374. #endif
  375.    return *this;
  376. }
  377.  
  378. //-------------------------------------------------------------------
  379. // ToolBarNotebook::ToolBarNotebook
  380. //-------------------------------------------------------------------
  381. ToolBarNotebook::ToolBarNotebook ( Editor&   editor )
  382.                 :IFrameWindow ( ID_TOOLBAR_WINDOW, IWindow::desktopWindow(),
  383.                                 (IWindow*) &editor, IRectangle(),
  384.                                 IFrameWindow::titleBar |
  385.                                 IFrameWindow::systemMenu |
  386.                                 IFrameWindow::dialogBorder |
  387.                                 IFrameWindow::appDBCSStatus ),
  388.                  editorFrame(editor),
  389.                  notebook(ID_NOTEBOOK,this,this)
  390. {
  391.   setClient(¬ebook);
  392.  
  393.   ITitle title(this);
  394.   title.setText(ID_TOOLBARS);
  395.  
  396.   notebook.setBinding(INotebook::spiral);
  397.   notebook.setMinorTabSize(ISize(0,0));
  398.  
  399. /*-----------------------------------------------------------------------------|
  400. |                                                                              |
  401. ------------------------------------------------------------------------------*/
  402.   // Add notebook pages
  403.   ToolBarPage filePage(ID_FILE,¬ebook,editor);
  404.   ToolBarPage editPage(ID_EDIT,¬ebook,editor);
  405.   ToolBarPage fontPage(ID_FONT,¬ebook,editor);
  406.  
  407. /*-----------------------------------------------------------------------------|
  408. |                                                                              |
  409. ------------------------------------------------------------------------------*/
  410.   // Center the notebook on the screen
  411.   IRectangle  clientRect;
  412.   clientRect.sizeTo(notebook.minimumSize());
  413.   clientRect.moveTo(IPoint((IWindow::desktopWindow()->size().width() -
  414.                             clientRect.width())/2,
  415.                            (IWindow::desktopWindow()->size().height() -
  416.                             clientRect.height())/2));
  417.  
  418.   moveSizeToClient(clientRect);
  419.   setFocus();
  420.   showModally();
  421.  
  422. }
  423.  
  424. //-------------------------------------------------------------------
  425. // ToolBarPage::ToolBarPage
  426. //-------------------------------------------------------------------
  427. ToolBarPage::ToolBarPage ( unsigned long id, INotebook* nbk, Editor& editor )
  428.             :IMultiCellCanvas(id,nbk,nbk),
  429.              editorFrame(editor),
  430.              locationBox(ID_LOCATION,this,this),
  431.              topButton(ID_TOP,this,this,IRectangle(),
  432.                        IRadioButton::defaultStyle()|IControl::group),
  433.              leftButton(ID_LEFT,this,this),
  434.              bottomButton(ID_BOTTOM,this,this),
  435.              rightButton(ID_RIGHT,this,this),
  436.              groupCheckBox(ID_GROUP,this,this),
  437.              floatingButton(ID_FLOATING,this,this),
  438.              hiddenButton(ID_HIDDEN,this,this),
  439.              viewBox(ID_VIEW,this,this),
  440.              bitmapButton(ID_BITMAP,this,this,IRectangle(),
  441.                           IRadioButton::defaultStyle()|IControl::group),
  442.              textButton(ID_TEXT,this,this),
  443.              bitmapAndTextButton(ID_BITMAP_AND_TEXT,this,this),
  444.              pageHandler(nbk,editor)
  445. {
  446. /*-----------------------------------------------------------------------------|
  447. |                                                                              |
  448. ------------------------------------------------------------------------------*/
  449.    INotebook::PageSettings settings(INotebook::PageSettings::autoPageSize |
  450.                                     INotebook::PageSettings::majorTab);
  451.  
  452.    settings.setTabText(id);
  453.  
  454. /*-----------------------------------------------------------------------------|
  455. |                                                                              |
  456. ------------------------------------------------------------------------------*/
  457.    locationBox.setText(ID_LOCATION);
  458.    topButton.setText(ID_TOP);
  459.    leftButton.setText(ID_LEFT);
  460.    bottomButton.setText(ID_BOTTOM);
  461.    rightButton.setText(ID_RIGHT);
  462.    groupCheckBox.setText(ID_GROUP);
  463.    floatingButton.setText(ID_FLOATING);
  464.    hiddenButton.setText(ID_HIDDEN);
  465.    viewBox.setText(ID_VIEW);
  466.    bitmapButton.setText(ID_BITMAP);
  467.    textButton.setText(ID_TEXT);
  468.    bitmapAndTextButton.setText(ID_BITMAP_AND_TEXT);
  469.  
  470. /*-----------------------------------------------------------------------------|
  471. |                                                                              |
  472. ------------------------------------------------------------------------------*/
  473.    addToCell(&locationBox,2,2,6,13);
  474.    addToCell(&topButton,4,4,2);
  475.    addToCell(&leftButton,4,5,2);
  476.    addToCell(&bottomButton,4,6,2);
  477.    addToCell(&rightButton,4,7,2);
  478.    addToCell(&groupCheckBox,5,8);
  479.    addToCell(&floatingButton,4,10,2);
  480.    addToCell(&hiddenButton,4,12,2);
  481.  
  482.    addToCell(&viewBox,9,2,5,7);
  483.    addToCell(&bitmapButton,11,4);
  484.    addToCell(&textButton,11,5);
  485.    addToCell(&bitmapAndTextButton,11,6);
  486.  
  487. /*-----------------------------------------------------------------------------|
  488. |                                                                              |
  489. ------------------------------------------------------------------------------*/
  490.    switch ( editorFrame.toolBar(this->id()).location() )
  491.    {
  492.       case IToolBar::aboveClient:
  493.          topButton.select();
  494.          break;
  495.       case IToolBar::belowClient:
  496.          bottomButton.select();
  497.          break;
  498.       case IToolBar::leftOfClient:
  499.          leftButton.select();
  500.          break;
  501.       case IToolBar::rightOfClient:
  502.          rightButton.select();
  503.          break;
  504.       case IToolBar::floating:
  505.          floatingButton.select();
  506.          break;
  507.       case IToolBar::hidden:
  508.          hiddenButton.select();
  509.          break;
  510.    }
  511.  
  512. /*-----------------------------------------------------------------------------|
  513. |                                                                              |
  514. ------------------------------------------------------------------------------*/
  515.    switch ( editorFrame.toolBar(this->id()).buttonView() )
  516.    {
  517.       case IToolBarButton::bitmapView:
  518.          bitmapButton.select();
  519.          break;
  520.       case IToolBarButton::textView:
  521.          textButton.select();
  522.          break;
  523.       case IToolBarButton::bitmapAndTextView:
  524.          bitmapAndTextButton.select();
  525.          break;
  526.    }
  527.  
  528.    if ( !editorFrame.toolBar(this->id()).isGroup() )
  529.       groupCheckBox.select();
  530.  
  531.    pageHandler.handleEventsFor(this);
  532.    nbk->addLastPage(settings,this);
  533.    sizeTo(minimumSize());
  534. }
  535.  
  536. //-------------------------------------------------------------------
  537. // Handle selection events for controls on the page
  538. //-------------------------------------------------------------------
  539. IBase::Boolean PageHandler::selected ( IControlEvent& event )
  540. {
  541.    switch ( event.controlWindow()->id() )
  542.    {
  543.       case ID_TOP:
  544.          editorFrame.toolBar(event.window()->id()).setLocation
  545.                             (IToolBar::aboveClient);
  546.          break;
  547.       case ID_BOTTOM:
  548.          editorFrame.toolBar(event.window()->id()).setLocation
  549.                             (IToolBar::belowClient);
  550.          break;
  551.       case ID_LEFT:
  552.          editorFrame.toolBar(event.window()->id()).setLocation
  553.                             (IToolBar::leftOfClient);
  554.          break;
  555.       case ID_RIGHT:
  556.          editorFrame.toolBar(event.window()->id()).setLocation
  557.                             (IToolBar::rightOfClient);
  558.          break;
  559.       case ID_FLOATING:
  560.          editorFrame.toolBar(event.window()->id()).setLocation
  561.                             (IToolBar::floating);
  562.          break;
  563.       case ID_HIDDEN:
  564.          editorFrame.toolBar(event.window()->id()).setLocation
  565.                             (IToolBar::hidden);
  566.          break;
  567.       case ID_GROUP:
  568.          {
  569.            ICheckBox* checkBox = (ICheckBox*) event.controlWindow();
  570.            editorFrame.toolBar(event.window()->id()).enableGroup
  571.                               (!checkBox->isSelected());
  572.  
  573.            switch (editorFrame.toolBar(event.window()->id()).location())
  574.            {
  575.              case IToolBar::aboveClient:
  576.              case IToolBar::belowClient:
  577.              case IToolBar::leftOfClient:
  578.              case IToolBar::rightOfClient:
  579.                 editorFrame.toolBar(event.window()->id()).parent()->
  580.                             setLayoutDistorted(IWindow::layoutChanged |
  581.                                                IWindow::immediateUpdate,0);
  582.                 break;
  583.            }
  584.          }
  585.          break;
  586.       case ID_BITMAP:
  587.          editorFrame.toolBar(event.window()->id()).setButtonView
  588.                             (IToolBarButton::bitmapView);
  589.          break;
  590.       case ID_TEXT:
  591.          editorFrame.toolBar(event.window()->id()).setButtonView
  592.                             (IToolBarButton::textView);
  593.          break;
  594.       case ID_BITMAP_AND_TEXT:
  595.          editorFrame.toolBar(event.window()->id()).setButtonView
  596.                             (IToolBarButton::bitmapAndTextView);
  597.          break;
  598.    }
  599.    return false;
  600. }
  601.  
  602.