%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
-%include _grid_rename.i
-
MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr);
MAKE_CONST_WXSTRING_NOSWIG(DefaultDateTimeFormat);
//---------------------------------------------------------------------------
-// wxGridCellRenderer is an ABC, and several derived classes are available.
-// Classes implemented in Python should be derived from wxPyGridCellRenderer.
+// TODO: Use these to have SWIG automatically handle the IncRef/DecRef calls:
+//
+// %ref wxGridCellWorker "$this->IncRef();";
+// %unref wxGridCellWorker "$this->DecRef();";
+//
-class wxGridCellRenderer
+class wxGridCellWorker
{
public:
%extend {
if (!self->GetClientObject())
self->SetClientObject(new wxPyOORClientData(_self));
}
+
+ // A dummy dtor to shut up SWIG. (The real one is protected and can
+ // only be called by DecRef)
+ ~wxGridCellWorker() {
+ }
}
void SetParameters(const wxString& params);
void IncRef();
void DecRef();
+};
+
+
+
+// wxGridCellRenderer is an ABC, and several derived classes are available.
+// Classes implemented in Python should be derived from wxPyGridCellRenderer.
+class wxGridCellRenderer : public wxGridCellWorker
+{
virtual void Draw(wxGrid& grid,
wxGridCellAttr& attr,
wxDC& dc,
};
+
// The C++ version of wxPyGridCellRenderer
%{
class wxPyGridCellRenderer : public wxGridCellRenderer
// wxGridCellEditor is an ABC, and several derived classes are available.
// Classes implemented in Python should be derived from wxPyGridCellEditor.
-class wxGridCellEditor
+class wxGridCellEditor : public wxGridCellWorker
{
public:
- %extend {
- void _setOORInfo(PyObject* _self) {
- if (!self->GetClientObject())
- self->SetClientObject(new wxPyOORClientData(_self));
- }
- }
-
bool IsCreated();
wxControl* GetControl();
void SetControl(wxControl* control);
wxGridCellAttr* GetCellAttr();
void SetCellAttr(wxGridCellAttr* attr);
- void SetParameters(const wxString& params);
- void IncRef();
- void DecRef();
-
virtual void Create(wxWindow* parent,
wxWindowID id,
wxEvtHandler* evtHandler);
%pythonAppend wxGridCellAttr "self._setOORInfo(self)"
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL);
+
+ %extend {
+ // A dummy dtor to shut up SWIG. (The real one is protected and can
+ // only be called by DecRef)
+ ~wxGridCellAttr() {
+ }
+ }
wxGridCellAttr *Clone() const;
void MergeWith(wxGridCellAttr *mergefrom);
+
void IncRef();
void DecRef();
+
void SetTextColour(const wxColour& colText);
void SetBackgroundColour(const wxColour& colBack);
void SetFont(const wxFont& font);
void _setCallbackInfo(PyObject* self, PyObject* _class);
wxGridCellAttr *GetAttr(int row, int col,
- wxGridCellAttr::wxAttrKind kind);
+ wxGridCellAttr::wxAttrKind kind);
void SetAttr(wxGridCellAttr *attr, int row, int col);
void SetRowAttr(wxGridCellAttr *attr, int row);
void SetColAttr(wxGridCellAttr *attr, int col);
{
public:
// wxGridTableBase(); This is an ABC
- //~wxGridTableBase();
+ ~wxGridTableBase();
%extend {
void _setOORInfo(PyObject* _self) {
void SetCol( int n );
void Set( int row, int col );
- bool operator==( const wxGridCellCoords& other ) const;
- bool operator!=( const wxGridCellCoords& other ) const;
+ %extend {
+ KeepGIL(__eq__);
+ DocStr(__eq__, "Test for equality of GridCellCoords objects.", "");
+ bool __eq__(PyObject* other) {
+ wxGridCellCoords temp, *obj = &temp;
+ if ( other == Py_None ) return false;
+ if ( ! wxGridCellCoords_helper(other, &obj) ) {
+ PyErr_Clear();
+ return false;
+ }
+ return self->operator==(*obj);
+ }
+
+
+ KeepGIL(__ne__);
+ DocStr(__ne__, "Test for inequality of GridCellCoords objects.", "");
+ bool __ne__(PyObject* other) {
+ wxGridCellCoords temp, *obj = &temp;
+ if ( other == Py_None ) return true;
+ if ( ! wxGridCellCoords_helper(other, &obj)) {
+ PyErr_Clear();
+ return true;
+ }
+ return self->operator!=(*obj);
+ }
+ }
+
%extend {
PyObject* Get() {
long style = wxWANTS_CHARS,
const wxString& name = wxPyPanelNameStr );
-
+ // Override the global renamer to leave these as they are, for backwards
+ // compatibility
+ %rename(wxGridSelectCells) wxGridSelectCells;
+ %rename(wxGridSelectRows) wxGridSelectRows;
+ %rename(wxGridSelectColumns) wxGridSelectColumns;
+
enum wxGridSelectionModes {
wxGridSelectCells,
wxGridSelectRows,
wxGridTableBase * GetTable() const;
+
+ %disownarg(wxGridTableBase *);
bool SetTable( wxGridTableBase *table, bool takeOwnership=false,
WXGRIDSELECTIONMODES selmode =
wxGrid::wxGridSelectCells );
+ %cleardisown(wxGridTableBase *);
void ClearGrid();
bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=true );
}
int YToRow( int y );
- int XToCol( int x );
+ int XToCol( int x, bool clipToMinMax = false );
int YToEdgeOfRow( int y );
int XToEdgeOfCol( int x );
void EnableDragColSize( bool enable = true );
void DisableDragColSize();
bool CanDragColSize();
+ void EnableDragColMove( bool enable = true );
+ void DisableDragColMove() { EnableDragColMove( false ); }
+ bool CanDragColMove() { return m_canDragColMove; }
void EnableDragGridSize(bool enable = true);
void DisableDragGridSize();
bool CanDragGridSize();
void SetColSize( int col, int width );
+ int GetColAt( int colPos ) const;
+ void SetColPos( int colID, int newPos );
+ int GetColPos( int colID ) const;
+
// automatically size the column or row to fit to its contents, if
// setAsMin is True, this optimal width will also be set as minimal width
// for this column
bool MetaDown();
bool ShiftDown();
bool AltDown();
-
+ bool CmdDown();
};
bool MetaDown();
bool ShiftDown();
bool AltDown();
-
+ bool CmdDown();
};
bool MetaDown();
bool ShiftDown();
bool AltDown();
+ bool CmdDown();
};