some of its standard buttons.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14496
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class WXDLLEXPORT wxListCtrl;
class WXDLLEXPORT wxListEvent;
class WXDLLEXPORT wxListCtrl;
class WXDLLEXPORT wxListEvent;
+#define wxEL_ALLOW_NEW 0x0100
+#define wxEL_ALLOW_EDIT 0x0200
+#define wxEL_ALLOW_DELETE 0x0400
+
// This class provides a composite control that lets the
// user easily enter list of strings
// This class provides a composite control that lets the
// user easily enter list of strings
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
+ long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
const wxString& name = wxT("editableListBox"));
void SetStrings(const wxArrayString& strings);
const wxString& name = wxT("editableListBox"));
void SetStrings(const wxArrayString& strings);
wxListCtrl *m_listCtrl;
int m_selection;
bool m_edittingNew;
wxListCtrl *m_listCtrl;
int m_selection;
bool m_edittingNew;
void OnItemSelected(wxListEvent& event);
void OnEndLabelEdit(wxListEvent& event);
void OnItemSelected(wxListEvent& event);
void OnEndLabelEdit(wxListEvent& event);
wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos, const wxSize& size,
wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos, const wxSize& size,
const wxString& name)
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name), m_edittingNew(FALSE)
{
const wxString& name)
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name), m_edittingNew(FALSE)
{
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
wxPanel *subp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
wxPanel *subp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
#ifdef __WXMSW__
#define BTN_BORDER 4
#ifdef __WXMSW__
#define BTN_BORDER 4
- // FIXME - why is this needed? There's some reason why sunken border is
- // ignored by sizers in wxMSW but not in wxGTK that I can't
+ // FIXME - why is this needed? There's some reason why sunken border is
+ // ignored by sizers in wxMSW but not in wxGTK that I can't
// figure out...
#else
#define BTN_BORDER 0
// figure out...
#else
#define BTN_BORDER 0
subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
+
+ if (!(m_style & wxEL_ALLOW_EDIT))
+ m_bEdit->Show(FALSE);
+ if (!(m_style & wxEL_ALLOW_NEW))
+ m_bNew->Show(FALSE);
+ if (!(m_style & wxEL_ALLOW_DELETE))
+ m_bDel->Show(FALSE);
+
subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
subsizer->Fit(subp);
sizer->Add(subp, 0, wxEXPAND);
subsizer->Fit(subp);
sizer->Add(subp, 0, wxEXPAND);
+
+ long st = wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxSUNKEN_BORDER;
+ if (style & wxEL_ALLOW_EDIT)
+ st |= wxLC_EDIT_LABELS;
m_listCtrl = new CleverListCtrl(this, wxID_ELD_LISTCTRL,
m_listCtrl = new CleverListCtrl(this, wxID_ELD_LISTCTRL,
- wxDefaultPosition, wxDefaultSize,
- wxLC_REPORT | wxLC_NO_HEADER |
- wxLC_SINGLE_SEL | wxSUNKEN_BORDER |
- wxLC_EDIT_LABELS);
+ wxDefaultPosition, wxDefaultSize, st);
wxArrayString empty_ar;
SetStrings(empty_ar);
wxArrayString empty_ar;
SetStrings(empty_ar);
m_selection = event.GetIndex();
m_bUp->Enable(m_selection != 0 && m_selection < m_listCtrl->GetItemCount()-1);
m_bDown->Enable(m_selection < m_listCtrl->GetItemCount()-2);
m_selection = event.GetIndex();
m_bUp->Enable(m_selection != 0 && m_selection < m_listCtrl->GetItemCount()-1);
m_bDown->Enable(m_selection < m_listCtrl->GetItemCount()-2);
- m_bEdit->Enable(m_selection < m_listCtrl->GetItemCount()-1);
- m_bDel->Enable(m_selection < m_listCtrl->GetItemCount()-1);
+ if (m_style & wxEL_ALLOW_EDIT)
+ m_bEdit->Enable(m_selection < m_listCtrl->GetItemCount()-1);
+ if (m_style & wxEL_ALLOW_DELETE)
+ m_bDel->Enable(m_selection < m_listCtrl->GetItemCount()-1);
}
void wxEditableListBox::OnNewItem(wxCommandEvent& event)
}
void wxEditableListBox::OnNewItem(wxCommandEvent& event)
-#define new_wxEditableListBox(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxEditableListBox(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5))
+#define new_wxEditableListBox(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (new wxEditableListBox(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6))
static PyObject *_wrap_new_wxEditableListBox(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxEditableListBox * _result;
static PyObject *_wrap_new_wxEditableListBox(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxEditableListBox * _result;
wxString * _arg2;
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
wxString * _arg2;
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
- char * _arg5 = (char *) "editableListBox";
+ long _arg5 = (long ) (wxEL_ALLOW_NEW)|(wxEL_ALLOW_EDIT)|(wxEL_ALLOW_DELETE);
+ char * _arg6 = (char *) "editableListBox";
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
wxPoint temp;
PyObject * _obj3 = 0;
wxSize temp0;
PyObject * _obj4 = 0;
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
wxPoint temp;
PyObject * _obj3 = 0;
wxSize temp0;
PyObject * _obj4 = 0;
- char *_kwnames[] = { "parent","id","label","pos","size","name", NULL };
+ char *_kwnames[] = { "parent","id","label","pos","size","style","name", NULL };
char _ptemp[128];
self = self;
char _ptemp[128];
self = self;
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO|OOs:new_wxEditableListBox",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_obj4,&_arg5))
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO|OOls:new_wxEditableListBox",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_obj4,&_arg5,&_arg6))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- _result = (wxEditableListBox *)new_wxEditableListBox(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5);
+ _result = (wxEditableListBox *)new_wxEditableListBox(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5,_arg6);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
PyDict_SetItemString(d,"wxEVT_DYNAMIC_SASH_UNIFY", PyInt_FromLong((long) wxEVT_DYNAMIC_SASH_UNIFY));
PyDict_SetItemString(d,"wxDS_MANAGE_SCROLLBARS", PyInt_FromLong((long) wxDS_MANAGE_SCROLLBARS));
PyDict_SetItemString(d,"wxDS_DRAG_CORNER", PyInt_FromLong((long) wxDS_DRAG_CORNER));
PyDict_SetItemString(d,"wxEVT_DYNAMIC_SASH_UNIFY", PyInt_FromLong((long) wxEVT_DYNAMIC_SASH_UNIFY));
PyDict_SetItemString(d,"wxDS_MANAGE_SCROLLBARS", PyInt_FromLong((long) wxDS_MANAGE_SCROLLBARS));
PyDict_SetItemString(d,"wxDS_DRAG_CORNER", PyInt_FromLong((long) wxDS_DRAG_CORNER));
+ PyDict_SetItemString(d,"wxEL_ALLOW_NEW", PyInt_FromLong((long) wxEL_ALLOW_NEW));
+ PyDict_SetItemString(d,"wxEL_ALLOW_EDIT", PyInt_FromLong((long) wxEL_ALLOW_EDIT));
+ PyDict_SetItemString(d,"wxEL_ALLOW_DELETE", PyInt_FromLong((long) wxEL_ALLOW_DELETE));
PyDict_SetItemString(d,"wxLED_ALIGN_LEFT", PyInt_FromLong((long) wxLED_ALIGN_LEFT));
PyDict_SetItemString(d,"wxLED_ALIGN_RIGHT", PyInt_FromLong((long) wxLED_ALIGN_RIGHT));
PyDict_SetItemString(d,"wxLED_ALIGN_CENTER", PyInt_FromLong((long) wxLED_ALIGN_CENTER));
PyDict_SetItemString(d,"wxLED_ALIGN_LEFT", PyInt_FromLong((long) wxLED_ALIGN_LEFT));
PyDict_SetItemString(d,"wxLED_ALIGN_RIGHT", PyInt_FromLong((long) wxLED_ALIGN_RIGHT));
PyDict_SetItemString(d,"wxLED_ALIGN_CENTER", PyInt_FromLong((long) wxLED_ALIGN_CENTER));
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+enum {
+ wxEL_ALLOW_NEW,
+ wxEL_ALLOW_EDIT,
+ wxEL_ALLOW_DELETE,
+};
// This class provides a composite control that lets the
// user easily enter list of strings
// This class provides a composite control that lets the
// user easily enter list of strings
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
+ long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
const char* name = "editableListBox");
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
const char* name = "editableListBox");
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
wxEVT_DYNAMIC_SASH_UNIFY = gizmosc.wxEVT_DYNAMIC_SASH_UNIFY
wxDS_MANAGE_SCROLLBARS = gizmosc.wxDS_MANAGE_SCROLLBARS
wxDS_DRAG_CORNER = gizmosc.wxDS_DRAG_CORNER
wxEVT_DYNAMIC_SASH_UNIFY = gizmosc.wxEVT_DYNAMIC_SASH_UNIFY
wxDS_MANAGE_SCROLLBARS = gizmosc.wxDS_MANAGE_SCROLLBARS
wxDS_DRAG_CORNER = gizmosc.wxDS_DRAG_CORNER
+wxEL_ALLOW_NEW = gizmosc.wxEL_ALLOW_NEW
+wxEL_ALLOW_EDIT = gizmosc.wxEL_ALLOW_EDIT
+wxEL_ALLOW_DELETE = gizmosc.wxEL_ALLOW_DELETE
wxLED_ALIGN_LEFT = gizmosc.wxLED_ALIGN_LEFT
wxLED_ALIGN_RIGHT = gizmosc.wxLED_ALIGN_RIGHT
wxLED_ALIGN_CENTER = gizmosc.wxLED_ALIGN_CENTER
wxLED_ALIGN_LEFT = gizmosc.wxLED_ALIGN_LEFT
wxLED_ALIGN_RIGHT = gizmosc.wxLED_ALIGN_RIGHT
wxLED_ALIGN_CENTER = gizmosc.wxLED_ALIGN_CENTER