Fixed thread state problem in wxTreeCtrl.GetBoundingBox
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,6 +2,17 @@ CHANGES.txt for wxPython
|
|||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
New in 2.1.14
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Fixed wxTreeCtrl.HitTest to return both the tree item as well as the
|
||||||
|
flags that clairify where the click was in relation to the item.
|
||||||
|
|
||||||
|
Fixed problem in wxTreeCtrl.GetBoundingBox
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
What's new in 2.1.13
|
What's new in 2.1.13
|
||||||
--------------------
|
--------------------
|
||||||
Skipped a version number to match what has been released for wxGTK.
|
Skipped a version number to match what has been released for wxGTK.
|
||||||
|
@@ -106,6 +106,9 @@ class TestTreeCtrlPanel(wxPanel):
|
|||||||
def OnSelChanged(self, event):
|
def OnSelChanged(self, event):
|
||||||
self.item = event.GetItem()
|
self.item = event.GetItem()
|
||||||
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item))
|
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item))
|
||||||
|
self.log.WriteText("BoundingRect: %s\n" %
|
||||||
|
self.tree.GetBoundingRect(self.item, true))
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -240,6 +240,25 @@ enum wxTreeItemIcon
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// constants for HitTest
|
||||||
|
enum {
|
||||||
|
wxTREE_HITTEST_ABOVE,
|
||||||
|
wxTREE_HITTEST_BELOW,
|
||||||
|
wxTREE_HITTEST_NOWHERE,
|
||||||
|
wxTREE_HITTEST_ONITEMBUTTON,
|
||||||
|
wxTREE_HITTEST_ONITEMICON,
|
||||||
|
wxTREE_HITTEST_ONITEMINDENT,
|
||||||
|
wxTREE_HITTEST_ONITEMLABEL,
|
||||||
|
wxTREE_HITTEST_ONITEMRIGHT,
|
||||||
|
wxTREE_HITTEST_ONITEMSTATEICON,
|
||||||
|
wxTREE_HITTEST_TOLEFT,
|
||||||
|
wxTREE_HITTEST_TORIGHT,
|
||||||
|
wxTREE_HITTEST_ONITEMUPPERPART,
|
||||||
|
wxTREE_HITTEST_ONITEMLOWERPART,
|
||||||
|
wxTREE_HITTEST_ONITEM
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class wxTreeItemId {
|
class wxTreeItemId {
|
||||||
public:
|
public:
|
||||||
wxTreeItemId();
|
wxTreeItemId();
|
||||||
@@ -464,7 +483,7 @@ public:
|
|||||||
|
|
||||||
void SetItemBold(const wxTreeItemId& item, int bold = TRUE);
|
void SetItemBold(const wxTreeItemId& item, int bold = TRUE);
|
||||||
bool IsBold(const wxTreeItemId& item) const;
|
bool IsBold(const wxTreeItemId& item) const;
|
||||||
wxTreeItemId HitTest(const wxPoint& point);
|
wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT);
|
||||||
|
|
||||||
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
|
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
|
||||||
void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
|
void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
|
||||||
@@ -477,8 +496,13 @@ public:
|
|||||||
%addmethods {
|
%addmethods {
|
||||||
PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) {
|
PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) {
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
if (self->GetBoundingRect(item, rect, textOnly))
|
if (self->GetBoundingRect(item, rect, textOnly)) {
|
||||||
return wxPyConstructObject((void*)&rect, "wxRect");
|
bool doSave = wxPyRestoreThread();
|
||||||
|
wxRect* r = new wxRect(rect);
|
||||||
|
PyObject* val = wxPyConstructObject((void*)r, "wxRect");
|
||||||
|
wxPySaveThread(doSave);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
|
@@ -5742,19 +5742,24 @@ static PyObject *_wrap_wxTreeCtrl_IsBold(PyObject *self, PyObject *args, PyObjec
|
|||||||
return _resultobj;
|
return _resultobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define wxTreeCtrl_HitTest(_swigobj,_swigarg0) (_swigobj->HitTest(_swigarg0))
|
#define wxTreeCtrl_HitTest(_swigobj,_swigarg0,_swigarg1) (_swigobj->HitTest(_swigarg0,_swigarg1))
|
||||||
static PyObject *_wrap_wxTreeCtrl_HitTest(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxTreeCtrl_HitTest(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
wxTreeItemId * _result;
|
wxTreeItemId * _result;
|
||||||
wxTreeCtrl * _arg0;
|
wxTreeCtrl * _arg0;
|
||||||
wxPoint * _arg1;
|
wxPoint * _arg1;
|
||||||
|
int * _arg2;
|
||||||
|
int temp;
|
||||||
PyObject * _argo0 = 0;
|
PyObject * _argo0 = 0;
|
||||||
wxPoint temp;
|
wxPoint temp0;
|
||||||
PyObject * _obj1 = 0;
|
PyObject * _obj1 = 0;
|
||||||
char *_kwnames[] = { "self","point", NULL };
|
char *_kwnames[] = { "self","point", NULL };
|
||||||
char _ptemp[128];
|
char _ptemp[128];
|
||||||
|
|
||||||
self = self;
|
self = self;
|
||||||
|
{
|
||||||
|
_arg2 = &temp;
|
||||||
|
}
|
||||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_HitTest",_kwnames,&_argo0,&_obj1))
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_HitTest",_kwnames,&_argo0,&_obj1))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (_argo0) {
|
if (_argo0) {
|
||||||
@@ -5765,17 +5770,22 @@ static PyObject *_wrap_wxTreeCtrl_HitTest(PyObject *self, PyObject *args, PyObje
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
_arg1 = &temp;
|
_arg1 = &temp0;
|
||||||
if (! wxPoint_helper(_obj1, &_arg1))
|
if (! wxPoint_helper(_obj1, &_arg1))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
wxPy_BEGIN_ALLOW_THREADS;
|
wxPy_BEGIN_ALLOW_THREADS;
|
||||||
_result = new wxTreeItemId (wxTreeCtrl_HitTest(_arg0,*_arg1));
|
_result = new wxTreeItemId (wxTreeCtrl_HitTest(_arg0,*_arg1,*_arg2));
|
||||||
|
|
||||||
wxPy_END_ALLOW_THREADS;
|
wxPy_END_ALLOW_THREADS;
|
||||||
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p");
|
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxTreeItemId_p");
|
||||||
_resultobj = Py_BuildValue("s",_ptemp);
|
_resultobj = Py_BuildValue("s",_ptemp);
|
||||||
|
{
|
||||||
|
PyObject *o;
|
||||||
|
o = PyInt_FromLong((long) (*_arg2));
|
||||||
|
_resultobj = t_output_helper(_resultobj, o);
|
||||||
|
}
|
||||||
return _resultobj;
|
return _resultobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5953,8 +5963,13 @@ static PyObject *_wrap_wxTreeCtrl_SetItemDropHighlight(PyObject *self, PyObject
|
|||||||
|
|
||||||
static PyObject * wxTreeCtrl_GetBoundingRect(wxTreeCtrl *self,const wxTreeItemId & item,int textOnly) {
|
static PyObject * wxTreeCtrl_GetBoundingRect(wxTreeCtrl *self,const wxTreeItemId & item,int textOnly) {
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
if (self->GetBoundingRect(item, rect, textOnly))
|
if (self->GetBoundingRect(item, rect, textOnly)) {
|
||||||
return wxPyConstructObject((void*)&rect, "wxRect");
|
bool doSave = wxPyRestoreThread();
|
||||||
|
wxRect* r = new wxRect(rect);
|
||||||
|
PyObject* val = wxPyConstructObject((void*)r, "wxRect");
|
||||||
|
wxPySaveThread(doSave);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -6588,6 +6603,20 @@ SWIGEXPORT(void) initcontrols2c() {
|
|||||||
PyDict_SetItemString(d,"wxTreeItemIcon_Expanded", PyInt_FromLong((long) wxTreeItemIcon_Expanded));
|
PyDict_SetItemString(d,"wxTreeItemIcon_Expanded", PyInt_FromLong((long) wxTreeItemIcon_Expanded));
|
||||||
PyDict_SetItemString(d,"wxTreeItemIcon_SelectedExpanded", PyInt_FromLong((long) wxTreeItemIcon_SelectedExpanded));
|
PyDict_SetItemString(d,"wxTreeItemIcon_SelectedExpanded", PyInt_FromLong((long) wxTreeItemIcon_SelectedExpanded));
|
||||||
PyDict_SetItemString(d,"wxTreeItemIcon_Max", PyInt_FromLong((long) wxTreeItemIcon_Max));
|
PyDict_SetItemString(d,"wxTreeItemIcon_Max", PyInt_FromLong((long) wxTreeItemIcon_Max));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ABOVE", PyInt_FromLong((long) wxTREE_HITTEST_ABOVE));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_BELOW", PyInt_FromLong((long) wxTREE_HITTEST_BELOW));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_NOWHERE", PyInt_FromLong((long) wxTREE_HITTEST_NOWHERE));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMBUTTON", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMBUTTON));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMICON", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMICON));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMINDENT", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMINDENT));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMLABEL", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMLABEL));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMRIGHT", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMRIGHT));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMSTATEICON", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMSTATEICON));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_TOLEFT", PyInt_FromLong((long) wxTREE_HITTEST_TOLEFT));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_TORIGHT", PyInt_FromLong((long) wxTREE_HITTEST_TORIGHT));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMUPPERPART", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMUPPERPART));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEMLOWERPART", PyInt_FromLong((long) wxTREE_HITTEST_ONITEMLOWERPART));
|
||||||
|
PyDict_SetItemString(d,"wxTREE_HITTEST_ONITEM", PyInt_FromLong((long) wxTREE_HITTEST_ONITEM));
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; _swig_mapping[i].n1; i++)
|
for (i = 0; _swig_mapping[i].n1; i++)
|
||||||
|
@@ -590,7 +590,6 @@ class wxTreeCtrlPtr(wxControlPtr):
|
|||||||
return val
|
return val
|
||||||
def HitTest(self, *_args, **_kwargs):
|
def HitTest(self, *_args, **_kwargs):
|
||||||
val = apply(controls2c.wxTreeCtrl_HitTest,(self,) + _args, _kwargs)
|
val = apply(controls2c.wxTreeCtrl_HitTest,(self,) + _args, _kwargs)
|
||||||
if val: val = wxTreeItemIdPtr(val) ; val.thisown = 1
|
|
||||||
return val
|
return val
|
||||||
def SetItemTextColour(self, *_args, **_kwargs):
|
def SetItemTextColour(self, *_args, **_kwargs):
|
||||||
val = apply(controls2c.wxTreeCtrl_SetItemTextColour,(self,) + _args, _kwargs)
|
val = apply(controls2c.wxTreeCtrl_SetItemTextColour,(self,) + _args, _kwargs)
|
||||||
@@ -687,3 +686,17 @@ wxTreeItemIcon_Selected = controls2c.wxTreeItemIcon_Selected
|
|||||||
wxTreeItemIcon_Expanded = controls2c.wxTreeItemIcon_Expanded
|
wxTreeItemIcon_Expanded = controls2c.wxTreeItemIcon_Expanded
|
||||||
wxTreeItemIcon_SelectedExpanded = controls2c.wxTreeItemIcon_SelectedExpanded
|
wxTreeItemIcon_SelectedExpanded = controls2c.wxTreeItemIcon_SelectedExpanded
|
||||||
wxTreeItemIcon_Max = controls2c.wxTreeItemIcon_Max
|
wxTreeItemIcon_Max = controls2c.wxTreeItemIcon_Max
|
||||||
|
wxTREE_HITTEST_ABOVE = controls2c.wxTREE_HITTEST_ABOVE
|
||||||
|
wxTREE_HITTEST_BELOW = controls2c.wxTREE_HITTEST_BELOW
|
||||||
|
wxTREE_HITTEST_NOWHERE = controls2c.wxTREE_HITTEST_NOWHERE
|
||||||
|
wxTREE_HITTEST_ONITEMBUTTON = controls2c.wxTREE_HITTEST_ONITEMBUTTON
|
||||||
|
wxTREE_HITTEST_ONITEMICON = controls2c.wxTREE_HITTEST_ONITEMICON
|
||||||
|
wxTREE_HITTEST_ONITEMINDENT = controls2c.wxTREE_HITTEST_ONITEMINDENT
|
||||||
|
wxTREE_HITTEST_ONITEMLABEL = controls2c.wxTREE_HITTEST_ONITEMLABEL
|
||||||
|
wxTREE_HITTEST_ONITEMRIGHT = controls2c.wxTREE_HITTEST_ONITEMRIGHT
|
||||||
|
wxTREE_HITTEST_ONITEMSTATEICON = controls2c.wxTREE_HITTEST_ONITEMSTATEICON
|
||||||
|
wxTREE_HITTEST_TOLEFT = controls2c.wxTREE_HITTEST_TOLEFT
|
||||||
|
wxTREE_HITTEST_TORIGHT = controls2c.wxTREE_HITTEST_TORIGHT
|
||||||
|
wxTREE_HITTEST_ONITEMUPPERPART = controls2c.wxTREE_HITTEST_ONITEMUPPERPART
|
||||||
|
wxTREE_HITTEST_ONITEMLOWERPART = controls2c.wxTREE_HITTEST_ONITEMLOWERPART
|
||||||
|
wxTREE_HITTEST_ONITEM = controls2c.wxTREE_HITTEST_ONITEM
|
||||||
|
Reference in New Issue
Block a user