Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / 3d / object_viewer / select_string.cpp
blob0a524053478b10875f8c7358695327c09562f55b
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "std_afx.h"
21 #include "object_viewer.h"
22 #include "select_string.h"
25 /////////////////////////////////////////////////////////////////////////////
26 // CSelectString dialog
29 CSelectString::CSelectString(const std::vector<std::string>& vectString, const std::string &title, CWnd* pParent, bool empty)
30 : CDialog(CSelectString::IDD, pParent)
32 //{{AFX_DATA_INIT(CSelectString)
33 //}}AFX_DATA_INIT
34 Title=title;
35 Strings=vectString;
36 Selection=-1;
37 Empty=empty;
41 void CSelectString::DoDataExchange(CDataExchange* pDX)
43 CDialog::DoDataExchange(pDX);
44 //{{AFX_DATA_MAP(CSelectString)
45 DDX_Control(pDX, IDEMPTY, EmptyCtrl);
46 DDX_Control(pDX, IDC_LIST, ListCtrl);
47 //}}AFX_DATA_MAP
51 BEGIN_MESSAGE_MAP(CSelectString, CDialog)
52 //{{AFX_MSG_MAP(CSelectString)
53 ON_LBN_DBLCLK(IDC_LIST, OnDblclkList)
54 ON_LBN_SELCHANGE(IDC_LIST, OnSelchangeList)
55 ON_BN_CLICKED(IDEMPTY, OnEmpty)
56 //}}AFX_MSG_MAP
57 END_MESSAGE_MAP()
59 /////////////////////////////////////////////////////////////////////////////
60 // CSelectString message handlers
62 void CSelectString::OnOK()
64 // TODO: Add extra validation here
65 if (Selection!=-1)
66 CDialog::OnOK();
67 else
68 CDialog::OnCancel();
71 void CSelectString::OnDblclkList()
73 // TODO: Add your control notification handler code here
74 OnSelchangeList();
75 OnOK();
78 BOOL CSelectString::OnInitDialog()
80 CDialog::OnInitDialog();
82 // Change title
83 SetWindowText(nlUtf8ToTStr(Title));
85 // Empty button ?
86 EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE);
88 // Add string
89 for (uint s=0; s<Strings.size(); s++)
90 ListCtrl.InsertString(-1, nlUtf8ToTStr(Strings[s]));
92 return TRUE; // return TRUE unless you set the focus to a control
93 // EXCEPTION: OCX Property Pages should return FALSE
96 void CSelectString::OnSelchangeList()
98 // Get selection
99 UpdateData ();
100 Selection=ListCtrl.GetCurSel ();
101 if (Selection==LB_ERR)
102 Selection=-1;
105 void CSelectString::OnEmpty()
107 // TODO: Add your control notification handler code here
108 Selection=-1;
109 CDialog::OnOK();