2007-01-22 10:04:49 -05: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 06:53:23 -04:00
|
|
|
#include "wx/window.h"
|
|
|
|
|
2011-10-18 17:56:52 -04: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 06:53:23 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNonOwnedWindow: a window that is not a child window of another one.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2011-10-11 13:56:57 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow
|
2011-10-10 06:53:23 -04: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 17:56:52 -04: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 06:53:23 -04:00
|
|
|
|
2011-10-18 17:56:52 -04:00
|
|
|
return DoSetPathShape(path);
|
|
|
|
}
|
|
|
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
|
|
|
|
2012-03-05 08:00:55 -05:00
|
|
|
|
|
|
|
// Overridden base class methods.
|
|
|
|
// ------------------------------
|
|
|
|
|
|
|
|
virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y),
|
2014-03-29 20:02:23 -04:00
|
|
|
int WXUNUSED(sizeFlags) = 0) const wxOVERRIDE
|
2012-03-05 08:00:55 -05:00
|
|
|
{
|
|
|
|
// Non owned windows positions don't need to be adjusted for parent
|
|
|
|
// client area origin so simply do nothing here.
|
|
|
|
}
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void InheritAttributes() wxOVERRIDE
|
2012-03-05 08:00:57 -05: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 17:56:52 -04: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 06:53:23 -04:00
|
|
|
};
|
|
|
|
|
2007-01-22 10:04:49 -05:00
|
|
|
#if defined(__WXDFB__)
|
|
|
|
#include "wx/dfb/nonownedwnd.h"
|
2012-02-27 13:07:21 -05:00
|
|
|
#elif defined(__WXGTK20__)
|
2011-10-13 08:45:56 -04:00
|
|
|
#include "wx/gtk/nonownedwnd.h"
|
2008-03-25 03:39:43 -04:00
|
|
|
#elif defined(__WXMAC__)
|
2008-06-11 15:17:41 -04:00
|
|
|
#include "wx/osx/nonownedwnd.h"
|
2011-10-14 20:20:56 -04:00
|
|
|
#elif defined(__WXMSW__) && !defined(__WXWINCE__)
|
2011-10-10 06:53:23 -04:00
|
|
|
#include "wx/msw/nonownedwnd.h"
|
2007-01-22 10:04:49 -05:00
|
|
|
#else
|
2011-10-10 06:53:23 -04:00
|
|
|
// No special class needed in other ports, they can derive both wxTLW and
|
2011-10-13 08:45:56 -04:00
|
|
|
// wxPopupWindow directly from wxWindow and don't implement SetShape().
|
2011-10-10 06:53:23 -04:00
|
|
|
class wxNonOwnedWindow : public wxNonOwnedWindowBase
|
|
|
|
{
|
|
|
|
};
|
2007-01-22 10:04:49 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _WX_NONOWNEDWND_H_
|