Determines if close button was selected for the given tab by comparing x and y position with known close button region
(self, tab, x, y)
| 996 | return False |
| 997 | |
| 998 | def CheckTabClose(self, tab, x, y): |
| 999 | """ |
| 1000 | Determines if close button was selected for the given tab by comparing |
| 1001 | x and y position with known close button region |
| 1002 | """ |
| 1003 | if not tab.closeable: # if not able to close, return False |
| 1004 | return False |
| 1005 | |
| 1006 | region = tab.GetCloseButtonRegion() |
| 1007 | posx, posy = tab.GetPosition() |
| 1008 | region.Offset(round(posx), round(posy)) |
| 1009 | |
| 1010 | if region.Contains(x, y): |
| 1011 | index = self.tabs.index(tab) |
| 1012 | ev = PageClosing(index) |
| 1013 | wx.PostEvent(self.Parent, ev) |
| 1014 | |
| 1015 | if ev.isVetoed(): |
| 1016 | return False |
| 1017 | |
| 1018 | index = self.GetTabIndex(tab) |
| 1019 | self.Parent.DeletePage(index) |
| 1020 | wx.PostEvent(self.Parent, PageClosed(index=index)) |
| 1021 | |
| 1022 | sel = self.GetSelected() |
| 1023 | if sel is not None: |
| 1024 | wx.PostEvent(self.Parent, PageChanged(-1, sel)) |
| 1025 | |
| 1026 | return True |
| 1027 | return False |
| 1028 | |
| 1029 | def CheckAddButton(self, x, y): |
| 1030 | """ |
no test coverage detected