home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / acdf3 / acdfvw3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  2.3 KB  |  71 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //                                              SAMPLE CODE
  3. //
  4. // FileName: ACDFVw3.cpp
  5. //
  6. // ClassName: ACompDocFwkView
  7. //
  8. // Description: Compound Document Framework Simple Container View
  9. //              In this sample the view inherits from the IView class 
  10. //              therefore all functionality is inherited from the base class
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #include "ACDFVw3.hpp"
  13. #include "acdfres3.h"
  14.  
  15. #include <iframe.hpp>  // must be included to set the icon
  16. #include <istring.hpp>
  17. #include <igstring.hpp>
  18. #include <igrect.hpp>
  19. #include <igrafctx.hpp>
  20. #include <igelipse.hpp>
  21. #include <igline.hpp>
  22. #include <igarc.hpp>
  23. #include <iguibndl.hpp> // must be include after windows.h
  24. #include <icolor.hpp>
  25.  
  26. ACompDocFwkView::ACompDocFwkView(IGUIBundle& bundle ) :
  27.                  IView(bundle)
  28. // Constructor 
  29. {   IFUNCTRACE_DEVELOP();
  30.     bundle.frameWindow().setIcon(IC_ACDF3);
  31. }
  32.  
  33. ACompDocFwkView::~ACompDocFwkView()
  34. // Destructor - resize the window
  35. {   IFUNCTRACE_DEVELOP();}
  36.  
  37. void ACompDocFwkView::initialize()
  38. // Intialize code e.g build menus
  39. {   IFUNCTRACE_DEVELOP();
  40.  
  41.     IView::initialize();
  42.     bundle().objectView().setBackgroundColor(IColor(64,128,128)); // Set the color to green
  43. }
  44.  
  45. void ACompDocFwkView::drawContents( IPresSpaceHandle& hdl,
  46.                       const IRectangle& invalidArea,
  47.                       Boolean metaFile)
  48. //  We can override "drawContents" if we want to optimize our drawing
  49. //  or do things differently when rendering to a meta-file (where controls
  50. //  won't be displayed).
  51. {   IFUNCTRACE_DEVELOP();
  52.  
  53.     if (metaFile)
  54.     {
  55.     // Place the embedded image code here !!!!
  56.         IGString myText (IApplication::current().userResourceLibrary().loadString(STR_METAFILE),IPoint(30,70));
  57.         IGraphicContext ctxt ( hdl );
  58.         IGEllipse myEllipse(IRectangle(IPoint(10,10),IPoint(210,50)));
  59.         IGLine myLine1(IPoint(10,30),IPoint(40,150));
  60.         IGLine myLine2(IPoint(210,30),IPoint(190,150));
  61.         IG3PointArc myArc(IPoint(40,150),IPoint(75,170),IPoint(190,150));
  62.  
  63.         myEllipse.drawOn( ctxt) ;
  64.         myLine1.drawOn( ctxt) ;
  65.         myLine2.drawOn( ctxt) ;
  66.         myArc.drawOn( ctxt) ;
  67.         myText.drawOn( ctxt) ;
  68.    }
  69.  
  70. }
  71.