root/trunk/ConstantsDlg.cpp

Revision 5, 2.4 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 // ConstantsDlg.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Elephant.h"
6 #include "ConstantsDlg.h"
7
8 #ifdef _DEBUG
9 #define new DEBUG_NEW
10 #undef THIS_FILE
11 static char THIS_FILE[] = __FILE__;
12 #endif
13
14 /////////////////////////////////////////////////////////////////////////////
15 // CConstantsDlg dialog
16
17
18 CConstantsDlg::CConstantsDlg(CWnd* pParent /*=NULL*/)
19
20 {
21     //{{AFX_DATA_INIT(CConstantsDlg)
22         // NOTE: the ClassWizard will add member initialization here
23     //}}AFX_DATA_INIT
24 }
25
26
27 void CConstantsDlg::DoDataExchange(CDataExchange* pDX)
28 {
29     CDialog::DoDataExchange(pDX);
30     //{{AFX_DATA_MAP(CConstantsDlg)
31     DDX_Control(pDX, IDC_LIST1, m_list);
32     //}}AFX_DATA_MAP
33 }
34
35
36 BEGIN_MESSAGE_MAP(CConstantsDlg, CDialog)
37     //{{AFX_MSG_MAP(CConstantsDlg)
38     ON_NOTIFY(NM_RETURN, IDC_LIST1, OnReturnList1)
39     //}}AFX_MSG_MAP
40 END_MESSAGE_MAP()
41
42 /////////////////////////////////////////////////////////////////////////////
43 // CConstantsDlg message handlers
44
45 BOOL CConstantsDlg::OnInitDialog()
46 {
47     CDialog::OnInitDialog();
48    
49     m_list.InsertColumn(0,"Constant",LVCFMT_LEFT,110);
50     m_list.InsertColumn(1,"Value",LVCFMT_LEFT,190);
51
52
53     m_list.InsertItem(0,"CURRENTFILE");
54     m_list.SetItemText(0,1,"The path to the current file.");
55
56    
57     m_list.InsertItem(1,"DATE");
58     m_list.SetItemText(1,1,"The current date.");
59    
60     m_list.InsertItem(2,"NAME");
61     m_list.SetItemText(2,1,"The name you have entered.");
62
63    
64     m_list.InsertItem(3,"PROJECTDIR");
65     m_list.SetItemText(3,1,"The path to the project directory.");
66
67    
68     m_list.InsertItem(4,"PROJECTEXE");
69     m_list.SetItemText(4,1,"The path to the project executable.");
70
71
72
73     m_list.InsertItem(5,"PROJECTFILES");
74     m_list.SetItemText(5,1,"Full paths to all files in the project , seperated by spaces.");
75
76
77     m_list.InsertItem(6,"PROJECTNAME");
78     m_list.SetItemText(6,1,"The name of the project.");
79    
80
81
82     m_list.InsertItem(7,"TIME");
83     m_list.SetItemText(7,1,"The current time.");
84
85
86     SetupListCtrl(&m_list);
87    
88    
89     return TRUE;  // return TRUE unless you set the focus to a control
90                   // EXCEPTION: OCX Property Pages should return FALSE
91 }
92
93 void CConstantsDlg::OnReturnList1(NMHDR* pNMHDR, LRESULT* pResult)
94 {
95     vector<string> lists;
96     GetSelListCtrlItems(&m_list,&lists);
97     for (int i = 0 ; i < lists.size()  ; i++ ) {
98         string sel = lists[i];
99         AfxMessageBox(sel.c_str());
100     }
101    
102    
103     *pResult = 0;
104 }
Note: See TracBrowser for help on using the browser.