+#---------------------------------------------------------------------------
+
+class TestListCtrlPanel(wxPanel):
+ def __init__(self, parent, log):
+ wxPanel.__init__(self, parent, -1)
+
+ self.log = log
+ tID = 1101
+
+ self.il = wxImageList(16, 16)
+ idx1 = self.il.Add(wxNoRefBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))
+
+ self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
+ wxLC_REPORT|wxSUNKEN_BORDER)
+ self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
+
+ self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
+ wxToolTip_Enable(true)
+
+ self.list.InsertColumn(0, "Column 0")
+ self.list.InsertColumn(1, "Column 1")
+ self.list.InsertColumn(2, "One More Column (2)")
+ for x in range(50):
+ self.list.InsertImageStringItem(x, "This is item %d" % x, idx1)
+ self.list.SetStringItem(x, 1, "Col 1, item %d" % x)
+ self.list.SetStringItem(x, 2, "item %d in column 2" % x)
+
+ self.list.SetColumnWidth(0, wxLIST_AUTOSIZE)
+ self.list.SetColumnWidth(1, wxLIST_AUTOSIZE)
+ self.list.SetColumnWidth(2, wxLIST_AUTOSIZE)
+
+
+ def OnSize(self, event):
+ w,h = self.GetClientSizeTuple()
+ self.list.SetDimensions(0, 0, w, h)
+
+
+
+
+class TestListCtrl(wxFrame):
+ def __init__(self, parent, log):
+ wxFrame.__init__(self, parent, -1, 'Test ListCtrl',
+ wxDefaultPosition, wxSize(250, 300))
+
+ p = TestListCtrlPanel(self, log)
+
+
+#---------------------------------------------------------------------------
+
+class TestSashWindow(wxMDIParentFrame):
+ NEW_WINDOW = 5000
+ TOGGLE_WINDOW = 5001
+ QUIT = 5002
+ ID_WINDOW_TOP = 5100
+ ID_WINDOW_LEFT1 = 5101
+ ID_WINDOW_LEFT2 = 5102
+ ID_WINDOW_BOTTOM = 5103
+
+
+ def __init__(self, parent, log):
+ wxMDIParentFrame.__init__(self, parent, -1, 'Test Sash Window',
+ wxDefaultPosition, wxSize(250, 300))
+
+ self.log = log
+ menu = wxMenu()
+ menu.Append(self.NEW_WINDOW, "&New Window")
+ menu.Append(self.TOGGLE_WINDOW, "&Toggle window")
+ menu.Append(self.QUIT, "E&xit")
+
+ menubar = wxMenuBar()
+ menubar.Append(menu, "&File")
+
+ self.SetMenuBar(menubar)
+ self.CreateStatusBar()
+
+ EVT_MENU(self, self.NEW_WINDOW, self.OnNewWindow)
+ EVT_MENU(self, self.TOGGLE_WINDOW, self.OnToggleWindow)
+ EVT_MENU(self, self.QUIT, self.OnQuit)
+
+ EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
+ self.ID_WINDOW_BOTTOM, self.OnSashDrag)
+
+
+ # Create some layout windows
+ # A window like a toolbar
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_TOP, wxDefaultPosition,
+ wxSize(200, 30), wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize(wxSize(1000, 30))
+ win.SetOrientation(wxLAYOUT_HORIZONTAL)
+ win.SetAlignment(wxLAYOUT_TOP)
+ win.SetBackgroundColour(wxColour(255, 0, 0))
+ win.SetSashVisible(wxSASH_BOTTOM, true)
+
+ self.topWindow = win
+
+
+ # A window like a statusbar
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_BOTTOM,
+ wxDefaultPosition, wxSize(200, 30),
+ wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize(wxSize(1000, 30))
+ win.SetOrientation(wxLAYOUT_HORIZONTAL)
+ win.SetAlignment(wxLAYOUT_BOTTOM)
+ win.SetBackgroundColour(wxColour(0, 0, 255))
+ win.SetSashVisible(wxSASH_TOP, true)
+
+ self.bottomWindow = win
+
+
+ # A window to the left of the client window
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT1,
+ wxDefaultPosition, wxSize(200, 30),
+ wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize(wxSize(120, 1000))
+ win.SetOrientation(wxLAYOUT_VERTICAL)
+ win.SetAlignment(wxLAYOUT_LEFT)
+ win.SetBackgroundColour(wxColour(0, 255, 0))
+ win.SetSashVisible(wxSASH_RIGHT, TRUE)
+ win.SetExtraBorderSize(10)
+
+ textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE|wxSUNKEN_BORDER)
+ textWindow.SetValue("A help window")
+
+ self.leftWindow1 = win
+
+
+ # Another window to the left of the client window
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT2,
+ wxDefaultPosition, wxSize(200, 30),
+ wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize(wxSize(120, 1000))
+ win.SetOrientation(wxLAYOUT_VERTICAL)
+ win.SetAlignment(wxLAYOUT_LEFT)
+ win.SetBackgroundColour(wxColour(0, 255, 255))
+ win.SetSashVisible(wxSASH_RIGHT, TRUE)
+
+ self.leftWindow2 = win
+
+
+ def OnNewWindow(self, event):
+ pass
+
+ def OnToggleWindow(self, event):
+ pass
+
+ def OnQuit(self, event):
+ self.Close(true)
+
+ def OnSashDrag(self, event):
+ if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
+ return
+
+ eID = event.GetId()
+ if eID == self.ID_WINDOW_TOP:
+ self.topWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
+
+ elif eID == self.ID_WINDOW_LEFT1:
+ self.leftWindow1.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
+
+
+ elif eID == self.ID_WINDOW_LEFT2:
+ self.leftWindow2.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
+
+ elif eID == self.ID_WINDOW_BOTTOM:
+ self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
+
+ wxLayoutAlgorithm().LayoutMDIFrame(self)
+
+ # Leaves bits of itself behind sometimes
+ self.GetClientWindow().Refresh()
+
+
+ def OnSize(self, event):
+ wxLayoutAlgorithm().LayoutMDIFrame(self)
+