This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
template<class T, class S>
class EditableList : public wxPanel
{
template<class T, class S>
class EditableList : public wxPanel
{
std::vector<std::string> columns,
boost::function<std::vector<T> ()> get,
boost::function<void (std::vector<T>)> set,
std::vector<std::string> columns,
boost::function<std::vector<T> ()> get,
boost::function<void (std::vector<T>)> set,
wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (0, 1);
wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (0, 1);
- _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (columns.size() * 200, 100), wxLC_REPORT | wxLC_SINGLE_SEL);
+ _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (columns.size() * 200, height), wxLC_REPORT | wxLC_SINGLE_SEL);
wxSizer* s = new wxBoxSizer (wxVERTICAL);
_add = new wxButton (this, wxID_ANY, _("Add..."));
s->Add (_add, 0, wxTOP | wxBOTTOM, 2);
wxSizer* s = new wxBoxSizer (wxVERTICAL);
_add = new wxButton (this, wxID_ANY, _("Add..."));
s->Add (_add, 0, wxTOP | wxBOTTOM, 2);
_edit = new wxButton (this, wxID_ANY, _("Edit..."));
s->Add (_edit, 0, wxTOP | wxBOTTOM, 2);
_remove = new wxButton (this, wxID_ANY, _("Remove"));
_edit = new wxButton (this, wxID_ANY, _("Edit..."));
s->Add (_edit, 0, wxTOP | wxBOTTOM, 2);
_remove = new wxButton (this, wxID_ANY, _("Remove"));
_edit->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::edit_clicked, this));
_remove->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::remove_clicked, this));
_list->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&EditableList::selection_changed, this));
_list->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&EditableList::selection_changed, this));
_list->Bind (wxEVT_SIZE, boost::bind (&EditableList::resized, this, _1));
_edit->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::edit_clicked, this));
_remove->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&EditableList::remove_clicked, this));
_list->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&EditableList::selection_changed, this));
_list->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&EditableList::selection_changed, this));
_list->Bind (wxEVT_SIZE, boost::bind (&EditableList::resized, this, _1));
for (int i = 0; i < _columns; ++i) {
_list->SetItem (item, i, std_to_wx (_column (all[item], i)));
}
for (int i = 0; i < _columns; ++i) {
_list->SetItem (item, i, std_to_wx (_column (all[item], i)));
}