]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/grid.i
added wxWindows shared library to link of OpenGL wxWindows shared library
[wxWidgets.git] / wxPython / src / grid.i
index 09a02568f8947d491625c06769856f25a847fce4..82c34448b904ec0716ab45b4922a5d9116db5c52 100644 (file)
 
 
 %{
 
 
 %{
-#define PYCALLBACK_GCA_INTINT(PCLASS, CBNAME)                           \
-    wxGridCellAttr* CBNAME(int a, int b) {                              \
-        wxGridCellAttr* rval = NULL;                                    \
-        bool doSave = wxPyRestoreThread();                              \
-        if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                           \
-            PyObject* ro;                                               \
-            wxGridCellAttr* ptr;                                        \
-            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)", a, b)); \
-            if (ro) {                                                   \
+#define PYCALLBACK_GCA_INTINTKIND(PCLASS, CBNAME)                               \
+    wxGridCellAttr* CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) {        \
+        wxGridCellAttr* rval = NULL;                                            \
+        bool doSave = wxPyRestoreThread();                                      \
+        if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \
+            PyObject* ro;                                                       \
+            wxGridCellAttr* ptr;                                                \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iii)", a, b, c)); \
+            if (ro) {                                                           \
                 if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p"))    \
                 if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p"))    \
-                    rval = ptr;                                         \
-                Py_DECREF(ro);                                          \
-            }                                                           \
-        }                                                               \
-        else                                                            \
-            rval = PCLASS::CBNAME(a, b);                                \
-        wxPySaveThread(doSave);                                         \
-        return rval;                                                    \
-    }                                                                   \
-    wxGridCellAttr *base_##CBNAME(int a, int b) {                       \
-        return PCLASS::CBNAME(a, b);                                    \
+                    rval = ptr;                                                 \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        else                                                                    \
+            rval = PCLASS::CBNAME(a, b, c);                                     \
+        wxPySaveThread(doSave);                                                 \
+        return rval;                                                            \
+    }                                                                           \
+    wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
+        return PCLASS::CBNAME(a, b, c);                                         \
     }
 
 
     }
 
 
@@ -809,9 +809,20 @@ public:
 class wxGridCellAttr
 {
 public:
 class wxGridCellAttr
 {
 public:
+    enum wxAttrKind
+    {
+        Any,
+        Default,
+        Cell,
+        Row,
+        Col,
+        Merged
+    };
+
     wxGridCellAttr();
 
     wxGridCellAttr *Clone() const;
     wxGridCellAttr();
 
     wxGridCellAttr *Clone() const;
+    void MergeWith(wxGridCellAttr *mergefrom);
     void IncRef();
     void DecRef();
     void SetTextColour(const wxColour& colText);
     void IncRef();
     void DecRef();
     void SetTextColour(const wxColour& colText);
@@ -822,6 +833,7 @@ public:
 
     void SetRenderer(wxGridCellRenderer *renderer);
     void SetEditor(wxGridCellEditor* editor);
 
     void SetRenderer(wxGridCellRenderer *renderer);
     void SetEditor(wxGridCellEditor* editor);
+    void SetKind(wxAttrKind kind);
 
     bool HasTextColour() const;
     bool HasBackgroundColour() const;
 
     bool HasTextColour() const;
     bool HasBackgroundColour() const;
@@ -829,6 +841,7 @@ public:
     bool HasAlignment() const;
     bool HasRenderer() const;
     bool HasEditor() const;
     bool HasAlignment() const;
     bool HasRenderer() const;
     bool HasEditor() const;
+    bool HasReadWriteMode() const;
 
     const wxColour& GetTextColour() const;
     const wxColour& GetBackgroundColour() const;
 
     const wxColour& GetTextColour() const;
     const wxColour& GetBackgroundColour() const;
@@ -849,7 +862,8 @@ public:
     wxGridCellAttrProvider();
     // ???? virtual ~wxGridCellAttrProvider();
 
     wxGridCellAttrProvider();
     // ???? virtual ~wxGridCellAttrProvider();
 
-    wxGridCellAttr *GetAttr(int row, int col) const;
+    wxGridCellAttr *GetAttr(int row, int col,
+                            wxGridCellAttr::wxAttrKind  kind) const;
     void SetAttr(wxGridCellAttr *attr, int row, int col);
     void SetRowAttr(wxGridCellAttr *attr, int row);
     void SetColAttr(wxGridCellAttr *attr, int col);
     void SetAttr(wxGridCellAttr *attr, int row, int col);
     void SetRowAttr(wxGridCellAttr *attr, int row);
     void SetColAttr(wxGridCellAttr *attr, int col);
@@ -867,7 +881,7 @@ class wxPyGridCellAttrProvider : public wxGridCellAttrProvider
 public:
     wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
 
 public:
     wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {};
 
-    PYCALLBACK_GCA_INTINT(wxGridCellAttrProvider, GetAttr);
+    PYCALLBACK_GCA_INTINTKIND(wxGridCellAttrProvider, GetAttr);
     PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
     PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
     PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
     PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr);
     PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr);
     PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr);
@@ -885,7 +899,8 @@ public:
     void _setSelf(PyObject* self, PyObject* _class);
     %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellAttrProvider)"
 
     void _setSelf(PyObject* self, PyObject* _class);
     %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellAttrProvider)"
 
-    wxGridCellAttr *base_GetAttr(int row, int col);
+    wxGridCellAttr *base_GetAttr(int row, int col,
+                                 wxGridCellAttr::wxAttrKind kind);
     void base_SetAttr(wxGridCellAttr *attr, int row, int col);
     void base_SetRowAttr(wxGridCellAttr *attr, int row);
     void base_SetColAttr(wxGridCellAttr *attr, int col);
     void base_SetAttr(wxGridCellAttr *attr, int row, int col);
     void base_SetRowAttr(wxGridCellAttr *attr, int row);
     void base_SetColAttr(wxGridCellAttr *attr, int col);
@@ -897,7 +912,7 @@ public:
 
 
 
 
 
 
-class wxGridTableBase
+class wxGridTableBase : public wxObject
 {
 public:
     // wxGridTableBase();   This is an ABC
 {
 public:
     // wxGridTableBase();   This is an ABC
@@ -946,7 +961,8 @@ public:
 
     virtual bool CanHaveAttributes();
 
 
     virtual bool CanHaveAttributes();
 
-    virtual wxGridCellAttr *GetAttr( int row, int col );
+    virtual wxGridCellAttr *GetAttr( int row, int col,
+                                     wxGridCellAttr::wxAttrKind  kind);
     virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
     virtual void SetRowAttr(wxGridCellAttr *attr, int row);
     virtual void SetColAttr(wxGridCellAttr *attr, int col);
     virtual void SetAttr(wxGridCellAttr* attr, int row, int col);
     virtual void SetRowAttr(wxGridCellAttr *attr, int row);
     virtual void SetColAttr(wxGridCellAttr *attr, int col);
@@ -980,7 +996,7 @@ public:
     PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
     PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
     PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
     PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue);
     PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue);
     PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes);
-    PYCALLBACK_GCA_INTINT(wxGridTableBase, GetAttr);
+    PYCALLBACK_GCA_INTINTKIND(wxGridTableBase, GetAttr);
     PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
     PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
     PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
     PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr);
     PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr);
     PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
@@ -1108,7 +1124,8 @@ public:
     void base_SetRowLabelValue( int row, const wxString& value );
     void base_SetColLabelValue( int col, const wxString& value );
     bool base_CanHaveAttributes();
     void base_SetRowLabelValue( int row, const wxString& value );
     void base_SetColLabelValue( int col, const wxString& value );
     bool base_CanHaveAttributes();
-    wxGridCellAttr *base_GetAttr( int row, int col );
+    wxGridCellAttr *base_GetAttr( int row, int col,
+                                  wxGridCellAttr::wxAttrKind kind );
     void base_SetAttr(wxGridCellAttr* attr, int row, int col);
     void base_SetRowAttr(wxGridCellAttr *attr, int row);
     void base_SetColAttr(wxGridCellAttr *attr, int col);
     void base_SetAttr(wxGridCellAttr* attr, int row, int col);
     void base_SetRowAttr(wxGridCellAttr *attr, int row);
     void base_SetColAttr(wxGridCellAttr *attr, int col);
@@ -1344,6 +1361,7 @@ public:
     void     BeginBatch();
     void     EndBatch();
     int      GetBatchCount();
     void     BeginBatch();
     void     EndBatch();
     int      GetBatchCount();
+    void     ForceRefresh();
 
 
     // ------ edit control functions
 
 
     // ------ edit control functions
@@ -1431,6 +1449,8 @@ public:
     wxString GetColLabelValue( int col );
     wxColour GetGridLineColour();
     wxColour GetCellHighlightColour();
     wxString GetColLabelValue( int col );
     wxColour GetGridLineColour();
     wxColour GetCellHighlightColour();
+    int      GetCellHighlightPenWidth();
+    int      GetCellHighlightROPenWidth();
 
     void     SetRowLabelSize( int width );
     void     SetColLabelSize( int height );
 
     void     SetRowLabelSize( int width );
     void     SetColLabelSize( int height );
@@ -1443,6 +1463,8 @@ public:
     void     SetColLabelValue( int col, const wxString& );
     void     SetGridLineColour( const wxColour& );
     void     SetCellHighlightColour( const wxColour& );
     void     SetColLabelValue( int col, const wxString& );
     void     SetGridLineColour( const wxColour& );
     void     SetCellHighlightColour( const wxColour& );
+    void     SetCellHighlightPenWidth(int width);
+    void     SetCellHighlightROPenWidth(int width);
 
     void     EnableDragRowSize( bool enable = TRUE );
     void     DisableDragRowSize();
 
     void     EnableDragRowSize( bool enable = TRUE );
     void     DisableDragRowSize();
@@ -1595,6 +1617,15 @@ public:
     // grid may occupy more space than needed for its rows/columns, this
     // function allows to set how big this extra space is
     void SetMargins(int extraWidth, int extraHeight);
     // grid may occupy more space than needed for its rows/columns, this
     // function allows to set how big this extra space is
     void SetMargins(int extraWidth, int extraHeight);
+
+
+    // Accessors for component windows
+    wxWindow* GetGridWindow();
+    wxWindow* GetGridRowLabelWindow();
+    wxWindow* GetGridColLabelWindow();
+    wxWindow* GetGridCornerLabelWindow();
+
+
 };
 
 
 };
 
 
@@ -1663,6 +1694,22 @@ public:
     bool        AltDown();
 };
 
     bool        AltDown();
 };
 
+
+class wxGridEditorCreatedEvent : public wxCommandEvent {
+public:
+    wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
+                             int row, int col, wxControl* ctrl);
+
+    int GetRow();
+    int GetCol();
+    wxControl* GetControl();
+    void SetRow(int row);
+    void SetCol(int col);
+    void SetControl(wxControl* ctrl);
+};
+
+
+
 enum {
     wxEVT_GRID_CELL_LEFT_CLICK,
     wxEVT_GRID_CELL_RIGHT_CLICK,
 enum {
     wxEVT_GRID_CELL_LEFT_CLICK,
     wxEVT_GRID_CELL_RIGHT_CLICK,
@@ -1679,6 +1726,7 @@ enum {
     wxEVT_GRID_SELECT_CELL,
     wxEVT_GRID_EDITOR_SHOWN,
     wxEVT_GRID_EDITOR_HIDDEN,
     wxEVT_GRID_SELECT_CELL,
     wxEVT_GRID_EDITOR_SHOWN,
     wxEVT_GRID_EDITOR_HIDDEN,
+    wxEVT_GRID_EDITOR_CREATED,
 };
 
 
 };
 
 
@@ -1729,6 +1777,9 @@ def EVT_GRID_EDITOR_SHOWN(win, fn):
 def EVT_GRID_EDITOR_HIDDEN(win, fn):
     win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn)
 
 def EVT_GRID_EDITOR_HIDDEN(win, fn):
     win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn)
 
+def EVT_GRID_EDITOR_CREATED(win, fn):
+    win.Connect(-1, -1, wxEVT_GRID_EDITOR_CREATED, fn)
+
 "
 
 //---------------------------------------------------------------------------
 "
 
 //---------------------------------------------------------------------------