Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Name: grid.i
|
||||
// Purpose: SWIG definitions for the new wxGrid and related classes
|
||||
//
|
||||
@@ -70,7 +70,7 @@ PyObject* wxPyMake_##TYPE(TYPE* source) { \
|
||||
/* Otherwise make a new wrapper for it the old fashioned way and \
|
||||
give it the OOR treatment */ \
|
||||
if (! target) { \
|
||||
target = wxPyConstructObject(source, #TYPE, FALSE); \
|
||||
target = wxPyConstructObject(source, wxT(#TYPE), FALSE); \
|
||||
if (target) \
|
||||
source->SetClientObject(new wxPyOORClientData(target)); \
|
||||
} \
|
||||
@@ -571,7 +571,7 @@ public:
|
||||
PyObject* go = wxPyMake_wxObject(&grid);
|
||||
PyObject* dco = wxPyMake_wxObject(&dc);
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rect, "wxRect", 0);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
|
||||
row, col, isSelected));
|
||||
@@ -747,6 +747,9 @@ public:
|
||||
wxControl* GetControl();
|
||||
void SetControl(wxControl* control);
|
||||
|
||||
wxGridCellAttr* GetCellAttr();
|
||||
void SetCellAttr(wxGridCellAttr* attr);
|
||||
|
||||
void SetParameters(const wxString& params);
|
||||
void IncRef();
|
||||
void DecRef();
|
||||
@@ -768,6 +771,7 @@ public:
|
||||
virtual void HandleReturn(wxKeyEvent& event);
|
||||
virtual void Destroy();
|
||||
|
||||
virtual wxString GetValue();
|
||||
};
|
||||
|
||||
|
||||
@@ -816,7 +820,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
wxGridCellEditor*Clone() const {
|
||||
wxGridCellEditor* Clone() const {
|
||||
wxGridCellEditor* rval = NULL;
|
||||
wxPyBeginBlockThreads();
|
||||
if (wxPyCBH_findCallback(m_myInst, "Clone")) {
|
||||
@@ -856,7 +860,7 @@ public:
|
||||
wxPyBeginBlockThreads();
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
|
||||
PyObject* ao = wxPyMake_wxGridCellAttr(attr);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rectCell, "wxRect", 0);
|
||||
PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
|
||||
|
||||
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));
|
||||
|
||||
@@ -880,6 +884,7 @@ public:
|
||||
DEC_PYCALLBACK__(StartingClick);
|
||||
DEC_PYCALLBACK__(Destroy);
|
||||
DEC_PYCALLBACK__STRING(SetParameters);
|
||||
DEC_PYCALLBACK_STRING__const(GetValue);
|
||||
|
||||
PYPRIVATE;
|
||||
};
|
||||
@@ -893,6 +898,7 @@ IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEven
|
||||
IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent);
|
||||
IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick);
|
||||
IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy);
|
||||
IMP_PYCALLBACK_STRING__const(wxPyGridCellEditor, wxGridCellEditor, GetValue);
|
||||
|
||||
%}
|
||||
|
||||
@@ -914,6 +920,7 @@ public:
|
||||
void base_HandleReturn(wxKeyEvent& event);
|
||||
void base_Destroy();
|
||||
void base_SetParameters(const wxString& params);
|
||||
wxString base_GetValue();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -1403,8 +1410,17 @@ public:
|
||||
return *self != other;
|
||||
}
|
||||
}
|
||||
%pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
|
||||
%pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
|
||||
%pragma(python) addtoclass = "
|
||||
def __str__(self): return str(self.asTuple())
|
||||
def __repr__(self): return 'wxGridCellCoords'+str(self.asTuple())
|
||||
def __len__(self): return len(self.asTuple())
|
||||
def __getitem__(self, index): return self.asTuple()[index]
|
||||
def __setitem__(self, index, val):
|
||||
if index == 0: self.SetRow(val)
|
||||
elif index == 1: self.SetCol(val)
|
||||
else: raise IndexError
|
||||
"
|
||||
|
||||
};
|
||||
|
||||
// Typemap to allow conversion of sequence objects to wxGridCellCoords...
|
||||
@@ -1440,6 +1456,36 @@ bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) {
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
|
||||
// Typemap to convert an array of cells coords to a list of tuples...
|
||||
%typemap(python, out) wxGridCellCoordsArray {
|
||||
$target = wxGridCellCoordsArray_helper($source);
|
||||
}
|
||||
|
||||
%typemap(python, ret) wxGridCellCoordsArray {
|
||||
delete $source;
|
||||
}
|
||||
|
||||
|
||||
// ...and the helper function for the above typemap.
|
||||
%{
|
||||
PyObject* wxGridCellCoordsArray_helper(const wxGridCellCoordsArray* source)
|
||||
{
|
||||
PyObject* list = PyList_New(0);
|
||||
size_t idx;
|
||||
for (idx = 0; idx < source->GetCount(); idx += 1) {
|
||||
wxGridCellCoords& coord = source->Item(idx);
|
||||
PyObject* tup = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(coord.GetRow()));
|
||||
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(coord.GetCol()));
|
||||
PyList_Append(list, tup);
|
||||
Py_DECREF(tup);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
// The grid itself
|
||||
@@ -1509,7 +1555,8 @@ public:
|
||||
//
|
||||
void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&,
|
||||
int horizontalAlignment = wxLEFT,
|
||||
int verticalAlignment = wxTOP );
|
||||
int verticalAlignment = wxTOP,
|
||||
int textOrientation = wxHORIZONTAL );
|
||||
|
||||
// // Split a string containing newline chararcters into an array of
|
||||
// // strings and return the number of lines
|
||||
@@ -1614,6 +1661,7 @@ public:
|
||||
wxFont GetLabelFont();
|
||||
void GetRowLabelAlignment( int *OUTPUT, int *OUTPUT );
|
||||
void GetColLabelAlignment( int *OUTPUT, int *OUTPUT );
|
||||
int GetColLabelTextOrientation();
|
||||
wxString GetRowLabelValue( int row );
|
||||
wxString GetColLabelValue( int col );
|
||||
wxColour GetGridLineColour();
|
||||
@@ -1628,6 +1676,7 @@ public:
|
||||
void SetLabelFont( const wxFont& );
|
||||
void SetRowLabelAlignment( int horiz, int vert );
|
||||
void SetColLabelAlignment( int horiz, int vert );
|
||||
void SetColLabelTextOrientation( int textOrientation );
|
||||
void SetRowLabelValue( int row, const wxString& );
|
||||
void SetColLabelValue( int col, const wxString& );
|
||||
void SetGridLineColour( const wxColour& );
|
||||
@@ -1700,6 +1749,13 @@ public:
|
||||
// and also set the grid size to just fit its contents
|
||||
void AutoSize();
|
||||
|
||||
// autosize row height depending on label text
|
||||
void AutoSizeRowLabelSize( int row );
|
||||
|
||||
// autosize column width depending on label text
|
||||
void AutoSizeColLabelSize( int col );
|
||||
|
||||
|
||||
// column won't be resized to be lesser width - this must be called during
|
||||
// the grid creation because it won't resize the column if it's already
|
||||
// narrower than the minimal width
|
||||
@@ -1763,12 +1819,15 @@ public:
|
||||
bool IsInSelection( int row, int col );
|
||||
// TODO: ??? bool IsInSelection( const wxGridCellCoords& coords )
|
||||
|
||||
// TODO: These need typemaps
|
||||
// wxGridCellCoordsArray GetSelectedCells() const;
|
||||
// wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
|
||||
// wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
|
||||
// wxArrayInt GetSelectedRows() const;
|
||||
// wxArrayInt GetSelectedCols() const;
|
||||
const wxGridCellCoordsArray GetSelectedCells() const;
|
||||
const wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
|
||||
const wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
|
||||
const wxArrayInt GetSelectedRows() const;
|
||||
const wxArrayInt GetSelectedCols() const;
|
||||
|
||||
void DeselectRow( int row );
|
||||
void DeselectCol( int col );
|
||||
void DeselectCell( int row, int col );
|
||||
|
||||
|
||||
// This function returns the rectangle that encloses the block of cells
|
||||
|
Reference in New Issue
Block a user