File: WorkDialog.cpp

package info (click to toggle)
libstxxl 1.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,532 kB
  • sloc: cpp: 30,003; ansic: 3,507; makefile: 665; sh: 515; perl: 289
file content (96 lines) | stat: -rw-r--r-- 1,778 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// WorkDialog.cpp : implementation file
//

#include "stdafx.h"
#include "WinGUI.h"
#include "WorkDialog.h"
#include ".\workdialog.h"


// CWorkDialog dialog

IMPLEMENT_DYNAMIC(CWorkDialog, CDialog)
CWorkDialog::CWorkDialog(CWnd * pParent /*=NULL*/)
    : CDialog(CWorkDialog::IDD, pParent)
      , m_Message(_T("Working ...")),
      thread(NULL)
{ }

CWorkDialog::~CWorkDialog()
{ }

void CWorkDialog::DoDataExchange(CDataExchange * pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_MESSAGE1, m_Message);
}


BEGIN_MESSAGE_MAP(CWorkDialog, CDialog)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
ON_MESSAGE(WM_WORK_THREAD_FINISHED, OnThreadFinished)
ON_WM_CREATE()
ON_WM_TIMER()
END_MESSAGE_MAP()


// CWorkDialog message handlers

void CWorkDialog::OnBnClickedOk()
{
    // TODO: Add your control notification handler code here
    //OnOK();
}

void CWorkDialog::OnBnClickedCancel()
{
    // TODO: Add your control notification handler code here
    //OnCancel();
}


afx_msg LRESULT CWorkDialog::OnThreadFinished(WPARAM wparam, LPARAM lparam)
{
    EndDialog(IDOK);
    return 0;
}

void CWorkDialog::SetThread(CWinThread * thread_)
{
    thread = thread_;
}

int CWorkDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDialog::OnCreate(lpCreateStruct) == -1)
        return -1;


    ASSERT(thread);

    thread->CreateThread();

    SetTimer(WORK_TIMER_ID, 400, NULL);


    return 0;
}


void CWorkDialog::OnTimer(UINT nIDEvent)
{
    // TODO: Add your message handler code here and/or call default
    if (nIDEvent == WORK_TIMER_ID)
    {
        if (m_Message == "")
            m_Message = "Working ...";

        else
            m_Message = "";

        UpdateData(FALSE);
    }

    CDialog::OnTimer(nIDEvent);
}