]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/demo/wxListCtrl.py
wxPython 2.0b9, first phase (win32)
[wxWidgets.git] / utils / wxPython / demo / wxListCtrl.py
CommitLineData
cf694132
RD
1#!/bin/env python
2#----------------------------------------------------------------------------
3# Name: ListCtrl.py
4# Purpose: Testing lots of stuff, controls, window types, etc.
5#
6# Author: Robin Dunn & Gary Dumer
7#
8# Created:
9# RCS-ID: $Id$
10# Copyright: (c) 1998 by Total Control Software
11# Licence: wxWindows license
12#----------------------------------------------------------------------------
13
14from wxPython.wx import *
15
16#---------------------------------------------------------------------------
17
18class TestListCtrlPanel(wxPanel):
19 def __init__(self, parent, log):
20 wxPanel.__init__(self, parent, -1)
21
22 self.log = log
23 tID = NewId()
24
25 self.il = wxImageList(16, 16)
26 idx1 = self.il.Add(wxNoRefBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))
27
28 self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
29 wxLC_REPORT|wxSUNKEN_BORDER)
30 self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
31
32 self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
33 wxToolTip_Enable(true)
34
35 self.list.InsertColumn(0, "Column 0")
36 self.list.InsertColumn(1, "Column 1")
37 self.list.InsertColumn(2, "One More Column (2)")
38 for x in range(50):
39 self.list.InsertImageStringItem(x, "This is item %d" % x, idx1)
40 self.list.SetStringItem(x, 1, "Col 1, item %d" % x)
41 self.list.SetStringItem(x, 2, "item %d in column 2" % x)
42
43 self.list.SetColumnWidth(0, wxLIST_AUTOSIZE)
44 self.list.SetColumnWidth(1, wxLIST_AUTOSIZE)
45 self.list.SetColumnWidth(2, wxLIST_AUTOSIZE)
46
47
48 def OnSize(self, event):
49 w,h = self.GetClientSizeTuple()
50 self.list.SetDimensions(0, 0, w, h)
51
52
53
54
55#---------------------------------------------------------------------------
56
57def runTest(frame, nb, log):
58 win = TestListCtrlPanel(nb, log)
59 return win
60
61#---------------------------------------------------------------------------
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78overview = """\
79A list control presents lists in a number of formats: list view, report view, icon view and small icon view. Elements are numbered from zero.
80
81wxListCtrl()
82------------------------
83
84Default constructor.
85
86wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
87
88Constructor, creating and showing a list control.
89
90Parameters
91-------------------
92
93parent = Parent window. Must not be NULL.
94
95id = Window identifier. A value of -1 indicates a default value.
96
97pos = Window position.
98
99size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
100
101style = Window style. See wxListCtrl.
102
103validator = Window validator.
104
105name = Window name.
106"""