]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/multisash.py
"wxWindows" --> "wxWidgets"
[wxWidgets.git] / wxPython / wx / lib / multisash.py
index 7d364910e751f61a0dcd5c72e943200632df6e10..34ed2599a443fe5197d6ae8ad525f4818bdba322 100644 (file)
@@ -7,12 +7,18 @@
 # Created:      2002/11/20
 # Version:      0.1
 # RCS-ID:       $Id$
-# License:      wxWindows licensie
+# License:      wxWindows license
 #----------------------------------------------------------------------
 # 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
 #
 # o 2.5 compatability update.
 #
+# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o wxMultiSash -> MultiSash
+# o wxMultiSplit -> MultiSplit 
+# o wxMultiViewLeaf -> MultiViewLeaf
+#
 
 import wx
 
@@ -24,11 +30,11 @@ CR_SIZE = SH_SIZE * 3
 
 #----------------------------------------------------------------------
 
-class wxMultiSash(wx.Window):
+class MultiSash(wx.Window):
     def __init__(self, *_args,**_kwargs):
         apply(wx.Window.__init__,(self,) + _args,_kwargs)
         self._defChild = EmptyChild
-        self.child = wxMultiSplit(self,self,(0,0),self.GetSize())
+        self.child = MultiSplit(self,self,(0,0),self.GetSize())
         self.Bind(wx.EVT_SIZE,self.OnMultiSize)
 
     def SetDefaultChildClass(self,childCls):
@@ -43,7 +49,7 @@ class wxMultiSash(wx.Window):
 
     def Clear(self):
         old = self.child
-        self.child = wxMultiSplit(self,self,(0,0),self.GetSize())
+        self.child = MultiSplit(self,self,(0,0),self.GetSize())
         old.Destroy()
         self.child.OnSize(None)
 
@@ -59,7 +65,7 @@ class wxMultiSash(wx.Window):
         exec 'import %s' % mod
         self._defChild = eval(dChild)
         old = self.child
-        self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
+        self.child = MultiSplit(self,self,wxPoint(0,0),self.GetSize())
         self.child.SetSaveData(data['child'])
         old.Destroy()
         self.OnMultiSize(None)
@@ -69,7 +75,7 @@ class wxMultiSash(wx.Window):
 #----------------------------------------------------------------------
 
 
-class wxMultiSplit(wx.Window):
+class MultiSplit(wx.Window):
     def __init__(self,multiView,parent,pos,size,view1 = None):
         wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
                           style = wx.CLIP_CHILDREN)
@@ -80,7 +86,7 @@ class wxMultiSplit(wx.Window):
             self.view1.Reparent(self)
             self.view1.MoveXY(0,0)
         else:
-            self.view1 = wxMultiViewLeaf(self.multiView,self,
+            self.view1 = MultiViewLeaf(self.multiView,self,
                                          (0,0),self.GetSize())
         self.direction = None
 
@@ -90,11 +96,11 @@ class wxMultiSplit(wx.Window):
         saveData = {}
         if self.view1:
             saveData['view1'] = self.view1.GetSaveData()
-            if isinstance(self.view1,wxMultiSplit):
+            if isinstance(self.view1,MultiSplit):
                 saveData['view1IsSplit'] = 1
         if self.view2:
             saveData['view2'] = self.view2.GetSaveData()
-            if isinstance(self.view2,wxMultiSplit):
+            if isinstance(self.view2,MultiSplit):
                 saveData['view2IsSplit'] = 1
         saveData['direction'] = self.direction
         v1,v2 = self.GetPosition()
@@ -107,16 +113,16 @@ class wxMultiSplit(wx.Window):
 
     def SetSaveData(self,data):
         self.direction = data['direction']
-        self.SetDimensions(data['x'],data['y'],data['w'],data['h'])
+        self.SetDimensions(int(data['x']), int(data['y']), int(data['w']), int(data['h']))
         v1Data = data.get('view1',None)
         if v1Data:
             isSplit = data.get('view1IsSplit',None)
             old = self.view1
             if isSplit:
-                self.view1 = wxMultiSplit(self.multiView,self,
+                self.view1 = MultiSplit(self.multiView,self,
                                           (0,0),self.GetSize())
             else:
-                self.view1 = wxMultiViewLeaf(self.multiView,self,
+                self.view1 = MultiViewLeaf(self.multiView,self,
                                              (0,0),self.GetSize())
             self.view1.SetSaveData(v1Data)
             if old:
@@ -126,10 +132,10 @@ class wxMultiSplit(wx.Window):
             isSplit = data.get('view2IsSplit',None)
             old = self.view2
             if isSplit:
-                self.view2 = wxMultiSplit(self.multiView,self,
+                self.view2 = MultiSplit(self.multiView,self,
                                           (0,0),self.GetSize())
             else:
-                self.view2 = wxMultiViewLeaf(self.multiView,self,
+                self.view2 = MultiViewLeaf(self.multiView,self,
                                              (0,0),self.GetSize())
             self.view2.SetSaveData(v2Data)
             if old:
@@ -152,13 +158,13 @@ class wxMultiSplit(wx.Window):
     def AddLeaf(self,direction,caller,pos):
         if self.view2:
             if caller == self.view1:
-                self.view1 = wxMultiSplit(self.multiView,self,
+                self.view1 = MultiSplit(self.multiView,self,
                                           caller.GetPosition(),
                                           caller.GetSize(),
                                           caller)
                 self.view1.AddLeaf(direction,caller,pos)
             else:
-                self.view2 = wxMultiSplit(self.multiView,self,
+                self.view2 = MultiSplit(self.multiView,self,
                                           caller.GetPosition(),
                                           caller.GetSize(),
                                           caller)
@@ -174,7 +180,7 @@ class wxMultiSplit(wx.Window):
                 x,y = (0,pos)
                 w1,h1 = (w,h-pos)
                 w2,h2 = (w,pos)
-            self.view2 = wxMultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
+            self.view2 = MultiViewLeaf(self.multiView, self, (x,y), (w1,h1))
             self.view1.SetSize((w2,h2))
             self.view2.OnSize(None)
 
@@ -272,8 +278,8 @@ class wxMultiSplit(wx.Window):
         else:
             v1h = v2h = h
 
-        self.view1.SetDimensions(v1x,v1y,v1w,v1h)
-        self.view2.SetDimensions(v2x,v2y,v2w,v2h)
+        self.view1.SetDimensions(int(v1x), int(v1y), int(v1w), int(v1h))
+        self.view2.SetDimensions(int(v2x), int(v2y), int(v2w), int(v2h))
         self.view1.OnSize(None)
         self.view2.OnSize(None)
 
@@ -281,7 +287,7 @@ class wxMultiSplit(wx.Window):
 #----------------------------------------------------------------------
 
 
-class wxMultiViewLeaf(wx.Window):
+class MultiViewLeaf(wx.Window):
     def __init__(self,multiView,parent,pos,size):
         wx.Window.__init__(self,id = -1,parent = parent,pos = pos,size = size,
                           style = wx.CLIP_CHILDREN)
@@ -296,6 +302,9 @@ class wxMultiViewLeaf(wx.Window):
 
         self.Bind(wx.EVT_SIZE,self.OnSize)
 
+        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))
+
+
     def GetSaveData(self):
         saveData = {}
         saveData['detailClass'] = str(self.detail.child.__class__)
@@ -444,6 +453,9 @@ class MultiSizer(wx.Window):
         self.Bind(wx.EVT_LEFT_DOWN,self.OnPress)
         self.Bind(wx.EVT_LEFT_UP,self.OnRelease)
 
+        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE))
+
+
     def CalcSizePos(self,parent):
         pw,ph = parent.GetSize()
         if self.side == MV_HOR:
@@ -604,13 +616,13 @@ class MultiCreator(wx.Window):
 
         # Draw outline
         dc.SetPen(highlight)
-        dc.DrawLine((0,0), (0,h))
-        dc.DrawLine((0,0), (w,0))
+        dc.DrawLine(0,0, 0,h)
+        dc.DrawLine(0,0, w,0)
         dc.SetPen(black)
-        dc.DrawLine((0,h), (w+1,h))
-        dc.DrawLine((w,0), (w,h))
+        dc.DrawLine(0,h, w+1,h)
+        dc.DrawLine(w,0, w,h)
         dc.SetPen(shadow)
-        dc.DrawLine((w-1,2), (w-1,h))
+        dc.DrawLine(w-1,2, w-1,h)
 
 #----------------------------------------------------------------------
 
@@ -686,11 +698,11 @@ def DrawSash(win,x,y,direction):
     bmp = wx.EmptyBitmap(8,8)
     bdc = wx.MemoryDC()
     bdc.SelectObject(bmp)
-    bdc.DrawRectangle((-1,-1), (10,10))
+    bdc.DrawRectangle(-1,-1, 10,10)
     for i in range(8):
         for j in range(8):
             if ((i + j) & 1):
-                bdc.DrawPoint((i,j))
+                bdc.DrawPoint(i,j)
 
     brush = wx.Brush(wx.Colour(0,0,0))
     brush.SetStipple(bmp)
@@ -720,8 +732,8 @@ def DrawSash(win,x,y,direction):
     h = body_h
 
     if direction == MV_HOR:
-        dc.DrawRectangle((x,y-2), (w,4))
+        dc.DrawRectangle(x,y-2, w,4)
     else:
-        dc.DrawRectangle((x-2,y), (4,h))
+        dc.DrawRectangle(x-2,y, 4,h)
 
     dc.EndDrawingOnTop()