+ // determine the position and size of the screen we clamp the popup to
+ wxPoint posScreen;
+ wxSize sizeScreen;
+
+ const int displayNum = wxDisplay::GetFromPoint(ptOrigin);
+ if ( displayNum != wxNOT_FOUND )
+ {
+ const wxRect rectScreen = wxDisplay(displayNum).GetGeometry();
+ posScreen = rectScreen.GetPosition();
+ sizeScreen = rectScreen.GetSize();
+ }
+ else // outside of any display?
+ {
+ // just use the primary one then
+ posScreen = wxPoint(0, 0);
+ sizeScreen = wxGetDisplaySize();
+ }
+
+
+ const wxSize sizeSelf = GetSize();