| 212 | |
| 213 | |
| 214 | void CMuleNotebook::OnMouseButton(wxMouseEvent &event) |
| 215 | { |
| 216 | if (GetImageList() == NULL) { |
| 217 | // This Mulenotebook has no images on tabs, so nothing to do. |
| 218 | event.Skip(); |
| 219 | return; |
| 220 | } |
| 221 | |
| 222 | long xpos, ypos; |
| 223 | event.GetPosition(&xpos, &ypos); |
| 224 | |
| 225 | long flags = 0; |
| 226 | int tab = HitTest(wxPoint(xpos,ypos),&flags); |
| 227 | static int tab_down_icon = -1; |
| 228 | static int tab_down_label = -1; |
| 229 | |
| 230 | if (event.LeftDown() && (flags == wxNB_HITTEST_ONICON)) { |
| 231 | tab_down_icon = tab; |
| 232 | } |
| 233 | else if (event.MiddleDown() && (flags == wxNB_HITTEST_ONLABEL)) { |
| 234 | tab_down_label = tab; |
| 235 | } |
| 236 | else if (event.LeftDown() || event.MiddleDown()) { |
| 237 | tab_down_icon = -1; |
| 238 | tab_down_label = -1; |
| 239 | } |
| 240 | |
| 241 | if (((tab != -1) && (((flags == wxNB_HITTEST_ONICON) && event.LeftUp() && (tab == tab_down_icon)) || |
| 242 | ((flags == wxNB_HITTEST_ONLABEL) && event.MiddleUp() && (tab == tab_down_label))))) { |
| 243 | // User did click on a 'x' or middle click on the label |
| 244 | tab_down_icon = -1; |
| 245 | tab_down_label = -1; |
| 246 | DeletePage(tab); |
| 247 | } else { |
| 248 | // Is not a 'x'. Send this event up. |
| 249 | event.Skip(); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | |
| 254 | void CMuleNotebook::OnMouseMotion(wxMouseEvent &event) |
nothing calls this directly
no test coverage detected