]>
Commit | Line | Data |
---|---|---|
c978d361 JS |
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 | |
65571936 | 9 | // Licence: wxWindows licence |
c978d361 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_REPARENT_H_ | |
13 | #define _WX_REPARENT_H_ | |
14 | ||
c978d361 JS |
15 | #include "wx/window.h" |
16 | ||
17 | /* | |
18 | * This class helps to reparent a specific window | |
19 | */ | |
20 | ||
968eb2ef MW |
21 | class WXDLLIMPEXP_CORE wxAdoptedWindow; |
22 | class WXDLLIMPEXP_CORE wxReparenter: public wxObject | |
c978d361 JS |
23 | { |
24 | public: | |
25 | wxReparenter() {} | |
26 | ||
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); | |
30 | ||
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); | |
37 | ||
38 | protected: | |
39 | ||
40 | bool ProcessXEvent(WXEvent* event); | |
41 | WXWindow FindAClientWindow(WXWindow window, const wxString& name); | |
42 | ||
43 | static bool sm_done; | |
44 | static wxAdoptedWindow* sm_toReparent; | |
45 | static wxWindow* sm_newParent; | |
46 | static wxString sm_name; | |
47 | static bool sm_exactMatch; | |
48 | }; | |
49 | ||
50 | /* | |
51 | * A window that adopts its handle from the native | |
52 | * toolkit. It has no parent until reparented. | |
53 | */ | |
54 | ||
968eb2ef | 55 | class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow |
c978d361 JS |
56 | { |
57 | public: | |
58 | wxAdoptedWindow(); | |
59 | wxAdoptedWindow(WXWindow window); | |
d3c7fc99 | 60 | virtual ~wxAdoptedWindow(); |
c978d361 | 61 | |
8e2baee5 | 62 | void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; } |
ab6b6b15 | 63 | WXWindow GetHandle() const { return GetMainWindow(); } |
c978d361 JS |
64 | }; |
65 | ||
66 | #endif | |
67 | // _WX_REPARENT_H_ |