home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / cxprndlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.2 KB  |  127 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. #include "stdafx.h"
  19.  
  20. #include "cxprndlg.h"
  21. #include "cxprint.h"
  22.  
  23. #ifdef _DEBUG
  24. #undef THIS_FILE
  25. static char BASED_CODE THIS_FILE[] = __FILE__;
  26. #endif
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CPrintStatusDialog dialog
  30.  
  31.  
  32. CPrintStatusDialog::CPrintStatusDialog(CWnd* pParent, CPrintCX *pCX)
  33.     : CDialog(CPrintStatusDialog::IDD, pParent)
  34. {
  35.     //{{AFX_DATA_INIT(CPrintStatusDialog)
  36.     m_csLocation = _T("");
  37.     m_csProgress = _T("");
  38.     //}}AFX_DATA_INIT
  39.  
  40.     //    Save the context which owns us.
  41.     m_pCX = pCX;
  42. }
  43.  
  44.  
  45. void CPrintStatusDialog::DoDataExchange(CDataExchange* pDX)
  46. {
  47.     CDialog::DoDataExchange(pDX);
  48.     //{{AFX_DATA_MAP(CPrintStatusDialog)
  49.     DDX_Text(pDX, IDC_LOCATION, m_csLocation);
  50.     DDX_Text(pDX, IDC_PROGRESS, m_csProgress);
  51.     //}}AFX_DATA_MAP
  52. }
  53.  
  54.  
  55. BEGIN_MESSAGE_MAP(CPrintStatusDialog, CDialog)
  56.     //{{AFX_MSG_MAP(CPrintStatusDialog)
  57.     ON_WM_PAINT()
  58.     ON_WM_SIZE()
  59.     ON_WM_QUERYDRAGICON()
  60.     ON_WM_SYSCOMMAND()
  61.     ON_WM_ERASEBKGND()
  62.     //}}AFX_MSG_MAP
  63. END_MESSAGE_MAP()
  64.  
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CPrintStatusDialog message handlers
  68.  
  69. void CPrintStatusDialog::OnCancel() 
  70. {
  71.     //    Let the owning context know that the cancel button has been
  72.     //        hit.
  73.     TRACE("Received request to cancel print job.\n");
  74.     m_pCX->CancelPrintJob();
  75.     
  76.     //    Don't call their on canel, or it blows away the dialog.
  77.     //CDialog::OnCancel();
  78. }
  79.  
  80. BOOL CPrintStatusDialog::OnEraseBkgnd(CDC *pDC)    {
  81.     if(IsIconic() == TRUE)    {
  82.         return(TRUE);
  83.     }
  84.  
  85.     return(CDialog::OnEraseBkgnd(pDC));
  86. }
  87.  
  88. void CPrintStatusDialog::OnSysCommand(UINT nID, LPARAM lParam)    {
  89.     //    Don't maximize ourselves
  90.     if(nID == SC_MAXIMIZE)    {
  91.         return;
  92.     }
  93.  
  94.     CDialog::OnSysCommand(nID, lParam);
  95. }
  96.  
  97. void CPrintStatusDialog::OnPaint() 
  98. {
  99.     CPaintDC dc(this); // device context for painting
  100.     
  101.     //    Check to see if we need to draw our icon.
  102.     if(IsIconic() != FALSE)    {
  103.         HICON hIcon = theApp.LoadIcon(IDR_MAINFRAME);
  104.         ASSERT(hIcon);
  105.         dc.DrawIcon(2, 2, hIcon);
  106.     }
  107.     
  108.     // Do not call CDialog::OnPaint() for painting messages
  109. }
  110.  
  111. void CPrintStatusDialog::OnSize(UINT nType, int cx, int cy) 
  112. {
  113.     //    Change any maximize request to a normal request.
  114.     if(nType == SIZE_MAXIMIZED)    {
  115.         nType = SIZE_RESTORED;
  116.     }
  117.  
  118.     CDialog::OnSize(nType, cx, cy);
  119. }
  120.  
  121. HCURSOR CPrintStatusDialog::OnQueryDragIcon()    {
  122.     //    Return the icon that will show up when dragged.
  123.     HICON hIcon = theApp.LoadIcon(IDR_MAINFRAME);
  124.     ASSERT(hIcon);
  125.     return((HCURSOR)hIcon);
  126. }
  127.