home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / drag1 / dmsamp1.cpp next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  4.0 KB  |  77 lines

  1. /******************************************************************************
  2. * .FILE:         dmsamp1.cpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION:  Direct Manipulation Sample Program 1: Class Implementation   *
  5. *                                                                             *
  6. * .CLASSES:                                                                   *
  7. *                                                                             *
  8. * .COPYRIGHT:                                                                 *
  9. *    Licensed Material - Program-Property of IBM                              *
  10. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  11. *                                                                             *
  12. * .DISCLAIMER:                                                                *
  13. *   The following [enclosed] code is sample code created by IBM               *
  14. *   Corporation.  This sample code is not part of any standard IBM product    *
  15. *   and is provided to you solely for the purpose of assisting you in the     *
  16. *   development of your applications.  The code is provided 'AS IS',          *
  17. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  18. *   arising out of your use of the sample code, even if they have been        *
  19. *   advised of the possibility of such damages.                               *
  20. *                                                                             *
  21. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  22. *                                                                             *
  23. ******************************************************************************/
  24.  
  25. #include <ibase.hpp>
  26. #include <iframe.hpp>
  27. #include <ientryfd.hpp>
  28. #include <idmefit.hpp>
  29. #include <idmhndlr.hpp>
  30. #include <icoordsy.hpp>
  31. #include "dmsamp1.h"
  32.  
  33. /*------------------------------------------------------------------------------
  34. | main - Application Entry point                                               |
  35. ------------------------------------------------------------------------------*/
  36. int main()
  37. {
  38.   ICoordinateSystem::setApplicationOrientation(
  39.           ICoordinateSystem::originLowerLeft );
  40.  
  41. /*-----------------------------------------------------------------------------|
  42. | Create a generic frame window.                                               |
  43. ------------------------------------------------------------------------------*/
  44.   IFrameWindow
  45.     frame( WND_MAIN );
  46.  
  47. /*-----------------------------------------------------------------------------|
  48. | Create 2 entry fields for the client area.                                   |
  49. ------------------------------------------------------------------------------*/
  50.   IEntryField
  51.     client( 1000, &frame, &frame ),
  52.     ext   ( 1001, &frame, &frame );
  53.  
  54. /*-----------------------------------------------------------------------------|
  55. | Enable source and target direct manipulation support for both entry fields.  |
  56. ------------------------------------------------------------------------------*/
  57.   IDMHandler::enableDragDropFor( &client );
  58.   IDMHandler::enableDragDropFor( &ext );
  59.  
  60. /*-----------------------------------------------------------------------------|
  61. | Frame setup - Put both entry fields in the client area, with one  added as   |
  62. | an extension.                                                                |
  63. ------------------------------------------------------------------------------*/
  64.   frame
  65.     .setIcon( frame.id() )
  66.     .setClient( &client )
  67.     .addExtension( &ext, IFrameWindow::belowClient, 0.5 )
  68.     .setFocus()
  69.     .show();
  70.  
  71. /*-----------------------------------------------------------------------------|
  72. | Run Direct Manipulation Sample 1                                             |
  73. |-----------------------------------------------------------------------------*/
  74.   IApplication::current().run();
  75.   return 0;
  76. }
  77.