]>
Commit | Line | Data |
---|---|---|
cf694132 RD |
1 | |
2 | from wxPython.wx import * | |
3 | ||
4 | #--------------------------------------------------------------------------- | |
5 | ||
6 | class TestToolBar(wxFrame): | |
7 | def __init__(self, parent, log): | |
8 | wxFrame.__init__(self, parent, -1, 'Test ToolBar', | |
9 | wxPoint(0,0), wxSize(500, 300)) | |
10 | self.log = log | |
11 | ||
12 | wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE")) | |
13 | ||
14 | tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER) | |
15 | #tb = wxToolBar(self, -1, wxDefaultPosition, wxDefaultSize, | |
16 | # wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT) | |
17 | #self.SetToolBar(tb) | |
18 | ||
19 | self.CreateStatusBar() | |
20 | ||
2f90df85 RD |
21 | tb.AddTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP), |
22 | wxNullBitmap, false, -1, -1, "New", "Long help for 'New'") | |
cf694132 RD |
23 | EVT_TOOL(self, 10, self.OnToolClick) |
24 | EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick) | |
25 | ||
2f90df85 RD |
26 | tb.AddTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP), |
27 | wxNullBitmap, false, -1, -1, "Open") | |
cf694132 RD |
28 | EVT_TOOL(self, 20, self.OnToolClick) |
29 | EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick) | |
30 | ||
31 | tb.AddSeparator() | |
2f90df85 RD |
32 | tb.AddTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP), |
33 | wxNullBitmap, false, -1, -1, "Copy") | |
cf694132 RD |
34 | EVT_TOOL(self, 30, self.OnToolClick) |
35 | EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick) | |
36 | ||
2f90df85 RD |
37 | tb.AddTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP), |
38 | wxNullBitmap, false, -1, -1, "Paste") | |
cf694132 RD |
39 | EVT_TOOL(self, 40, self.OnToolClick) |
40 | EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick) | |
41 | ||
42 | tb.AddSeparator() | |
43 | ||
2f90df85 RD |
44 | tb.AddTool(50, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP), |
45 | wxNullBitmap, true, -1, -1, "Toggle this") | |
cf694132 RD |
46 | EVT_TOOL(self, 50, self.OnToolClick) |
47 | EVT_TOOL_RCLICKED(self, 50, self.OnToolRClick) | |
48 | ||
2f90df85 RD |
49 | tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP), |
50 | wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP), | |
51 | true, -1, -1, "Toggle with 2 bitmaps") | |
cf694132 RD |
52 | EVT_TOOL(self, 60, self.OnToolClick) |
53 | EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick) | |
54 | ||
55 | tb.Realize() | |
56 | ||
57 | ||
58 | def OnCloseWindow(self, event): | |
59 | self.Destroy() | |
60 | ||
61 | def OnToolClick(self, event): | |
62 | self.log.WriteText("tool %s clicked\n" % event.GetId()) | |
63 | ||
64 | def OnToolRClick(self, event): | |
65 | self.log.WriteText("tool %s right-clicked\n" % event.GetId()) | |
66 | ||
67 | #--------------------------------------------------------------------------- | |
68 | ||
69 | def runTest(frame, nb, log): | |
70 | win = TestToolBar(frame, log) | |
71 | frame.otherWin = win | |
72 | win.Show(true) | |
73 | ||
74 | #--------------------------------------------------------------------------- | |
75 | ||
76 | ||
77 | ||
78 | ||
79 | ||
80 | ||
81 | ||
82 | ||
83 | ||
84 | ||
85 | ||
86 | ||
87 | ||
88 | ||
89 | ||
90 | ||
91 | overview = """\ | |
92 | The name wxToolBar is defined to be a synonym for one of the following classes: | |
93 | ||
94 | wxToolBar95 The native Windows 95 toolbar. Used on Windows 95, NT 4 and above. | |
95 | ||
96 | wxToolBarMSW A Windows implementation. Used on 16-bit Windows. | |
97 | ||
98 | wxToolBarGTK The GTK toolbar. | |
99 | ||
100 | wxToolBarSimple A simple implementation, with scrolling. Used on platforms with no native toolbar control, or where scrolling is required. | |
101 | ||
102 | wxToolBar() | |
103 | ----------------------- | |
104 | ||
105 | Default constructor. | |
106 | ||
107 | wxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTB_HORIZONTAL | wxNO_BORDER, const wxString& name = wxPanelNameStr) | |
108 | ||
109 | Constructs a toolbar. | |
110 | ||
111 | Parameters | |
112 | ------------------- | |
113 | ||
114 | parent = Pointer to a parent window. | |
115 | ||
116 | id = Window identifier. If -1, will automatically create an identifier. | |
117 | ||
118 | pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows should generate a default position for the window. If using the wxWindow class directly, supply an actual position. | |
119 | ||
120 | size = Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows should generate a default size for the window. | |
121 | ||
122 | style = Window style. See wxToolBar for details. | |
123 | ||
124 | name = Window name. | |
125 | """ |