X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0812732316f715a480526cedcd481e7fc31a130c..2356708db31b737c6eae53c2316b642aa5a2e68d:/utils/wxPython/tests/test4.py diff --git a/utils/wxPython/tests/test4.py b/utils/wxPython/tests/test4.py index b4b1238b86..89b94ebe2e 100644 --- a/utils/wxPython/tests/test4.py +++ b/utils/wxPython/tests/test4.py @@ -22,11 +22,11 @@ class TestSimpleControlsDlg(wxDialog): def __init__(self, parent, log): self.log = log wxDialog.__init__(self, parent, -1, "Test Simple Controls", - wxDefaultPosition, wxSize(350, 350)) + wxDefaultPosition, wxSize(350, 400)) - sampleList = ['zero', 'one', 'two', 'three', 'four', 'five', - 'six', 'seven', 'eight'] + sampleList = ["zero", "one", "two", "three", "four", "five", + "six", "seven", "eight", "nine", "ten"] y_pos = 5 delta = 25 @@ -41,7 +41,7 @@ class TestSimpleControlsDlg(wxDialog): y_pos = y_pos + delta rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(80, y_pos), wxDefaultSize, - sampleList, 3, wxRA_HORIZONTAL| wxNO_BORDER) + sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER) EVT_RADIOBOX(self, 30, self.EvtRadioBox) width, height = rb.GetSizeTuple() y_pos = y_pos + height + 5 @@ -250,10 +250,9 @@ class ColoredPanel(wxWindow): class TestNotebookWindow(wxFrame): def __init__(self, parent, log): - wxFrame.__init__(self, parent, -1, 'Test wxNotebook', - wxDefaultPosition, wxDefaultSize) + wxFrame.__init__(self, parent, -1, 'Test wxNotebook') - nb = wxNotebook(self, -1) + nb = wxNotebook(self, -1, wxPoint(0,0), self.GetClientSize()) win = ColoredPanel(nb, wxBLUE) nb.AddPage(win, "Blue") @@ -271,6 +270,9 @@ class TestNotebookWindow(wxFrame): win = TestTreeCtrlPanel(nb, log) nb.AddPage(win, "TreeCtrl") + win = TestListCtrlPanel(nb, log) + nb.AddPage(win, "ListCtrl") + win = ColoredPanel(nb, wxRED) nb.AddPage(win, "Red") @@ -292,9 +294,8 @@ class TestNotebookWindow(wxFrame): win = ColoredPanel(nb, wxNamedColour('INDIAN RED')) nb.AddPage(win, "INDIAN RED") - nb.SetSelection(0) - self.SetSize(wxSize(350, 300)) # force a redraw so the notebook will draw + self.SetSize(wxSize(350, 300)) def OnCloseWindow(self, event): @@ -338,7 +339,7 @@ class CustomStatusBar(wxStatusBar): # figure out how tall to make it. dc = wxClientDC(self) dc.SetFont(self.GetFont()) - (w,h, d,e) = dc.GetTextExtent('X') + (w,h) = dc.GetTextExtent('X') h = int(h * 1.8) self.SetSize(wxSize(100, h)) @@ -499,6 +500,53 @@ class TestTreeCtrl(wxFrame): p = TestTreeCtrlPanel(self, log) +#--------------------------------------------------------------------------- + +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): @@ -740,6 +788,10 @@ class AppFrame(wxFrame): menu.Append(mID, 'T&ree Control') EVT_MENU(self, mID, self.OnTestTreeCtrl) + mID = NewId() + menu.Append(mID, '&List Control') + EVT_MENU(self, mID, self.OnTestListCtrl) + mID = NewId() menu.Append(mID, 'S&ash Window and Layout Algorithm') EVT_MENU(self, mID, self.OnTestSashWindow) @@ -842,7 +894,7 @@ class AppFrame(wxFrame): def OnTestPageSetupDlg(self, event): - data = wxPageSetupData() + data = wxPageSetupDialogData() data.SetMarginTopLeft(wxPoint(50,50)) data.SetMarginBottomRight(wxPoint(50,50)) dlg = wxPageSetupDialog(self, data) @@ -854,7 +906,7 @@ class AppFrame(wxFrame): dlg.Destroy() def OnTestPrintDlg(self, event): - data = wxPrintData() + data = wxPrintDialogData() data.EnablePrintToFile(true) data.EnablePageNumbers(true) data.EnableSelection(true) @@ -890,6 +942,10 @@ class AppFrame(wxFrame): win = TestTreeCtrl(self, self) win.Show(true) + def OnTestListCtrl(self, event): + win = TestListCtrl(self, self) + win.Show(true) + def OnTestSashWindow(self, event): win = TestSashWindow(self, self) win.Show(true) @@ -942,7 +998,36 @@ if __name__ == '__main__': #---------------------------------------------------------------------------- # # $Log$ +# Revision 1.16 1999/04/30 03:29:54 RD +# wxPython 2.0b9, first phase (win32) +# Added gobs of stuff, see wxPython/README.txt for details +# +# Revision 1.15.2.1 1999/03/16 06:05:50 RD +# +# wxPython 2.0b7 +# +# Revision 1.15 1999/03/05 07:23:42 RD +# +# Minor wxPython changes for wxWin 2.0 +# +# Revision 1.14 1999/02/27 04:20:50 RD +# +# minor tweaks for testing +# +# Revision 1.13 1999/02/20 09:04:44 RD +# Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a +# window handle. If you can get the window handle into the python code, +# it should just work... More news on this later. +# +# Added wxImageList, wxToolTip. +# +# Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the +# wxRegConfig class. +# +# As usual, some bug fixes, tweaks, etc. +# # Revision 1.12 1999/01/30 07:31:33 RD +# # Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. # # Various cleanup, tweaks, minor additions, etc. to maintain