Return a tuple indicating which (item, subItem) the given pt (client coordinates) is over. This uses the built-in version on Windows, and poor mans replacement on other platforms.
(self, pt)
| 51 | # Source: ObjectListView |
| 52 | |
| 53 | def HitTestSubItem(self, pt): |
| 54 | """ |
| 55 | Return a tuple indicating which (item, subItem) the given pt (client coordinates) is over. |
| 56 | |
| 57 | This uses the built-in version on Windows, and poor mans replacement on other platforms. |
| 58 | """ |
| 59 | # The buildin version works on Windows |
| 60 | |
| 61 | if wx.Platform == "__WXMSW__": |
| 62 | return wx.ListCtrl.HitTestSubItem(self, pt) |
| 63 | |
| 64 | (rowIndex, flags) = self.HitTest(pt) |
| 65 | |
| 66 | # Did the point hit any item? |
| 67 | if (flags & wx.LIST_HITTEST_ONITEM) == 0: |
| 68 | return -1, 0, -1 |
| 69 | |
| 70 | # If it did hit an item and we are not in report mode, it must be the primary cell |
| 71 | if not self.InReportView(): |
| 72 | return rowIndex, wx.LIST_HITTEST_ONITEM, 0 |
| 73 | |
| 74 | # Find which subitem is hit |
| 75 | right = 0 |
| 76 | scrolledX = self.GetScrollPos(wx.HORIZONTAL) * wx.SystemSettings.GetMetric(wx.SYS_HSCROLL_Y) + pt.x |
| 77 | for i in range(self.GetColumnCount()): |
| 78 | left = right |
| 79 | right += self.GetColumnWidth(i) |
| 80 | if scrolledX < right: |
| 81 | if (scrolledX - left) < self.imageList.GetSize(0)[0]: |
| 82 | flag = wx.LIST_HITTEST_ONITEMICON |
| 83 | else: |
| 84 | flag = wx.LIST_HITTEST_ONITEMLABEL |
| 85 | return rowIndex, flag, i |
| 86 | |
| 87 | return rowIndex, 0, -1 |
| 88 | |
| 89 | # noinspection PyPropertyAccess |
| 90 | def addColumn(self, i, col): |
no test coverage detected