Fixed some broken things related to context help, fixed memory leak

in wxGenericTreeCtrl (Init should be called before Create, not _in_ Create)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-09-08 13:52:10 +00:00
parent fb6261e9ba
commit 57591e0edb
16 changed files with 58 additions and 18 deletions

View File

@@ -57,6 +57,7 @@ public:
const wxValidator &validator = wxDefaultValidator,
const wxString& name = wxTreeCtrlNameStr)
{
Init();
Create(parent, id, pos, size, style, validator, name);
}

View File

@@ -270,6 +270,9 @@ WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent
// Returns menu item id or -1 if none.
WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString);
// Find the wxWindow at the given point. wxGenericFindWindowAtPoint
// is always present but may be less reliable than a native version.
WXDLLEXPORT wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
WXDLLEXPORT wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
// ----------------------------------------------------------------------------

View File

@@ -191,8 +191,8 @@ bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt)
#if !defined(__WXMSW__)
static char * csquery_xpm[] = {
"12 11 2 1",
" c None",
". c Black",
" c None",
". c #000000",
" ",
" .... ",
" .. .. ",
@@ -228,7 +228,7 @@ wxContextHelpButton::wxContextHelpButton(wxWindow* parent, wxWindowID id,
void wxContextHelpButton::OnContextHelp(wxCommandEvent& event)
{
wxContextHelp contextHelp;
wxContextHelp contextHelp(GetParent());
}
#endif // wxUSE_HELP

View File

@@ -694,16 +694,19 @@ wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt)
return NULL;
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt)
{
wxNode* node = wxTopLevelWindows.First();
// Go backwards through the list since windows
// on top are likely to have been appended most
// recently.
wxNode* node = wxTopLevelWindows.Last();
while (node)
{
wxWindow* win = (wxWindow*) node->Data();
wxWindow* found = wxFindWindowAtPoint(win, pt);
if (found)
return found;
node = node->Next();
node = node->Previous();
}
return NULL;
}

View File

@@ -638,8 +638,6 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, wxWindowID id,
const wxValidator &validator,
const wxString& name )
{
Init();
wxScrolledWindow::Create( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name );
#if wxUSE_VALIDATORS

View File

@@ -111,6 +111,12 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
return wxGTK;
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);
}
// ----------------------------------------------------------------------------
// subprocess routines
// ----------------------------------------------------------------------------

View File

@@ -3777,6 +3777,8 @@ wxPoint wxGetMousePosition()
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
if (!windowAtPtr)
return wxPoint(-999, -999);
Display *display = GDK_WINDOW_XDISPLAY(windowAtPtr);
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));

View File

@@ -111,6 +111,12 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
return wxGTK;
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);
}
// ----------------------------------------------------------------------------
// subprocess routines
// ----------------------------------------------------------------------------

View File

@@ -3777,6 +3777,8 @@ wxPoint wxGetMousePosition()
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
if (!windowAtPtr)
return wxPoint(-999, -999);
Display *display = GDK_WINDOW_XDISPLAY(windowAtPtr);
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));

View File

@@ -329,3 +329,7 @@ void wxDisplaySize(int *width, int *height)
#endif
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);
}

View File

@@ -2369,7 +2369,8 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
// Get the current mouse position.
wxPoint wxGetMousePosition()
{
wxFAIL_MSG(_("Not implemented"));
return wxPoint;
int x, y;
wxGetMousePosition(& x, & y);
return wxPoint(x, y);
}

View File

@@ -329,3 +329,7 @@ void wxDisplaySize(int *width, int *height)
#endif
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);
}

View File

@@ -2369,7 +2369,8 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
// Get the current mouse position.
wxPoint wxGetMousePosition()
{
wxFAIL_MSG(_("Not implemented"));
return wxPoint;
int x, y;
wxGetMousePosition(& x, & y);
return wxPoint(x, y);
}

View File

@@ -706,6 +706,11 @@ wxString wxGetDisplayName()
return gs_displayName;
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);
}
// ----------------------------------------------------------------------------
// accelerators
// ----------------------------------------------------------------------------

View File

@@ -2992,9 +2992,7 @@ wxWindow *wxGetActiveWindow()
// position.
wxWindow* wxFindWindowAtPointer(wxPoint& pt)
{
pt = wxGetMousePosition();
wxWindow* found = wxFindWindowAtPoint(pt);
return found;
return wxFindWindowAtPoint(wxGetMousePosition());
}
// Get the current mouse position.

View File

@@ -4389,9 +4389,15 @@ static TEXTMETRIC wxGetTextMetrics(const wxWindow *win)
// position.
wxWindow* wxFindWindowAtPointer(wxPoint& pt)
{
// Use current message to find last mouse position
extern MSG s_currentMsg;
HWND hWndHit = ::WindowFromPoint(s_currentMsg.pt);
return wxFindWindowAtPoint(wxGetMousePosition());
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
POINT pt2;
pt2.x = pt.x;
pt2.y = pt.y;
HWND hWndHit = ::WindowFromPoint(pt2);
wxWindow* win = wxFindWinFromHandle((WXHWND) hWndHit) ;
HWND hWnd = hWndHit;