- if (parent)
- {
- return wxFindWindowByName1 (title, parent);
- }
- else
- {
- for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *win = node->GetData();
- wxWindow *retwin = wxFindWindowByName1 (title, win);
- if (retwin)
- return retwin;
- }
-
- }
-
- // Failed? Try by label instead.
- return wxFindWindowByLabel(title, parent);
-}
-
-// Recursive
-static wxWindow *
-wxFindWindowByName1 (const wxString& title, wxWindow * parent)
-{
- if (parent)
- {
- if ( parent->GetName() == title )
- return parent;
- }
-
- if (parent)
- {
- for (wxNode * node = parent->GetChildren().First (); node; node = node->Next ())
- {
- wxWindow *win = (wxWindow *) node->Data ();
- wxWindow *retwin = wxFindWindowByName1 (title, win);
- if (retwin)
- return retwin;
- } // for()
-
- }
-
- return (wxWindow *) NULL; // Not found
-