MCPcopy Create free account
hub / github.com/amule-project/amule / OnMouseButton

Method OnMouseButton

src/MuleNotebook.cpp:214–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213
214void 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
254void CMuleNotebook::OnMouseMotion(wxMouseEvent &event)

Callers

nothing calls this directly

Calls 1

GetPositionMethod · 0.45

Tested by

no test coverage detected