GME
13
|
00001 // DialogList.cpp : implementation file 00002 // 00003 00004 #include "stdafx.h" 00005 #include "DialogList.h" 00006 00007 #ifdef _DEBUG 00008 #define new DEBUG_NEW 00009 #undef THIS_FILE 00010 static char THIS_FILE[] = __FILE__; 00011 #endif 00012 00014 // CDialogList dialog 00015 00016 00017 CDialogList::CDialogList(CString _caption, dialogmode _mode, bool hasIgnore, CWnd* pParent ) 00018 : CDialog(CDialogList::IDD, pParent), mn_selection_index(LB_ERR), 00019 m_caption(_caption), cb_mode(_mode) 00020 { 00021 //{{AFX_DATA_INIT(CDialogList) 00022 m_sz_listselection = _T(""); 00023 mb_check_once = FALSE; 00024 //}}AFX_DATA_INIT 00025 00026 m_hasIgnore = hasIgnore; 00027 } 00028 00029 00030 void CDialogList::DoDataExchange(CDataExchange* pDX) 00031 { 00032 CDialog::DoDataExchange(pDX); 00033 //{{AFX_DATA_MAP(CDialogList) 00034 DDX_Control(pDX, IDC_BUTTON_IGNORE, m_btnIgnore); 00035 DDX_Control(pDX, IDC_CHECK1, mcb_check_once); 00036 DDX_Control(pDX, IDC_LIST, m_list); 00037 DDX_LBString(pDX, IDC_LIST, m_sz_listselection); 00038 DDX_Check(pDX, IDC_CHECK1, mb_check_once); 00039 //}}AFX_DATA_MAP 00040 } 00041 00042 00043 BEGIN_MESSAGE_MAP(CDialogList, CDialog) 00044 //{{AFX_MSG_MAP(CDialogList) 00045 ON_BN_CLICKED(IDC_BUTTON_IGNORE, OnButtonIgnore) 00046 ON_LBN_DBLCLK(IDC_LIST, OnDblclkList) 00047 ON_LBN_SELCHANGE(IDC_LIST, OnChangeList) 00048 //}}AFX_MSG_MAP 00049 END_MESSAGE_MAP() 00050 00052 // CDialogList message handlers 00053 00054 BOOL CDialogList::OnInitDialog() 00055 { 00056 CDialog::OnInitDialog(); 00057 00058 // TODO: Add extra initialization here 00059 00060 this->SetWindowText(this->m_caption); 00061 00062 00063 if(cb_mode == CHKTEXT_NONE) { 00064 mcb_check_once.EnableWindow(FALSE); 00065 } 00066 else { 00067 static CString chkboxtexts[] = { 00068 "Remember this decision", 00069 "Apply this selection in future until Shift is pressed" 00070 }; 00071 ASSERT(cb_mode <= sizeof(chkboxtexts)/sizeof(chkboxtexts[0])); 00072 mcb_check_once.SetWindowText(chkboxtexts[cb_mode-1]); 00073 this->mcb_check_once.SetCheck(((this->mb_check_once == FALSE) ? 0 : 1)); 00074 } 00075 POSITION pos = this->m_sz_prelist.GetHeadPosition(); 00076 00077 while (pos != NULL) { 00078 00079 this->m_list.AddString( this->m_sz_prelist.GetNext(pos) ); 00080 } 00081 00082 m_btnIgnore.ShowWindow( m_hasIgnore ? SW_SHOW : SW_HIDE ); 00083 00084 CWnd* wndOK = this->GetDlgItem(IDOK); 00085 wndOK->EnableWindow(FALSE); 00086 00087 return TRUE; 00088 } 00089 00090 void CDialogList::OnOK() 00091 { 00092 // TODO: Add extra validation here 00093 00094 this->mn_selection_index = this->m_list.GetCurSel(); 00095 00096 CDialog::OnOK(); 00097 } 00098 00099 void CDialogList::OnButtonIgnore() 00100 { 00101 UpdateData(TRUE); 00102 EndDialog( IDIGNORE ); 00103 } 00104 00105 void CDialogList::OnDblclkList(void) 00106 { 00107 OnOK(); 00108 } 00109 00110 void CDialogList::OnChangeList(void) 00111 { 00112 CWnd* wndOK = this->GetDlgItem(IDOK); 00113 wndOK->EnableWindow(TRUE); 00114 }