~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to examples/Log_Msg/Log_Msg_MFC/Log_Msg_MFCDlg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Log_Msg_MFCDlg.cpp : implementation file
2
 
// Log_Msg_MFCDlg.cpp,v 1.3 2003/11/01 11:15:23 dhinton Exp
3
 
 
4
 
#include "Log_Msg_MFC.h"
5
 
 
6
 
#if defined (ACE_WIN32)
7
 
 
8
 
#include "stdafx.h"
9
 
#include "Log_Msg_MFCDlg.h"
10
 
 
11
 
#ifdef _DEBUG
12
 
#define new DEBUG_NEW
13
 
#undef THIS_FILE
14
 
static char THIS_FILE[] = __FILE__;
15
 
#endif
16
 
 
17
 
#include <ace/ACE.h>
18
 
 
19
 
/////////////////////////////////////////////////////////////////////////////
20
 
// CAboutDlg dialog used for App About
21
 
 
22
 
class CAboutDlg : public CDialog
23
 
{
24
 
public:
25
 
        CAboutDlg();
26
 
 
27
 
// Dialog Data
28
 
        //{{AFX_DATA(CAboutDlg)
29
 
        enum { IDD = IDD_ABOUTBOX };
30
 
        //}}AFX_DATA
31
 
 
32
 
        // ClassWizard generated virtual function overrides
33
 
        //{{AFX_VIRTUAL(CAboutDlg)
34
 
        protected:
35
 
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
36
 
        //}}AFX_VIRTUAL
37
 
 
38
 
// Implementation
39
 
protected:
40
 
        //{{AFX_MSG(CAboutDlg)
41
 
        //}}AFX_MSG
42
 
        DECLARE_MESSAGE_MAP()
43
 
};
44
 
 
45
 
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
46
 
{
47
 
        //{{AFX_DATA_INIT(CAboutDlg)
48
 
        //}}AFX_DATA_INIT
49
 
}
50
 
 
51
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
52
 
{
53
 
        CDialog::DoDataExchange(pDX);
54
 
        //{{AFX_DATA_MAP(CAboutDlg)
55
 
        //}}AFX_DATA_MAP
56
 
}
57
 
 
58
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
59
 
        //{{AFX_MSG_MAP(CAboutDlg)
60
 
                // No message handlers
61
 
        //}}AFX_MSG_MAP
62
 
END_MESSAGE_MAP()
63
 
 
64
 
/////////////////////////////////////////////////////////////////////////////
65
 
// CLog_Msg_MFCDlg dialog
66
 
 
67
 
CLog_Msg_MFCDlg::CLog_Msg_MFCDlg(CWnd* pParent /*=NULL*/)
68
 
        : CDialog(CLog_Msg_MFCDlg::IDD, pParent)
69
 
{
70
 
        //{{AFX_DATA_INIT(CLog_Msg_MFCDlg)
71
 
                // NOTE: the ClassWizard will add member initialization here
72
 
        //}}AFX_DATA_INIT
73
 
        // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
74
 
        m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
75
 
}
76
 
 
77
 
void CLog_Msg_MFCDlg::DoDataExchange(CDataExchange* pDX)
78
 
{
79
 
        CDialog::DoDataExchange(pDX);
80
 
        //{{AFX_DATA_MAP(CLog_Msg_MFCDlg)
81
 
                // NOTE: the ClassWizard will add DDX and DDV calls here
82
 
        //}}AFX_DATA_MAP
83
 
}
84
 
 
85
 
BEGIN_MESSAGE_MAP(CLog_Msg_MFCDlg, CDialog)
86
 
        //{{AFX_MSG_MAP(CLog_Msg_MFCDlg)
87
 
        ON_WM_SYSCOMMAND()
88
 
        ON_WM_PAINT()
89
 
        ON_WM_QUERYDRAGICON()
90
 
        ON_BN_CLICKED(IDC_BUTTON1, OnDebugButtonClicked)
91
 
        ON_WM_CLOSE()
92
 
        //}}AFX_MSG_MAP
93
 
END_MESSAGE_MAP()
94
 
 
95
 
/////////////////////////////////////////////////////////////////////////////
96
 
// CLog_Msg_MFCDlg message handlers
97
 
 
98
 
BOOL CLog_Msg_MFCDlg::OnInitDialog()
99
 
{
100
 
        CDialog::OnInitDialog();
101
 
 
102
 
 
103
 
        // Add "About..." menu item to system menu.
104
 
 
105
 
        // IDM_ABOUTBOX must be in the system command range.
106
 
        ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
107
 
        ASSERT(IDM_ABOUTBOX < 0xF000);
108
 
 
109
 
        CMenu* pSysMenu = GetSystemMenu(FALSE);
110
 
        if (pSysMenu != NULL)
111
 
        {
112
 
                CString strAboutMenu;
113
 
                strAboutMenu.LoadString(IDS_ABOUTBOX);
114
 
                if (!strAboutMenu.IsEmpty())
115
 
                {
116
 
                        pSysMenu->AppendMenu(MF_SEPARATOR);
117
 
                        pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
118
 
                }
119
 
        }
120
 
 
121
 
        // Set the icon for this dialog.  The framework does this automatically
122
 
        //  when the application's main window is not a dialog
123
 
        SetIcon(m_hIcon, TRUE);                 // Set big icon
124
 
        SetIcon(m_hIcon, FALSE);                // Set small icon
125
 
        
126
 
        // TODO: Add extra initialization here
127
 
        
128
 
        return TRUE;  // return TRUE  unless you set the focus to a control
129
 
}
130
 
 
131
 
void CLog_Msg_MFCDlg::OnSysCommand(UINT nID, LPARAM lParam)
132
 
{
133
 
        if ((nID & 0xFFF0) == IDM_ABOUTBOX)
134
 
        {
135
 
                CAboutDlg dlgAbout;
136
 
                dlgAbout.DoModal();
137
 
        }
138
 
        else
139
 
        {
140
 
                CDialog::OnSysCommand(nID, lParam);
141
 
        }
142
 
}
143
 
 
144
 
// If you add a minimize button to your dialog, you will need the code below
145
 
//  to draw the icon.  For MFC applications using the document/view model,
146
 
//  this is automatically done for you by the framework.
147
 
 
148
 
void CLog_Msg_MFCDlg::OnPaint() 
149
 
{
150
 
        if (IsIconic())
151
 
        {
152
 
                CPaintDC dc(this); // device context for painting
153
 
 
154
 
                SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
155
 
 
156
 
                // Center icon in client rectangle
157
 
                int cxIcon = GetSystemMetrics(SM_CXICON);
158
 
                int cyIcon = GetSystemMetrics(SM_CYICON);
159
 
                CRect rect;
160
 
                GetClientRect(&rect);
161
 
                int x = (rect.Width() - cxIcon + 1) / 2;
162
 
                int y = (rect.Height() - cyIcon + 1) / 2;
163
 
 
164
 
                // Draw the icon
165
 
                dc.DrawIcon(x, y, m_hIcon);
166
 
        }
167
 
        else
168
 
        {
169
 
                CDialog::OnPaint();
170
 
        }
171
 
}
172
 
 
173
 
// The system calls this to obtain the cursor to display while the user drags
174
 
//  the minimized window.
175
 
HCURSOR CLog_Msg_MFCDlg::OnQueryDragIcon()
176
 
{
177
 
        return (HCURSOR) m_hIcon;
178
 
}
179
 
 
180
 
void CLog_Msg_MFCDlg::OnDebugButtonClicked() 
181
 
{
182
 
    ACE_DEBUG(( LM_DEBUG, "Debug message sent!\n" ));
183
 
    
184
 
}
185
 
 
186
 
#endif /* ACE_WIN32 */