2002-03-09 16:51:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: reparent.h
|
|
|
|
// Purpose: Reparenting classes
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2002-03-09
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2002-03-09 16:51:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_REPARENT_H_
|
|
|
|
#define _WX_REPARENT_H_
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This class helps to reparent a specific window
|
|
|
|
*/
|
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxAdoptedWindow;
|
|
|
|
class WXDLLIMPEXP_CORE wxReparenter: public wxObject
|
2002-03-09 16:51:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxReparenter() {}
|
|
|
|
|
|
|
|
// We assume that toReparent has had its X window set
|
|
|
|
// appropriately. toReparent is typically a wxAdoptedWindow.
|
|
|
|
bool Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent);
|
|
|
|
|
|
|
|
// Wait for an appropriate window to be created.
|
|
|
|
// If exactMatch is FALSE, a substring match is OK.
|
|
|
|
// If windowName is empty, then wait for the next overrideRedirect window.
|
|
|
|
bool WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent,
|
|
|
|
const wxString& windowName = wxEmptyString,
|
|
|
|
bool exactMatch = TRUE);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool ProcessXEvent(WXEvent* event);
|
|
|
|
WXWindow FindAClientWindow(WXWindow window, const wxString& name);
|
|
|
|
|
|
|
|
static bool sm_done;
|
|
|
|
static wxAdoptedWindow* sm_toReparent;
|
|
|
|
static wxWindow* sm_newParent;
|
|
|
|
static wxString sm_name;
|
|
|
|
static bool sm_exactMatch;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A window that adopts its handle from the native
|
|
|
|
* toolkit. It has no parent until reparented.
|
|
|
|
*/
|
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow
|
2002-03-09 16:51:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxAdoptedWindow();
|
|
|
|
wxAdoptedWindow(WXWindow window);
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxAdoptedWindow();
|
2002-03-09 16:51:10 -05:00
|
|
|
|
2002-04-02 07:41:28 -05:00
|
|
|
void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; }
|
2002-03-24 17:17:53 -05:00
|
|
|
WXWindow GetHandle() const { return GetMainWindow(); }
|
2002-03-09 16:51:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_REPARENT_H_
|