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
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_REPARENT_H_
|
|
|
|
#define _WX_REPARENT_H_
|
|
|
|
|
2003-05-11 14:08:58 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2002-03-09 16:51:10 -05:00
|
|
|
#pragma interface "reparent.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This class helps to reparent a specific window
|
|
|
|
*/
|
|
|
|
|
|
|
|
class wxAdoptedWindow;
|
|
|
|
class wxReparenter: public wxObject
|
|
|
|
{
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class wxAdoptedWindow: public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxAdoptedWindow();
|
|
|
|
wxAdoptedWindow(WXWindow window);
|
|
|
|
~wxAdoptedWindow();
|
|
|
|
|
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_
|