home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pwrgu2.zip / POWERGU2.EXE / GENHDRS / CMDHDRS / CMDHDRS.CPP next >
Text File  |  1995-07-25  |  1KB  |  42 lines

  1. //************************************************************
  2. // Reusable Handlers - Simple Command Handler
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // All Rights Reserved.
  6. //************************************************************
  7. #include <iapp.hpp>
  8. #include <icnrctl.hpp>
  9. #include <iframe.hpp>
  10. #include <icconst.h>
  11. #include "cmdhdr1.hpp"
  12. #include "cmdhdr2.hpp"
  13.  
  14. void main ( )
  15. {
  16.   // Create the frame with a container client window.
  17.   IFrameWindow frame( "Command Handlers" );
  18.   IContainerControl client( IC_FRAME_CLIENT_ID, &frame, &frame );
  19.   frame.setClient( &client );
  20.  
  21.   // Set up the container.
  22.   client
  23.    .setTitle( "Use mouse button 2 to display a pop-up menu." )
  24.    .showTitle()
  25.    .showTitleSeparator();
  26.  
  27.   // Add this container menu handler to display the pop-up menu.
  28.   PopupMenuHandler popupHandler;
  29.   popupHandler.handleEventsFor( &client );
  30.  
  31.   // Attach command handlers.
  32.   OneBeepCmdHandler oneBeepHandler;
  33.   oneBeepHandler.handleEventsFor( &client );
  34.   TwoBeepCmdHandler twoBeepHandler;
  35.   twoBeepHandler.handleEventsFor( &frame );
  36.  
  37.   frame
  38.    .setFocus()
  39.    .show();
  40.   IApplication::current().run();
  41. }
  42.