Added patch that adds style flags for wxEditableListBox to not use
some of its standard buttons. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -28,6 +28,10 @@ class WXDLLEXPORT wxBitmapButton;
|
|||||||
class WXDLLEXPORT wxListCtrl;
|
class WXDLLEXPORT wxListCtrl;
|
||||||
class WXDLLEXPORT wxListEvent;
|
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
|
// This class provides a composite control that lets the
|
||||||
// user easily enter list of strings
|
// user easily enter list of strings
|
||||||
|
|
||||||
@@ -40,6 +44,7 @@ public:
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
|
||||||
const wxString& name = wxT("editableListBox"));
|
const wxString& name = wxT("editableListBox"));
|
||||||
|
|
||||||
void SetStrings(const wxArrayString& strings);
|
void SetStrings(const wxArrayString& strings);
|
||||||
@@ -50,6 +55,7 @@ protected:
|
|||||||
wxListCtrl *m_listCtrl;
|
wxListCtrl *m_listCtrl;
|
||||||
int m_selection;
|
int m_selection;
|
||||||
bool m_edittingNew;
|
bool m_edittingNew;
|
||||||
|
long m_style;
|
||||||
|
|
||||||
void OnItemSelected(wxListEvent& event);
|
void OnItemSelected(wxListEvent& event);
|
||||||
void OnEndLabelEdit(wxListEvent& event);
|
void OnEndLabelEdit(wxListEvent& event);
|
||||||
|
@@ -107,9 +107,11 @@ END_EVENT_TABLE()
|
|||||||
wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
|
wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name), m_edittingNew(FALSE)
|
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name), m_edittingNew(FALSE)
|
||||||
{
|
{
|
||||||
|
m_style = style;
|
||||||
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
wxPanel *subp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
|
wxPanel *subp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
|
||||||
@@ -142,6 +144,14 @@ wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
|
|||||||
subsizer->Add(m_bEdit, 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_bNew, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||||
subsizer->Add(m_bDel, 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_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||||
subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||||
|
|
||||||
@@ -150,11 +160,12 @@ wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
|
|||||||
subsizer->Fit(subp);
|
subsizer->Fit(subp);
|
||||||
|
|
||||||
sizer->Add(subp, 0, wxEXPAND);
|
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,
|
wxDefaultPosition, wxDefaultSize, st);
|
||||||
wxLC_REPORT | wxLC_NO_HEADER |
|
|
||||||
wxLC_SINGLE_SEL | wxSUNKEN_BORDER |
|
|
||||||
wxLC_EDIT_LABELS);
|
|
||||||
wxArrayString empty_ar;
|
wxArrayString empty_ar;
|
||||||
SetStrings(empty_ar);
|
SetStrings(empty_ar);
|
||||||
|
|
||||||
@@ -190,7 +201,9 @@ void wxEditableListBox::OnItemSelected(wxListEvent& event)
|
|||||||
m_selection = event.GetIndex();
|
m_selection = event.GetIndex();
|
||||||
m_bUp->Enable(m_selection != 0 && m_selection < m_listCtrl->GetItemCount()-1);
|
m_bUp->Enable(m_selection != 0 && m_selection < m_listCtrl->GetItemCount()-1);
|
||||||
m_bDown->Enable(m_selection < m_listCtrl->GetItemCount()-2);
|
m_bDown->Enable(m_selection < m_listCtrl->GetItemCount()-2);
|
||||||
|
if (m_style & wxEL_ALLOW_EDIT)
|
||||||
m_bEdit->Enable(m_selection < m_listCtrl->GetItemCount()-1);
|
m_bEdit->Enable(m_selection < m_listCtrl->GetItemCount()-1);
|
||||||
|
if (m_style & wxEL_ALLOW_DELETE)
|
||||||
m_bDel->Enable(m_selection < m_listCtrl->GetItemCount()-1);
|
m_bDel->Enable(m_selection < m_listCtrl->GetItemCount()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -530,7 +530,7 @@ static void *SwigwxEditableListBoxTowxObject(void *ptr) {
|
|||||||
return (void *) dest;
|
return (void *) dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
#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) {
|
static PyObject *_wrap_new_wxEditableListBox(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
wxEditableListBox * _result;
|
wxEditableListBox * _result;
|
||||||
@@ -539,18 +539,19 @@ static PyObject *_wrap_new_wxEditableListBox(PyObject *self, PyObject *args, PyO
|
|||||||
wxString * _arg2;
|
wxString * _arg2;
|
||||||
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
|
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
|
||||||
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
|
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 * _argo0 = 0;
|
||||||
PyObject * _obj2 = 0;
|
PyObject * _obj2 = 0;
|
||||||
wxPoint temp;
|
wxPoint temp;
|
||||||
PyObject * _obj3 = 0;
|
PyObject * _obj3 = 0;
|
||||||
wxSize temp0;
|
wxSize temp0;
|
||||||
PyObject * _obj4 = 0;
|
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];
|
char _ptemp[128];
|
||||||
|
|
||||||
self = self;
|
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;
|
return NULL;
|
||||||
if (_argo0) {
|
if (_argo0) {
|
||||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
@@ -591,7 +592,7 @@ static PyObject *_wrap_new_wxEditableListBox(PyObject *self, PyObject *args, PyO
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
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);
|
wxPyEndAllowThreads(__tstate);
|
||||||
if (PyErr_Occurred()) return NULL;
|
if (PyErr_Occurred()) return NULL;
|
||||||
@@ -1913,6 +1914,9 @@ SWIGEXPORT(void) initgizmosc() {
|
|||||||
PyDict_SetItemString(d,"wxEVT_DYNAMIC_SASH_UNIFY", PyInt_FromLong((long) wxEVT_DYNAMIC_SASH_UNIFY));
|
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_MANAGE_SCROLLBARS", PyInt_FromLong((long) wxDS_MANAGE_SCROLLBARS));
|
||||||
PyDict_SetItemString(d,"wxDS_DRAG_CORNER", PyInt_FromLong((long) wxDS_DRAG_CORNER));
|
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_LEFT", PyInt_FromLong((long) wxLED_ALIGN_LEFT));
|
||||||
PyDict_SetItemString(d,"wxLED_ALIGN_RIGHT", PyInt_FromLong((long) wxLED_ALIGN_RIGHT));
|
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_CENTER", PyInt_FromLong((long) wxLED_ALIGN_CENTER));
|
||||||
|
@@ -155,6 +155,11 @@ def EVT_DYNAMIC_SASH_UNIFY(win, id, func):
|
|||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum {
|
||||||
|
wxEL_ALLOW_NEW,
|
||||||
|
wxEL_ALLOW_EDIT,
|
||||||
|
wxEL_ALLOW_DELETE,
|
||||||
|
};
|
||||||
|
|
||||||
// This class provides a composite control that lets the
|
// This class provides a composite control that lets the
|
||||||
// user easily enter list of strings
|
// user easily enter list of strings
|
||||||
@@ -165,6 +170,7 @@ public:
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
|
||||||
const char* name = "editableListBox");
|
const char* name = "editableListBox");
|
||||||
|
|
||||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||||
|
@@ -272,6 +272,9 @@ wxEVT_DYNAMIC_SASH_SPLIT = gizmosc.wxEVT_DYNAMIC_SASH_SPLIT
|
|||||||
wxEVT_DYNAMIC_SASH_UNIFY = gizmosc.wxEVT_DYNAMIC_SASH_UNIFY
|
wxEVT_DYNAMIC_SASH_UNIFY = gizmosc.wxEVT_DYNAMIC_SASH_UNIFY
|
||||||
wxDS_MANAGE_SCROLLBARS = gizmosc.wxDS_MANAGE_SCROLLBARS
|
wxDS_MANAGE_SCROLLBARS = gizmosc.wxDS_MANAGE_SCROLLBARS
|
||||||
wxDS_DRAG_CORNER = gizmosc.wxDS_DRAG_CORNER
|
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_LEFT = gizmosc.wxLED_ALIGN_LEFT
|
||||||
wxLED_ALIGN_RIGHT = gizmosc.wxLED_ALIGN_RIGHT
|
wxLED_ALIGN_RIGHT = gizmosc.wxLED_ALIGN_RIGHT
|
||||||
wxLED_ALIGN_CENTER = gizmosc.wxLED_ALIGN_CENTER
|
wxLED_ALIGN_CENTER = gizmosc.wxLED_ALIGN_CENTER
|
||||||
|
Reference in New Issue
Block a user