home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / APPEXPRT.PAK / TWINDOWV.OWL < prev    next >
Encoding:
Text File  |  1997-05-06  |  4.0 KB  |  145 lines

  1. <<[H]TWindowView [[TWindowView]]
  2. ##{hheader.snp}
  3. #include <owl/docview.h>
  4.  
  5. ##<<TApplication QUERY_FILENAME_CPP [[Filename]]
  6. #include "[[Filename]].rh"            // Definition of all resources.
  7.  
  8.  
  9. //{{TWindowView = [[TWindowView]]}}
  10. class [[TWindowView]] : public TWindowView {
  11.   public:
  12.     [[TWindowView]](TDocument& doc, TWindow* parent = 0);
  13.     virtual ~[[TWindowView]]();
  14. ##--BEGIN-- @OPT_APPL_PRINTING
  15.  
  16. //{{[[TWindowView]]VIRTUAL_BEGIN}}
  17.   public:
  18.     virtual void Paint(TDC& dc, bool erase, TRect& rect);
  19. ##:DBVirtual(\\"[[TWindowView]]", "Paint")
  20. //{{[[TWindowView]]VIRTUAL_END}}
  21. //{{[[TWindowView]]RSP_TBL_BEGIN}}
  22.   protected:
  23.     void EvGetMinMaxInfo(MINMAXINFO far& minmaxinfo);
  24. //{{[[TWindowView]]RSP_TBL_END}}
  25. DECLARE_RESPONSE_TABLE([[TWindowView]]);
  26. ##--END-- @OPT_APPL_PRINTING
  27. };    //{{[[TWindowView]]}}
  28. ##{hfooter.snp}
  29. >>[H]TWindowView [[TWindowView]]
  30.  
  31.  
  32. <<[CPP]TWindowView [[TWindowView]]
  33. ##{cheader.snp}
  34. #include <owl/pch.h>
  35.  
  36. ##<<TApplication QUERY_FILE_H [[FileName]]
  37. #include "[[FileName]]"
  38. ##QUERY_FILE_H [[FileName]]
  39. #include "[[FileName]]"
  40.  
  41. #include <stdio.h>
  42.  
  43.  
  44. //{{[[TWindowView]] Implementation}}
  45.  
  46.  
  47. ##--BEGIN-- @OPT_APPL_PRINTING
  48. ##@QUERY_APPL_COMMENT == VALUE_VERBOSE 4
  49. //
  50. // Build a response table for all messages/commands handled
  51. // by [[TWindowView]] derived from TWindowView.
  52. //
  53. DEFINE_RESPONSE_TABLE1([[TWindowView]], TWindowView)
  54. //{{[[TWindowView]]RSP_TBL_BEGIN}}
  55. ##:DBResponse(\\"[[TWindowView]]", "", "", "WM_GETMINMAXINFO", "")
  56.   EV_WM_GETMINMAXINFO,
  57. //{{[[TWindowView]]RSP_TBL_END}}
  58. END_RESPONSE_TABLE;
  59.  
  60.  
  61. ##--END-- @OPT_APPL_PRINTING
  62. ##--BEGIN-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
  63. //--------------------------------------------------------
  64. // [[TWindowView]]
  65. // ~~~~~~~~~~
  66. // Construction/Destruction handling.
  67. //
  68. ##--END-- @QUERY_APPL_COMMENT == VALUE_VERBOSE
  69. [[TWindowView]]::[[TWindowView]](TDocument& doc, TWindow* parent)
  70. :
  71.   TWindowView(doc, parent)
  72. {
  73. ##QUERY_WIND_STYLE [[StyleAttributes]]
  74. ##StyleAttributes != "" 3
  75.   // Override the default window style for TWindowView.
  76. [[StyleAttributes]]
  77.  
  78. ##{wndbkgd.snp}
  79.   // INSERT>> Your constructor code here.
  80.  
  81. }
  82.  
  83.  
  84. [[TWindowView]]::~[[TWindowView]]()
  85. {
  86.   // INSERT>> Your destructor code here.
  87.  
  88. }
  89. ##--BEGIN-- @OPT_APPL_PRINTING == TRUE
  90.  
  91.  
  92. ##@QUERY_APPL_COMMENT == VALUE_VERBOSE 3
  93. //
  94. // Paint routine for Window, Printer, and PrintPreview for a TWindowView client.
  95. //
  96. void [[TWindowView]]::Paint(TDC&, bool, TRect& rect)
  97. {
  98. ##<<TApplication QUERY_CLASS_NAME [[TApplication]]
  99.   [[TApplication]]* theApp = TYPESAFE_DOWNCAST(GetApplication(), [[TApplication]]);
  100.   if (theApp) {
  101. ##:@QUERY_APPL_COMMENT == VALUE_VERBOSE 2
  102.     // Only paint if we're printing and we have something to paint, otherwise do nothing.
  103.     //
  104.     if (theApp->Printing && theApp->Printer && !rect.IsEmpty()) {
  105. ##:@QUERY_APPL_COMMENT == VALUE_VERBOSE 3
  106.       // Use pageSize to get the size of the window to render into.  For a Window it's the client area,
  107.       // for a printer it's the printer DC dimensions and for print preview it's the layout window.
  108.       //
  109.       TSize   pageSize(rect.right - rect.left, rect.bottom - rect.top);
  110.  
  111.       TPrintDialog::TData& printerData = theApp->Printer->GetSetup();
  112.  
  113. ##:@QUERY_APPL_COMMENT == VALUE_VERBOSE 2
  114.       // Compute the number of pages to print.
  115.       //
  116.       printerData.MinPage = 1;
  117.       printerData.MaxPage = 1;
  118.  
  119.       // INSERT>> Special printing code goes here.
  120.  
  121.     }
  122.     else {
  123.       // INSERT>> Normal painting code goes here.
  124.  
  125.     }
  126.   }
  127. }
  128.  
  129.  
  130. void [[TWindowView]]::EvGetMinMaxInfo(MINMAXINFO far& minmaxinfo)
  131. {
  132. ##<<TApplication QUERY_CLASS_NAME [[TApplication]]
  133.   [[TApplication]]* theApp = TYPESAFE_DOWNCAST(GetApplication(), [[TApplication]]);
  134.   if (theApp) {
  135.     if (theApp->Printing) {
  136.       minmaxinfo.ptMaxSize = TPoint(32000, 32000);
  137.       minmaxinfo.ptMaxTrackSize = TPoint(32000, 32000);
  138.       return;
  139.     }
  140.   }
  141.   TWindowView::EvGetMinMaxInfo(minmaxinfo);
  142. }
  143. ##--END-- @OPT_APPL_PRINTING == TRUE
  144. >>[CPP]TWindowView [[TWindowView]]
  145.