home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / toolbar / tbarlocs / tbarlocs.cpp < prev   
Encoding:
C/C++ Source or Header  |  1996-10-29  |  3.0 KB  |  93 lines

  1. //************************************************************
  2. // Tool Bars  - Custom Button 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 <itbar.hpp>
  10. #include <itbarbut.hpp>
  11. #include <imle.hpp>
  12. #include <iapp.hpp>
  13. #include <icconst.h>
  14.  
  15. void main()
  16. {
  17. IFrameWindow
  18.   frame ("Tool Bar Location Example");
  19.  
  20. // Create an MLE for the client area.
  21. IMultiLineEdit
  22.   mle(IC_FRAME_CLIENT_ID, &frame, &frame);
  23.  
  24. // Create a Tool Bar above the client by default.
  25. IToolBar
  26.   aboveClient(0x01, &frame);
  27.  
  28. // Create tool bars in the other frame extension areas.
  29. IToolBar
  30.   leftOfClient (0x02, &frame, IToolBar::leftOfClient),
  31.   rightOfClient(0x03, &frame, IToolBar::rightOfClient),
  32.   belowClient  (0x04, &frame, IToolBar::belowClient),
  33.   floating1    (0x05, &frame, IToolBar::floating),
  34.   floating2    (0x06, &frame, IToolBar::floating);
  35.  
  36. // Create some library supplied tool bar buttons.
  37. IToolBarButton
  38.   cutButton1      (IC_ID_CUT,        &aboveClient, &aboveClient),
  39.   copyButton1     (IC_ID_COPY,       &aboveClient, &aboveClient),
  40.   pasteButton1    (IC_ID_PASTE,      &aboveClient, &aboveClient),
  41.   cutButton2      (IC_ID_CUT,        &leftOfClient, &leftOfClient),
  42.   copyButton2     (IC_ID_COPY,       &leftOfClient, &leftOfClient),
  43.   pasteButton2    (IC_ID_PASTE,      &leftOfClient, &leftOfClient),
  44.   cutButton3      (IC_ID_CUT,        &rightOfClient, &rightOfClient),
  45.   copyButton3     (IC_ID_COPY,       &rightOfClient, &rightOfClient),
  46.   pasteButton3    (IC_ID_PASTE,      &rightOfClient, &rightOfClient),
  47.   cutButton4      (IC_ID_CUT,        &belowClient, &belowClient),
  48.   copyButton4     (IC_ID_COPY,       &belowClient, &belowClient),
  49.   pasteButton4    (IC_ID_PASTE,      &belowClient, &belowClient),
  50.   cutButton5      (IC_ID_CUT,        &floating1, &floating1),
  51.   copyButton5     (IC_ID_COPY,       &floating1, &floating1),
  52.   pasteButton5    (IC_ID_PASTE,      &floating1, &floating1),
  53.   cutButton6      (IC_ID_CUT,        &floating2, &floating2),
  54.   copyButton6     (IC_ID_COPY,       &floating2, &floating2),
  55.   pasteButton6    (IC_ID_PASTE,      &floating2, &floating2);
  56.  
  57. // Add the buttons to the respective tool bars.
  58. aboveClient
  59.   .addAsLast ( &cutButton1 )
  60.   .addAsLast ( ©Button1 )
  61.   .addAsLast ( &pasteButton1 );
  62. belowClient  
  63.   .addAsLast ( &cutButton2 )
  64.   .addAsLast ( ©Button2 )
  65.   .addAsLast ( &pasteButton2 );
  66. leftOfClient
  67.   .addAsLast ( &cutButton3 )
  68.   .addAsLast ( ©Button3 )
  69.   .addAsLast ( &pasteButton3 );
  70. rightOfClient
  71.   .addAsLast ( &cutButton4 )
  72.   .addAsLast ( ©Button4 )
  73.   .addAsLast ( &pasteButton4 );
  74. floating1
  75.   .addAsLast ( &cutButton5 )
  76.   .addAsLast ( ©Button5 )
  77.   .addAsLast ( &pasteButton5 );
  78. floating2
  79.   .addAsLast ( &cutButton6 )
  80.   .addAsLast ( ©Button6 )
  81.   .addAsLast ( &pasteButton6 );
  82.  
  83.  
  84. frame
  85.   .setClient (&mle)
  86.   .setFocus()
  87.   .show();
  88. IApplication::current().run();
  89.  
  90. }
  91.  
  92.  
  93.