]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/reparent.h
compilation fix for gcc (closes bug 996701)
[wxWidgets.git] / include / wx / x11 / reparent.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: reparent.h
3 // Purpose: Reparenting classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2002-03-09
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_REPARENT_H_
13 #define _WX_REPARENT_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "reparent.h"
17 #endif
18
19 #include "wx/window.h"
20
21 /*
22 * This class helps to reparent a specific window
23 */
24
25 class wxAdoptedWindow;
26 class wxReparenter: public wxObject
27 {
28 public:
29 wxReparenter() {}
30
31 // We assume that toReparent has had its X window set
32 // appropriately. toReparent is typically a wxAdoptedWindow.
33 bool Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent);
34
35 // Wait for an appropriate window to be created.
36 // If exactMatch is FALSE, a substring match is OK.
37 // If windowName is empty, then wait for the next overrideRedirect window.
38 bool WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent,
39 const wxString& windowName = wxEmptyString,
40 bool exactMatch = TRUE);
41
42 protected:
43
44 bool ProcessXEvent(WXEvent* event);
45 WXWindow FindAClientWindow(WXWindow window, const wxString& name);
46
47 static bool sm_done;
48 static wxAdoptedWindow* sm_toReparent;
49 static wxWindow* sm_newParent;
50 static wxString sm_name;
51 static bool sm_exactMatch;
52 };
53
54 /*
55 * A window that adopts its handle from the native
56 * toolkit. It has no parent until reparented.
57 */
58
59 class wxAdoptedWindow: public wxWindow
60 {
61 public:
62 wxAdoptedWindow();
63 wxAdoptedWindow(WXWindow window);
64 ~wxAdoptedWindow();
65
66 void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; }
67 WXWindow GetHandle() const { return GetMainWindow(); }
68 };
69
70 #endif
71 // _WX_REPARENT_H_