home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / toolbar / flytbar / flytbar.cpp next >
C/C++ Source or Header  |  1996-10-29  |  2KB  |  72 lines

  1. /************************************************************
  2. / Tool Bar - Tool Bar Fly-over Help Example   
  3. /
  4. / Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. / Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. / All Rights Reserved.
  7. ************************************************************/
  8. #include <iframe.hpp>
  9. #include <ipushbut.hpp>
  10. #include <iinfoa.hpp>
  11. #include <iflytext.hpp>
  12. #include <iflyhhdr.hpp>
  13. #include <icanvas.hpp>
  14. #include <itbar.hpp>
  15. #include <itbarbut.hpp>
  16. #include "flytbar.h"
  17.  
  18. void main( )
  19. {
  20.  
  21.   // Create the frame, a canvas for the client, and
  22.   // the tool bar.
  23.   IFrameWindow frame("Tool Bar Fly-over Help");
  24.   ICanvas client (IC_FRAME_CLIENT_ID, &frame, &frame);
  25.   frame.setClient(&client);
  26.   
  27.  
  28.   // Create the fly-over text for short text and an info area 
  29.   // for the long text.
  30.   IFlyText flyText(ID_FLYTEXT, &frame);
  31.   IInfoArea infoArea(&frame);
  32.  
  33.   // Create the fly-over help handler for our own resources
  34.   // and attach it to the frame.
  35.   IFlyOverHelpHandler flyHandler( &flyText, &infoArea);
  36.   flyHandler.handleEventsFor(&frame);
  37.  
  38.   // Set the string table offsets for our resources.
  39.   flyHandler.setFlyTextStringTableOffset(FLYTEXT_OFFSET);
  40.   flyHandler.setLongStringTableOffset( LONGTEXT_OFFSET);
  41.  
  42.  
  43.   // Create a tool bar for edit controls.
  44.   IToolBar editToolBar (ID_EDITTOOLBAR, &frame);
  45.  
  46.   // Create the edit buttons from IOC-supplied tool bar 
  47.   // buttons and add them to the tool bar.
  48.   IToolBarButton cut(IC_ID_CUT, &editToolBar, &editToolBar);
  49.   IToolBarButton copy(IC_ID_COPY, &editToolBar, &editToolBar);
  50.   IToolBarButton paste(IC_ID_PASTE, &editToolBar, &editToolBar);
  51.   editToolBar
  52.     .addAsLast(&cut)
  53.     .addAsLast(©)
  54.     .addAsLast(&paste);
  55.  
  56.   // Create a special application tool bar.
  57.   IToolBar launchToolBar (ID_LAUNCHTOOLBAR, &editToolBar, true);
  58.  
  59.   // Create a few tool bar buttons of our own and add
  60.   // them to the tool bar.
  61.   IToolBarButton launchBrowser (
  62.              ID_LAUNCHWEB, &launchToolBar, &launchToolBar);
  63.   launchToolBar.addAsLast (&launchBrowser);
  64.  
  65.   // Show the window and start the application.
  66.   frame
  67.    .setFocus()
  68.    .show();
  69.  
  70.   IApplication::current().run();
  71. }
  72.