- )
- SetFocus();
-
- wxPoint findPos;
- findPos.x = dc.DeviceToLogicalX(event.GetX());
- findPos.y = dc.DeviceToLogicalY(event.GetY());
-
- findPos.x -= WXLO_XOFFSET;
- findPos.y -= WXLO_YOFFSET;
-
- if(findPos.x < 0)
- findPos.x = 0;
- if(findPos.y < 0)
- findPos.y = 0;
-
- m_ClickPosition = wxPoint(event.GetX(), event.GetY());
-
- // Scroll the window if the mouse is at the end of it:
- if(m_Selecting && eventId == WXLOWIN_MENU_MOUSEMOVE)
- {
- //WXLO_DEBUG(("selecting at : %d/%d", (int) event.GetX(), (int)event.GetY()));
- int left, top;
- ViewStart(&left, &top);
- wxSize size = GetClientSize();
- int xdelta, ydelta;
-
- if(event.GetX() < WXLO_SCROLLMARGIN_X)
- xdelta = -(WXLO_SCROLLMARGIN_X-event.GetX());
- else if(event.GetX() > size.x-WXLO_SCROLLMARGIN_X)
- xdelta = event.GetX()-size.x+WXLO_SCROLLMARGIN_X;
- else
- xdelta = 0;
- if(event.GetY() < WXLO_SCROLLMARGIN_Y)
- ydelta = -(WXLO_SCROLLMARGIN_Y-event.GetY());
- else if(event.GetY() > size.y-WXLO_SCROLLMARGIN_Y)
- ydelta = event.GetY()-size.y+WXLO_SCROLLMARGIN_Y;
- else
- ydelta = 0;
-
- //WXLO_DEBUG(("xdelta: %d", (int) xdelta));
- if(xdelta != 0 || ydelta != 0)
- {
- top += ydelta; if(top < 0) top = 0;
- left += xdelta; if(left < 0) left = 0;
- Scroll(left, top);
- }
- }
-
- wxPoint cursorPos;
- bool found;
- wxLayoutObject *obj = m_llist->FindObjectScreen(dc, findPos,
- &cursorPos, &found);
- wxLayoutObject::UserData *u = obj ? obj->GetUserData() : NULL;
-
- // has the mouse only been moved?
- switch ( eventId )
- {
- case WXLOWIN_MENU_MOUSEMOVE:
- {
- // this variables is used to only erase the message in the status
- // bar if we had put it there previously - otherwise empting status
- // bar might be undesirable
- static bool s_hasPutMessageInStatusBar = false;
-
- // found is only true if we are really over an object, not just
- // behind it
- if(found && u && ! m_Selecting)
- {
- if(!m_HandCursor)
- SetCursor(wxCURSOR_HAND);
- m_HandCursor = TRUE;
- if(m_StatusBar && m_StatusFieldLabel != -1)
- {
- const wxString &label = u->GetLabel();
- if(label.Length())
+ )
+ && (wxWindow::FindFocus() != this) )
+ {
+ SetFocus();
+ }
+
+ wxPoint findPos;
+ findPos.x = dc.DeviceToLogicalX(event.GetX());
+ findPos.y = dc.DeviceToLogicalY(event.GetY());
+
+ findPos.x -= WXLO_XOFFSET;
+ findPos.y -= WXLO_YOFFSET;
+
+ if(findPos.x < 0)
+ findPos.x = 0;
+
+ if(findPos.y < 0)
+ findPos.y = 0;
+
+ m_ClickPosition = wxPoint(event.GetX(), event.GetY());
+
+ // Scroll the window if the mouse is at the end of it:
+ if(m_Selecting && eventId == WXLOWIN_MENU_MOUSEMOVE)
+ {
+ //WXLO_DEBUG(("selecting at : %d/%d", (int) event.GetX(), (int)event.GetY()));
+ int left, top;
+ GetViewStart(&left, &top);
+ wxSize size = GetClientSize();
+ int xdelta, ydelta;
+
+ if(event.GetX() < WXLO_SCROLLMARGIN_X)
+ xdelta = -(WXLO_SCROLLMARGIN_X-event.GetX());
+ else if(event.GetX() > size.x-WXLO_SCROLLMARGIN_X)
+ xdelta = event.GetX()-size.x+WXLO_SCROLLMARGIN_X;
+ else
+ xdelta = 0;
+
+ if(event.GetY() < WXLO_SCROLLMARGIN_Y)
+ ydelta = -(WXLO_SCROLLMARGIN_Y-event.GetY());
+ else if(event.GetY() > size.y-WXLO_SCROLLMARGIN_Y)
+ ydelta = event.GetY()-size.y+WXLO_SCROLLMARGIN_Y;
+ else
+ ydelta = 0;
+
+ //WXLO_DEBUG(("xdelta: %d", (int) xdelta));
+ if(xdelta != 0 || ydelta != 0)
+ {
+ top += ydelta; if(top < 0) top = 0;
+ left += xdelta; if(left < 0) left = 0;
+ Scroll(left, top);
+ }
+ }
+
+ wxPoint cursorPos;
+ bool found;
+ wxLayoutObject *obj = m_llist->FindObjectScreen(dc, findPos,
+ &cursorPos, &found);
+ wxLayoutObject::UserData *u = obj ? obj->GetUserData() : NULL;
+
+ // has the mouse only been moved?
+ switch ( eventId )
+ {
+ case WXLOWIN_MENU_MOUSEMOVE:
+ {
+ // this variables is used to only erase the message in the status
+ // bar if we had put it there previously - otherwise empting status
+ // bar might be undesirable
+#if wxUSE_STATUSBAR
+ static bool s_hasPutMessageInStatusBar = false;
+#endif // wxUSE_STATUSBAR
+
+ // found is only true if we are really over an object, not just
+ // behind it
+ if(found && u && ! m_Selecting)
+ {
+ if(!m_HandCursor)
+ SetCursor(wxCURSOR_HAND);
+ m_HandCursor = true;
+#if wxUSE_STATUSBAR
+ if(m_StatusBar && m_StatusFieldLabel != -1)
+ {
+ const wxString &label = u->GetLabel();
+ if(label.Length())
+ {
+ m_StatusBar->SetStatusText(label,m_StatusFieldLabel);
+ s_hasPutMessageInStatusBar = true;
+ }
+ }
+#endif // wxUSE_STATUSBAR
+ }
+ else
+ {
+ if(m_HandCursor)
+ SetCursor(wxCURSOR_IBEAM);
+ m_HandCursor = false;
+#if wxUSE_STATUSBAR
+ if( m_StatusBar && m_StatusFieldLabel != -1 &&
+ s_hasPutMessageInStatusBar )