1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Reparenting classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_REPARENT_H_
13 #define _WX_REPARENT_H_
15 #include "wx/window.h"
18 * This class helps to reparent a specific window
21 class WXDLLIMPEXP_CORE wxAdoptedWindow
;
22 class WXDLLIMPEXP_CORE wxReparenter
: public wxObject
27 // We assume that toReparent has had its X window set
28 // appropriately. toReparent is typically a wxAdoptedWindow.
29 bool Reparent(wxWindow
* newParent
, wxAdoptedWindow
* toReparent
);
31 // Wait for an appropriate window to be created.
32 // If exactMatch is FALSE, a substring match is OK.
33 // If windowName is empty, then wait for the next overrideRedirect window.
34 bool WaitAndReparent(wxWindow
* newParent
, wxAdoptedWindow
* toReparent
,
35 const wxString
& windowName
= wxEmptyString
,
36 bool exactMatch
= TRUE
);
40 bool ProcessXEvent(WXEvent
* event
);
41 WXWindow
FindAClientWindow(WXWindow window
, const wxString
& name
);
44 static wxAdoptedWindow
* sm_toReparent
;
45 static wxWindow
* sm_newParent
;
46 static wxString sm_name
;
47 static bool sm_exactMatch
;
51 * A window that adopts its handle from the native
52 * toolkit. It has no parent until reparented.
55 class WXDLLIMPEXP_CORE wxAdoptedWindow
: public wxWindow
59 wxAdoptedWindow(WXWindow window
);
62 void SetHandle(WXWindow window
) { m_mainWindow
= window
; m_clientWindow
= window
; }
63 WXWindow
GetHandle() const { return GetMainWindow(); }