]>
Commit | Line | Data |
---|---|---|
c978d361 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/x11/reparent.h |
c978d361 JS |
3 | // Purpose: Reparenting classes |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2002-03-09 | |
c978d361 | 7 | // Copyright: (c) Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
c978d361 JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_REPARENT_H_ | |
12 | #define _WX_REPARENT_H_ | |
13 | ||
c978d361 JS |
14 | #include "wx/window.h" |
15 | ||
16 | /* | |
17 | * This class helps to reparent a specific window | |
18 | */ | |
19 | ||
b5dbe15d | 20 | class WXDLLIMPEXP_FWD_CORE wxAdoptedWindow; |
968eb2ef | 21 | class WXDLLIMPEXP_CORE wxReparenter: public wxObject |
c978d361 JS |
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); | |
03647350 | 41 | |
c978d361 JS |
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 | ||
968eb2ef | 54 | class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow |
c978d361 JS |
55 | { |
56 | public: | |
57 | wxAdoptedWindow(); | |
58 | wxAdoptedWindow(WXWindow window); | |
d3c7fc99 | 59 | virtual ~wxAdoptedWindow(); |
c978d361 | 60 | |
8e2baee5 | 61 | void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; } |
679918f9 | 62 | WXWindow GetHandle() const { return X11GetMainWindow(); } |
c978d361 JS |
63 | }; |
64 | ||
65 | #endif | |
66 | // _WX_REPARENT_H_ |