home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / ttips2 / tooltvw.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-13  |  3.7 KB  |  134 lines

  1. // tooltvw.cpp : implementation of the CTooltestView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "tooltest.h"
  6.  
  7. #include "tooltdoc.h"
  8. #include "tooltvw.h"
  9.  
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char BASED_CODE THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CTooltestView
  17.  
  18. IMPLEMENT_DYNCREATE(CTooltestView, CView)
  19.  
  20. BEGIN_MESSAGE_MAP(CTooltestView, CView)
  21.     //{{AFX_MSG_MAP(CTooltestView)
  22.     //}}AFX_MSG_MAP
  23.     // Standard printing commands
  24.     ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  25.     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CTooltestView construction/destruction
  30.  
  31. CTooltestView::CTooltestView()
  32. {
  33.     // TODO: add construction code here
  34. }
  35.  
  36. CTooltestView::~CTooltestView()
  37. {
  38. }
  39.  
  40. void CTooltestView::OnInitialUpdate()
  41. {
  42.     CView::OnInitialUpdate();
  43. //
  44. // I want all child windows to use up the whole client area on the screen
  45. //
  46.     ((CMDIChildWnd *) GetParentFrame())->MDIMaximize();
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CTooltestView drawing
  50.  
  51. char *Msg[] = {
  52.     "TOOLTEST Demonstration Program:",
  53.     "   This is a test program that demonstrates the Tool Tips functions.",
  54.     "",
  55.     "   Tool Tips is FREEWARE and Contains Lots of Features Including:",
  56.     "      Automatic Popup Tip Windows With Very Easy Setup",
  57.     "      Automatically Gets Tips From Corresponding Menu or String Table Item",
  58.     "      Support For Custom Toolbar Controls Like Combo Boxes",
  59.     "      Standard Square, Rounded, or 3D Styles",
  60.     "      Standard Small or System Fonts",
  61.     "      Functions to Set Status Line Messages, Popup Hints, and Wait Time",
  62.     "      Very Little Code Space Required",
  63.     "      Complete Source Code Included",
  64.     "",
  65.     "Sample Popup Windows:",
  66.     "   Move the mouse cursor over one of the tool bar buttons at the top of the screen to see a",
  67.     "   sample popup tip window.  When you move the mouse cursor away from the toolbar window",
  68.     "   the popup tip window automatically disappears.",
  69.     "",                      
  70.     "Changing Options:",
  71.     "   To change the Tool Tips options use the View/Toolbar Options dialog.  Select the set of",
  72.     "   options you would like to see and notice that the changes take effect immediately.",
  73.     "",
  74.     "See File: TOOLTIPS.WRI For Complete Details...",
  75.     NULL
  76. };
  77.  
  78. void CTooltestView::OnDraw(CDC* pDC)
  79. {
  80.     CTooltestDoc* pDoc = GetDocument();
  81.     ASSERT_VALID(pDoc);
  82.  
  83.     CClientDC dc(this);
  84.     TEXTMETRIC tm;
  85.     dc.GetTextMetrics(&tm);
  86.  
  87.     for (int line = 0; Msg[line] != NULL; ++line)
  88.         dc.TextOut(5,line*tm.tmHeight,Msg[line]);
  89. }
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CTooltestView printing
  93.  
  94. BOOL CTooltestView::OnPreparePrinting(CPrintInfo* pInfo)
  95. {
  96.     // default preparation
  97.     return DoPreparePrinting(pInfo);
  98. }
  99.  
  100. void CTooltestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  101. {
  102.     // TODO: add extra initialization before printing
  103. }
  104.  
  105. void CTooltestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  106. {
  107.     // TODO: add cleanup after printing
  108. }
  109.  
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CTooltestView diagnostics
  112.  
  113. #ifdef _DEBUG
  114. void CTooltestView::AssertValid() const
  115. {
  116.     CView::AssertValid();
  117. }
  118.  
  119. void CTooltestView::Dump(CDumpContext& dc) const
  120. {
  121.     CView::Dump(dc);
  122. }
  123.  
  124. CTooltestDoc* CTooltestView::GetDocument() // non-debug version is inline
  125. {
  126.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTooltestDoc)));
  127.     return (CTooltestDoc*)m_pDocument;
  128. }
  129. #endif //_DEBUG
  130.  
  131. /////////////////////////////////////////////////////////////////////////////
  132. // CTooltestView message handlers
  133.  
  134.