2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
5
* wxSmith is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmith is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: wxsarraystringeditordlg.cpp 4850 2008-01-29 21:45:49Z byo $
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/properties/wxsarraystringeditordlg.cpp $
23
#include "wxsarraystringeditordlg.h"
25
#include <wx/tokenzr.h>
27
//(*InternalHeaders(wxsArrayStringEditorDlg)
29
#include <wx/string.h>
32
//(*IdInit(wxsArrayStringEditorDlg)
33
const long wxsArrayStringEditorDlg::ID_TEXTCTRL1 = wxNewId();
36
BEGIN_EVENT_TABLE(wxsArrayStringEditorDlg,wxDialog)
37
//(*EventTable(wxsArrayStringEditorDlg)
41
wxsArrayStringEditorDlg::wxsArrayStringEditorDlg(wxWindow* parent,wxArrayString& _Data,wxWindowID id):
44
//(*Initialize(wxsArrayStringEditorDlg)
46
wxBoxSizer* BoxSizer2;
48
wxBoxSizer* BoxSizer1;
49
wxStaticBoxSizer* StaticBoxSizer1;
51
Create(parent, id, _("Edit items"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
52
BoxSizer1 = new wxBoxSizer(wxVERTICAL);
53
StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Enter items (one item per line)"));
54
Items = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(350,200), wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL1"));
55
StaticBoxSizer1->Add(Items, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
56
BoxSizer1->Add(StaticBoxSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
57
BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
58
Button1 = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_OK"));
59
Button1->SetDefault();
60
BoxSizer2->Add(Button1, 1, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
61
Button2 = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_CANCEL"));
62
BoxSizer2->Add(Button2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
63
BoxSizer1->Add(BoxSizer2, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
66
BoxSizer1->SetSizeHints(this);
68
Connect(wxID_OK,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsArrayStringEditorDlg::OnOK);
69
Connect(wxID_CANCEL,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&wxsArrayStringEditorDlg::OnCancel);
72
size_t Count = Data.Count();
73
for ( size_t i = 0; i<Count; i++ )
75
Items->AppendText(Data[i]);
76
Items->AppendText(_T('\n'));
80
wxsArrayStringEditorDlg::~wxsArrayStringEditorDlg()
82
//(*Destroy(wxsArrayStringEditorDlg)
87
void wxsArrayStringEditorDlg::OnOK(wxCommandEvent& event)
89
wxStringTokenizer Tknz(Items->GetValue(),_T("\n"),wxTOKEN_RET_EMPTY);
92
while ( Tknz.HasMoreTokens() )
94
wxString Line = Tknz.GetNextToken();
101
void wxsArrayStringEditorDlg::OnCancel(wxCommandEvent& event)
103
EndModal(wxID_CANCEL);