home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.6)
-
- import wx
- import config
- from common import setpref, pref
- wxMSW = 'wxMSW' in wx.PlatformInfo
- from FormattedExpandoTextCtrl import EVT_ETC_LAYOUT_NEEDED
- EVT_SIZE = None if config.platform == 'win' else wx.wxEVT_SIZE
-
- class SplitterEventMixin(object):
-
- def OnExpandEventSplitter(self, event):
- if self.resizing:
- return None
- self.OnExpandEvent(event)
- if hasattr(self, 'splitter'):
- best_size = self.BestSizeControl.BestSize.height
- splitterpos = self.splitter.ClientSize.height - best_size - self.splitter.SashSize
- self.splitter.SetSashPosition(splitterpos)
- self.Layout()
-
-
-
- def BestSizeControl(self):
- if 'wxMac' in wx.PlatformInfo:
- return self.tc
- return self
-
- BestSizeControl = property(BestSizeControl)
-
- def BindSplitter(self, splitter, heightpref = None):
- splitter.Bind(wx.EVT_LEFT_DOWN, self.OnSplitterStart)
- splitter.Bind(wx.EVT_LEFT_UP, self.OnSplitterSet)
- self.splitter = splitter
- self.heightpref = heightpref
- self.resizing = False
- self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnExpandEventSplitter)
- if 'wxMac' in wx.PlatformInfo:
- self.tc.Bind(wx.EVT_TEXT, self.OnExpandEventSplitter)
-
- tc = self.tc
- tc.SetMinHeight(pref(self.heightpref, 0))
- tc.ForceExpandEvent()
- self.Top.Bind(wx.EVT_SHOW, self.OnTopShow)
- self.Top.Bind(wx.EVT_SET_FOCUS, self.OnTopShow)
- self.splitter.GrandParent.Bind(wx.EVT_SHOW, self.OnTopShow)
- if hasattr(self.Top, 'iconizecallbacks'):
- self.Top.iconizecallbacks.add(self.OnRestore)
- else:
- self.Top.Bind(wx.EVT_ICONIZE, self.OnRestore)
-
-
- def OnSplitterStart(self, event):
- self.resizing = True
- tc = self.tc
- baseh = tc.GetNatHeight()
- tc.SetMinHeight(baseh)
- self.BestSizeControl.MinSize = self.BestSizeControl.BestSize
- event.Skip()
-
-
- def OnSplitterSet(self, event):
- self.resizing = False
- event.Skip()
- tc = self.tc
- natHeight = tc.GetNatHeight()
- setHeight = tc.GetSize().height
- h = None if setHeight <= natHeight else setHeight
- if hasattr(self, 'heightpref') and self.heightpref is not None:
- setpref(self.heightpref, h)
-
- tc.SetMinHeight(h)
-
-
- def OnTopShow(self, event):
- event.Skip()
- if not hasattr(event, 'GetShow') or event.GetShow():
- self.tc.ForceExpandEvent()
-
-
-
- def OnRestore(self, event = None):
- if event is not None:
- event.Skip()
-
- if event is None or not event.Iconized():
- wx.CallAfter(self.tc.ForceExpandEvent)
-
-
-
-