home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / btns.zip / BUTTONS.CPP < prev    next >
Text File  |  1994-06-23  |  2KB  |  57 lines

  1. /******************************************************************************/
  2. /* DISCLAIMER OF WARRANTIES:                                                  */
  3. /*   The following [enclosed] code is sample code created by IBM              */
  4. /*   Corporation.  This sample code is not part of any standard IBM product   */
  5. /*   and is provided to you solely for the purpose of assisting you in the    */
  6. /*   development of your applications.  The code is provided "AS IS",         */
  7. /*   without warranty of any kind.  IBM shall not be liable for any damages   */
  8. /*   arising out of your use of the sample code, even if they have been       */
  9. /*   advised of the possibility of such damages.                              */
  10. /******************************************************************************/
  11. #define INCL_WINFRAMEMGR
  12. #include <os2.h>
  13.  
  14. #include <iframe.hpp>
  15. #include <ipushbut.hpp>
  16. #include <igraphbt.hpp>
  17. #include <imcelcv.hpp>
  18. #include <isetcv.hpp>
  19. #include <iapp.hpp>
  20. #include "buttons.h"
  21.  
  22. void main ()
  23. {
  24.    IFrameWindow frame ("Push Button Example");
  25.    IMultiCellCanvas client (ID_MCELL, &frame, &frame);
  26.    ISetCanvas buttonHolder (ID_BUTTONS, &client, &client);
  27.    IPushButton
  28.       okPushButton (ID_OK, &buttonHolder, &buttonHolder),
  29.       cancelPushButton (SC_CLOSE, &buttonHolder, &buttonHolder);
  30.    IResourceLibrary resLibrary;
  31.    IPointerHandle iconHandle = resLibrary.loadIcon (ID_ICONBUTTON);
  32.    IGraphicPushButton
  33.       bitmapPushButton (ID_BITMAPBUTTON, &buttonHolder, &buttonHolder,
  34.                         ISystemBitmapHandle (ISystemBitmapHandle::program)),
  35.       iconPushButton (ID_ICONBUTTON, &buttonHolder, &buttonHolder,
  36.                       iconHandle);
  37.    IPushButton helpButton (ID_HELP, &buttonHolder, &buttonHolder, IRectangle(),
  38.                            IPushButton::defaultStyle() | IPushButton::noPointerFocus);
  39.    okPushButton.enableDefault()
  40.                .setText ("OK")
  41.                .enableTabStop()
  42.                .enableGroup();
  43.  
  44.    cancelPushButton.enableSystemCommand()
  45.                    .setText("Cancel");
  46.  
  47.    helpButton.enableHelp()
  48.              .setText ("Help");
  49.  
  50.    client.addToCell (&buttonHolder, 2,6,3,1);
  51.    client.setRowHeight (1,20,true);
  52.    frame.setClient (&client)
  53.         .setFocus()
  54.         .show();
  55.    IApplication::current().run();
  56. }
  57.