]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/wxFloatBar.py
added font encoding support
[wxWidgets.git] / utils / wxPython / demo / wxFloatBar.py
1 from wxPython.wx import *
2 from wxPython.lib.floatbar import *
3
4 class TestFloatBar(wxFrame):
5 def __init__(self, parent, log):
6 wxFrame.__init__(self, parent, -1, 'Test ToolBar',
7 wxPoint(0,0), wxSize(500, 300))
8 self.log = log
9
10 wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
11
12 tb = wxFloatBar(self, -1)
13 self.SetToolBar(tb)
14 tb.SetFloatable(1)
15 tb.SetTitle("Floating!")
16 self.CreateStatusBar()
17 tb.AddTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
18 wxNullBitmap, false, -1, -1, "New", "Long help for 'New'")
19 EVT_TOOL(self, 10, self.OnToolClick)
20 EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
21
22 tb.AddTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
23 wxNullBitmap, false, -1, -1, "Open")
24 EVT_TOOL(self, 20, self.OnToolClick)
25 EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
26
27 tb.AddSeparator()
28 tb.AddTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
29 wxNullBitmap, false, -1, -1, "Copy")
30 EVT_TOOL(self, 30, self.OnToolClick)
31 EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
32
33 tb.AddTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
34 wxNullBitmap, false, -1, -1, "Paste")
35 EVT_TOOL(self, 40, self.OnToolClick)
36 EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
37
38 tb.AddSeparator()
39
40 tb.AddTool(50, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
41 wxNullBitmap, true, -1, -1, "Toggle this")
42 EVT_TOOL(self, 50, self.OnToolClick)
43 EVT_TOOL_RCLICKED(self, 50, self.OnToolRClick)
44
45 tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
46 wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
47 true, -1, -1, "Toggle with 2 bitmaps")
48 EVT_TOOL(self, 60, self.OnToolClick)
49 EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
50 tb.Realize()
51 # b = wxButton(tb, -1, "HELLO!")
52 # EVT_BUTTON(b, b.GetId(), self.test)
53
54
55 def OnCloseWindow(self, event):
56 self.Destroy()
57
58 def OnToolClick(self, event):
59 self.log.WriteText("tool %s clicked\n" % event.GetId())
60
61 def OnToolRClick(self, event):
62 self.log.WriteText("tool %s right-clicked\n" % event.GetId())
63 # def test(self, event):
64 # self.log.WriteText("Button clicked!")
65
66 #---------------------------------------------------------------------------
67
68 def runTest(frame, nb, log):
69 win = TestFloatBar(frame, log)
70 frame.otherWin = win
71 win.Show(true)
72
73 #---------------------------------------------------------------------------
74
75 overview = """\
76 wxFloatBar is a subclass of wxToolBar, implemented in Python, which can be detached from its frame.
77
78 Drag the toolbar with the mouse to make it float, and drag it back, or close it to make the toolbar
79
80 return to its original position.
81
82 wxFloatBar()
83 -----------------------
84
85 Default constructor.
86
87 wxFloatBar(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTB_HORIZONTAL | wxNO_BORDER, const wxString& name = wxPanelNameStr)
88
89 Constructs a floatable toolbar.
90
91 Parameters
92 -------------------
93
94 parent = Pointer to a parent window.
95
96 id = Window identifier. If -1, will automatically create an identifier.
97
98 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.
99
100 size = Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows should generate a default size for the window.
101
102 style = Window style. Se wxToolBar for details.
103
104 name = Window name.
105 """
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122