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:
Robin Dunn
2003-03-29 19:03:04 +00:00
parent 9f5fc44733
commit 8c879ff9c5
38 changed files with 971 additions and 614 deletions

1036
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -228,7 +228,7 @@ case "${host}" in
dnl dnl
dnl Both archive libraries and shared libraries on AIX have an .a dnl Both archive libraries and shared libraries on AIX have an .a
dnl extension. This will explain why you can't link with an .so and dnl extension. This will explain why you can't link with an .so and
dnl why it works with the name changed to .a. dnl why it works with the name changed to .a.
SO_SUFFIX=a SO_SUFFIX=a
AC_DEFINE(__AIX__) AC_DEFINE(__AIX__)
AC_DEFINE(__SYSV__) AC_DEFINE(__SYSV__)
@@ -2211,7 +2211,7 @@ equivalent variable and GTK+ is version 1.2.3 or above.
AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.]) AC_MSG_ERROR([Cannot find MGL libraries, make sure they are compiled.])
fi fi
AC_MSG_RESULT("$MGL_ROOT/lib/$mgl_lib_type/$mgl_os") AC_MSG_RESULT("$MGL_ROOT/lib/$mgl_lib_type/$mgl_os")
wxUSE_UNIVERSAL="yes" wxUSE_UNIVERSAL="yes"
TOOLKIT_INCLUDE="-I$MGL_ROOT/include" TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
@@ -2797,7 +2797,7 @@ case "${host}" in
*-*-darwin* ) *-*-darwin* )
dnl Under Mac OS X, the naming conventions for shared libraries dnl Under Mac OS X, the naming conventions for shared libraries
dnl are different: the number precedes the suffix. dnl are different: the number precedes the suffix.
WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.${SO_SUFFIX}" WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.${SO_SUFFIX}"
WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY_GL}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.${SO_SUFFIX}" WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY_GL}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.${SO_SUFFIX}"
@@ -5301,7 +5301,7 @@ if test "$wxUSE_GUI" = "yes"; then
dnl ipc, mfc, nativdlg, oleauto, ownerdrw dnl ipc, mfc, nativdlg, oleauto, ownerdrw
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs \ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs \
drawing dynamic erase event exec font image \ 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 dnl this is needed to be able to find AFM files
CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)" CPPFLAGS="$CPPFLAGS \$(EXTRADEFS) \$(APPEXTRADEFS)"

View File

@@ -217,6 +217,7 @@ protocol.cpp Common Socket,Base
quantize.cpp Common quantize.cpp Common
radiocmn.cpp Common NotMac radiocmn.cpp Common NotMac
regex.cpp Common Base regex.cpp Common Base
rgncmn.cpp Common
resource.cpp Common resource.cpp Common
sckaddr.cpp Common Socket,Base sckaddr.cpp Common Socket,Base
sckfile.cpp Common Socket,Base sckfile.cpp Common Socket,Base

View File

@@ -51,7 +51,7 @@ caption. When pressed, Windows will go into a context-sensitive help mode and wx
a wxEVT\_HELP event if the user clicked on an application window. {\it Note} that this is an extended a wxEVT\_HELP event if the user clicked on an application window. {\it Note} that this is an extended
style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction). style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction).
You cannot use this style together with wxMAXIMIZE\_BOX or wxMINIMIZE\_BOX, so You cannot use this style together with wxMAXIMIZE\_BOX or wxMINIMIZE\_BOX, so
you should use you should use
{\tt wxDEFAULT\_FRAME\_STYLE \& (wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the {\tt wxDEFAULT\_FRAME\_STYLE \& (wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the
frames having this style (the dialogs don't have minimize nor maximize box by frames having this style (the dialogs don't have minimize nor maximize box by
default)} default)}
@@ -476,7 +476,7 @@ Sets the icons for this frame.
See also \helpref{wxIconBundle}{wxiconbundle}. See also \helpref{wxIconBundle}{wxiconbundle}.
% VZ: we don't have all this any more (18.08.00) % VZ: we don't have all this any more (18.08.00)
% %
%Under Windows, instead of using {\bf SetIcon}, you can add the %Under Windows, instead of using {\bf SetIcon}, you can add the
%following lines to your MS Windows resource file: %following lines to your MS Windows resource file:
@@ -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}. \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} \membersection{wxFrame::SetStatusBar}\label{wxframesetstatusbar}
\func{void}{SetStatusBar}{\param{wxStatusBar*}{ statusBar}} \func{void}{SetStatusBar}{\param{wxStatusBar*}{ statusBar}}

View File

@@ -43,11 +43,19 @@ Constructs a region by copying another region.
\func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}} \func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}}
Constructs a region corresponding to the polygon made of {\it n} points in the Constructs a region corresponding to the polygon made of {\it n} points in the
provided array. {\it fillStyle} parameter may have values provided array. {\it fillStyle} parameter may have values
{\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}. {\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}.
{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWindows ports. {\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}} \membersection{wxRegion::\destruct{wxRegion}}
\func{}{\destruct{wxRegion}}{\void} \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 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. 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} \membersection{wxRegion::GetBox}\label{wxregiongetbox}
\constfunc{void}{GetBox}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}} \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. 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} \wxheading{Return value}
{\tt TRUE} if successful, {\tt FALSE} otherwise. {\tt TRUE} if successful, {\tt FALSE} otherwise.

View File

@@ -53,7 +53,7 @@ class wxRegion : public wxGDIObject
{ {
public: public:
wxRegion() { } wxRegion() { }
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{ {
InitRect(x, y, w, h); InitRect(x, y, w, h);
@@ -71,6 +71,14 @@ public:
} }
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); 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();
wxRegion( const wxRegion& region ) wxRegion( const wxRegion& region )
@@ -114,18 +122,31 @@ public:
wxRegionContain Contains(const wxPoint& pt) const; wxRegionContain Contains(const wxPoint& pt) const;
wxRegionContain Contains(const wxRect& rect) 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: public:
// Init with GdkRegion, set ref count to 2 so that // Init with GdkRegion, set ref count to 2 so that
// the C++ class will not destroy the region! // the C++ class will not destroy the region!
wxRegion( GdkRegion *region ); wxRegion( GdkRegion *region );
GdkRegion *GetRegion() const; GdkRegion *GetRegion() const;
protected: protected:
// ref counting code // ref counting code
virtual wxObjectRefData *CreateRefData() const; virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// common part of ctors for a rectangle region // common part of ctors for a rectangle region
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);

View File

@@ -60,6 +60,8 @@ public:
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual bool IsFullScreen() const { return m_fsIsShowing; }; virtual bool IsFullScreen() const { return m_fsIsShowing; };
virtual bool SetShape(const wxRegion& region);
virtual bool Show(bool show = TRUE); virtual bool Show(bool show = TRUE);
virtual void SetTitle( const wxString &title ); virtual void SetTitle( const wxString &title );

View File

@@ -53,7 +53,7 @@ class wxRegion : public wxGDIObject
{ {
public: public:
wxRegion() { } wxRegion() { }
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{ {
InitRect(x, y, w, h); InitRect(x, y, w, h);
@@ -71,6 +71,14 @@ public:
} }
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); 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();
wxRegion( const wxRegion& region ) wxRegion( const wxRegion& region )
@@ -114,18 +122,31 @@ public:
wxRegionContain Contains(const wxPoint& pt) const; wxRegionContain Contains(const wxPoint& pt) const;
wxRegionContain Contains(const wxRect& rect) 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: public:
// Init with GdkRegion, set ref count to 2 so that // Init with GdkRegion, set ref count to 2 so that
// the C++ class will not destroy the region! // the C++ class will not destroy the region!
wxRegion( GdkRegion *region ); wxRegion( GdkRegion *region );
GdkRegion *GetRegion() const; GdkRegion *GetRegion() const;
protected: protected:
// ref counting code // ref counting code
virtual wxObjectRefData *CreateRefData() const; virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// common part of ctors for a rectangle region // common part of ctors for a rectangle region
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);

View File

@@ -60,6 +60,8 @@ public:
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
virtual bool IsFullScreen() const { return m_fsIsShowing; }; virtual bool IsFullScreen() const { return m_fsIsShowing; };
virtual bool SetShape(const wxRegion& region);
virtual bool Show(bool show = TRUE); virtual bool Show(bool show = TRUE);
virtual void SetTitle( const wxString &title ); virtual void SetTitle( const wxString &title );

View File

@@ -45,19 +45,26 @@ public:
wxRegion(const wxRect& rect); wxRegion(const wxRect& rect);
wxRegion( WXHRGN hRegion ); wxRegion( WXHRGN hRegion );
wxRegion(); wxRegion();
wxRegion( const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0)
{
Union(bmp, transColour, tolerance);
}
~wxRegion(); ~wxRegion();
//# Copying //# Copying
wxRegion(const wxRegion& r) wxRegion(const wxRegion& r)
: wxGDIObject() : wxGDIObject()
{ Ref(r); } { Ref(r); }
wxRegion& operator = (const wxRegion& r) wxRegion& operator = (const wxRegion& r)
{ Ref(r); return (*this); } { Ref(r); return (*this); }
//# Modify region //# Modify region
// Clear current region // Clear current region
void Clear(); void Clear();
// Union rectangle or region with this. // Union rectangle or region with this.
bool Union(long x, long y, long width, long height) bool Union(long x, long y, long width, long height)
{ return Combine(x, y, width, height, wxRGN_OR); } { return Combine(x, y, width, height, wxRGN_OR); }
@@ -65,7 +72,7 @@ public:
{ return Combine(rect, wxRGN_OR); } { return Combine(rect, wxRGN_OR); }
bool Union(const wxRegion& region) bool Union(const wxRegion& region)
{ return Combine(region, wxRGN_OR); } { return Combine(region, wxRGN_OR); }
// Intersect rectangle or region with this. // Intersect rectangle or region with this.
bool Intersect(long x, long y, long width, long height) bool Intersect(long x, long y, long width, long height)
{ return Combine(x, y, width, height, wxRGN_AND); } { return Combine(x, y, width, height, wxRGN_AND); }
@@ -73,7 +80,7 @@ public:
{ return Combine(rect, wxRGN_AND); } { return Combine(rect, wxRGN_AND); }
bool Intersect(const wxRegion& region) bool Intersect(const wxRegion& region)
{ return Combine(region, wxRGN_AND); } { return Combine(region, wxRGN_AND); }
// Subtract rectangle or region from this: // Subtract rectangle or region from this:
// Combines the parts of 'this' that are not part of the second region. // Combines the parts of 'this' that are not part of the second region.
bool Subtract(long x, long y, long width, long height) bool Subtract(long x, long y, long width, long height)
@@ -82,7 +89,7 @@ public:
{ return Combine(rect, wxRGN_DIFF); } { return Combine(rect, wxRGN_DIFF); }
bool Subtract(const wxRegion& region) bool Subtract(const wxRegion& region)
{ return Combine(region, wxRGN_DIFF); } { return Combine(region, wxRGN_DIFF); }
// XOR: the union of two combined regions except for any overlapping areas. // XOR: the union of two combined regions except for any overlapping areas.
bool Xor(long x, long y, long width, long height) bool Xor(long x, long y, long width, long height)
{ return Combine(x, y, width, height, wxRGN_XOR); } { return Combine(x, y, width, height, wxRGN_XOR); }
@@ -90,16 +97,16 @@ public:
{ return Combine(rect, wxRGN_XOR); } { return Combine(rect, wxRGN_XOR); }
bool Xor(const wxRegion& region) bool Xor(const wxRegion& region)
{ return Combine(region, wxRGN_XOR); } { return Combine(region, wxRGN_XOR); }
//# Information on region //# Information on region
// Outer bounds of region // Outer bounds of region
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const; void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
wxRect GetBox() const ; wxRect GetBox() const ;
// Is region empty? // Is region empty?
bool Empty() const; bool Empty() const;
inline bool IsEmpty() const { return Empty(); } inline bool IsEmpty() const { return Empty(); }
//# Tests //# Tests
// Does the region contain the point (x,y)? // Does the region contain the point (x,y)?
wxRegionContain Contains(long x, long y) const; wxRegionContain Contains(long x, long y) const;
@@ -109,7 +116,19 @@ public:
wxRegionContain Contains(long x, long y, long w, long h) const; wxRegionContain Contains(long x, long y, long w, long h) const;
// Does the region contain the rectangle rect? // Does the region contain the rectangle rect?
wxRegionContain Contains(const wxRect& rect) 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);
// Internal // Internal
bool Combine(long x, long y, long width, long height, wxRegionOp op); bool Combine(long x, long y, long width, long height, wxRegionOp op);
bool Combine(const wxRegion& region, wxRegionOp op); bool Combine(const wxRegion& region, wxRegionOp op);
@@ -120,7 +139,7 @@ public:
class WXDLLEXPORT wxRegionIterator : public wxObject class WXDLLEXPORT wxRegionIterator : public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxRegionIterator) DECLARE_DYNAMIC_CLASS(wxRegionIterator)
public: public:
wxRegionIterator(); wxRegionIterator();
wxRegionIterator(const wxRegion& region); wxRegionIterator(const wxRegion& region);
@@ -131,13 +150,13 @@ public:
void Reset() { m_current = 0; } void Reset() { m_current = 0; }
void Reset(const wxRegion& region); void Reset(const wxRegion& region);
operator bool () const { return m_current < m_numRects; } operator bool () const { return m_current < m_numRects; }
bool HaveRects() const { return m_current < m_numRects; } bool HaveRects() const { return m_current < m_numRects; }
wxRegionIterator& operator++(); wxRegionIterator& operator++();
wxRegionIterator operator++(int); wxRegionIterator operator++(int);
long GetX() const; long GetX() const;
long GetY() const; long GetY() const;
long GetW() const; long GetW() const;

View File

@@ -58,6 +58,8 @@ public:
virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); } virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
virtual void Restore(); virtual void Restore();
virtual bool SetShape(const wxRegion& region);
virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style) = wxFULLSCREEN_ALL) virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style) = wxFULLSCREEN_ALL)
{ return FALSE; } { return FALSE; }
virtual bool IsFullScreen() const { return FALSE; } virtual bool IsFullScreen() const { return FALSE; }

View File

@@ -24,14 +24,14 @@ class WXDLLEXPORT wxRect;
class WXDLLEXPORT wxPoint; class WXDLLEXPORT wxPoint;
class MGLRegion; class MGLRegion;
enum wxRegionContain enum wxRegionContain
{ {
wxOutRegion = 0, wxOutRegion = 0,
wxPartRegion = 1, wxPartRegion = 1,
wxInRegion = 2 wxInRegion = 2
}; };
class WXDLLEXPORT wxRegion : public wxGDIObject class WXDLLEXPORT wxRegion : public wxGDIObject
{ {
DECLARE_DYNAMIC_CLASS(wxRegion); DECLARE_DYNAMIC_CLASS(wxRegion);
friend class WXDLLEXPORT wxRegionIterator; friend class WXDLLEXPORT wxRegionIterator;
@@ -41,6 +41,12 @@ public:
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect); wxRegion(const wxRect& rect);
wxRegion(const MGLRegion& region); wxRegion(const MGLRegion& region);
wxRegion( const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0)
{
Union(bmp, transColour, tolerance);
}
wxRegion(); wxRegion();
~wxRegion(); ~wxRegion();
@@ -96,7 +102,20 @@ public:
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const; wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const;
// Does the region contain the rectangle rect? // Does the region contain the rectangle rect?
wxRegionContain Contains(const wxRect& rect) 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);
// implementation from now on: // implementation from now on:
const MGLRegion& GetMGLRegion() const; const MGLRegion& GetMGLRegion() const;
@@ -109,7 +128,7 @@ protected:
WX_DECLARE_EXPORTED_LIST(wxRect, wxRegionRectList); WX_DECLARE_EXPORTED_LIST(wxRect, wxRegionRectList);
class WXDLLEXPORT wxRegionIterator : public wxObject class WXDLLEXPORT wxRegionIterator : public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxRegionIterator); DECLARE_DYNAMIC_CLASS(wxRegionIterator);
public: public:

View File

@@ -48,49 +48,55 @@ public:
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect); wxRegion(const wxRect& rect);
wxRegion(); wxRegion();
wxRegion( const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0)
{
Union(bmp, transColour, tolerance);
}
~wxRegion(); ~wxRegion();
//# Copying //# Copying
inline wxRegion(const wxRegion& r) inline wxRegion(const wxRegion& r)
{ Ref(r); } { Ref(r); }
inline wxRegion& operator = (const wxRegion& r) inline wxRegion& operator = (const wxRegion& r)
{ Ref(r); return (*this); } { Ref(r); return (*this); }
//# Modify region //# Modify region
// Clear current region // Clear current region
void Clear(); void Clear();
// Union rectangle or region with this. // Union rectangle or region with this.
inline bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_OR); } inline bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_OR); }
inline bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); } inline bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); }
inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); } inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); }
// Intersect rectangle or region with this. // Intersect rectangle or region with this.
inline bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_AND); } inline bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_AND); }
inline bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); } inline bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); }
inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); } inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); }
// Subtract rectangle or region from this: // Subtract rectangle or region from this:
// Combines the parts of 'this' that are not part of the second region. // Combines the parts of 'this' that are not part of the second region.
inline bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_DIFF); } inline bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_DIFF); }
inline bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); } inline bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); }
inline bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); } inline bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); }
// XOR: the union of two combined regions except for any overlapping areas. // XOR: the union of two combined regions except for any overlapping areas.
inline bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_XOR); } inline bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_XOR); }
inline bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); } inline bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); }
inline bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); } inline bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); }
//# Information on region //# Information on region
// Outer bounds of region // Outer bounds of region
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const; void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
wxRect GetBox() const ; wxRect GetBox() const ;
// Is region empty? // Is region empty?
bool Empty() const; bool Empty() const;
inline bool IsEmpty() const { return Empty(); } inline bool IsEmpty() const { return Empty(); }
bool Ok() const { return (m_refData != NULL) ; } bool Ok() const { return (m_refData != NULL) ; }
//# Tests //# Tests
// Does the region contain the point (x,y)? // Does the region contain the point (x,y)?
wxRegionContain Contains(wxCoord x, wxCoord y) const; wxRegionContain Contains(wxCoord x, wxCoord y) const;
@@ -100,15 +106,27 @@ public:
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const; wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const;
// Does the region contain the rectangle rect? // Does the region contain the rectangle rect?
wxRegionContain Contains(const wxRect& rect) 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);
// Internal // Internal
bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op); bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op);
bool Combine(const wxRegion& region, wxRegionOp op); bool Combine(const wxRegion& region, wxRegionOp op);
bool Combine(const wxRect& rect, wxRegionOp op); bool Combine(const wxRect& rect, wxRegionOp op);
// Get the internal Region handle // Get the internal Region handle
WXRegion GetXRegion() const; WXRegion GetXRegion() const;
// 'Naughty' functions that allow wxWindows to use a list of rects // 'Naughty' functions that allow wxWindows to use a list of rects
// instead of the region, in certain circumstances (e.g. when // instead of the region, in certain circumstances (e.g. when
// making a region out of the update rectangles). // making a region out of the update rectangles).
@@ -126,16 +144,16 @@ public:
wxRegionIterator(); wxRegionIterator();
wxRegionIterator(const wxRegion& region); wxRegionIterator(const wxRegion& region);
~wxRegionIterator(); ~wxRegionIterator();
void Reset() { m_current = 0; } void Reset() { m_current = 0; }
void Reset(const wxRegion& region); void Reset(const wxRegion& region);
operator bool () const { return m_current < m_numRects; } operator bool () const { return m_current < m_numRects; }
bool HaveRects() const { return m_current < m_numRects; } bool HaveRects() const { return m_current < m_numRects; }
void operator ++ (); void operator ++ ();
void operator ++ (int); void operator ++ (int);
wxCoord GetX() const; wxCoord GetX() const;
wxCoord GetY() const; wxCoord GetY() const;
wxCoord GetW() const; wxCoord GetW() const;
@@ -143,7 +161,7 @@ public:
wxCoord GetH() const; wxCoord GetH() const;
wxCoord GetHeight() const { return GetH(); } wxCoord GetHeight() const { return GetH(); }
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
private: private:
size_t m_current; size_t m_current;
size_t m_numRects; size_t m_numRects;

View File

@@ -48,6 +48,12 @@ public:
wxRegion(const wxRect& rect); wxRegion(const wxRect& rect);
wxRegion(WXHRGN hRegion); // Hangs on to this region wxRegion(WXHRGN hRegion); // Hangs on to this region
wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); 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(); virtual ~wxRegion();
@@ -108,6 +114,18 @@ public:
// Does the region contain the rectangle rect? // Does the region contain the rectangle rect?
wxRegionContain Contains(const wxRect& rect) 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);
// Internal // Internal
bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op); bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op);
bool Combine(const wxRegion& region, wxRegionOp op); bool Combine(const wxRegion& region, wxRegionOp op);

View File

@@ -58,6 +58,8 @@ public:
virtual void SetIcons(const wxIconBundle& icons ); virtual void SetIcons(const wxIconBundle& icons );
virtual void Restore(); virtual void Restore();
virtual bool SetShape(const wxRegion& region);
virtual bool Show(bool show = TRUE); virtual bool Show(bool show = TRUE);
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);

View File

@@ -73,6 +73,14 @@ public:
} }
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); 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();
wxRegion( const wxRegion& region ) { Ref(region); } wxRegion( const wxRegion& region ) { Ref(region); }
@@ -114,6 +122,19 @@ public:
wxRegionContain Contains(const wxPoint& pt) const; wxRegionContain Contains(const wxPoint& pt) const;
wxRegionContain Contains(const wxRect& rect) 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: public:
WXRegion *GetX11Region() const; WXRegion *GetX11Region() const;
@@ -121,7 +142,7 @@ protected:
// ref counting code // ref counting code
virtual wxObjectRefData *CreateRefData() const; virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// common part of ctors for a rectangle region // common part of ctors for a rectangle region
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);

12
samples/configure vendored
View File

@@ -693,15 +693,21 @@ trap 'rm -fr `echo "
mobile/Makefile mobile/Makefile
mobile/wxedit/Makefile mobile/wxedit/Makefile
mobile/styles/Makefile mobile/styles/Makefile
multimon/Makefile
nativedlg/Makefile
newgrid/Makefile newgrid/Makefile
notebook/Makefile notebook/Makefile
oleauto/Makefile
ownerdrw/Makefile
png/Makefile png/Makefile
printing/Makefile printing/Makefile
proplist/Makefile proplist/Makefile
propsize/Makefile propsize/Makefile
regtest/Makefile
resource/Makefile resource/Makefile
rotate/Makefile rotate/Makefile
sashtest/Makefile sashtest/Makefile
shaped/Makefile
scroll/Makefile scroll/Makefile
scrollsub/Makefile scrollsub/Makefile
sockets/Makefile sockets/Makefile
@@ -847,15 +853,21 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
mobile/Makefile mobile/Makefile
mobile/wxedit/Makefile mobile/wxedit/Makefile
mobile/styles/Makefile mobile/styles/Makefile
multimon/Makefile
nativedlg/Makefile
newgrid/Makefile newgrid/Makefile
notebook/Makefile notebook/Makefile
oleauto/Makefile
ownerdrw/Makefile
png/Makefile png/Makefile
printing/Makefile printing/Makefile
proplist/Makefile proplist/Makefile
propsize/Makefile propsize/Makefile
regtest/Makefile
resource/Makefile resource/Makefile
rotate/Makefile rotate/Makefile
sashtest/Makefile sashtest/Makefile
shaped/Makefile
scroll/Makefile scroll/Makefile
scrollsub/Makefile scrollsub/Makefile
sockets/Makefile sockets/Makefile

View File

@@ -77,6 +77,7 @@ AC_OUTPUT([
resource/Makefile resource/Makefile
rotate/Makefile rotate/Makefile
sashtest/Makefile sashtest/Makefile
shaped/Makefile
scroll/Makefile scroll/Makefile
scrollsub/Makefile scrollsub/Makefile
sockets/Makefile sockets/Makefile

View File

@@ -42,7 +42,6 @@
#endif #endif
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/image.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes
@@ -155,7 +154,7 @@ ShapedFrame::ShapedFrame()
m_bmp = wxBitmap("star.png", wxBITMAP_TYPE_PNG); m_bmp = wxBitmap("star.png", wxBITMAP_TYPE_PNG);
SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight())); SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
SetToolTip(wxT("Right-click to exit")); 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 // 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 // yet so we wait until the EVT_WINDOW_CREATE event happens. On wxMSW it
// has been created so we set the shape now. // has been created so we set the shape now.

View File

@@ -102,6 +102,7 @@ ALL_HEADERS = \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
db.h \ db.h \
dbkeyg.h \
dbtable.h \ dbtable.h \
dde.h \ dde.h \
debug.h \ debug.h \

View File

@@ -142,6 +142,7 @@ ALL_SOURCES = \
common/radiocmn.cpp \ common/radiocmn.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -730,6 +731,7 @@ COMMONOBJS = \
radiocmn.o \ radiocmn.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -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 // vi:sts=4:sw=4:et

View File

@@ -142,6 +142,7 @@ ALL_SOURCES = \
common/radiocmn.cpp \ common/radiocmn.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -730,6 +731,7 @@ COMMONOBJS = \
radiocmn.o \ radiocmn.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -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 // vi:sts=4:sw=4:et

View File

@@ -139,6 +139,7 @@ ALL_SOURCES = \
common/quantize.cpp \ common/quantize.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -759,6 +760,7 @@ COMMONOBJS = \
quantize.o \ quantize.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -114,13 +114,13 @@ void wxTopLevelWindowMac::Init()
class wxMacDeferredWindowDeleter : public wxObject class wxMacDeferredWindowDeleter : public wxObject
{ {
public : public :
wxMacDeferredWindowDeleter( WindowRef windowRef ) wxMacDeferredWindowDeleter( WindowRef windowRef )
{ {
m_macWindow = windowRef ; m_macWindow = windowRef ;
} }
virtual ~wxMacDeferredWindowDeleter() virtual ~wxMacDeferredWindowDeleter()
{ {
UMADisposeWindow( (WindowRef) m_macWindow ) ; UMADisposeWindow( (WindowRef) m_macWindow ) ;
} }
protected : protected :
WindowRef m_macWindow ; WindowRef m_macWindow ;
@@ -186,7 +186,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
bool wxTopLevelWindowMac::IsMaximized() const bool wxTopLevelWindowMac::IsMaximized() const
{ {
return false ; return false ;
} }
void wxTopLevelWindowMac::Iconize(bool iconize) void wxTopLevelWindowMac::Iconize(bool iconize)
@@ -353,7 +353,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
#endif #endif
} }
} }
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ) if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
{ {
attr |= kWindowFullZoomAttribute ; attr |= kWindowFullZoomAttribute ;
@@ -399,7 +399,7 @@ void wxTopLevelWindowMac::Clear()
wxWindow::Clear() ; wxWindow::Clear() ;
} }
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding() WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
{ {
return m_macRootControl ; return m_macRootControl ;
} }
@@ -412,7 +412,7 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
BeginUpdate( (WindowRef)m_macWindow ) ; BeginUpdate( (WindowRef)m_macWindow ) ;
RgnHandle updateRgn = NewRgn(); RgnHandle updateRgn = NewRgn();
RgnHandle diffRgn = NewRgn() ; RgnHandle diffRgn = NewRgn() ;
if ( updateRgn && diffRgn ) if ( updateRgn && diffRgn )
{ {
@@ -615,7 +615,7 @@ bool wxTopLevelWindowMac::Show(bool show)
return FALSE; return FALSE;
if (show) if (show)
{ {
::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil); ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
::SelectWindow( (WindowRef)m_macWindow ) ; ::SelectWindow( (WindowRef)m_macWindow ) ;
// no need to generate events here, they will get them triggered by macos // no need to generate events here, they will get them triggered by macos
@@ -635,7 +635,7 @@ bool wxTopLevelWindowMac::Show(bool show)
} }
else else
{ {
Refresh() ; Refresh() ;
} }
return TRUE; return TRUE;
@@ -683,17 +683,17 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( doMove ) if ( doMove )
::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost ::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost
if ( doResize ) if ( doResize )
::SizeWindow((WindowRef)m_macWindow, m_width, m_height , true); ::SizeWindow((WindowRef)m_macWindow, m_width, m_height , true);
// the OS takes care of invalidating and erasing the new area so we only have to // the OS takes care of invalidating and erasing the new area so we only have to
// take care of refreshing for full repaints // take care of refreshing for full repaints
if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) ) if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
Refresh() ; Refresh() ;
if ( IsKindOf( CLASSINFO( wxFrame ) ) ) if ( IsKindOf( CLASSINFO( wxFrame ) ) )
{ {
wxFrame* frame = (wxFrame*) this ; wxFrame* frame = (wxFrame*) this ;
@@ -720,7 +720,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(event);
} }
} }
} }
/* /*
@@ -787,3 +787,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
SetPort( formerPort ) ; SetPort( formerPort ) ;
} }
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
return FALSE;
}

View File

@@ -139,6 +139,7 @@ ALL_SOURCES = \
common/quantize.cpp \ common/quantize.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -759,6 +760,7 @@ COMMONOBJS = \
quantize.o \ quantize.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -114,13 +114,13 @@ void wxTopLevelWindowMac::Init()
class wxMacDeferredWindowDeleter : public wxObject class wxMacDeferredWindowDeleter : public wxObject
{ {
public : public :
wxMacDeferredWindowDeleter( WindowRef windowRef ) wxMacDeferredWindowDeleter( WindowRef windowRef )
{ {
m_macWindow = windowRef ; m_macWindow = windowRef ;
} }
virtual ~wxMacDeferredWindowDeleter() virtual ~wxMacDeferredWindowDeleter()
{ {
UMADisposeWindow( (WindowRef) m_macWindow ) ; UMADisposeWindow( (WindowRef) m_macWindow ) ;
} }
protected : protected :
WindowRef m_macWindow ; WindowRef m_macWindow ;
@@ -186,7 +186,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
bool wxTopLevelWindowMac::IsMaximized() const bool wxTopLevelWindowMac::IsMaximized() const
{ {
return false ; return false ;
} }
void wxTopLevelWindowMac::Iconize(bool iconize) void wxTopLevelWindowMac::Iconize(bool iconize)
@@ -353,7 +353,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
#endif #endif
} }
} }
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ) if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
{ {
attr |= kWindowFullZoomAttribute ; attr |= kWindowFullZoomAttribute ;
@@ -399,7 +399,7 @@ void wxTopLevelWindowMac::Clear()
wxWindow::Clear() ; wxWindow::Clear() ;
} }
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding() WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
{ {
return m_macRootControl ; return m_macRootControl ;
} }
@@ -412,7 +412,7 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
BeginUpdate( (WindowRef)m_macWindow ) ; BeginUpdate( (WindowRef)m_macWindow ) ;
RgnHandle updateRgn = NewRgn(); RgnHandle updateRgn = NewRgn();
RgnHandle diffRgn = NewRgn() ; RgnHandle diffRgn = NewRgn() ;
if ( updateRgn && diffRgn ) if ( updateRgn && diffRgn )
{ {
@@ -615,7 +615,7 @@ bool wxTopLevelWindowMac::Show(bool show)
return FALSE; return FALSE;
if (show) if (show)
{ {
::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil); ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
::SelectWindow( (WindowRef)m_macWindow ) ; ::SelectWindow( (WindowRef)m_macWindow ) ;
// no need to generate events here, they will get them triggered by macos // no need to generate events here, they will get them triggered by macos
@@ -635,7 +635,7 @@ bool wxTopLevelWindowMac::Show(bool show)
} }
else else
{ {
Refresh() ; Refresh() ;
} }
return TRUE; return TRUE;
@@ -683,17 +683,17 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( doMove ) if ( doMove )
::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost ::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost
if ( doResize ) if ( doResize )
::SizeWindow((WindowRef)m_macWindow, m_width, m_height , true); ::SizeWindow((WindowRef)m_macWindow, m_width, m_height , true);
// the OS takes care of invalidating and erasing the new area so we only have to // the OS takes care of invalidating and erasing the new area so we only have to
// take care of refreshing for full repaints // take care of refreshing for full repaints
if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) ) if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
Refresh() ; Refresh() ;
if ( IsKindOf( CLASSINFO( wxFrame ) ) ) if ( IsKindOf( CLASSINFO( wxFrame ) ) )
{ {
wxFrame* frame = (wxFrame*) this ; wxFrame* frame = (wxFrame*) this ;
@@ -720,7 +720,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(event);
} }
} }
} }
/* /*
@@ -787,3 +787,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
SetPort( formerPort ) ; SetPort( formerPort ) ;
} }
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
return FALSE;
}

View File

@@ -144,6 +144,7 @@ ALL_SOURCES = \
common/radiocmn.cpp \ common/radiocmn.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -655,6 +656,7 @@ COMMONOBJS = \
radiocmn.o \ radiocmn.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -186,6 +186,7 @@ COMMONOBJS = &
radiocmn.obj & radiocmn.obj &
regex.obj & regex.obj &
resource.obj & resource.obj &
rgncmn.obj &
sckaddr.obj & sckaddr.obj &
sckfile.obj & sckfile.obj &
sckipc.obj & sckipc.obj &
@@ -822,6 +823,9 @@ regex.obj: $(COMMDIR)\regex.cpp
resource.obj: $(COMMDIR)\resource.cpp resource.obj: $(COMMDIR)\resource.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
rgncmn.obj: $(COMMDIR)\rgncmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
sckaddr.obj: $(COMMDIR)\sckaddr.cpp sckaddr.obj: $(COMMDIR)\sckaddr.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<

View File

@@ -142,6 +142,7 @@ ALL_SOURCES = \
common/radiocmn.cpp \ common/radiocmn.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -721,6 +722,7 @@ COMMONOBJS = \
radiocmn.o \ radiocmn.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -127,6 +127,7 @@ ALL_SOURCES = \
common/radiocmn.cpp \ common/radiocmn.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -797,6 +798,7 @@ COMMONOBJS = \
radiocmn.o \ radiocmn.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -724,6 +724,47 @@ bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
return TRUE; 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 // wxTopLevelWindow event handling
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -872,3 +913,4 @@ HWND wxTLWHiddenParentModule::GetHWND()
return ms_hwnd; return ms_hwnd;
} }

View File

@@ -175,6 +175,7 @@ ALL_SOURCES = \
common/radiocmn.cpp \ common/radiocmn.cpp \
common/regex.cpp \ common/regex.cpp \
common/resource.cpp \ common/resource.cpp \
common/rgncmn.cpp \
common/sckaddr.cpp \ common/sckaddr.cpp \
common/sckfile.cpp \ common/sckfile.cpp \
common/sckipc.cpp \ common/sckipc.cpp \
@@ -744,6 +745,7 @@ COMMONOBJS = \
radiocmn.o \ radiocmn.o \
regex.o \ regex.o \
resource.o \ resource.o \
rgncmn.o \
sckaddr.o \ sckaddr.o \
sckfile.o \ sckfile.o \
sckipc.o \ sckipc.o \

View File

@@ -13,7 +13,7 @@ from distutils.command.install_data import install_data
# flags and values that affect this script # flags and values that affect this script
#---------------------------------------------------------------------- #----------------------------------------------------------------------
VERSION = "2.4.0.7" VERSION = "2.4.0.8p1"
DESCRIPTION = "Cross platform GUI toolkit for Python" DESCRIPTION = "Cross platform GUI toolkit for Python"
AUTHOR = "Robin Dunn" AUTHOR = "Robin Dunn"
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>" AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"

View File

@@ -517,10 +517,10 @@ def EVT_SASH_DRAGGED_RANGE(win, id1, id2, func):
win.Connect(id1, id2, wxEVT_SASH_DRAGGED, func) win.Connect(id1, id2, wxEVT_SASH_DRAGGED, func)
def EVT_QUERY_LAYOUT_INFO(win, 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): def EVT_CALCULATE_LAYOUT(win, func):
win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func) win.Connect(-1, -1, wxEVT_CALCULATE_LAYOUT, func)
#wxSplitterWindow #wxSplitterWindow
@@ -730,7 +730,7 @@ def wxCallAfter(callable, *args, **kw):
global _wxCallAfterId global _wxCallAfterId
if _wxCallAfterId is None: if _wxCallAfterId is None:
_wxCallAfterId = wxNewId() _wxCallAfterId = wxNewEventType()
app.Connect(-1, -1, _wxCallAfterId, app.Connect(-1, -1, _wxCallAfterId,
lambda event: apply(event.callable, event.args, event.kw) ) lambda event: apply(event.callable, event.args, event.kw) )
evt = wxPyEvent() evt = wxPyEvent()

View File

@@ -116,6 +116,12 @@ public:
virtual void SetTitle(const wxString& title); virtual void SetTitle(const wxString& title);
virtual wxString GetTitle() const; 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);
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@@ -1043,8 +1043,12 @@ public:
#ifndef __WXMAC__ #ifndef __WXMAC__
%name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE); %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
#endif #endif
%name(wxRegionFromBitmap)wxRegion(const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0);
~wxRegion(); ~wxRegion();
void Clear(); void Clear();
#ifndef __WXMAC__ #ifndef __WXMAC__
bool Offset(wxCoord x, wxCoord y); bool Offset(wxCoord x, wxCoord y);
@@ -1074,6 +1078,18 @@ public:
bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height); bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(XorRect)bool Xor(const wxRect& rect); %name(XorRect)bool Xor(const wxRect& rect);
%name(XorRegion)bool Xor(const wxRegion& region); %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 %readonly
%{ %{
#if 0 #if 0