Added wxTLW::SetShape and implementations for wxGTK, wxMSW and an
empty stub for wxMac. Added some generic helpers and a new ctor to wxRegion. Added samples/shaped. (Backport to 2.4 from 2.5) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5301,7 +5301,7 @@ if test "$wxUSE_GUI" = "yes"; then
|
||||
dnl ipc, mfc, nativdlg, oleauto, ownerdrw
|
||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs \
|
||||
drawing dynamic erase event exec font image \
|
||||
minimal propsize rotate widgets"
|
||||
minimal propsize rotate shaped widgets"
|
||||
|
||||
dnl this is needed to be able to find AFM files
|
||||
CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"
|
||||
|
@@ -217,6 +217,7 @@ protocol.cpp Common Socket,Base
|
||||
quantize.cpp Common
|
||||
radiocmn.cpp Common NotMac
|
||||
regex.cpp Common Base
|
||||
rgncmn.cpp Common
|
||||
resource.cpp Common
|
||||
sckaddr.cpp Common Socket,Base
|
||||
sckfile.cpp Common Socket,Base
|
||||
|
@@ -529,6 +529,17 @@ Note that it is not possible to call this function twice for the same frame obje
|
||||
|
||||
\helpref{wxFrame::GetMenuBar}{wxframegetmenubar}, \helpref{wxMenuBar}{wxmenubar}, \helpref{wxMenu}{wxmenu}.
|
||||
|
||||
\membersection{wxFrame::SetShape}\label{wxframesetshape}
|
||||
|
||||
\func{bool}{SetShape}{\param{const wxRegion&}{ region}}
|
||||
|
||||
If the platform supports it, sets the shape of the window to that
|
||||
depicted by \it{region}. The system will not display or
|
||||
respond to any mouse event for the pixels that lie outside of the
|
||||
region. To reset the window to the normal rectangular shape simply
|
||||
call \it{SetShape} again with an empty region. Returns TRUE if the
|
||||
operation is successful.
|
||||
|
||||
\membersection{wxFrame::SetStatusBar}\label{wxframesetstatusbar}
|
||||
|
||||
\func{void}{SetStatusBar}{\param{wxStatusBar*}{ statusBar}}
|
||||
|
@@ -48,6 +48,14 @@ provided array. {\it fillStyle} parameter may have values
|
||||
|
||||
{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWindows ports.
|
||||
|
||||
\func{}{wxRegion}{\param{const wxBitmap&}{ bmp},
|
||||
\param{const wxColour&}{ transColour = wxNullColour},
|
||||
\param{int}{ tolerance = 0}}
|
||||
|
||||
Constructs a region using the non-transparent pixels of a bitmap. See
|
||||
\helpref{Union}{wxregionunion} for more details.
|
||||
|
||||
|
||||
\membersection{wxRegion::\destruct{wxRegion}}
|
||||
|
||||
\func{}{\destruct{wxRegion}}{\void}
|
||||
@@ -85,6 +93,13 @@ The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
|
||||
On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
|
||||
all or some part of the region is contained in this region.
|
||||
|
||||
\membersection{wxRegion::ConvertToBitmap}\label{wxregionconverttobitmap}
|
||||
|
||||
\constfunc{wxBitmap}{ConvertToBitmap}{}
|
||||
|
||||
Convert the region to a black and white bitmap with the black pixels
|
||||
being inside the region.
|
||||
|
||||
\membersection{wxRegion::GetBox}\label{wxregiongetbox}
|
||||
|
||||
\constfunc{void}{GetBox}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}}
|
||||
@@ -168,6 +183,15 @@ Finds the union of this region and another, rectangular region.
|
||||
|
||||
Finds the union of this region and another region.
|
||||
|
||||
\func{bool}{Union}{\param{const wxBitmap&}{ bmp},
|
||||
\param{const wxColour&}{ transColour = wxNullColour},
|
||||
\param{int}{ tolerance = 0}}
|
||||
|
||||
Finds the union of this region and the the non-transparent pixels of a
|
||||
bitmap. If the bitmap has a mask then it will be used, otherwise the
|
||||
colour to be treated as transparent may be specified, along with an
|
||||
optional colour tolerance value.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
{\tt TRUE} if successful, {\tt FALSE} otherwise.
|
||||
|
@@ -71,6 +71,14 @@ public:
|
||||
}
|
||||
|
||||
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
~wxRegion();
|
||||
|
||||
wxRegion( const wxRegion& region )
|
||||
@@ -114,6 +122,19 @@ public:
|
||||
wxRegionContain Contains(const wxPoint& pt) const;
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
|
||||
public:
|
||||
// Init with GdkRegion, set ref count to 2 so that
|
||||
// the C++ class will not destroy the region!
|
||||
|
@@ -60,6 +60,8 @@ public:
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
virtual bool SetShape(const wxRegion& region);
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
|
@@ -71,6 +71,14 @@ public:
|
||||
}
|
||||
|
||||
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
~wxRegion();
|
||||
|
||||
wxRegion( const wxRegion& region )
|
||||
@@ -114,6 +122,19 @@ public:
|
||||
wxRegionContain Contains(const wxPoint& pt) const;
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
|
||||
public:
|
||||
// Init with GdkRegion, set ref count to 2 so that
|
||||
// the C++ class will not destroy the region!
|
||||
|
@@ -60,6 +60,8 @@ public:
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; };
|
||||
|
||||
virtual bool SetShape(const wxRegion& region);
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
|
@@ -45,6 +45,13 @@ public:
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion( WXHRGN hRegion );
|
||||
wxRegion();
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
~wxRegion();
|
||||
|
||||
//# Copying
|
||||
@@ -110,6 +117,18 @@ public:
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
// Internal
|
||||
bool Combine(long x, long y, long width, long height, wxRegionOp op);
|
||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
||||
|
@@ -58,6 +58,8 @@ public:
|
||||
virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
|
||||
virtual void Restore();
|
||||
|
||||
virtual bool SetShape(const wxRegion& region);
|
||||
|
||||
virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style) = wxFULLSCREEN_ALL)
|
||||
{ return FALSE; }
|
||||
virtual bool IsFullScreen() const { return FALSE; }
|
||||
|
@@ -41,6 +41,12 @@ public:
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion(const MGLRegion& region);
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
wxRegion();
|
||||
~wxRegion();
|
||||
@@ -97,6 +103,19 @@ public:
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
|
||||
// implementation from now on:
|
||||
const MGLRegion& GetMGLRegion() const;
|
||||
|
||||
|
@@ -48,6 +48,12 @@ public:
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion();
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
~wxRegion();
|
||||
|
||||
//# Copying
|
||||
@@ -101,6 +107,18 @@ public:
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
// Internal
|
||||
bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op);
|
||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
||||
|
@@ -48,6 +48,12 @@ public:
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion(WXHRGN hRegion); // Hangs on to this region
|
||||
wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
virtual ~wxRegion();
|
||||
|
||||
@@ -108,6 +114,18 @@ public:
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
// Internal
|
||||
bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op);
|
||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
||||
|
@@ -58,6 +58,8 @@ public:
|
||||
virtual void SetIcons(const wxIconBundle& icons );
|
||||
virtual void Restore();
|
||||
|
||||
virtual bool SetShape(const wxRegion& region);
|
||||
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
|
@@ -73,6 +73,14 @@ public:
|
||||
}
|
||||
|
||||
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
|
||||
wxRegion( const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
~wxRegion();
|
||||
|
||||
wxRegion( const wxRegion& region ) { Ref(region); }
|
||||
@@ -114,6 +122,19 @@ public:
|
||||
wxRegionContain Contains(const wxPoint& pt) const;
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
|
||||
|
||||
public:
|
||||
WXRegion *GetX11Region() const;
|
||||
|
||||
|
12
samples/configure
vendored
12
samples/configure
vendored
@@ -693,15 +693,21 @@ trap 'rm -fr `echo "
|
||||
mobile/Makefile
|
||||
mobile/wxedit/Makefile
|
||||
mobile/styles/Makefile
|
||||
multimon/Makefile
|
||||
nativedlg/Makefile
|
||||
newgrid/Makefile
|
||||
notebook/Makefile
|
||||
oleauto/Makefile
|
||||
ownerdrw/Makefile
|
||||
png/Makefile
|
||||
printing/Makefile
|
||||
proplist/Makefile
|
||||
propsize/Makefile
|
||||
regtest/Makefile
|
||||
resource/Makefile
|
||||
rotate/Makefile
|
||||
sashtest/Makefile
|
||||
shaped/Makefile
|
||||
scroll/Makefile
|
||||
scrollsub/Makefile
|
||||
sockets/Makefile
|
||||
@@ -847,15 +853,21 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
||||
mobile/Makefile
|
||||
mobile/wxedit/Makefile
|
||||
mobile/styles/Makefile
|
||||
multimon/Makefile
|
||||
nativedlg/Makefile
|
||||
newgrid/Makefile
|
||||
notebook/Makefile
|
||||
oleauto/Makefile
|
||||
ownerdrw/Makefile
|
||||
png/Makefile
|
||||
printing/Makefile
|
||||
proplist/Makefile
|
||||
propsize/Makefile
|
||||
regtest/Makefile
|
||||
resource/Makefile
|
||||
rotate/Makefile
|
||||
sashtest/Makefile
|
||||
shaped/Makefile
|
||||
scroll/Makefile
|
||||
scrollsub/Makefile
|
||||
sockets/Makefile
|
||||
|
@@ -77,6 +77,7 @@ AC_OUTPUT([
|
||||
resource/Makefile
|
||||
rotate/Makefile
|
||||
sashtest/Makefile
|
||||
shaped/Makefile
|
||||
scroll/Makefile
|
||||
scrollsub/Makefile
|
||||
sockets/Makefile
|
||||
|
@@ -42,7 +42,6 @@
|
||||
#endif
|
||||
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
@@ -155,7 +154,7 @@ ShapedFrame::ShapedFrame()
|
||||
m_bmp = wxBitmap("star.png", wxBITMAP_TYPE_PNG);
|
||||
SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
|
||||
SetToolTip(wxT("Right-click to exit"));
|
||||
#ifdef __WXMSW__
|
||||
#ifdef __wxMSW__
|
||||
// On wxGTK we can't do this yet because the window hasn't been created
|
||||
// yet so we wait until the EVT_WINDOW_CREATE event happens. On wxMSW it
|
||||
// has been created so we set the shape now.
|
||||
|
@@ -102,6 +102,7 @@ ALL_HEADERS = \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
db.h \
|
||||
dbkeyg.h \
|
||||
dbtable.h \
|
||||
dde.h \
|
||||
debug.h \
|
||||
|
@@ -142,6 +142,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -730,6 +731,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -987,4 +987,43 @@ void wxTopLevelWindowGTK::RemoveGrab()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// helper
|
||||
static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region)
|
||||
{
|
||||
if (window)
|
||||
{
|
||||
if (region.IsEmpty())
|
||||
{
|
||||
gdk_window_shape_combine_mask(window, NULL, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0);
|
||||
#else
|
||||
wxBitmap bmp = region.ConvertToBitmap();
|
||||
bmp.SetMask(new wxMask(bmp, *wxWHITE));
|
||||
GdkBitmap* mask = bmp.GetMask()->GetBitmap();
|
||||
gdk_window_shape_combine_mask(window, mask, 0, 0);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool wxTopLevelWindowGTK::SetShape(const wxRegion& region)
|
||||
{
|
||||
GdkWindow *window = NULL;
|
||||
if (m_wxwindow)
|
||||
{
|
||||
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||
do_shape_combine_region(window, region);
|
||||
}
|
||||
window = m_widget->window;
|
||||
return do_shape_combine_region(window, region);
|
||||
}
|
||||
|
||||
// vi:sts=4:sw=4:et
|
||||
|
@@ -142,6 +142,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -730,6 +731,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -987,4 +987,43 @@ void wxTopLevelWindowGTK::RemoveGrab()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// helper
|
||||
static bool do_shape_combine_region(GdkWindow* window, const wxRegion& region)
|
||||
{
|
||||
if (window)
|
||||
{
|
||||
if (region.IsEmpty())
|
||||
{
|
||||
gdk_window_shape_combine_mask(window, NULL, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
gdk_window_shape_combine_region(window, region.GetRegion(), 0, 0);
|
||||
#else
|
||||
wxBitmap bmp = region.ConvertToBitmap();
|
||||
bmp.SetMask(new wxMask(bmp, *wxWHITE));
|
||||
GdkBitmap* mask = bmp.GetMask()->GetBitmap();
|
||||
gdk_window_shape_combine_mask(window, mask, 0, 0);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool wxTopLevelWindowGTK::SetShape(const wxRegion& region)
|
||||
{
|
||||
GdkWindow *window = NULL;
|
||||
if (m_wxwindow)
|
||||
{
|
||||
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||
do_shape_combine_region(window, region);
|
||||
}
|
||||
window = m_widget->window;
|
||||
return do_shape_combine_region(window, region);
|
||||
}
|
||||
|
||||
// vi:sts=4:sw=4:et
|
||||
|
@@ -139,6 +139,7 @@ ALL_SOURCES = \
|
||||
common/quantize.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -759,6 +760,7 @@ COMMONOBJS = \
|
||||
quantize.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -787,3 +787,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
|
||||
SetPort( formerPort ) ;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -139,6 +139,7 @@ ALL_SOURCES = \
|
||||
common/quantize.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -759,6 +760,7 @@ COMMONOBJS = \
|
||||
quantize.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -787,3 +787,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
|
||||
SetPort( formerPort ) ;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -144,6 +144,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -655,6 +656,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -186,6 +186,7 @@ COMMONOBJS = &
|
||||
radiocmn.obj &
|
||||
regex.obj &
|
||||
resource.obj &
|
||||
rgncmn.obj &
|
||||
sckaddr.obj &
|
||||
sckfile.obj &
|
||||
sckipc.obj &
|
||||
@@ -822,6 +823,9 @@ regex.obj: $(COMMDIR)\regex.cpp
|
||||
resource.obj: $(COMMDIR)\resource.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
rgncmn.obj: $(COMMDIR)\rgncmn.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
sckaddr.obj: $(COMMDIR)\sckaddr.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
|
@@ -142,6 +142,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -721,6 +722,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -127,6 +127,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -797,6 +798,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -724,6 +724,47 @@ bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMSW::SetShape(const wxRegion& region)
|
||||
{
|
||||
// The empty region signifies that the shape should be removed from the
|
||||
// window.
|
||||
if ( region.IsEmpty() )
|
||||
{
|
||||
if (::SetWindowRgn(GetHwnd(), NULL, TRUE) == 0)
|
||||
{
|
||||
wxLogLastError(_T("SetWindowRgn"));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Windows takes ownership of the region, so
|
||||
// we'll have to make a copy of the region to give to it.
|
||||
DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, NULL);
|
||||
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
|
||||
::GetRegionData(GetHrgnOf(region), noBytes, rgnData);
|
||||
HRGN hrgn = ::ExtCreateRegion(NULL, noBytes, rgnData);
|
||||
delete[] (char*) rgnData;
|
||||
|
||||
// SetWindowRgn expects the region to be in coordinants
|
||||
// relative to the window, not the client area. Figure
|
||||
// out the offset, if any.
|
||||
RECT rect;
|
||||
DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
|
||||
DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE);
|
||||
::GetClientRect(GetHwnd(), &rect);
|
||||
::AdjustWindowRectEx(&rect, dwStyle, FALSE, dwExStyle);
|
||||
::OffsetRgn(hrgn, -rect.left, -rect.top);
|
||||
|
||||
// Now call the shape API with the new region.
|
||||
if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0)
|
||||
{
|
||||
wxLogLastError(_T("SetWindowRgn"));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTopLevelWindow event handling
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -872,3 +913,4 @@ HWND wxTLWHiddenParentModule::GetHWND()
|
||||
return ms_hwnd;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -175,6 +175,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -744,6 +745,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -13,7 +13,7 @@ from distutils.command.install_data import install_data
|
||||
# flags and values that affect this script
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
VERSION = "2.4.0.7"
|
||||
VERSION = "2.4.0.8p1"
|
||||
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
||||
AUTHOR = "Robin Dunn"
|
||||
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
|
||||
|
@@ -517,10 +517,10 @@ def EVT_SASH_DRAGGED_RANGE(win, id1, id2, func):
|
||||
win.Connect(id1, id2, wxEVT_SASH_DRAGGED, func)
|
||||
|
||||
def EVT_QUERY_LAYOUT_INFO(win, func):
|
||||
win.Connect(-1, -1, wxEVT_EVT_QUERY_LAYOUT_INFO, func)
|
||||
win.Connect(-1, -1, wxEVT_QUERY_LAYOUT_INFO, func)
|
||||
|
||||
def EVT_CALCULATE_LAYOUT(win, func):
|
||||
win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func)
|
||||
win.Connect(-1, -1, wxEVT_CALCULATE_LAYOUT, func)
|
||||
|
||||
|
||||
#wxSplitterWindow
|
||||
@@ -730,7 +730,7 @@ def wxCallAfter(callable, *args, **kw):
|
||||
|
||||
global _wxCallAfterId
|
||||
if _wxCallAfterId is None:
|
||||
_wxCallAfterId = wxNewId()
|
||||
_wxCallAfterId = wxNewEventType()
|
||||
app.Connect(-1, -1, _wxCallAfterId,
|
||||
lambda event: apply(event.callable, event.args, event.kw) )
|
||||
evt = wxPyEvent()
|
||||
|
@@ -116,6 +116,12 @@ public:
|
||||
|
||||
virtual void SetTitle(const wxString& title);
|
||||
virtual wxString GetTitle() const;
|
||||
|
||||
// Set the shape of the window to the given region.
|
||||
// Returns TRUE if the platform supports this feature (and the operation
|
||||
// is successful.)
|
||||
virtual bool SetShape(const wxRegion& region);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -1043,8 +1043,12 @@ public:
|
||||
#ifndef __WXMAC__
|
||||
%name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
|
||||
#endif
|
||||
%name(wxRegionFromBitmap)wxRegion(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
~wxRegion();
|
||||
|
||||
|
||||
void Clear();
|
||||
#ifndef __WXMAC__
|
||||
bool Offset(wxCoord x, wxCoord y);
|
||||
@@ -1074,6 +1078,18 @@ public:
|
||||
bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
%name(XorRect)bool Xor(const wxRect& rect);
|
||||
%name(XorRegion)bool Xor(const wxRegion& region);
|
||||
|
||||
// Convert the region to a B&W bitmap with the black pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap();
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. If the bitmap has a mask then it will be used,
|
||||
// otherwise the colour to be treated as transparent may be specified,
|
||||
// along with an optional tolerance value.
|
||||
%name(UnionBitmap)bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour = wxNullColour,
|
||||
int tolerance = 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -1103,6 +1119,7 @@ public:
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
%readonly
|
||||
%{
|
||||
#if 0
|
||||
|
Reference in New Issue
Block a user