2007-01-22 15:04:49 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/nonownedwnd.h
|
|
|
|
// Purpose: declares wxNonTopLevelWindow class
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2006-12-24
|
|
|
|
// Copyright: (c) 2006 TT-Solutions
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_NONOWNEDWND_H_
|
|
|
|
#define _WX_NONOWNEDWND_H_
|
|
|
|
|
2011-10-10 10:53:23 +00:00
|
|
|
#include "wx/window.h"
|
|
|
|
|
2011-10-18 21:56:52 +00:00
|
|
|
// Styles that can be used with any wxNonOwnedWindow:
|
|
|
|
#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
|
|
|
|
|
2011-10-10 10:53:23 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNonOwnedWindow: a window that is not a child window of another one.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2011-10-11 17:56:57 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow
|
2011-10-10 10:53:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Set the shape of the window to the given region.
|
|
|
|
// Returns true if the platform supports this feature (and the
|
|
|
|
// operation is successful.)
|
2011-10-18 21:56:52 +00:00
|
|
|
bool SetShape(const wxRegion& region)
|
|
|
|
{
|
|
|
|
// This style is in fact only needed by wxOSX/Carbon so once we don't
|
|
|
|
// use this port any more, we could get rid of this requirement, but
|
|
|
|
// for now you must specify wxFRAME_SHAPED for SetShape() to work on
|
|
|
|
// all platforms.
|
|
|
|
wxCHECK_MSG
|
|
|
|
(
|
|
|
|
HasFlag(wxFRAME_SHAPED), false,
|
|
|
|
wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
|
|
|
|
);
|
|
|
|
|
|
|
|
return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if wxUSE_GRAPHICS_CONTEXT
|
|
|
|
// Set the shape using the specified path.
|
|
|
|
bool SetShape(const wxGraphicsPath& path)
|
|
|
|
{
|
|
|
|
wxCHECK_MSG
|
|
|
|
(
|
|
|
|
HasFlag(wxFRAME_SHAPED), false,
|
|
|
|
wxS("Shaped windows must be created with the wxFRAME_SHAPED style.")
|
|
|
|
);
|
2011-10-10 10:53:23 +00:00
|
|
|
|
2011-10-18 21:56:52 +00:00
|
|
|
return DoSetPathShape(path);
|
|
|
|
}
|
|
|
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
|
|
|
|
2012-03-05 13:00:55 +00:00
|
|
|
|
|
|
|
// Overridden base class methods.
|
|
|
|
// ------------------------------
|
|
|
|
|
|
|
|
virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y),
|
2014-03-30 00:02:23 +00:00
|
|
|
int WXUNUSED(sizeFlags) = 0) const wxOVERRIDE
|
2012-03-05 13:00:55 +00:00
|
|
|
{
|
|
|
|
// Non owned windows positions don't need to be adjusted for parent
|
|
|
|
// client area origin so simply do nothing here.
|
|
|
|
}
|
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual void InheritAttributes() wxOVERRIDE
|
2012-03-05 13:00:57 +00:00
|
|
|
{
|
|
|
|
// Non owned windows don't inherit attributes from their parent window
|
|
|
|
// (if the parent frame is red, it doesn't mean that all dialogs shown
|
|
|
|
// by it should be red as well), so don't do anything here neither.
|
|
|
|
}
|
|
|
|
|
2011-10-18 21:56:52 +00:00
|
|
|
protected:
|
|
|
|
virtual bool DoClearShape()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if wxUSE_GRAPHICS_CONTEXT
|
|
|
|
virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
2011-10-10 10:53:23 +00:00
|
|
|
};
|
|
|
|
|
2007-01-22 15:04:49 +00:00
|
|
|
#if defined(__WXDFB__)
|
|
|
|
#include "wx/dfb/nonownedwnd.h"
|
2012-02-27 18:07:21 +00:00
|
|
|
#elif defined(__WXGTK20__)
|
2011-10-13 12:45:56 +00:00
|
|
|
#include "wx/gtk/nonownedwnd.h"
|
2008-03-25 07:39:43 +00:00
|
|
|
#elif defined(__WXMAC__)
|
2008-06-11 19:17:41 +00:00
|
|
|
#include "wx/osx/nonownedwnd.h"
|
2011-10-15 00:20:56 +00:00
|
|
|
#elif defined(__WXMSW__) && !defined(__WXWINCE__)
|
2011-10-10 10:53:23 +00:00
|
|
|
#include "wx/msw/nonownedwnd.h"
|
2007-01-22 15:04:49 +00:00
|
|
|
#else
|
2011-10-10 10:53:23 +00:00
|
|
|
// No special class needed in other ports, they can derive both wxTLW and
|
2011-10-13 12:45:56 +00:00
|
|
|
// wxPopupWindow directly from wxWindow and don't implement SetShape().
|
2011-10-10 10:53:23 +00:00
|
|
|
class wxNonOwnedWindow : public wxNonOwnedWindowBase
|
|
|
|
{
|
|
|
|
};
|
2007-01-22 15:04:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _WX_NONOWNEDWND_H_
|