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

  1. /******************************************************************************
  2. * .FILE:         tbar2.hpp                                                    *
  3. *                                                                             *
  4. * .DESCRIPTION:  Tool Bar Sample Program Version 2:    Class definitions      *
  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. #ifndef _TBAR2_
  31. #define _TBAR2_
  32.  
  33. #include <iapp.hpp>
  34. #include <iframe.hpp>
  35. #include <ifont.hpp>
  36. #include <itbar.hpp>
  37. #include <itbarbut.hpp>
  38. #include <imle.hpp>
  39. #include <icmdhdr.hpp>
  40. #include <imenubar.hpp>
  41. #include <iflytext.hpp>
  42. #include <istattxt.hpp>
  43. #include <iflyhhdr.hpp>
  44. #include <icombobx.hpp>
  45. #include <iselhdr.hpp>
  46. #include <idmhndlr.hpp>
  47. #include <isubmenu.hpp>
  48. #include <ifontdlg.hpp>
  49. #include <inotebk.hpp>
  50. #include <ititle.hpp>
  51. #include <imcelcv.hpp>
  52. #include <iradiobt.hpp>
  53. #include <icheckbx.hpp>
  54. #include <igroupbx.hpp>
  55. #include <ifiledlg.hpp>
  56. #include <icolor.hpp>
  57.  
  58. class Editor;
  59.  
  60. //-------------------------------------------------------------------
  61. // EditorCommandHandler
  62. //-------------------------------------------------------------------
  63. class EditorCommandHandler : public ICommandHandler
  64. {
  65. public:
  66.   EditorCommandHandler ( Editor& editor ) : editorFrame(editor) {}
  67.  
  68. Boolean
  69.  command ( ICommandEvent& event );
  70.  
  71. private:
  72. Editor
  73.  &editorFrame;
  74. };
  75.  
  76. //-------------------------------------------------------------------
  77. // FontSelectHandler
  78. //
  79. // This class is used to handle selection of a new font from the font
  80. // combo box on the tool bar.
  81. //-------------------------------------------------------------------
  82. class FontSelectHandler : public ISelectHandler
  83. {
  84. public:
  85.   FontSelectHandler ( Editor& editor ) : editorFrame(editor) {}
  86.  
  87. protected:
  88. virtual Boolean
  89.   enter ( IControlEvent& event );
  90.  
  91. private:
  92. Editor
  93.  &editorFrame;
  94. };
  95.  
  96. //-------------------------------------------------------------------
  97. // EditorMLE
  98. //-------------------------------------------------------------------
  99. class EditorMLE : public IMultiLineEdit
  100. {
  101. public:
  102.   EditorMLE ( unsigned long id, Editor& editor )
  103.             : IMultiLineEdit ( id, (IWindow*) &editor, (IWindow*) &editor ),
  104.               editorFrame(editor) {}
  105.  
  106. virtual ITextControl
  107.   &setLayoutDistorted ( unsigned long layoutAttributesOn,
  108.                         unsigned long layoutAttributesOff );
  109. private:
  110. Editor
  111.  &editorFrame;
  112. };
  113.  
  114. //-------------------------------------------------------------------
  115. // Editor
  116. //
  117. // This class is the main window of the sample problem.  It is
  118. // responsible for creating and managing all of the windows that
  119. // are used.
  120. //-------------------------------------------------------------------
  121. class Editor : public IFrameWindow
  122. {
  123. public:
  124.   Editor();
  125.  
  126. EditorMLE
  127.  &editorWindow ( ) { return editWindow; }
  128.  
  129. IFont
  130.  &editorFont ( ) { return editFont; }
  131.  
  132. Editor
  133.  &updateFontToolBar ( );
  134.  
  135. IToolBar
  136.  &toolBar ( unsigned long id );
  137.  
  138. private:
  139.   ITitle
  140.     title;
  141.   IToolBar
  142.     fileToolBar,
  143.     editToolBar,
  144.     fontToolBar;
  145. IFlyText
  146.   flyText;
  147. IStaticText
  148.   infoText;
  149. IFlyOverHelpHandler
  150.   flyHelpHandler;
  151. EditorMLE
  152.   editWindow;
  153. EditorCommandHandler
  154.   commandHandler;
  155. FontSelectHandler
  156.   fontSelectHandler;
  157. IToolBarButton
  158.   openButton,
  159.   saveButton,
  160.   cutButton,
  161.   copyButton,
  162.   pasteButton,
  163.   boldButton,
  164.   italicButton,
  165.   underscoreButton;
  166. IComboBox
  167.   fontCombo;
  168. IMenuBar
  169.   menu;
  170. IFont
  171.   editFont;
  172. ISubmenu
  173.   *fileSubmenu,
  174.   *editSubmenu;
  175. };
  176.  
  177. //-------------------------------------------------------------------
  178. // ToolBarNotebook
  179. //-------------------------------------------------------------------
  180. class ToolBarNotebook : public IFrameWindow
  181. {
  182. public:
  183.   ToolBarNotebook ( Editor&   editor );
  184. private:
  185. Editor
  186.   &editorFrame;
  187. INotebook
  188.   notebook;
  189. };
  190.  
  191. //-------------------------------------------------------------------
  192. // PageHandler
  193. //-------------------------------------------------------------------
  194. class PageHandler : public ISelectHandler
  195. {
  196. public:
  197.   PageHandler ( INotebook* notebook, Editor& editor )
  198.               : toolbarNotebook(notebook),
  199.                 editorFrame(editor) {}
  200.  
  201. protected:
  202. virtual Boolean
  203.   selected ( IControlEvent& event );
  204.  
  205. private:
  206. INotebook
  207.  *toolbarNotebook;
  208. Editor
  209.  &editorFrame;
  210. };
  211.  
  212. //-------------------------------------------------------------------
  213. // ToolBarPage
  214. //-------------------------------------------------------------------
  215. class ToolBarPage : public IMultiCellCanvas
  216. {
  217. public:
  218.   ToolBarPage ( unsigned long id, INotebook* nbk, Editor& editor );
  219. private:
  220. Editor
  221.  &editorFrame;
  222. IGroupBox
  223.   locationBox;
  224. IRadioButton
  225.   topButton,
  226.   leftButton,
  227.   bottomButton,
  228.   rightButton;
  229. ICheckBox
  230.   groupCheckBox;
  231. IRadioButton
  232.   floatingButton,
  233.   hiddenButton;
  234. IGroupBox
  235.   viewBox;
  236. IRadioButton
  237.   bitmapButton;
  238. IRadioButton
  239.   textButton;
  240. IRadioButton
  241.   bitmapAndTextButton;
  242. PageHandler
  243.   pageHandler;
  244. };
  245.  
  246. #endif /* _TBAR2_ */
  247.