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:
@@ -228,7 +228,7 @@ case "${host}" in
|
||||
dnl
|
||||
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 why it works with the name changed to .a.
|
||||
dnl why it works with the name changed to .a.
|
||||
SO_SUFFIX=a
|
||||
AC_DEFINE(__AIX__)
|
||||
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.])
|
||||
fi
|
||||
AC_MSG_RESULT("$MGL_ROOT/lib/$mgl_lib_type/$mgl_os")
|
||||
|
||||
|
||||
wxUSE_UNIVERSAL="yes"
|
||||
|
||||
TOOLKIT_INCLUDE="-I$MGL_ROOT/include"
|
||||
@@ -2797,7 +2797,7 @@ case "${host}" in
|
||||
*-*-darwin* )
|
||||
dnl Under Mac OS X, the naming conventions for shared libraries
|
||||
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_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
|
||||
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
|
||||
|
@@ -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
|
||||
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 should use
|
||||
you should use
|
||||
{\tt wxDEFAULT\_FRAME\_STYLE \& (wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the
|
||||
frames having this style (the dialogs don't have minimize nor maximize box by
|
||||
default)}
|
||||
@@ -476,7 +476,7 @@ Sets the icons for this frame.
|
||||
|
||||
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
|
||||
%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}.
|
||||
|
||||
\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}}
|
||||
|
@@ -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}}
|
||||
|
||||
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}.
|
||||
|
||||
{\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.
|
||||
|
@@ -53,7 +53,7 @@ class wxRegion : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxRegion() { }
|
||||
|
||||
|
||||
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||
{
|
||||
InitRect(x, y, w, h);
|
||||
@@ -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,18 +122,31 @@ 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!
|
||||
wxRegion( GdkRegion *region );
|
||||
|
||||
|
||||
GdkRegion *GetRegion() const;
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
|
||||
// common part of ctors for a rectangle region
|
||||
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||
|
||||
|
@@ -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 );
|
||||
|
@@ -53,7 +53,7 @@ class wxRegion : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxRegion() { }
|
||||
|
||||
|
||||
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||
{
|
||||
InitRect(x, y, w, h);
|
||||
@@ -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,18 +122,31 @@ 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!
|
||||
wxRegion( GdkRegion *region );
|
||||
|
||||
|
||||
GdkRegion *GetRegion() const;
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
|
||||
// common part of ctors for a rectangle region
|
||||
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||
|
||||
|
@@ -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,19 +45,26 @@ 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
|
||||
wxRegion(const wxRegion& r)
|
||||
: wxGDIObject()
|
||||
{ Ref(r); }
|
||||
wxRegion& operator = (const wxRegion& r)
|
||||
{ Ref(r); return (*this); }
|
||||
|
||||
|
||||
//# Modify region
|
||||
// Clear current region
|
||||
void Clear();
|
||||
|
||||
|
||||
// Union rectangle or region with this.
|
||||
bool Union(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_OR); }
|
||||
@@ -65,7 +72,7 @@ public:
|
||||
{ return Combine(rect, wxRGN_OR); }
|
||||
bool Union(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_OR); }
|
||||
|
||||
|
||||
// Intersect rectangle or region with this.
|
||||
bool Intersect(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_AND); }
|
||||
@@ -73,7 +80,7 @@ public:
|
||||
{ return Combine(rect, wxRGN_AND); }
|
||||
bool Intersect(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_AND); }
|
||||
|
||||
|
||||
// Subtract rectangle or region from this:
|
||||
// Combines the parts of 'this' that are not part of the second region.
|
||||
bool Subtract(long x, long y, long width, long height)
|
||||
@@ -82,7 +89,7 @@ public:
|
||||
{ return Combine(rect, wxRGN_DIFF); }
|
||||
bool Subtract(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_DIFF); }
|
||||
|
||||
|
||||
// XOR: the union of two combined regions except for any overlapping areas.
|
||||
bool Xor(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_XOR); }
|
||||
@@ -90,16 +97,16 @@ public:
|
||||
{ return Combine(rect, wxRGN_XOR); }
|
||||
bool Xor(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_XOR); }
|
||||
|
||||
|
||||
//# Information on region
|
||||
// Outer bounds of region
|
||||
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
|
||||
wxRect GetBox() const ;
|
||||
|
||||
|
||||
// Is region empty?
|
||||
bool Empty() const;
|
||||
inline bool IsEmpty() const { return Empty(); }
|
||||
|
||||
|
||||
//# Tests
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain Contains(long x, long y) const;
|
||||
@@ -109,7 +116,19 @@ public:
|
||||
wxRegionContain Contains(long x, long y, long w, long h) const;
|
||||
// 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);
|
||||
@@ -120,7 +139,7 @@ public:
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
||||
|
||||
|
||||
public:
|
||||
wxRegionIterator();
|
||||
wxRegionIterator(const wxRegion& region);
|
||||
@@ -131,13 +150,13 @@ public:
|
||||
|
||||
void Reset() { m_current = 0; }
|
||||
void Reset(const wxRegion& region);
|
||||
|
||||
|
||||
operator bool () const { return m_current < m_numRects; }
|
||||
bool HaveRects() const { return m_current < m_numRects; }
|
||||
|
||||
wxRegionIterator& operator++();
|
||||
wxRegionIterator operator++(int);
|
||||
|
||||
|
||||
long GetX() const;
|
||||
long GetY() const;
|
||||
long GetW() const;
|
||||
|
@@ -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; }
|
||||
|
@@ -24,14 +24,14 @@ class WXDLLEXPORT wxRect;
|
||||
class WXDLLEXPORT wxPoint;
|
||||
class MGLRegion;
|
||||
|
||||
enum wxRegionContain
|
||||
enum wxRegionContain
|
||||
{
|
||||
wxOutRegion = 0,
|
||||
wxPartRegion = 1,
|
||||
wxOutRegion = 0,
|
||||
wxPartRegion = 1,
|
||||
wxInRegion = 2
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxRegion : public wxGDIObject
|
||||
class WXDLLEXPORT wxRegion : public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||
friend class WXDLLEXPORT wxRegionIterator;
|
||||
@@ -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();
|
||||
@@ -96,7 +102,20 @@ public:
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const;
|
||||
// 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;
|
||||
|
||||
@@ -109,7 +128,7 @@ protected:
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST(wxRect, wxRegionRectList);
|
||||
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
||||
public:
|
||||
|
@@ -48,49 +48,55 @@ 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
|
||||
inline wxRegion(const wxRegion& r)
|
||||
{ Ref(r); }
|
||||
inline wxRegion& operator = (const wxRegion& r)
|
||||
{ Ref(r); return (*this); }
|
||||
|
||||
|
||||
//# Modify region
|
||||
// Clear current region
|
||||
void Clear();
|
||||
|
||||
|
||||
// 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(const wxRect& rect) { return Combine(rect, wxRGN_OR); }
|
||||
inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); }
|
||||
|
||||
|
||||
// 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(const wxRect& rect) { return Combine(rect, wxRGN_AND); }
|
||||
inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); }
|
||||
|
||||
|
||||
// Subtract rectangle or region from this:
|
||||
// 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(const wxRect& rect) { return Combine(rect, 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.
|
||||
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 wxRegion& region) { return Combine(region, wxRGN_XOR); }
|
||||
|
||||
|
||||
//# Information on region
|
||||
// Outer bounds of region
|
||||
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
|
||||
wxRect GetBox() const ;
|
||||
|
||||
|
||||
// Is region empty?
|
||||
bool Empty() const;
|
||||
inline bool IsEmpty() const { return Empty(); }
|
||||
bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
|
||||
//# Tests
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y) const;
|
||||
@@ -100,15 +106,27 @@ public:
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const;
|
||||
// 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);
|
||||
bool Combine(const wxRect& rect, wxRegionOp op);
|
||||
|
||||
|
||||
// Get the internal Region handle
|
||||
WXRegion GetXRegion() const;
|
||||
|
||||
|
||||
// 'Naughty' functions that allow wxWindows to use a list of rects
|
||||
// instead of the region, in certain circumstances (e.g. when
|
||||
// making a region out of the update rectangles).
|
||||
@@ -126,16 +144,16 @@ public:
|
||||
wxRegionIterator();
|
||||
wxRegionIterator(const wxRegion& region);
|
||||
~wxRegionIterator();
|
||||
|
||||
|
||||
void Reset() { m_current = 0; }
|
||||
void Reset(const wxRegion& region);
|
||||
|
||||
|
||||
operator bool () const { return m_current < m_numRects; }
|
||||
bool HaveRects() const { return m_current < m_numRects; }
|
||||
|
||||
|
||||
void operator ++ ();
|
||||
void operator ++ (int);
|
||||
|
||||
|
||||
wxCoord GetX() const;
|
||||
wxCoord GetY() const;
|
||||
wxCoord GetW() const;
|
||||
@@ -143,7 +161,7 @@ public:
|
||||
wxCoord GetH() const;
|
||||
wxCoord GetHeight() const { return GetH(); }
|
||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
||||
|
||||
|
||||
private:
|
||||
size_t m_current;
|
||||
size_t m_numRects;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -121,7 +142,7 @@ protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
|
||||
// common part of ctors for a rectangle region
|
||||
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||
|
||||
|
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 \
|
||||
|
@@ -114,13 +114,13 @@ void wxTopLevelWindowMac::Init()
|
||||
class wxMacDeferredWindowDeleter : public wxObject
|
||||
{
|
||||
public :
|
||||
wxMacDeferredWindowDeleter( WindowRef windowRef )
|
||||
{
|
||||
m_macWindow = windowRef ;
|
||||
wxMacDeferredWindowDeleter( WindowRef windowRef )
|
||||
{
|
||||
m_macWindow = windowRef ;
|
||||
}
|
||||
virtual ~wxMacDeferredWindowDeleter()
|
||||
{
|
||||
UMADisposeWindow( (WindowRef) m_macWindow ) ;
|
||||
virtual ~wxMacDeferredWindowDeleter()
|
||||
{
|
||||
UMADisposeWindow( (WindowRef) m_macWindow ) ;
|
||||
}
|
||||
protected :
|
||||
WindowRef m_macWindow ;
|
||||
@@ -186,7 +186,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
|
||||
|
||||
bool wxTopLevelWindowMac::IsMaximized() const
|
||||
{
|
||||
return false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::Iconize(bool iconize)
|
||||
@@ -353,7 +353,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
|
||||
{
|
||||
attr |= kWindowFullZoomAttribute ;
|
||||
@@ -399,7 +399,7 @@ void wxTopLevelWindowMac::Clear()
|
||||
wxWindow::Clear() ;
|
||||
}
|
||||
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
{
|
||||
return m_macRootControl ;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
||||
|
||||
BeginUpdate( (WindowRef)m_macWindow ) ;
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle diffRgn = NewRgn() ;
|
||||
if ( updateRgn && diffRgn )
|
||||
{
|
||||
@@ -615,7 +615,7 @@ bool wxTopLevelWindowMac::Show(bool show)
|
||||
return FALSE;
|
||||
|
||||
if (show)
|
||||
{
|
||||
{
|
||||
::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
|
||||
::SelectWindow( (WindowRef)m_macWindow ) ;
|
||||
// no need to generate events here, they will get them triggered by macos
|
||||
@@ -635,7 +635,7 @@ bool wxTopLevelWindowMac::Show(bool show)
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh() ;
|
||||
Refresh() ;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -683,17 +683,17 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
|
||||
if ( doMove )
|
||||
::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost
|
||||
|
||||
|
||||
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
|
||||
// take care of refreshing for full repaints
|
||||
|
||||
if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
|
||||
Refresh() ;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( IsKindOf( CLASSINFO( wxFrame ) ) )
|
||||
{
|
||||
wxFrame* frame = (wxFrame*) this ;
|
||||
@@ -720,7 +720,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -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 \
|
||||
|
@@ -114,13 +114,13 @@ void wxTopLevelWindowMac::Init()
|
||||
class wxMacDeferredWindowDeleter : public wxObject
|
||||
{
|
||||
public :
|
||||
wxMacDeferredWindowDeleter( WindowRef windowRef )
|
||||
{
|
||||
m_macWindow = windowRef ;
|
||||
wxMacDeferredWindowDeleter( WindowRef windowRef )
|
||||
{
|
||||
m_macWindow = windowRef ;
|
||||
}
|
||||
virtual ~wxMacDeferredWindowDeleter()
|
||||
{
|
||||
UMADisposeWindow( (WindowRef) m_macWindow ) ;
|
||||
virtual ~wxMacDeferredWindowDeleter()
|
||||
{
|
||||
UMADisposeWindow( (WindowRef) m_macWindow ) ;
|
||||
}
|
||||
protected :
|
||||
WindowRef m_macWindow ;
|
||||
@@ -186,7 +186,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
|
||||
|
||||
bool wxTopLevelWindowMac::IsMaximized() const
|
||||
{
|
||||
return false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::Iconize(bool iconize)
|
||||
@@ -353,7 +353,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
|
||||
{
|
||||
attr |= kWindowFullZoomAttribute ;
|
||||
@@ -399,7 +399,7 @@ void wxTopLevelWindowMac::Clear()
|
||||
wxWindow::Clear() ;
|
||||
}
|
||||
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
{
|
||||
return m_macRootControl ;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
||||
|
||||
BeginUpdate( (WindowRef)m_macWindow ) ;
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle diffRgn = NewRgn() ;
|
||||
if ( updateRgn && diffRgn )
|
||||
{
|
||||
@@ -615,7 +615,7 @@ bool wxTopLevelWindowMac::Show(bool show)
|
||||
return FALSE;
|
||||
|
||||
if (show)
|
||||
{
|
||||
{
|
||||
::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
|
||||
::SelectWindow( (WindowRef)m_macWindow ) ;
|
||||
// no need to generate events here, they will get them triggered by macos
|
||||
@@ -635,7 +635,7 @@ bool wxTopLevelWindowMac::Show(bool show)
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh() ;
|
||||
Refresh() ;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -683,17 +683,17 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
|
||||
if ( doMove )
|
||||
::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost
|
||||
|
||||
|
||||
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
|
||||
// take care of refreshing for full repaints
|
||||
|
||||
if ( doResize && !HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
|
||||
Refresh() ;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( IsKindOf( CLASSINFO( wxFrame ) ) )
|
||||
{
|
||||
wxFrame* frame = (wxFrame*) this ;
|
||||
@@ -720,7 +720,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -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