]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/testtool/win32/RunTestsDlg.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / testtool / win32 / RunTestsDlg.cpp
1 //####COPYRIGHTBEGIN####
2 //                                                                          
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
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) 
11 // any later version.
12 // 
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 
16 // more details.
17 // 
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.
21 //
22 // ----------------------------------------------------------------------------
23 //                                                                          
24 //####COPYRIGHTEND####
25 // RunTestsDlg.cpp : implementation file
26 //
27
28 #include "stdafx.h"
29 #include "RunTestsDlg.h"
30 #include "TestToolRes.h"
31
32 #ifdef _DEBUG
33 #define new DEBUG_NEW
34 #undef THIS_FILE
35 static char THIS_FILE[] = __FILE__;
36 #endif
37
38 /////////////////////////////////////////////////////////////////////////////
39 // CAboutDlg dialog used for App About
40 /*
41 class CAboutDlg : public CeCosDialog
42 {
43 public:
44         CAboutDlg();
45
46 // Dialog Data
47         //{{AFX_DATA(CAboutDlg)
48         enum { IDD = IDD_TT_ABOUTBOX };
49         //}}AFX_DATA
50
51         // ClassWizard generated virtual function overrides
52         //{{AFX_VIRTUAL(CAboutDlg)
53         protected:
54         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
55         //}}AFX_VIRTUAL
56
57 // Implementation
58 protected:
59         //{{AFX_MSG(CAboutDlg)
60         //}}AFX_MSG
61         DECLARE_MESSAGE_MAP()
62 };
63
64 CAboutDlg::CAboutDlg() : CeCosDialog(CAboutDlg::IDD)
65 {
66         //{{AFX_DATA_INIT(CAboutDlg)
67         //}}AFX_DATA_INIT
68 }
69
70 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
71 {
72         CeCosDialog::DoDataExchange(pDX);
73         //{{AFX_DATA_MAP(CAboutDlg)
74         //}}AFX_DATA_MAP
75 }
76
77 BEGIN_MESSAGE_MAP(CAboutDlg, CeCosDialog)
78         //{{AFX_MSG_MAP(CAboutDlg)
79                 // No message handlers
80         //}}AFX_MSG_MAP
81 END_MESSAGE_MAP()
82 */
83 /////////////////////////////////////////////////////////////////////////////
84 // CRunTestsDlg dialog
85
86 CRunTestsDlg::CRunTestsDlg(CWnd* pParent /*=NULL*/)
87         : CeCosDialog(IDD_TT_RUNTESTS_DIALOG, pParent)
88 {
89         //{{AFX_DATA_INIT(CRunTestsDlg)
90                 // NOTE: the ClassWizard will add member initialization here
91         //}}AFX_DATA_INIT
92         // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
93         m_hIcon = AfxGetApp()->LoadIcon(IDR_TT_MAINFRAME);
94 }
95
96 void CRunTestsDlg::DoDataExchange(CDataExchange* pDX)
97 {
98         CeCosDialog::DoDataExchange(pDX);
99         //{{AFX_DATA_MAP(CRunTestsDlg)
100                 // NOTE: the ClassWizard will add DDX and DDV calls here
101         //}}AFX_DATA_MAP
102 }
103
104 BEGIN_MESSAGE_MAP(CRunTestsDlg, CeCosDialog)
105         //{{AFX_MSG_MAP(CRunTestsDlg)
106         ON_WM_SYSCOMMAND()
107         ON_WM_DESTROY()
108         ON_WM_PAINT()
109         ON_WM_QUERYDRAGICON()
110         //}}AFX_MSG_MAP
111 END_MESSAGE_MAP()
112
113 /////////////////////////////////////////////////////////////////////////////
114 // CRunTestsDlg message handlers
115
116 BOOL CRunTestsDlg::OnInitDialog()
117 {
118         CeCosDialog::OnInitDialog();
119
120         // Add "About..." menu item to system menu.
121
122         // IDM_TT_ABOUTBOX must be in the system command range.
123     /*
124         ASSERT((IDM_TT_ABOUTBOX & 0xFFF0) == IDM_TT_ABOUTBOX);
125         ASSERT(IDM_TT_ABOUTBOX < 0xF000);
126
127         CMenu* pSysMenu = GetSystemMenu(FALSE);
128         if (pSysMenu != NULL)
129         {
130                 CString strAboutMenu;
131                 strAboutMenu.LoadString(IDS_TT_ABOUTBOX);
132                 if (!strAboutMenu.IsEmpty())
133                 {
134                         pSysMenu->AppendMenu(MF_SEPARATOR);
135                         pSysMenu->AppendMenu(MF_STRING, IDM_TT_ABOUTBOX, strAboutMenu);
136                 }
137         }
138     */
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
143         
144         // TODO: Add extra initialization here
145         
146         return TRUE;  // return TRUE  unless you set the focus to a control
147 }
148
149 void CRunTestsDlg::OnSysCommand(UINT nID, LPARAM lParam)
150 {
151     /*
152         if ((nID & 0xFFF0) == IDM_TT_ABOUTBOX)
153         {
154                 CAboutDlg dlgAbout;
155                 dlgAbout.DoModal();
156         }
157         else
158     */
159         {
160                 CeCosDialog::OnSysCommand(nID, lParam);
161         }
162 }
163
164 void CRunTestsDlg::OnDestroy()
165 {
166         WinHelp(0L, HELP_QUIT);
167         CeCosDialog::OnDestroy();
168 }
169
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.
173
174 void CRunTestsDlg::OnPaint() 
175 {
176         if (IsIconic())
177         {
178                 CPaintDC dc(this); // device context for painting
179
180                 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
181
182                 // Center icon in client rectangle
183                 int cxIcon = GetSystemMetrics(SM_CXICON);
184                 int cyIcon = GetSystemMetrics(SM_CYICON);
185                 CRect rect;
186                 GetClientRect(&rect);
187                 int x = (rect.Width() - cxIcon + 1) / 2;
188                 int y = (rect.Height() - cyIcon + 1) / 2;
189
190                 // Draw the icon
191                 dc.DrawIcon(x, y, m_hIcon);
192         }
193         else
194         {
195                 CeCosDialog::OnPaint();
196         }
197 }
198
199 // The system calls this to obtain the cursor to display while the user drags
200 //  the minimized window.
201 HCURSOR CRunTestsDlg::OnQueryDragIcon()
202 {
203         return (HCURSOR) m_hIcon;
204 }
205