1
2
3
4
5 import wx
6
9
10 from Gnumed.wxpython import gmListWidgets
11
12
13 kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL
14 wx.ScrolledWindow.__init__(self, *args, **kwds)
15 self._LBL_message = wx.StaticText(self, -1, "", style=wx.ALIGN_CENTRE)
16 self._LCTRL_items = gmListWidgets.cReportListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_HRULES | wx.NO_BORDER)
17 self._BTN_add = wx.Button(self, wx.ID_ADD, "")
18 self._BTN_edit = wx.Button(self, -1, _("&Edit"))
19 self._BTN_remove = wx.Button(self, wx.ID_REMOVE, "")
20 self._BTN_extra_left = wx.Button(self, -1, _("left extra"), style=wx.BU_EXACTFIT)
21 self._BTN_extra_middle = wx.Button(self, -1, _("middle extra"), style=wx.BU_EXACTFIT)
22 self._BTN_extra_right = wx.Button(self, -1, _("right extra"), style=wx.BU_EXACTFIT)
23
24 self.__set_properties()
25 self.__do_layout()
26
27 self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._on_list_item_deselected, self._LCTRL_items)
28 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_list_item_selected, self._LCTRL_items)
29 self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self._on_list_item_activated, self._LCTRL_items)
30 self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self._on_list_item_focused, self._LCTRL_items)
31 self.Bind(wx.EVT_BUTTON, self._on_add_button_pressed, self._BTN_add)
32 self.Bind(wx.EVT_BUTTON, self._on_edit_button_pressed, self._BTN_edit)
33 self.Bind(wx.EVT_BUTTON, self._on_remove_button_pressed, self._BTN_remove)
34 self.Bind(wx.EVT_BUTTON, self._on_left_extra_button_pressed, self._BTN_extra_left)
35 self.Bind(wx.EVT_BUTTON, self._on_middle_extra_button_pressed, self._BTN_extra_middle)
36 self.Bind(wx.EVT_BUTTON, self._on_right_extra_button_pressed, self._BTN_extra_right)
37
38
40
41 self.SetScrollRate(10, 10)
42 self._BTN_add.SetToolTipString(_("Add a new item to the list."))
43 self._BTN_add.Enable(False)
44 self._BTN_edit.SetToolTipString(_("Edit the selected item."))
45 self._BTN_edit.Enable(False)
46 self._BTN_remove.SetToolTipString(_("Remove the selected item(s) from the list."))
47 self._BTN_remove.Enable(False)
48 self._BTN_extra_left.Enable(False)
49 self._BTN_extra_left.Hide()
50 self._BTN_extra_middle.Enable(False)
51 self._BTN_extra_middle.Hide()
52 self._BTN_extra_right.Enable(False)
53 self._BTN_extra_right.Hide()
54
55
57
58 __szr_main = wx.BoxSizer(wx.VERTICAL)
59 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
60 __szr_main.Add(self._LBL_message, 0, wx.BOTTOM | wx.EXPAND, 3)
61 __szr_main.Add(self._LCTRL_items, 1, wx.EXPAND, 0)
62 __szr_buttons.Add((20, 20), 2, wx.ALIGN_CENTER_VERTICAL, 0)
63 __szr_buttons.Add(self._BTN_add, 0, wx.ALIGN_CENTER_VERTICAL, 0)
64 __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL, 0)
65 __szr_buttons.Add(self._BTN_edit, 0, wx.ALIGN_CENTER_VERTICAL, 0)
66 __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL, 0)
67 __szr_buttons.Add(self._BTN_remove, 0, wx.ALIGN_CENTER_VERTICAL, 0)
68 __szr_buttons.Add((20, 20), 2, wx.ALIGN_CENTER_VERTICAL, 0)
69 __szr_buttons.Add(self._BTN_extra_left, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
70 __szr_buttons.Add(self._BTN_extra_middle, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
71 __szr_buttons.Add(self._BTN_extra_right, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
72 __szr_buttons.Add((20, 20), 2, wx.ALIGN_CENTER_VERTICAL, 0)
73 __szr_main.Add(__szr_buttons, 0, wx.TOP | wx.EXPAND, 3)
74 self.SetSizer(__szr_main)
75 __szr_main.Fit(self)
76
77
79 print "Event handler `_on_list_item_deselected' not implemented!"
80 event.Skip()
81
83 print "Event handler `_on_list_item_selected' not implemented!"
84 event.Skip()
85
87 print "Event handler `_on_list_item_activated' not implemented!"
88 event.Skip()
89
91 print "Event handler `_on_add_button_pressed' not implemented!"
92 event.Skip()
93
95 print "Event handler `_on_edit_button_pressed' not implemented!"
96 event.Skip()
97
99 print "Event handler `_on_remove_button_pressed' not implemented!"
100 event.Skip()
101
103 print "Event handler `_on_list_item_focused' not implemented"
104 event.Skip()
105
107 print "Event handler `_on_left_extra_button_pressed' not implemented"
108 event.Skip()
109
111 print "Event handler `_on_middle_extra_button_pressed' not implemented"
112 event.Skip()
113
115 print "Event handler `_on_right_extra_button_pressed' not implemented"
116 event.Skip()
117
118
119