]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/gtk/grid.py
undo last change
[wxWidgets.git] / wxPython / src / gtk / grid.py
index 00b981918dbbd89e87d1483599a3b3e53db582e3..d2b321501355cd73a0f4709b65b66ef1ea1df6ed 100644 (file)
@@ -1,12 +1,16 @@
 # This file was created automatically by SWIG.
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+Classes for implementing a spreadsheet-like control.
+"""
+
 import _grid
 
-import windows
-import core
-wx = core 
-__docfilter__ = wx.__docfilter__ 
+import _windows
+import _core
+wx = _core 
+__docfilter__ = wx.__DocFilter(globals()) 
 GRID_VALUE_STRING = _grid.GRID_VALUE_STRING
 GRID_VALUE_BOOL = _grid.GRID_VALUE_BOOL
 GRID_VALUE_NUMBER = _grid.GRID_VALUE_NUMBER
@@ -16,6 +20,16 @@ GRID_VALUE_TEXT = _grid.GRID_VALUE_TEXT
 GRID_VALUE_LONG = _grid.GRID_VALUE_LONG
 GRID_VALUE_CHOICEINT = _grid.GRID_VALUE_CHOICEINT
 GRID_VALUE_DATETIME = _grid.GRID_VALUE_DATETIME
+GRID_DEFAULT_NUMBER_ROWS = _grid.GRID_DEFAULT_NUMBER_ROWS
+GRID_DEFAULT_NUMBER_COLS = _grid.GRID_DEFAULT_NUMBER_COLS
+GRID_DEFAULT_ROW_HEIGHT = _grid.GRID_DEFAULT_ROW_HEIGHT
+GRID_DEFAULT_COL_WIDTH = _grid.GRID_DEFAULT_COL_WIDTH
+GRID_DEFAULT_COL_LABEL_HEIGHT = _grid.GRID_DEFAULT_COL_LABEL_HEIGHT
+GRID_DEFAULT_ROW_LABEL_WIDTH = _grid.GRID_DEFAULT_ROW_LABEL_WIDTH
+GRID_LABEL_EDGE_ZONE = _grid.GRID_LABEL_EDGE_ZONE
+GRID_MIN_ROW_HEIGHT = _grid.GRID_MIN_ROW_HEIGHT
+GRID_MIN_COL_WIDTH = _grid.GRID_MIN_COL_WIDTH
+GRID_DEFAULT_SCROLLBAR_WIDTH = _grid.GRID_DEFAULT_SCROLLBAR_WIDTH
 class GridCellRenderer(object):
     def __init__(self): raise RuntimeError, "No constructor defined"
     def __repr__(self):
@@ -704,6 +718,10 @@ class GridCellAttr(object):
         """IsReadOnly(self) -> bool"""
         return _grid.GridCellAttr_IsReadOnly(*args, **kwargs)
 
+    def GetKind(*args, **kwargs):
+        """GetKind(self) -> int"""
+        return _grid.GridCellAttr_GetKind(*args, **kwargs)
+
     def SetDefAttr(*args, **kwargs):
         """SetDefAttr(self, GridCellAttr defAttr)"""
         return _grid.GridCellAttr_SetDefAttr(*args, **kwargs)
@@ -802,7 +820,7 @@ class PyGridCellAttrProviderPtr(PyGridCellAttrProvider):
         self.__class__ = PyGridCellAttrProvider
 _grid.PyGridCellAttrProvider_swigregister(PyGridCellAttrProviderPtr)
 
-class GridTableBase(core.Object):
+class GridTableBase(_core.Object):
     def __init__(self): raise RuntimeError, "No constructor defined"
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxGridTableBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
@@ -1186,13 +1204,14 @@ class GridCellCoords(object):
         """__ne__(self, GridCellCoords other) -> bool"""
         return _grid.GridCellCoords___ne__(*args, **kwargs)
 
-    def asTuple(*args, **kwargs):
-        """asTuple(self) -> PyObject"""
-        return _grid.GridCellCoords_asTuple(*args, **kwargs)
+    def Get(*args, **kwargs):
+        """Get(self) -> PyObject"""
+        return _grid.GridCellCoords_Get(*args, **kwargs)
 
-    def __str__(self):                   return str(self.asTuple())
-    def __repr__(self):                  return 'wxGridCellCoords'+str(self.asTuple())
-    def __len__(self):                   return len(self.asTuple())
+    asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
+    def __str__(self):                   return str(self.Get())
+    def __repr__(self):                  return 'wxGridCellCoords'+str(self.Get())
+    def __len__(self):                   return len(self.Get())
     def __getitem__(self, index):        return self.asTuple()[index]
     def __setitem__(self, index, val):
         if index == 0: self.SetRow(val)
@@ -1207,13 +1226,13 @@ class GridCellCoordsPtr(GridCellCoords):
         self.__class__ = GridCellCoords
 _grid.GridCellCoords_swigregister(GridCellCoordsPtr)
 
-class Grid(windows.ScrolledWindow):
+class Grid(_windows.ScrolledWindow):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxGrid instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def __init__(self, *args, **kwargs):
         """
-        __init__(self, Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize
-            long style=WANTS_CHARS, 
+        __init__(self, Window parent, int id=-1, Point pos=DefaultPosition
+            Size size=DefaultSize, long style=WANTS_CHARS, 
             String name=PanelNameStr) -> Grid
         """
         newobj = _grid.new_Grid(*args, **kwargs)
@@ -1222,6 +1241,14 @@ class Grid(windows.ScrolledWindow):
         del newobj.thisown
         self._setOORInfo(self)
 
+    def Create(*args, **kwargs):
+        """
+        Create(self, Window parent, int id=-1, Point pos=DefaultPosition, 
+            Size size=DefaultSize, long style=WANTS_CHARS, 
+            String name=PanelNameStr) -> bool
+        """
+        return _grid.Grid_Create(*args, **kwargs)
+
     wxGridSelectCells = _grid.Grid_wxGridSelectCells
     wxGridSelectRows = _grid.Grid_wxGridSelectRows
     wxGridSelectColumns = _grid.Grid_wxGridSelectColumns
@@ -1604,6 +1631,18 @@ class Grid(windows.ScrolledWindow):
         """CanDragGridSize(self) -> bool"""
         return _grid.Grid_CanDragGridSize(*args, **kwargs)
 
+    def EnableDragCell(*args, **kwargs):
+        """EnableDragCell(self, bool enable=True)"""
+        return _grid.Grid_EnableDragCell(*args, **kwargs)
+
+    def DisableDragCell(*args, **kwargs):
+        """DisableDragCell(self)"""
+        return _grid.Grid_DisableDragCell(*args, **kwargs)
+
+    def CanDragCell(*args, **kwargs):
+        """CanDragCell(self) -> bool"""
+        return _grid.Grid_CanDragCell(*args, **kwargs)
+
     def SetAttr(*args, **kwargs):
         """SetAttr(self, int row, int col, GridCellAttr attr)"""
         return _grid.Grid_SetAttr(*args, **kwargs)
@@ -1616,6 +1655,10 @@ class Grid(windows.ScrolledWindow):
         """SetColAttr(self, int col, GridCellAttr attr)"""
         return _grid.Grid_SetColAttr(*args, **kwargs)
 
+    def GetOrCreateCellAttr(*args, **kwargs):
+        """GetOrCreateCellAttr(self, int row, int col) -> GridCellAttr"""
+        return _grid.Grid_GetOrCreateCellAttr(*args, **kwargs)
+
     def SetColFormatBool(*args, **kwargs):
         """SetColFormatBool(self, int col)"""
         return _grid.Grid_SetColFormatBool(*args, **kwargs)
@@ -1983,6 +2026,24 @@ class Grid(windows.ScrolledWindow):
         """GetGridCornerLabelWindow(self) -> Window"""
         return _grid.Grid_GetGridCornerLabelWindow(*args, **kwargs)
 
+    def GetClassDefaultAttributes(*args, **kwargs):
+        """
+        GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
+
+        Get the default attributes for this class.  This is useful if you want
+        to use the same font or colour in your own control as in a standard
+        control -- which is a much better idea than hard coding specific
+        colours or fonts which might look completely out of place on the
+        user's system, especially if it uses themes.
+
+        The variant parameter is only relevant under Mac currently and is
+        ignore under other platforms. Under Mac, it will change the size of
+        the returned font. See `wx.Window.SetWindowVariant` for more about
+        this.
+        """
+        return _grid.Grid_GetClassDefaultAttributes(*args, **kwargs)
+
+    GetClassDefaultAttributes = staticmethod(GetClassDefaultAttributes)
 
 class GridPtr(Grid):
     def __init__(self, this):
@@ -1991,7 +2052,31 @@ class GridPtr(Grid):
         self.__class__ = Grid
 _grid.Grid_swigregister(GridPtr)
 
-class GridEvent(core.NotifyEvent):
+def PreGrid(*args, **kwargs):
+    """PreGrid() -> Grid"""
+    val = _grid.new_PreGrid(*args, **kwargs)
+    val.thisown = 1
+    self._setOORInfo(self)
+    return val
+
+def Grid_GetClassDefaultAttributes(*args, **kwargs):
+    """
+    Grid_GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
+
+    Get the default attributes for this class.  This is useful if you want
+    to use the same font or colour in your own control as in a standard
+    control -- which is a much better idea than hard coding specific
+    colours or fonts which might look completely out of place on the
+    user's system, especially if it uses themes.
+
+    The variant parameter is only relevant under Mac currently and is
+    ignore under other platforms. Under Mac, it will change the size of
+    the returned font. See `wx.Window.SetWindowVariant` for more about
+    this.
+    """
+    return _grid.Grid_GetClassDefaultAttributes(*args, **kwargs)
+
+class GridEvent(_core.NotifyEvent):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxGridEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def __init__(self, *args, **kwargs):
@@ -2045,7 +2130,7 @@ class GridEventPtr(GridEvent):
         self.__class__ = GridEvent
 _grid.GridEvent_swigregister(GridEventPtr)
 
-class GridSizeEvent(core.NotifyEvent):
+class GridSizeEvent(_core.NotifyEvent):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxGridSizeEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def __init__(self, *args, **kwargs):
@@ -2090,7 +2175,7 @@ class GridSizeEventPtr(GridSizeEvent):
         self.__class__ = GridSizeEvent
 _grid.GridSizeEvent_swigregister(GridSizeEventPtr)
 
-class GridRangeSelectEvent(core.NotifyEvent):
+class GridRangeSelectEvent(_core.NotifyEvent):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxGridRangeSelectEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def __init__(self, *args, **kwargs):
@@ -2156,7 +2241,7 @@ class GridRangeSelectEventPtr(GridRangeSelectEvent):
         self.__class__ = GridRangeSelectEvent
 _grid.GridRangeSelectEvent_swigregister(GridRangeSelectEventPtr)
 
-class GridEditorCreatedEvent(core.CommandEvent):
+class GridEditorCreatedEvent(_core.CommandEvent):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxGridEditorCreatedEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def __init__(self, *args, **kwargs):
@@ -2216,6 +2301,7 @@ wxEVT_GRID_SELECT_CELL = _grid.wxEVT_GRID_SELECT_CELL
 wxEVT_GRID_EDITOR_SHOWN = _grid.wxEVT_GRID_EDITOR_SHOWN
 wxEVT_GRID_EDITOR_HIDDEN = _grid.wxEVT_GRID_EDITOR_HIDDEN
 wxEVT_GRID_EDITOR_CREATED = _grid.wxEVT_GRID_EDITOR_CREATED
+wxEVT_GRID_CELL_BEGIN_DRAG = _grid.wxEVT_GRID_CELL_BEGIN_DRAG
 EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK )
 EVT_GRID_CELL_RIGHT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK )
 EVT_GRID_CELL_LEFT_DCLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK )
@@ -2232,5 +2318,27 @@ EVT_GRID_SELECT_CELL = wx.PyEventBinder( wxEVT_GRID_SELECT_CELL )
 EVT_GRID_EDITOR_SHOWN = wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN )
 EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
 EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
+EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG )
+
+
+# The same as above but with the ability to specify an identifier
+EVT_GRID_CMD_CELL_LEFT_CLICK =     wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK,    1 )
+EVT_GRID_CMD_CELL_RIGHT_CLICK =    wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_CLICK,   1 )
+EVT_GRID_CMD_CELL_LEFT_DCLICK =    wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_DCLICK,   1 )
+EVT_GRID_CMD_CELL_RIGHT_DCLICK =   wx.PyEventBinder( wxEVT_GRID_CELL_RIGHT_DCLICK,  1 )
+EVT_GRID_CMD_LABEL_LEFT_CLICK =    wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_CLICK,   1 )
+EVT_GRID_CMD_LABEL_RIGHT_CLICK =   wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_CLICK,  1 )
+EVT_GRID_CMD_LABEL_LEFT_DCLICK =   wx.PyEventBinder( wxEVT_GRID_LABEL_LEFT_DCLICK,  1 )
+EVT_GRID_CMD_LABEL_RIGHT_DCLICK =  wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
+EVT_GRID_CMD_ROW_SIZE =            wx.PyEventBinder( wxEVT_GRID_ROW_SIZE,           1 )
+EVT_GRID_CMD_COL_SIZE =            wx.PyEventBinder( wxEVT_GRID_COL_SIZE,           1 )
+EVT_GRID_CMD_RANGE_SELECT =        wx.PyEventBinder( wxEVT_GRID_RANGE_SELECT,       1 )
+EVT_GRID_CMD_CELL_CHANGE =         wx.PyEventBinder( wxEVT_GRID_CELL_CHANGE,        1 )
+EVT_GRID_CMD_SELECT_CELL =         wx.PyEventBinder( wxEVT_GRID_SELECT_CELL,        1 )
+EVT_GRID_CMD_EDITOR_SHOWN =        wx.PyEventBinder( wxEVT_GRID_EDITOR_SHOWN,       1 )
+EVT_GRID_CMD_EDITOR_HIDDEN =       wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN,      1 )
+EVT_GRID_CMD_EDITOR_CREATED =      wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED,     1 )
+EVT_GRID_CMD_CELL_BEGIN_DRAG =     wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG,    1 )
+