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