# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

DialogEditList.cpp

Go to the documentation of this file.
00001 // DialogEditList.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "tile_edit_exe.h"
00006 #include "DialogEditList.h"
00007 #include <vector>
00008 
00009 #ifdef _DEBUG
00010 #define new DEBUG_NEW
00011 #undef THIS_FILE
00012 static char THIS_FILE[] = __FILE__;
00013 #endif
00014 
00016 // CDialogEditList dialog
00017 
00018 
00019 CDialogEditList::CDialogEditList(CWnd* pParent /*=NULL*/)
00020         : CDialog(CDialogEditList::IDD, pParent)
00021 {
00022         //{{AFX_DATA_INIT(CDialogEditList)
00023         //}}AFX_DATA_INIT
00024 }
00025 
00026 
00027 void CDialogEditList::DoDataExchange(CDataExchange* pDX)
00028 {
00029         CDialog::DoDataExchange(pDX);
00030         //{{AFX_DATA_MAP(CDialogEditList)
00031         DDX_Control(pDX, IDC_LIST1, m_ctrlList);
00032         DDX_Control(pDX, IDC_COMBO1, m_ctrlCombo);
00033         //}}AFX_DATA_MAP
00034 }
00035 
00036 
00037 BEGIN_MESSAGE_MAP(CDialogEditList, CDialog)
00038         //{{AFX_MSG_MAP(CDialogEditList)
00039         ON_BN_CLICKED(ID_ADD, OnAdd)
00040         ON_BN_CLICKED(ID_DEL, OnDel)
00041         //}}AFX_MSG_MAP
00042 END_MESSAGE_MAP()
00043 
00045 // CDialogEditList message handlers
00046 
00047 void CDialogEditList::OnAdd() 
00048 {
00049         // TODO: Add your control notification handler code here
00050         UpdateData ();
00051         CString str;
00052         m_ctrlCombo.GetWindowText (str);
00053         if (m_ctrlList.FindStringExact (0, str)==LB_ERR)
00054         {
00055                 m_ctrlList.InsertString (-1, str);
00056         }
00057         UpdateData (FALSE);
00058 }
00059 
00060 BOOL CDialogEditList::OnInitDialog() 
00061 {
00062         CDialog::OnInitDialog();
00063 
00064         OnInit ();
00065         UpdateData ();
00066         m_ctrlCombo.SetCurSel (0);
00067         UpdateData (FALSE);
00068 
00069         // TODO: Add extra initialization here
00070         
00071         return TRUE;  // return TRUE unless you set the focus to a control
00072                       // EXCEPTION: OCX Property Pages should return FALSE
00073 }
00074 
00075 void CDialogEditList::OnOK() 
00076 {
00077         // TODO: Add extra validation here
00078         OnOk ();
00079         
00080         CDialog::OnOK();
00081 }
00082 
00083 void CDialogEditList::OnDel() 
00084 {
00085         // TODO: Add your control notification handler code here
00086         UpdateData ();
00087         if (m_ctrlList.GetSelCount())
00088         {
00089                 std::vector<int> vect (m_ctrlList.GetSelCount());
00090                 m_ctrlList.GetSelItems (m_ctrlList.GetSelCount(), &*vect.begin());
00091                 for (int i=m_ctrlList.GetSelCount()-1; i>=0; i--)
00092                         m_ctrlList.DeleteString (vect[i]);
00093                 m_ctrlCombo.SetCurSel (0);
00094         }
00095         UpdateData (FALSE);     
00096 }