]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/reparent.h
The rounded corners look really dumb at this size.
[wxWidgets.git] / include / wx / x11 / reparent.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/reparent.h
3 // Purpose: Reparenting classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2002-03-09
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_REPARENT_H_
12 #define _WX_REPARENT_H_
13
14 #include "wx/window.h"
15
16 /*
17 * This class helps to reparent a specific window
18 */
19
20 class WXDLLIMPEXP_FWD_CORE wxAdoptedWindow;
21 class WXDLLIMPEXP_CORE wxReparenter: public wxObject
22 {
23 public:
24 wxReparenter() {}
25
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);
29
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);
36
37 protected:
38
39 bool ProcessXEvent(WXEvent* event);
40 WXWindow FindAClientWindow(WXWindow window, const wxString& name);
41
42 static bool sm_done;
43 static wxAdoptedWindow* sm_toReparent;
44 static wxWindow* sm_newParent;
45 static wxString sm_name;
46 static bool sm_exactMatch;
47 };
48
49 /*
50 * A window that adopts its handle from the native
51 * toolkit. It has no parent until reparented.
52 */
53
54 class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow
55 {
56 public:
57 wxAdoptedWindow();
58 wxAdoptedWindow(WXWindow window);
59 virtual ~wxAdoptedWindow();
60
61 void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; }
62 WXWindow GetHandle() const { return X11GetMainWindow(); }
63 };
64
65 #endif
66 // _WX_REPARENT_H_