subresyncDlg.cpp

00001 /* 
00002  *      SubResync.  Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 // subresyncDlg.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "subresync.h"
00027 #include "subresyncDlg.h"
00028 
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #endif
00032 
00033 
00034 // CAboutDlg dialog used for App About
00035 
00036 class CAboutDlg : public CDialog
00037 {
00038 public:
00039         CAboutDlg();
00040 
00041 // Dialog Data
00042         enum { IDD = IDD_ABOUTBOX };
00043 
00044         protected:
00045         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00046 
00047 // Implementation
00048 protected:
00049         DECLARE_MESSAGE_MAP()
00050 };
00051 
00052 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
00053 {
00054 }
00055 
00056 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
00057 {
00058         CDialog::DoDataExchange(pDX);
00059 }
00060 
00061 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
00062 END_MESSAGE_MAP()
00063 
00064 
00065 // CSubresyncDlg dialog
00066 
00067 
00068 
00069 CSubresyncDlg::CSubresyncDlg(CWnd* pParent /*=NULL*/)
00070         : CDialog(CSubresyncDlg::IDD, pParent)
00071 {
00072         m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
00073 }
00074 
00075 void CSubresyncDlg::DoDataExchange(CDataExchange* pDX)
00076 {
00077         CDialog::DoDataExchange(pDX);
00078 }
00079 
00080 BEGIN_MESSAGE_MAP(CSubresyncDlg, CDialog)
00081         ON_WM_SYSCOMMAND()
00082         ON_WM_PAINT()
00083         ON_WM_QUERYDRAGICON()
00084         //}}AFX_MSG_MAP
00085 END_MESSAGE_MAP()
00086 
00087 
00088 // CSubresyncDlg message handlers
00089 
00090 BOOL CSubresyncDlg::OnInitDialog()
00091 {
00092         CDialog::OnInitDialog();
00093 
00094         // Add "About..." menu item to system menu.
00095 
00096         // IDM_ABOUTBOX must be in the system command range.
00097         ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
00098         ASSERT(IDM_ABOUTBOX < 0xF000);
00099 
00100         CMenu* pSysMenu = GetSystemMenu(FALSE);
00101         if (pSysMenu != NULL)
00102         {
00103                 CString strAboutMenu;
00104                 strAboutMenu.LoadString(IDS_ABOUTBOX);
00105                 if (!strAboutMenu.IsEmpty())
00106                 {
00107                         pSysMenu->AppendMenu(MF_SEPARATOR);
00108                         pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
00109                 }
00110         }
00111 
00112         // Set the icon for this dialog.  The framework does this automatically
00113         //  when the application's main window is not a dialog
00114         SetIcon(m_hIcon, TRUE);                 // Set big icon
00115         SetIcon(m_hIcon, FALSE);                // Set small icon
00116 
00117         // TODO: Add extra initialization here
00118         
00119         return TRUE;  // return TRUE  unless you set the focus to a control
00120 }
00121 
00122 void CSubresyncDlg::OnSysCommand(UINT nID, LPARAM lParam)
00123 {
00124         if ((nID & 0xFFF0) == IDM_ABOUTBOX)
00125         {
00126                 CAboutDlg dlgAbout;
00127                 dlgAbout.DoModal();
00128         }
00129         else
00130         {
00131                 CDialog::OnSysCommand(nID, lParam);
00132         }
00133 }
00134 
00135 // If you add a minimize button to your dialog, you will need the code below
00136 //  to draw the icon.  For MFC applications using the document/view model,
00137 //  this is automatically done for you by the framework.
00138 
00139 void CSubresyncDlg::OnPaint() 
00140 {
00141         if (IsIconic())
00142         {
00143                 CPaintDC dc(this); // device context for painting
00144 
00145                 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
00146 
00147                 // Center icon in client rectangle
00148                 int cxIcon = GetSystemMetrics(SM_CXICON);
00149                 int cyIcon = GetSystemMetrics(SM_CYICON);
00150                 CRect rect;
00151                 GetClientRect(&rect);
00152                 int x = (rect.Width() - cxIcon + 1) / 2;
00153                 int y = (rect.Height() - cyIcon + 1) / 2;
00154 
00155                 // Draw the icon
00156                 dc.DrawIcon(x, y, m_hIcon);
00157         }
00158         else
00159         {
00160                 CDialog::OnPaint();
00161         }
00162 }
00163 
00164 // The system calls this function to obtain the cursor to display while the user drags
00165 //  the minimized window.
00166 HCURSOR CSubresyncDlg::OnQueryDragIcon()
00167 {
00168         return static_cast<HCURSOR>(m_hIcon);
00169 }

Generated on Tue Dec 13 14:47:05 2005 for guliverkli by  doxygen 1.4.5