+ if ( nItem != wxNOT_FOUND )
+ {
+ wxRect rect;
+ GetItemRect(nItem, rect);
+
+ // convert item rect to check mark rect
+ wxSize size = wxRendererNative::Get().GetCheckBoxSize(this);
+ rect.x += CHECKMARK_EXTRA_SPACE;
+ rect.y += (rect.GetHeight() - size.GetHeight()) / 2;
+ rect.SetSize(size);
+
+ if ( rect.Contains(event.GetX(), event.GetY()) )
+ {
+ // people expect to get "kill focus" event for the currently
+ // focused control before getting events from the other controls
+ // and, equally importantly, they may prevent the focus change from
+ // taking place at all (e.g. because the old control contents is
+ // invalid and needs to be corrected) in which case we shouldn't
+ // generate this event at all
+ SetFocus();
+ if ( FindFocus() == this )
+ {
+ Toggle(nItem);
+ SendEvent(nItem);
+
+ // scroll one item down if the item is the last one
+ // and isn't visible at all
+ int h;
+ GetClientSize(NULL, &h);
+ if ( rect.GetBottom() > h )
+ ScrollLines(1);
+ }
+ }
+ else
+ {
+ // implement default behaviour: clicking on the item selects it
+ event.Skip();
+ }
+ }
+ else
+ {
+ // implement default behavior on click outside of client zone
+ event.Skip();