]> git.saurik.com Git - wxWidgets.git/blame - wxPython/tests/TstLstIcon.py
corrections to dynamic loading for Darwin
[wxWidgets.git] / wxPython / tests / TstLstIcon.py
CommitLineData
8bf5d46e
RD
1#!/bin/env python
2#----------------------------------------------------------------------------
3# Name: TstLstIcon.py
4# Purpose: Lest Icon List
5#
6# Author: Lorne White
7#
8# Version: 0.8
9# Licence: wxWindows, wxPython license
10#----------------------------------------------------------------------------
11
12import sys, os
13from wxPython.wx import *
14
15class AppFrame(wxFrame):
16 def __init__(self, parent, id=-1, title="New"):
17 wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, wxSize(420, 320))
18 if wxPlatform == '__WXMSW__':
19 self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
20 self.SetIcon(self.icon)
21
22 self.CreateStatusBar()
23
24 self.mainmenu = wxMenuBar()
25 menu = wxMenu()
26
27 menu = self.MakeFileMenu()
28 self.mainmenu.Append(menu, '&File')
29
30 self.SetMenuBar(self.mainmenu)
31
32 self.il = wxImageList(32, 32)
33 self.idx1 = idx1 = self.il.Add(wxNoRefBitmap('table.bmp', wxBITMAP_TYPE_BMP))
34 self.idx2 = idx2 = self.il.Add(wxNoRefBitmap('query.bmp', wxBITMAP_TYPE_BMP))
35
36 self.nb = nb = wxNotebook(self, -1)
37
38 self.list = wxListCtrl(nb, 1100, wxDefaultPosition, wxDefaultSize)
39
40 nb.AddPage(self.list, "Tables")
41
42 self.list.SetSingleStyle(wxLC_ICON)
43 self.list.SetWindowStyleFlag(wxSTATIC_BORDER|wxVSCROLL)
44 self.list.SetImageList(self.il, wxIMAGE_LIST_NORMAL)
45
46 self.qlist = wxListCtrl(nb, 1200, wxDefaultPosition, wxDefaultSize)
47 nb.AddPage(self.qlist, "Queries")
48
49 self.qlist.SetSingleStyle(wxLC_ICON)
50 self.qlist.SetWindowStyleFlag(wxSTATIC_BORDER|wxVSCROLL)
51 self.qlist.SetImageList(self.il, wxIMAGE_LIST_NORMAL)
52
53 self.UpdateView2()
54 self.UpdateView1()
55
56 self.nb.SetSelection(1)
57 self.nb.SetSelection(0)
58 #self.nb.Refresh()
59 #self.nb.ResizeChildren()
60
61 def MakeFileMenu(self):
62 self.fl_mn = menu = wxMenu()
63
64 mID = NewId()
65 menu.Append(mID, 'E&xit', 'Exit')
66 EVT_MENU(self, mID, self.OnFileExit)
67
68 return menu
69
70
71 def UpdateView1(self):
72 vset = "ViewA "
73 for i in range(20):
74 self.list.InsertImageStringItem(i, vset + str(i), self.idx1)
75
76 def UpdateView2(self):
77 vset = "ViewB "
78 for i in range(5):
79 self.qlist.InsertImageStringItem(i, vset + str(i), self.idx2)
80
81 def OnFileExit(self, event):
82 self.Close()
83
84#---------------------------------------------------------------------------
85
86
87class MyApp(wxApp):
88 def OnInit(self):
89 frame = AppFrame(NULL, -1, "Demo")
90 frame.Show(true)
91 self.SetTopWindow(frame)
92 return true
93
94#---------------------------------------------------------------------------
95
96
97def main():
98 app = MyApp(0)
99 app.MainLoop()
100
101
102def t():
103 import pdb
104 pdb.run('main()')
105
106
107if __name__ == '__main__':
108 main()