1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 // RunTestsDlg.cpp : implementation file
29 #include "RunTestsDlg.h"
30 #include "TestToolRes.h"
35 static char THIS_FILE[] = __FILE__;
38 /////////////////////////////////////////////////////////////////////////////
39 // CAboutDlg dialog used for App About
41 class CAboutDlg : public CeCosDialog
47 //{{AFX_DATA(CAboutDlg)
48 enum { IDD = IDD_TT_ABOUTBOX };
51 // ClassWizard generated virtual function overrides
52 //{{AFX_VIRTUAL(CAboutDlg)
54 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
59 //{{AFX_MSG(CAboutDlg)
64 CAboutDlg::CAboutDlg() : CeCosDialog(CAboutDlg::IDD)
66 //{{AFX_DATA_INIT(CAboutDlg)
70 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
72 CeCosDialog::DoDataExchange(pDX);
73 //{{AFX_DATA_MAP(CAboutDlg)
77 BEGIN_MESSAGE_MAP(CAboutDlg, CeCosDialog)
78 //{{AFX_MSG_MAP(CAboutDlg)
79 // No message handlers
83 /////////////////////////////////////////////////////////////////////////////
84 // CRunTestsDlg dialog
86 CRunTestsDlg::CRunTestsDlg(CWnd* pParent /*=NULL*/)
87 : CeCosDialog(IDD_TT_RUNTESTS_DIALOG, pParent)
89 //{{AFX_DATA_INIT(CRunTestsDlg)
90 // NOTE: the ClassWizard will add member initialization here
92 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
93 m_hIcon = AfxGetApp()->LoadIcon(IDR_TT_MAINFRAME);
96 void CRunTestsDlg::DoDataExchange(CDataExchange* pDX)
98 CeCosDialog::DoDataExchange(pDX);
99 //{{AFX_DATA_MAP(CRunTestsDlg)
100 // NOTE: the ClassWizard will add DDX and DDV calls here
104 BEGIN_MESSAGE_MAP(CRunTestsDlg, CeCosDialog)
105 //{{AFX_MSG_MAP(CRunTestsDlg)
109 ON_WM_QUERYDRAGICON()
113 /////////////////////////////////////////////////////////////////////////////
114 // CRunTestsDlg message handlers
116 BOOL CRunTestsDlg::OnInitDialog()
118 CeCosDialog::OnInitDialog();
120 // Add "About..." menu item to system menu.
122 // IDM_TT_ABOUTBOX must be in the system command range.
124 ASSERT((IDM_TT_ABOUTBOX & 0xFFF0) == IDM_TT_ABOUTBOX);
125 ASSERT(IDM_TT_ABOUTBOX < 0xF000);
127 CMenu* pSysMenu = GetSystemMenu(FALSE);
128 if (pSysMenu != NULL)
130 CString strAboutMenu;
131 strAboutMenu.LoadString(IDS_TT_ABOUTBOX);
132 if (!strAboutMenu.IsEmpty())
134 pSysMenu->AppendMenu(MF_SEPARATOR);
135 pSysMenu->AppendMenu(MF_STRING, IDM_TT_ABOUTBOX, strAboutMenu);
139 // Set the icon for this dialog. The framework does this automatically
140 // when the application's main window is not a dialog
141 SetIcon(m_hIcon, TRUE); // Set big icon
142 SetIcon(m_hIcon, FALSE); // Set small icon
144 // TODO: Add extra initialization here
146 return TRUE; // return TRUE unless you set the focus to a control
149 void CRunTestsDlg::OnSysCommand(UINT nID, LPARAM lParam)
152 if ((nID & 0xFFF0) == IDM_TT_ABOUTBOX)
160 CeCosDialog::OnSysCommand(nID, lParam);
164 void CRunTestsDlg::OnDestroy()
166 WinHelp(0L, HELP_QUIT);
167 CeCosDialog::OnDestroy();
170 // If you add a minimize button to your dialog, you will need the code below
171 // to draw the icon. For MFC applications using the document/view model,
172 // this is automatically done for you by the framework.
174 void CRunTestsDlg::OnPaint()
178 CPaintDC dc(this); // device context for painting
180 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
182 // Center icon in client rectangle
183 int cxIcon = GetSystemMetrics(SM_CXICON);
184 int cyIcon = GetSystemMetrics(SM_CYICON);
186 GetClientRect(&rect);
187 int x = (rect.Width() - cxIcon + 1) / 2;
188 int y = (rect.Height() - cyIcon + 1) / 2;
191 dc.DrawIcon(x, y, m_hIcon);
195 CeCosDialog::OnPaint();
199 // The system calls this to obtain the cursor to display while the user drags
200 // the minimized window.
201 HCURSOR CRunTestsDlg::OnQueryDragIcon()
203 return (HCURSOR) m_hIcon;