]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/x11/reparent.h
split wxControl::Ellipsize() in two functions for better readability of the code...
[wxWidgets.git] / include / wx / x11 / reparent.h
... / ...
CommitLineData
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#include "wx/window.h"
16
17/*
18 * This class helps to reparent a specific window
19 */
20
21class WXDLLIMPEXP_FWD_CORE wxAdoptedWindow;
22class WXDLLIMPEXP_CORE wxReparenter: public wxObject
23{
24public:
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
38protected:
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
55class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow
56{
57 public:
58 wxAdoptedWindow();
59 wxAdoptedWindow(WXWindow window);
60 virtual ~wxAdoptedWindow();
61
62 void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; }
63 WXWindow GetHandle() const { return GetMainWindow(); }
64};
65
66#endif
67// _WX_REPARENT_H_