]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxListbook.py
reSWIGged
[wxWidgets.git] / wxPython / demo / wxListbook.py
index c8b7958a820dbe705b2384570c7bd500b6a21c0b..2186205cb3e7aae2e88fbbf3560c5ce20a54b940 100644 (file)
@@ -1,20 +1,43 @@
+# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o Updated for wx namespace
+# 
+# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o Bunches of imports that might need to go away for the final roll-out.
+# 
 
-from   wxPython.wx import *
+import  sys
+
+import  wx
 
-import ColorPanel
-import GridSimple
-import wxListCtrl
-import wxScrolledWindow
 import images
 
-import sys
+import ColorPanel
+
+colourList = [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
+               "Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
+               "Dark Olive Green", "Dark Orchid", "Dark Slate Blue",
+               "Dark Slate Grey", "Dark Turquoise", "Dim Grey", "Firebrick",
+               "Forest Green", "Gold", "Goldenrod", "Grey", "Green", "Green Yellow",
+               "Indian Red", "Khaki", "Light Blue", "Light Grey", "Light Steel Blue",
+               "Lime Green", "Magenta", "Maroon", "Medium Aquamarine", "Medium Blue",
+               "Medium Forest Green", "Medium Goldenrod", "Medium Orchid",
+               "Medium Sea Green", "Medium Slate Blue", "Medium Spring Green",
+               "Medium Turquoise", "Medium Violet Red", "Midnight Blue", "Navy",
+               "Orange", "Orange Red", "Orchid", "Pale Green", "Pink", "Plum",
+               "Purple", "Red", "Salmon", "Sea Green", "Sienna", "Sky Blue",
+               "Slate Blue", "Spring Green", "Steel Blue", "Tan", "Thistle",
+               "Turquoise", "Violet", "Violet Red", "Wheat", "White", "Yellow",
+               "Yellow Green"
+               ]
 
 #----------------------------------------------------------------------------
 
-class TestLB(wxListbook):
+class TestLB(wx.Listbook):
     def __init__(self, parent, id, log):
-        wxListbook.__init__(self, parent, id, style=
-                            wxLB_DEFAULT
+        wx.Listbook.__init__(self, parent, id, style=
+                            wx.LB_DEFAULT
                             #wxLB_TOP
                             #wxLB_BOTTOM
                             #wxLB_LEFT
@@ -22,67 +45,45 @@ class TestLB(wxListbook):
                             )
         self.log = log
 
-        win = self.makeColorPanel(wxBLUE)
-        self.AddPage(win, "Blue")
-        st = wxStaticText(win.win, -1,
-                          "You can put nearly any type of window here,\n"
-                          "and if the platform supports it then the\n"
-                          "tabs can be on any side of the notebook.",
-                          wxPoint(10, 10))
-        st.SetForegroundColour(wxWHITE)
-        st.SetBackgroundColour(wxBLUE)
-
-        # Show how to put an image on one of the notebook tabs,
-        # first make the image list:
-        il = wxImageList(16, 16)
-        idx1 = il.Add(images.getSmilesBitmap())
-        self.AssignImageList(il)
-
-        # now put an image on the first tab we just created:
-        self.SetPageImage(0, idx1)
-
-
-        win = self.makeColorPanel(wxRED)
-        self.AddPage(win, "Red")
-
-        win = wxScrolledWindow.MyCanvas(self)
-        self.AddPage(win, 'ScrolledWindow')
-
-        win = self.makeColorPanel(wxGREEN)
-        self.AddPage(win, "Green")
-
-        win = GridSimple.SimpleGrid(self, log)
-        self.AddPage(win, "Grid")
 
-        win = wxListCtrl.TestListCtrlPanel(self, log)
-        self.AddPage(win, 'List')
-
-        win = self.makeColorPanel(wxCYAN)
-        self.AddPage(win, "Cyan")
-
-##         win = self.makeColorPanel(wxWHITE)
-##         self.AddPage(win, "White")
-
-##         win = self.makeColorPanel(wxBLACK)
-##         self.AddPage(win, "Black")
-
-        win = self.makeColorPanel(wxNamedColour('MIDNIGHT BLUE'))
-        self.AddPage(win, "MIDNIGHT BLUE")
+        # make an image list using the BlomXX images
+        il = wx.ImageList(32, 32)
+        for x in range(1, 15):
+            f = getattr(images, 'getBlom%02dBitmap' % x)
+            bmp = f()
+            il.Add(bmp)
+        self.AssignImageList(il)
 
-        win = self.makeColorPanel(wxNamedColour('INDIAN RED'))
-        self.AddPage(win, "INDIAN RED")
+        # Now make a bunch of panels for the list book
+        first = True
+        imID = 0
+        for colour in colourList:
+            win = self.makeColorPanel(colour)
+            self.AddPage(win, colour, imageId=imID)
+            imID += 1
+            if imID == il.GetImageCount(): imID = 0
+            if first:
+                st = wx.StaticText(win.win, -1,
+                          "You can put nearly any type of window here,\n"
+                          "and the list can be on any side of the Listbook",
+                          wx.Point(10, 10))
+                #st.SetForegroundColour(wxWHITE)
+                #st.SetBackgroundColour(wxBLUE)
+                first = False
+            
+                
 
-        EVT_LISTBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
-        EVT_LISTBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
+        wx.EVT_LISTBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
+        wx.EVT_LISTBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
 
 
     def makeColorPanel(self, color):
-        p = wxPanel(self, -1)
+        p = wx.Panel(self, -1)
         win = ColorPanel.ColoredPanel(p, color)
         p.win = win
         def OnCPSize(evt, win=win):
             win.SetSize(evt.GetSize())
-        EVT_SIZE(p, OnCPSize)
+        p.Bind(wx.EVT_SIZE, OnCPSize)
         return p
 
 
@@ -109,8 +110,6 @@ def runTest(frame, nb, log):
 #----------------------------------------------------------------------------
 
 
-
-
 overview = """\
 <html><body>
 <h2>wxListbook</h2>
@@ -128,6 +127,3 @@ if __name__ == '__main__':
     run.main(['', os.path.basename(sys.argv[0])])
 
 
-
-
-