]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/controls.py
Add some ownerdraw methods to ListBox for MSW
[wxWidgets.git] / wxPython / src / msw / controls.py
index 8aff9df6a6c231bfc5ef64b64c07b36dc837825b..ce2e790841507bd2c3c9cff9e60d8c325406366a 100644 (file)
@@ -62,7 +62,7 @@ class Button(core.Control):
         return _controls.Button_SetImageMargins(*args, **kwargs)
 
     def GetDefaultSize(*args, **kwargs):
-        """Button.GetDefaultSize() -> Size"""
+        """GetDefaultSize() -> Size"""
         return _controls.Button_GetDefaultSize(*args, **kwargs)
 
     GetDefaultSize = staticmethod(GetDefaultSize)
@@ -297,7 +297,7 @@ class Choice(core.ControlWithItems):
     def __init__(self, *args, **kwargs):
         """
         __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ChoiceNameStr) -> Choice
         """
@@ -310,7 +310,7 @@ class Choice(core.ControlWithItems):
     def Create(*args, **kwargs):
         """
         Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ChoiceNameStr) -> bool
         """
@@ -360,7 +360,7 @@ class ComboBox(Choice):
         """
         __init__(Window parent, int id, String value=EmptyString, Point pos=DefaultPosition, 
             Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ComboBoxNameStr) -> ComboBox
         """
@@ -374,7 +374,7 @@ class ComboBox(Choice):
         """
         Create(Window parent, int id, String value=EmptyString, Point pos=DefaultPosition, 
             Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ComboBoxNameStr) -> bool
         """
@@ -605,7 +605,7 @@ class StaticLine(core.Control):
         return _controls.StaticLine_IsVertical(*args, **kwargs)
 
     def GetDefaultSize(*args, **kwargs):
-        """StaticLine.GetDefaultSize() -> int"""
+        """GetDefaultSize() -> int"""
         return _controls.StaticLine_GetDefaultSize(*args, **kwargs)
 
     GetDefaultSize = staticmethod(GetDefaultSize)
@@ -723,7 +723,7 @@ class ListBox(core.ControlWithItems):
     def __init__(self, *args, **kwargs):
         """
         __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ListBoxNameStr) -> ListBox
         """
@@ -736,7 +736,7 @@ class ListBox(core.ControlWithItems):
     def Create(*args, **kwargs):
         """
         Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ListBoxNameStr) -> bool
         """
@@ -825,7 +825,7 @@ class CheckListBox(ListBox):
     def __init__(self, *args, **kwargs):
         """
         __init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ListBoxNameStr) -> CheckListBox
         """
@@ -833,10 +833,12 @@ class CheckListBox(ListBox):
         self.this = newobj.this
         self.thisown = 1
         del newobj.thisown
+        self._setOORInfo(self)
+
     def Create(*args, **kwargs):
         """
         Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize, 
-            int choices=0, String choices_array=None
+            wxArrayString choices=wxPyEmptyStringArray
             long style=0, Validator validator=DefaultValidator, 
             String name=ListBoxNameStr) -> bool
         """
@@ -914,6 +916,11 @@ TEXT_ATTR_ALIGNMENT = _controls.TEXT_ATTR_ALIGNMENT
 TEXT_ATTR_LEFT_INDENT = _controls.TEXT_ATTR_LEFT_INDENT
 TEXT_ATTR_RIGHT_INDENT = _controls.TEXT_ATTR_RIGHT_INDENT
 TEXT_ATTR_TABS = _controls.TEXT_ATTR_TABS
+TE_HT_UNKNOWN = _controls.TE_HT_UNKNOWN
+TE_HT_BEFORE = _controls.TE_HT_BEFORE
+TE_HT_ON_TEXT = _controls.TE_HT_ON_TEXT
+TE_HT_BELOW = _controls.TE_HT_BELOW
+TE_HT_BEYOND = _controls.TE_HT_BEYOND
 class TextAttr(object):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxTextAttr instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
@@ -927,6 +934,12 @@ class TextAttr(object):
         self.this = newobj.this
         self.thisown = 1
         del newobj.thisown
+    def __del__(self, destroy=_controls.delete_TextAttr):
+        """__del__()"""
+        try:
+            if self.thisown: destroy(self)
+        except: pass
+
     def Init(*args, **kwargs):
         """Init()"""
         return _controls.TextAttr_Init(*args, **kwargs)
@@ -1032,7 +1045,7 @@ class TextAttr(object):
         return _controls.TextAttr_IsDefault(*args, **kwargs)
 
     def Combine(*args, **kwargs):
-        """TextAttr.Combine(TextAttr attr, TextAttr attrDef, TextCtrl text) -> TextAttr"""
+        """Combine(TextAttr attr, TextAttr attrDef, TextCtrl text) -> TextAttr"""
         return _controls.TextAttr_Combine(*args, **kwargs)
 
     Combine = staticmethod(Combine)
@@ -1198,6 +1211,16 @@ class TextCtrl(core.Control):
         """ShowPosition(long pos)"""
         return _controls.TextCtrl_ShowPosition(*args, **kwargs)
 
+    def HitTest(*args, **kwargs):
+        """
+        HitTest(Point pt) -> (result, row, col)
+
+        Find the character at position given in pixels.
+        NB: pt is in device coords (not adjusted for the client area
+        origin nor scrolling)
+        """
+        return _controls.TextCtrl_HitTest(*args, **kwargs)
+
     def Copy(*args, **kwargs):
         """Copy()"""
         return _controls.TextCtrl_Copy(*args, **kwargs)
@@ -1550,8 +1573,36 @@ def PreSpinCtrl(*args, **kwargs):
     val.thisown = 1
     return val
 
+class SpinEvent(core.NotifyEvent):
+    def __repr__(self):
+        return "<%s.%s; proxy of C++ wxSpinEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
+    def __init__(self, *args, **kwargs):
+        """__init__(wxEventType commandType=wxEVT_NULL, int winid=0) -> SpinEvent"""
+        newobj = _controls.new_SpinEvent(*args, **kwargs)
+        self.this = newobj.this
+        self.thisown = 1
+        del newobj.thisown
+    def GetPosition(*args, **kwargs):
+        """GetPosition() -> int"""
+        return _controls.SpinEvent_GetPosition(*args, **kwargs)
+
+    def SetPosition(*args, **kwargs):
+        """SetPosition(int pos)"""
+        return _controls.SpinEvent_SetPosition(*args, **kwargs)
+
+
+class SpinEventPtr(SpinEvent):
+    def __init__(self, this):
+        self.this = this
+        if not hasattr(self,"thisown"): self.thisown = 0
+        self.__class__ = SpinEvent
+_controls.SpinEvent_swigregister(SpinEventPtr)
+
 wxEVT_COMMAND_SPINCTRL_UPDATED = _controls.wxEVT_COMMAND_SPINCTRL_UPDATED
-EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
+EVT_SPIN_UP   = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEUP, 1)
+EVT_SPIN_DOWN = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEDOWN, 1)
+EVT_SPIN      = wx.PyEventBinder( wx.wxEVT_SCROLL_THUMBTRACK, 1)
+EVT_SPINCTRL  = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
 
 #---------------------------------------------------------------------------
 
@@ -1560,12 +1611,13 @@ class RadioBox(core.Control):
         return "<%s.%s; proxy of C++ wxRadioBox instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def __init__(self, *args, **kwargs):
         """
-        __init__(Window parent, int id, String label, Point point=DefaultPosition, 
-            Size size=DefaultSize, int choices=0
-            String choices_array=None, int majorDimension=0, 
+        __init__(Window parent, int id, String label, Point pos=DefaultPosition, 
+            Size size=DefaultSize, wxArrayString choices=wxPyEmptyStringArray
+            int majorDimension=0, 
             long style=RA_HORIZONTAL, Validator validator=DefaultValidator, 
             String name=RadioBoxNameStr) -> RadioBox
         """
+        if kwargs.has_key('point'): kwargs['pos'] = kwargs['point']
         newobj = _controls.new_RadioBox(*args, **kwargs)
         self.this = newobj.this
         self.thisown = 1
@@ -1574,9 +1626,9 @@ class RadioBox(core.Control):
 
     def Create(*args, **kwargs):
         """
-        Create(Window parent, int id, String label, Point point=DefaultPosition, 
-            Size size=DefaultSize, int choices=0
-            String choices_array=None, int majorDimension=0, 
+        Create(Window parent, int id, String label, Point pos=DefaultPosition, 
+            Size size=DefaultSize, wxArrayString choices=wxPyEmptyStringArray
+            int majorDimension=0, 
             long style=RA_HORIZONTAL, Validator validator=DefaultValidator, 
             String name=RadioBoxNameStr) -> bool
         """
@@ -1707,10 +1759,11 @@ class Slider(core.Control):
     def __init__(self, *args, **kwargs):
         """
         __init__(Window parent, int id, int value, int minValue, int maxValue, 
-            Point point=DefaultPosition, Size size=DefaultSize, 
+            Point pos=DefaultPosition, Size size=DefaultSize, 
             long style=SL_HORIZONTAL, Validator validator=DefaultValidator, 
             String name=SliderNameStr) -> Slider
         """
+        if kwargs.has_key('point'): kwargs['pos'] = kwargs['point']
         newobj = _controls.new_Slider(*args, **kwargs)
         self.this = newobj.this
         self.thisown = 1
@@ -1720,7 +1773,7 @@ class Slider(core.Control):
     def Create(*args, **kwargs):
         """
         Create(Window parent, int id, int value, int minValue, int maxValue, 
-            Point point=DefaultPosition, Size size=DefaultSize, 
+            Point pos=DefaultPosition, Size size=DefaultSize, 
             long style=SL_HORIZONTAL, Validator validator=DefaultValidator, 
             String name=SliderNameStr) -> bool
         """
@@ -1779,7 +1832,7 @@ class Slider(core.Control):
         return _controls.Slider_GetThumbLength(*args, **kwargs)
 
     def SetTickFreq(*args, **kwargs):
-        """SetTickFreq(int n, int pos)"""
+        """SetTickFreq(int n, int pos=1)"""
         return _controls.Slider_SetTickFreq(*args, **kwargs)
 
     def GetTickFreq(*args, **kwargs):
@@ -1912,9 +1965,7 @@ class BookCtrl(core.Control):
 
     def AssignImageList(*args, **kwargs):
         """AssignImageList(ImageList imageList)"""
-        val = _controls.BookCtrl_AssignImageList(*args, **kwargs)
-        args[1].thisown = 0
-        return val
+        return _controls.BookCtrl_AssignImageList(*args, **kwargs)
 
     def GetImageList(*args, **kwargs):
         """GetImageList() -> ImageList"""
@@ -2061,7 +2112,7 @@ class Notebook(BookCtrl):
         """
         HitTest(Point pt) -> (tab, where)
 
-        Returns the tab which is hit, and flags indicating where using wxNB_HITTEST_ flags.
+        Returns the tab which is hit, and flags indicating where using wx.NB_HITTEST_ flags.
         """
         return _controls.Notebook_HitTest(*args, **kwargs)
 
@@ -3373,9 +3424,7 @@ class ListCtrl(core.Control):
 
     def AssignImageList(*args, **kwargs):
         """AssignImageList(ImageList imageList, int which)"""
-        val = _controls.ListCtrl_AssignImageList(*args, **kwargs)
-        args[1].thisown = 0
-        return val
+        return _controls.ListCtrl_AssignImageList(*args, **kwargs)
 
     def IsVirtual(*args, **kwargs):
         """IsVirtual() -> bool"""
@@ -3949,15 +3998,11 @@ class TreeCtrl(core.Control):
 
     def AssignImageList(*args, **kwargs):
         """AssignImageList(ImageList imageList)"""
-        val = _controls.TreeCtrl_AssignImageList(*args, **kwargs)
-        args[1].thisown = 0
-        return val
+        return _controls.TreeCtrl_AssignImageList(*args, **kwargs)
 
     def AssignStateImageList(*args, **kwargs):
         """AssignStateImageList(ImageList imageList)"""
-        val = _controls.TreeCtrl_AssignStateImageList(*args, **kwargs)
-        args[1].thisown = 0
-        return val
+        return _controls.TreeCtrl_AssignStateImageList(*args, **kwargs)
 
     def GetItemText(*args, **kwargs):
         """GetItemText(TreeItemId item) -> String"""
@@ -4074,7 +4119,7 @@ class TreeCtrl(core.Control):
         return _controls.TreeCtrl_GetFirstChild(*args, **kwargs)
 
     def GetNextChild(*args, **kwargs):
-        """GetNextChild(TreeItemId item, wxTreeItemIdValue cookie) -> PyObject"""
+        """GetNextChild(TreeItemId item, void cookie) -> PyObject"""
         return _controls.TreeCtrl_GetNextChild(*args, **kwargs)
 
     def GetLastChild(*args, **kwargs):
@@ -4165,14 +4210,22 @@ class TreeCtrl(core.Control):
         """Unselect()"""
         return _controls.TreeCtrl_Unselect(*args, **kwargs)
 
+    def UnselectItem(*args, **kwargs):
+        """UnselectItem(TreeItemId item)"""
+        return _controls.TreeCtrl_UnselectItem(*args, **kwargs)
+
     def UnselectAll(*args, **kwargs):
         """UnselectAll()"""
         return _controls.TreeCtrl_UnselectAll(*args, **kwargs)
 
     def SelectItem(*args, **kwargs):
-        """SelectItem(TreeItemId item)"""
+        """SelectItem(TreeItemId item, bool select=True)"""
         return _controls.TreeCtrl_SelectItem(*args, **kwargs)
 
+    def ToggleItemSelection(*args, **kwargs):
+        """ToggleItemSelection(TreeItemId item)"""
+        return _controls.TreeCtrl_ToggleItemSelection(*args, **kwargs)
+
     def EnsureVisible(*args, **kwargs):
         """EnsureVisible(TreeItemId item)"""
         return _controls.TreeCtrl_EnsureVisible(*args, **kwargs)
@@ -4605,12 +4658,12 @@ class HelpProvider(object):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxHelpProvider instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
     def Set(*args, **kwargs):
-        """HelpProvider.Set(HelpProvider helpProvider) -> HelpProvider"""
+        """Set(HelpProvider helpProvider) -> HelpProvider"""
         return _controls.HelpProvider_Set(*args, **kwargs)
 
     Set = staticmethod(Set)
     def Get(*args, **kwargs):
-        """HelpProvider.Get() -> HelpProvider"""
+        """Get() -> HelpProvider"""
         return _controls.HelpProvider_Get(*args, **kwargs)
 
     Get = staticmethod(Get)