home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / dm / lboxdrag / lboxdrag.cpp next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.3 KB  |  49 lines

  1. //************************************************************
  2.  
  3. // Direct Manipulation - List Box Example
  4. //
  5. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  6. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  7. // All Rights Reserved.
  8. //************************************************************
  9. #include <iframe.hpp>
  10. #include <ilistbox.hpp>
  11. #include <ientryfd.hpp>
  12. #include <idmhndlr.hpp>
  13. #include <idmprov.hpp>
  14. #include <icoordsy.hpp>
  15.  
  16. #include "lboxitem.hpp"
  17.  
  18. void main()
  19.   {
  20.   IFrameWindow
  21.     frame( "List Box Drag Drop Sample" );
  22.  
  23.   IListBox
  24.     client( 0, &frame, &frame, IRectangle()
  25. #ifdef IC_WIN
  26.     ,IListBox::defaultStyle() & ~IListBox::border3D
  27. #endif
  28.     );
  29.   ListBoxItemProvider
  30.     provider( &client );
  31.   IDMHandler::enableDragDropFor( &client );
  32.   client.addAsLast( "Drag an item as text" );
  33.   client.addAsLast( "Drag to shredder to delete (OS/2 only)" );
  34.   client.addAsLast( "Drop on item to replace text" );
  35.   client.addAsLast( "Drop off end to add item" );
  36.  
  37.   IEntryField
  38.     ef( 0xef, &frame, &frame );
  39.   IDMHandler::enableDragDropFor( &ef );
  40.   ef.setLimit( 1024 );
  41.   ef.setText( "Drag text from here to list box" );
  42.  
  43.   frame.setClient( &client );
  44.   frame.addExtension( &ef, frame.belowClient, 30 );
  45.   frame.setFocus();
  46.   frame.moveSizeTo( frame.rect().scaleBy( 0.5, 1.0 ) );
  47.   frame.showModally();
  48.   }
  49.