+ self.PopulateList()
+
+ # Now that the list exists we can init the other base class,
+ # see wxPython/lib/mixins/listctrl.py
+ self.itemDataMap = musicdata
+ wxColumnSorterMixin.__init__(self, 3)
+ #self.SortListItems(0, True)
+
+ EVT_SIZE(self, self.OnSize)
+ EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
+ EVT_LIST_ITEM_DESELECTED(self, tID, self.OnItemDeselected)
+ EVT_LIST_ITEM_ACTIVATED(self, tID, self.OnItemActivated)
+ EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
+ EVT_LIST_COL_CLICK(self, tID, self.OnColClick)
+ EVT_LIST_COL_RIGHT_CLICK(self, tID, self.OnColRightClick)
+ EVT_LIST_COL_BEGIN_DRAG(self, tID, self.OnColBeginDrag)
+ EVT_LIST_COL_DRAGGING(self, tID, self.OnColDragging)
+ EVT_LIST_COL_END_DRAG(self, tID, self.OnColEndDrag)
+
+ EVT_LEFT_DCLICK(self.list, self.OnDoubleClick)
+ EVT_RIGHT_DOWN(self.list, self.OnRightDown)
+
+ # for wxMSW
+ EVT_COMMAND_RIGHT_CLICK(self.list, tID, self.OnRightClick)
+
+ # for wxGTK
+ EVT_RIGHT_UP(self.list, self.OnRightClick)
+
+
+ def PopulateList(self):
+ if 0:
+ # for normal, simple columns, you can add them like this:
+ self.list.InsertColumn(0, "Artist")
+ self.list.InsertColumn(1, "Title", wxLIST_FORMAT_RIGHT)
+ self.list.InsertColumn(2, "Genre")
+ else:
+ # but since we want images on the column header we have to do it the hard way:
+ info = wxListItem()
+ info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE | wxLIST_MASK_FORMAT
+ info.m_image = -1
+ info.m_format = 0
+ info.m_text = "Artist"
+ self.list.InsertColumnInfo(0, info)
+
+ info.m_format = wxLIST_FORMAT_RIGHT
+ info.m_text = "Title"
+ self.list.InsertColumnInfo(1, info)
+
+ info.m_format = 0
+ info.m_text = "Genre"
+ self.list.InsertColumnInfo(2, info)