]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/foldmenu.py
fixed indentation error
[wxWidgets.git] / wxPython / wx / lib / foldmenu.py
index 72e38192217f086bb12c1c9d6ddc2e9b220a6e73..1c1bc1f88a0f23255f6499ef18f74e29a82a696c 100644 (file)
@@ -1,3 +1,7 @@
+# 12/07/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o 2.5 Compatability changes
+#
 
 import wx
 from wx.lib.evtmgr import eventManager
@@ -11,22 +15,24 @@ class FoldOutWindow(wx.PopupWindow):
         self.handlers={}
         self.InitColors()
         self.inWindow=False
-        wx.EVT_ENTER_WINDOW(self,self.evEnter)
-        wx.EVT_LEAVE_WINDOW(self,self.evLeave)
+        self.Bind(wx.EVT_ENTER_WINDOW, self.evEnter)
+        self.Bind(wx.EVT_LEAVE_WINDOW, self.evLeave)
         
     def InitColors(self):
-        faceClr      = wx.SystemSettings_GetSystemColour(wx.SYS_COLOUR_WINDOW)
+        faceClr = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
         self.SetBackgroundColour(faceClr)
 
     def AddButton(self,bitmap,handler=None):
         id=wx.NewId()
         btn=wx.BitmapButton(self,id,bitmap)
         self.sizer.Add(btn, 1, wx.ALIGN_CENTER|wx.ALL|wx.EXPAND, 2)
-        wx.EVT_BUTTON(self,id,self.OnBtnClick)
+        self.Bind(wx.EVT_BUTTON, self.OnBtnClick, btn)
         self.sizer.Fit(self)
         self.Layout()
+
         if handler:
             self.handlers[id]=handler
+
         return id
 
     def Popup(self):
@@ -35,8 +41,10 @@ class FoldOutWindow(wx.PopupWindow):
 
     def OnBtnClick(self,event):
         id=event.GetEventObject().GetId()
+
         if self.handlers.has_key(id):
             self.handlers[id](event)
+
         self.Hide()
         self.inWindow=False
         event.Skip()
@@ -50,6 +58,7 @@ class FoldOutWindow(wx.PopupWindow):
         if self.inWindow:
             if not self.rect.Inside(self.ClientToScreen(event.GetPosition())):
                 self.Hide()
+
         event.Skip()
 
 
@@ -60,10 +69,12 @@ class FoldOutMenu(wx.BitmapButton):
     def __init__(self,parent,id,bitmap,pos = wx.DefaultPosition,
                  size = wx.DefaultSize, style = wx.BU_AUTODRAW,
                  validator = wx.DefaultValidator, name = "button"):
+
         wx.BitmapButton.__init__(self, parent, id, bitmap, pos, size, style,
                                  validator, name)
+
         self.parent=parent
-        wx.EVT_BUTTON(self.parent, self.GetId(), self.click)
+        self.parent.Bind(wx.EVT_BUTTON, self.click, self)
         self.popwin=FoldOutWindow(self.parent)
 
     def AddButton(self,bitmap,handler=None):