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.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-28 23:05:05 +00:00
parent 7728856b75
commit 1542ea396a
59 changed files with 5861 additions and 1155 deletions

1638
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -5355,7 +5355,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

@@ -221,6 +221,7 @@ protocol.cpp Common Socket,Base
quantize.cpp Common quantize.cpp Common
radiocmn.cpp Common radiocmn.cpp Common
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

@@ -63,6 +63,9 @@ All GUI ports:
- use typesafe Get* instead - use typesafe Get* instead
wxListBase::operator wxList&() wxListBase::operator wxList&()
- use typesafe lists instead - use typesafe lists instead
- Added wxTLW::SetShape with implementations for wxMSW and wxGTK (so
far).
Unix: Unix:

View File

@@ -519,6 +519,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

@@ -48,6 +48,14 @@ provided array. {\it fillStyle} parameter may have values
{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWindows ports. {\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

@@ -44,6 +44,13 @@ 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
@@ -109,6 +116,19 @@ 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(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);

View File

@@ -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,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:
// 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!

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

@@ -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,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:
// 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!

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,6 +45,13 @@ 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
@@ -110,6 +117,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(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);

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

@@ -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();
@@ -97,6 +103,19 @@ 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);
// implementation from now on: // implementation from now on:
const MGLRegion& GetMGLRegion() const; const MGLRegion& GetMGLRegion() const;

View File

@@ -48,6 +48,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(); wxRegion();
wxRegion( const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0)
{
Union(bmp, transColour, tolerance);
}
~wxRegion(); ~wxRegion();
//# Copying //# Copying
@@ -101,6 +107,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

@@ -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

@@ -108,6 +108,11 @@ public:
virtual wxString GetTitle() const = 0; virtual wxString GetTitle() const = 0;
*/ */
// 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) { return FALSE; }
// old functions, use the new ones instead! // old functions, use the new ones instead!
#if WXWIN_COMPATIBILITY_2 #if WXWIN_COMPATIBILITY_2
bool Iconized() const { return IsIconized(); } bool Iconized() const { return IsIconized(); }

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;

14
samples/configure vendored
View File

@@ -693,15 +693,20 @@ trap 'rm -fr `echo "
mobile/Makefile mobile/Makefile
mobile/wxedit/Makefile mobile/wxedit/Makefile
mobile/styles/Makefile mobile/styles/Makefile
newgrid/Makefile multimon/Makefile
nativedlg/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 +852,20 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
mobile/Makefile mobile/Makefile
mobile/wxedit/Makefile mobile/wxedit/Makefile
mobile/styles/Makefile mobile/styles/Makefile
newgrid/Makefile multimon/Makefile
nativedlg/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

@@ -76,6 +76,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

@@ -0,0 +1,7 @@
shapedM5.mcp
shapedM*Data
*Classic?Debug*
*Classic?Release*
*Carbon?Debug*
*Carbon?Release*
shaped

View File

@@ -0,0 +1,16 @@
# Purpose: makefile for shaped example (UNIX).
# Created: 2000-01-03
top_srcdir = @top_srcdir@/..
top_builddir = ../..
program_dir = samples/shaped
DATAFILES=star.png
PROGRAM=shaped
OBJECTS =$(PROGRAM).o
DEPFILES=$(PROGRAM).d
include ../../src/makeprog.env
@IF_GNU_MAKE@-include $(DEPFILES)

View File

@@ -0,0 +1,47 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.stm.tudelft.nl) *
# Date : 4 October 2000 *
# *
#*****************************************************************************
.first
define wx [--.include.wx]
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
CXX_DEFINE =
.endif
.endif
.suffixes : .cpp
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
all :
.ifdef __WXMOTIF__
$(MMS)$(MMSQUALIFIERS) shaped.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) shaped_gtk.exe
.endif
.endif
.ifdef __WXMOTIF__
shaped.exe : shaped.obj
cxxlink shaped,[--.lib]vms/opt
.else
.ifdef __WXGTK__
shaped_gtk.exe : shaped.obj
cxxlink/exec=shaped_gtk.exe shaped,[--.lib]vms_gtk/opt
.endif
.endif
shaped.obj : shaped.cpp

View File

@@ -0,0 +1,10 @@
# Purpose: makefile for shaped example (BC++ 32bit)
# Created: 2000-01-03
WXDIR = $(WXWIN)
TARGET=shaped
OBJECTS = $(TARGET).obj
!include $(WXDIR)\src\makeprog.b32

View File

@@ -0,0 +1,14 @@
# Purpose: makefile for shaped example (BC++ 16bit)
# Created: 2000-01-03
!if "$(WXWIN)" == ""
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
!endif
WXDIR = $(WXWIN)
TARGET=shaped
OBJECTS=$(TARGET).obj
!include $(WXDIR)\src\makeprog.bcc

View File

@@ -0,0 +1,10 @@
# Purpose: makefile for shaped example (VC++ 1.5x)
# Created: 2000-01-03
WXDIR = $(WXWIN)
TARGET=shaped
OBJECTS=$(TARGET).obj
!include $(WXDIR)\src\makeprog.msc

View File

@@ -0,0 +1,10 @@
# Purpose: makefile for shaped example (Cygwin/Mingw32)
# Created: #03.01.00
WXDIR = ../..
TARGET=shaped
OBJECTS = $(TARGET).o
include $(WXDIR)/src/makeprog.g95

View File

@@ -0,0 +1,37 @@
# Purpose: makefile for shaped example (Symantec C++)
# Created: 2000-01-03
WXDIR = $(WXWIN)
WXLIB = $(WXDIR)\lib\wx.lib
INCDIR = $(WXDIR)\include
INCLUDE=$(INCDIR)
TARGET=shaped
include $(WXDIR)\src\makesc.env
shaped.exe: shaped.obj $(DEFFILE) shaped.res
*$(CC) $(LDFLAGS) -o$@ $** $(LIBS)
*$(RC) -k shaped.res
sc32.def:
echo EXETYPE NT > sc32.def
echo SUBSYSTEM WINDOWS >> sc32.def
sc16.def:
echo NAME $(TARGET) > sc16.def
echo EXETYPE WINDOWS >> sc16.def
echo STUB 'WINSTUB.EXE' >> sc16.def
echo CODE PRELOAD MOVEABLE DISCARDABLE >> sc16.def
echo DATA PRELOAD MOVEABLE MULTIPLE >> sc16.def
echo HEAPSIZE 1024 >> sc16.def
echo STACKSIZE 8192 >> sc16.def
clean:
-del *.obj
-del *.exe
-del *.res
-del *.map
-del *.rws
-del sc32.def
-del sc16.def

View File

@@ -0,0 +1,14 @@
# Purpose: makefile for shaped example (Salford C++)
# Created: 2000-01-03
PROGRAM = shaped
OBJECTS = $(PROGRAM).obj
include ..\..\src\makeprog.sl
all: wx $(TARGET)
wx:
cd $(WXDIR)\src\msw ^ mk32 -f makefile.sl all
cd $(WXDIR)\samples\shaped

View File

@@ -0,0 +1,35 @@
# Purpose: makefile for shaped example (TWIN)
# Created: 2000-01-03
WXDIR = ../..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/maketwin.env
OBJECTS = $(OBJDIR)/shaped.$(OBJSUFF) $(OBJDIR)/shaped.$(OBJSUFF)
all: $(OBJDIR) shaped$(GUISUFFIX)$(EXESUFF)
wx:
$(OBJDIR):
mkdir $(OBJDIR)
shaped$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
$(CC) $(LDFLAGS) -o shaped$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
$(OBJDIR)/shaped.$(OBJSUFF): shaped.$(SRCSUFF)
$(CC) -c $(CPPFLAGS) -o $@ shaped.$(SRCSUFF)
shaped.c: shaped.rc
$(RESCOMP) $(RCINPUTSWITCH) shaped.rc $(RCOUTPUTSWITCH) shaped.c $(RESFLAGS)
$(OBJDIR)/shaped.$(OBJSUFF): shaped.c
$(CC) -c $(CPPFLAGS) -o $@ shaped.c
#$(OBJDIR)/shaped.o: shaped.rc
# $(RESCOMP) $(RCINPUTSWITCH) shaped.rc $(RCOUTPUTSWITCH) $(OBJDIR)/shaped.o $(RESFLAGS)
clean:
rm -f $(OBJECTS) shaped$(GUISUFFIX).exe core *.rsc *.res

View File

@@ -0,0 +1,23 @@
# Purpose: makefile for shaped example (Unix)
# Created: 2000-01-03
CXX = $(shell wx-config --cxx)
PROGRAM = shaped
OBJECTS = $(PROGRAM).o
# implementation
.SUFFIXES: .o .cpp
.cpp.o :
$(CXX) -c `wx-config --cxxflags` -o $@ $<
all: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
$(CXX) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
clean:
rm -f *.o $(PROGRAM)

View File

@@ -0,0 +1,11 @@
# Purpose: makefile for shaped example (VC++ 32bit)
# Created: 2000-01-03
# Set WXDIR for your system
WXDIR = $(WXWIN)
PROGRAM=shaped
OBJECTS = $(PROGRAM).obj
!include $(WXDIR)\src\makeprog.vc

View File

@@ -0,0 +1,11 @@
# Purpose: makefile for shaped example (Watcom)
# Created: 2000-01-03
WXDIR = $(%WXWIN)
PROGRAM = shaped
OBJECTS = $(PROGRAM).obj
!include $(WXDIR)\src\makeprog.wat

223
samples/shaped/shaped.cpp Normal file
View File

@@ -0,0 +1,223 @@
/////////////////////////////////////////////////////////////////////////////
// Name: shaped.cpp
// Purpose: Shaped Window sample
// Author: Robin Dunn
// Modified by:
// Created: 28-Mar-2003
// RCS-ID: $Id$
// Copyright: (c) Robin Dunn
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "shaped.cpp"
#pragma interface "shaped.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/log.h"
#include "wx/frame.h"
#include "wx/panel.h"
#include "wx/stattext.h"
#include "wx/menu.h"
#include "wx/layout.h"
#include "wx/msgdlg.h"
#endif
#include "wx/dcclient.h"
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
// override base class virtuals
// ----------------------------
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
virtual bool OnInit();
};
// Define a new frame type: this is going to be our main frame
class ShapedFrame : public wxFrame
{
public:
// ctor(s)
ShapedFrame();
void SetWindowShape();
// event handlers (these functions should _not_ be virtual)
void OnDoubleClick(wxMouseEvent& evt);
void OnLeftDown(wxMouseEvent& evt);
void OnLeftUp(wxMouseEvent& evt);
void OnMouseMove(wxMouseEvent& evt);
void OnExit(wxMouseEvent& evt);
void OnPaint(wxPaintEvent& evt);
void OnWindowCreate(wxWindowCreateEvent& evt);
private:
bool m_hasShape;
wxBitmap m_bmp;
wxPoint m_delta;
// any class wishing to process wxWindows events must use this macro
DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// event tables and other macros for wxWindows
// ----------------------------------------------------------------------------
// the event tables connect the wxWindows events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(ShapedFrame, wxFrame)
EVT_LEFT_DCLICK(ShapedFrame::OnDoubleClick)
EVT_LEFT_DOWN(ShapedFrame::OnLeftDown)
EVT_LEFT_UP(ShapedFrame::OnLeftUp)
EVT_MOTION(ShapedFrame::OnMouseMove)
EVT_RIGHT_UP(ShapedFrame::OnExit)
EVT_PAINT(ShapedFrame::OnPaint)
#ifdef __WXGTK__
EVT_WINDOW_CREATE(ShapedFrame::OnWindowCreate)
#endif
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
IMPLEMENT_APP(MyApp)
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// the application class
// ----------------------------------------------------------------------------
// `Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
wxInitAllImageHandlers();
// Create the main application window
ShapedFrame *frame = new ShapedFrame();
frame->Show(TRUE);
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned FALSE here, the
// application would exit immediately.
return TRUE;
}
// ----------------------------------------------------------------------------
// main frame
// ----------------------------------------------------------------------------
// frame constructor
ShapedFrame::ShapedFrame()
: wxFrame((wxFrame *)NULL, -1, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR)
{
m_hasShape = FALSE;
m_bmp = wxBitmap("star.png", wxBITMAP_TYPE_PNG);
SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
SetToolTip(wxT("Right-click to exit"));
#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.
SetWindowShape();
#endif
}
void ShapedFrame::SetWindowShape()
{
wxRegion region(m_bmp, *wxWHITE);
m_hasShape = SetShape(region);
}
void ShapedFrame::OnDoubleClick(wxMouseEvent& evt)
{
if (m_hasShape)
{
wxRegion region;
SetShape(region);
m_hasShape = FALSE;
}
else
SetWindowShape();
}
void ShapedFrame::OnLeftDown(wxMouseEvent& evt)
{
CaptureMouse();
wxPoint pos = ClientToScreen(evt.GetPosition());
wxPoint origin = GetPosition();
int dx = pos.x - origin.x;
int dy = pos.y - origin.y;
m_delta = wxPoint(dx, dy);
}
void ShapedFrame::OnLeftUp(wxMouseEvent& evt)
{
if (HasCapture())
ReleaseMouse();
}
void ShapedFrame::OnMouseMove(wxMouseEvent& evt)
{
if (evt.Dragging() && evt.LeftIsDown())
{
wxPoint pos = ClientToScreen(evt.GetPosition());
Move(wxPoint(pos.x - m_delta.x, pos.y - m_delta.y));
}
}
void ShapedFrame::OnExit(wxMouseEvent& evt)
{
Close();
}
void ShapedFrame::OnPaint(wxPaintEvent& evt)
{
wxPaintDC dc(this);
dc.DrawBitmap(m_bmp, 0, 0, TRUE);
}
void ShapedFrame::OnWindowCreate(wxWindowCreateEvent& evt)
{
SetWindowShape();
}

154
samples/shaped/shaped.dsp Normal file
View File

@@ -0,0 +1,154 @@
# Microsoft Developer Studio Project File - Name="shaped" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=shaped - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "shaped.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "shaped.mak" CFG="shaped - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "shaped - Win32 Release DLL" (based on "Win32 (x86) Application")
!MESSAGE "shaped - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "shaped - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "shaped - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!ELSEIF "$(CFG)" == "shaped - Win32 Release DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseDll"
# PROP BASE Intermediate_Dir "ReleaseDll"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDll"
# PROP Intermediate_Dir "ReleaseDll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MD /D WXUSINGDLL /I..\..\lib\mswdll
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "NDEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386 ..\..\lib\wxmsw250.lib
!ELSEIF "$(CFG)" == "shaped - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugDll"
# PROP BASE Intermediate_Dir "DebugDll"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDll"
# PROP Intermediate_Dir "DebugDll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /Zi /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MDd /D "__WXDEBUG__" /D "WXDEBUG=1" /D WXUSINGDLL /I..\..\lib\mswdlld
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "_DEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ..\..\lib\wxmsw250d.lib
!ELSEIF "$(CFG)" == "shaped - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MD /I..\..\lib\msw
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "NDEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386 ..\..\lib\zlib.lib ..\..\lib\regex.lib ..\..\lib\png.lib ..\..\lib\jpeg.lib ..\..\lib\tiff.lib ..\..\lib\wxmsw.lib
!ELSEIF "$(CFG)" == "shaped - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
# ADD CPP /nologo /W4 /Zi /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D WIN32 /D WINVER=0x400 /D _MT /D wxUSE_GUI=1 /YX /FD /c /MDd /D "__WXDEBUG__" /D "WXDEBUG=1" /I..\..\lib\mswd
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /I "../../include"
# ADD RSC /l 0x409 /d "_DEBUG" /I "../../include"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\pngd.lib ..\..\lib\jpegd.lib ..\..\lib\tiffd.lib ..\..\lib\wxmswd.lib
!ENDIF
# Begin Target
# Name "shaped - Win32 Release DLL"
# Name "shaped - Win32 Debug DLL"
# Name "shaped - Win32 Release"
# Name "shaped - Win32 Debug"
# Begin Source File
SOURCE=.\shaped.cpp
# End Source File
# Begin Source File
SOURCE=.\shaped.rc
# End Source File
# End Target
# End Project

2
samples/shaped/shaped.rc Normal file
View File

@@ -0,0 +1,2 @@
#include "wx/msw/wx.rc"

3685
samples/shaped/shapedM5.xml Normal file

File diff suppressed because it is too large Load Diff

BIN
samples/shaped/star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

118
src/common/rgncmn.cpp Normal file
View File

@@ -0,0 +1,118 @@
/////////////////////////////////////////////////////////////////////////////
// Name: rgncmn.cpp
// Purpose: Methods of wxRegion that have a generic implementation
// Author: Robin Dunn
// Modified by:
// Created: 27-Mar-2003
// RCS-ID: $Id$
// Copyright: (c) Robin Dunn
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "rgncmn.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/region.h"
#include "wx/bitmap.h"
#include "wx/dcmemory.h"
//---------------------------------------------------------------------------
wxBitmap wxRegion::ConvertToBitmap() const
{
wxRect box = GetBox();
wxBitmap bmp(box.GetRight(), box.GetBottom());
wxMemoryDC dc;
dc.SelectObject(bmp);
dc.SetBackground(*wxWHITE_BRUSH);
dc.Clear();
dc.SetClippingRegion(*this);
dc.SetBackground(*wxBLACK_BRUSH);
dc.Clear();
dc.SelectObject(wxNullBitmap);
return bmp;
}
//---------------------------------------------------------------------------
bool wxRegion::Union(const wxBitmap& bmp,
const wxColour& transColour,
int tolerance)
{
unsigned char loR, loG, loB;
unsigned char hiR, hiG, hiB;
wxCHECK_MSG((bmp.GetMask() != NULL) || transColour.Ok(),
FALSE,
wxT("Either the bitmap should have a mask or a colour should be given."));
wxImage image = bmp.ConvertToImage();
if (image.HasMask())
{
loR = image.GetMaskRed();
loG = image.GetMaskGreen();
loB = image.GetMaskBlue();
}
else
{
loR = transColour.Red();
loG = transColour.Green();
loB = transColour.Blue();
}
hiR = wxMin(0xFF, loR + tolerance);
hiG = wxMin(0xFF, loG + tolerance);
hiB = wxMin(0xFF, loB + tolerance);
// Loop through the image row by row, pixel by pixel, building up
// rectangles to add to the region.
int width = image.GetWidth();
int height = image.GetHeight();
for (int y=0; y < height; y++)
{
wxRect rect;
rect.y = y;
rect.height = 1;
for (int x=0; x < width; x++)
{
// search for a continuous range of non-transparent pixels
int x0 = x;
while ( x < width)
{
unsigned char R = image.GetRed(x,y);
unsigned char G = image.GetGreen(x,y);
unsigned char B = image.GetBlue(x,y);
if (( R >= loR && R <= hiR) &&
( G >= loG && G <= hiG) &&
( B >= loB && B <= hiB)) // It's transparent
break;
x++;
}
// Add the run of non-transparent pixels (if any) to the region
if (x > x0) {
rect.x = x0;
rect.width = x - x0;
Union(rect);
}
}
}
return TRUE;
}
//---------------------------------------------------------------------------

View File

@@ -97,7 +97,6 @@ ALL_HEADERS = \
cmdline.h \ cmdline.h \
confbase.h \ confbase.h \
config.h \ config.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -139,6 +138,7 @@ ALL_HEADERS = \
listimpl.cpp \ listimpl.cpp \
log.h \ log.h \
longlong.h \ longlong.h \
math.h \
memconf.h \ memconf.h \
memory.h \ memory.h \
memtext.h \ memtext.h \
@@ -163,7 +163,6 @@ ALL_HEADERS = \
textfile.h \ textfile.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tokenzr.h \ tokenzr.h \
txtstrm.h \ txtstrm.h \

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 \
@@ -309,7 +310,6 @@ ALL_HEADERS = \
ctrlsub.h \ ctrlsub.h \
cursor.h \ cursor.h \
dataobj.h \ dataobj.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -483,7 +483,6 @@ ALL_HEADERS = \
tglbtn.h \ tglbtn.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tipdlg.h \ tipdlg.h \
tipwin.h \ tipwin.h \
@@ -740,6 +739,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

@@ -973,4 +973,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

@@ -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 \
@@ -309,7 +310,6 @@ ALL_HEADERS = \
ctrlsub.h \ ctrlsub.h \
cursor.h \ cursor.h \
dataobj.h \ dataobj.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -483,7 +483,6 @@ ALL_HEADERS = \
tglbtn.h \ tglbtn.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tipdlg.h \ tipdlg.h \
tipwin.h \ tipwin.h \
@@ -740,6 +739,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

@@ -973,4 +973,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

@@ -141,6 +141,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 \
@@ -765,6 +766,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

@@ -1012,3 +1012,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
SetPort( formerPort ) ; SetPort( formerPort ) ;
} }
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
return FALSE;
}

View File

@@ -141,6 +141,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 \
@@ -765,6 +766,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

@@ -1012,3 +1012,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
SetPort( formerPort ) ; SetPort( formerPort ) ;
} }
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
return FALSE;
}

View File

@@ -48,6 +48,7 @@ ALL_SOURCES = \
generic/treectlg.cpp \ generic/treectlg.cpp \
generic/treelay.cpp \ generic/treelay.cpp \
generic/wizard.cpp \ generic/wizard.cpp \
common/accesscmn.cpp \
common/appcmn.cpp \ common/appcmn.cpp \
common/artprov.cpp \ common/artprov.cpp \
common/artstd.cpp \ common/artstd.cpp \
@@ -75,6 +76,7 @@ ALL_SOURCES = \
common/dobjcmn.cpp \ common/dobjcmn.cpp \
common/docmdi.cpp \ common/docmdi.cpp \
common/docview.cpp \ common/docview.cpp \
common/dpycmn.cpp \
common/dseldlg.cpp \ common/dseldlg.cpp \
common/dynarray.cpp \ common/dynarray.cpp \
common/dynlib.cpp \ common/dynlib.cpp \
@@ -134,7 +136,6 @@ ALL_SOURCES = \
common/mstream.cpp \ common/mstream.cpp \
common/nbkbase.cpp \ common/nbkbase.cpp \
common/object.cpp \ common/object.cpp \
common/odbc.cpp \
common/paper.cpp \ common/paper.cpp \
common/popupcmn.cpp \ common/popupcmn.cpp \
common/prntbase.cpp \ common/prntbase.cpp \
@@ -144,6 +145,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 \
@@ -234,6 +236,7 @@ ALL_SOURCES = \
ALL_HEADERS = \ ALL_HEADERS = \
accel.h \ accel.h \
access.h \
app.h \ app.h \
arrimpl.cpp \ arrimpl.cpp \
artprov.h \ artprov.h \
@@ -267,7 +270,6 @@ ALL_HEADERS = \
ctrlsub.h \ ctrlsub.h \
cursor.h \ cursor.h \
dataobj.h \ dataobj.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -290,6 +292,7 @@ ALL_HEADERS = \
dir.h \ dir.h \
dirctrl.h \ dirctrl.h \
dirdlg.h \ dirdlg.h \
display.h \
dnd.h \ dnd.h \
docmdi.h \ docmdi.h \
docview.h \ docview.h \
@@ -364,6 +367,7 @@ ALL_HEADERS = \
listimpl.cpp \ listimpl.cpp \
log.h \ log.h \
longlong.h \ longlong.h \
math.h \
matrix.h \ matrix.h \
mdi.h \ mdi.h \
memconf.h \ memconf.h \
@@ -380,7 +384,6 @@ ALL_HEADERS = \
mstream.h \ mstream.h \
notebook.h \ notebook.h \
object.h \ object.h \
odbc.h \
ownerdrw.h \ ownerdrw.h \
palette.h \ palette.h \
panel.h \ panel.h \
@@ -399,6 +402,7 @@ ALL_HEADERS = \
quantize.h \ quantize.h \
radiobox.h \ radiobox.h \
radiobut.h \ radiobut.h \
rawbmp.h \
regex.h \ regex.h \
region.h \ region.h \
resource.h \ resource.h \
@@ -439,7 +443,6 @@ ALL_HEADERS = \
tglbtn.h \ tglbtn.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tipdlg.h \ tipdlg.h \
tipwin.h \ tipwin.h \
@@ -560,6 +563,7 @@ ALL_HEADERS = \
protocol/protocol.h protocol/protocol.h
COMMONOBJS = \ COMMONOBJS = \
accesscmn.o \
appcmn.o \ appcmn.o \
artprov.o \ artprov.o \
artstd.o \ artstd.o \
@@ -587,6 +591,7 @@ COMMONOBJS = \
dobjcmn.o \ dobjcmn.o \
docmdi.o \ docmdi.o \
docview.o \ docview.o \
dpycmn.o \
dseldlg.o \ dseldlg.o \
dynarray.o \ dynarray.o \
dynlib.o \ dynlib.o \
@@ -646,7 +651,6 @@ COMMONOBJS = \
mstream.o \ mstream.o \
nbkbase.o \ nbkbase.o \
object.o \ object.o \
odbc.o \
paper.o \ paper.o \
popupcmn.o \ popupcmn.o \
prntbase.o \ prntbase.o \
@@ -656,6 +660,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

@@ -90,6 +90,7 @@ GENERICOBJS= accel.obj &
COMMONOBJS = & COMMONOBJS = &
y_tab.obj & y_tab.obj &
accesscmn.obj &
appcmn.obj & appcmn.obj &
artprov.obj & artprov.obj &
artstd.obj & artstd.obj &
@@ -117,6 +118,7 @@ COMMONOBJS = &
dobjcmn.obj & dobjcmn.obj &
docmdi.obj & docmdi.obj &
docview.obj & docview.obj &
dpycmn.obj &
dseldlg.obj & dseldlg.obj &
dynarray.obj & dynarray.obj &
dynlib.obj & dynlib.obj &
@@ -176,7 +178,6 @@ COMMONOBJS = &
mstream.obj & mstream.obj &
nbkbase.obj & nbkbase.obj &
object.obj & object.obj &
odbc.obj &
paper.obj & paper.obj &
popupcmn.obj & popupcmn.obj &
prntbase.obj & prntbase.obj &
@@ -186,6 +187,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 &
@@ -534,6 +536,9 @@ win32.obj: $(UNIVTHEMEDIR)\win32.cpp
######################################################## ########################################################
# Common objects (always compiled) # Common objects (always compiled)
accesscmn.obj: $(COMMDIR)\accesscmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
appcmn.obj: $(COMMDIR)\appcmn.cpp appcmn.obj: $(COMMDIR)\appcmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -615,6 +620,9 @@ docmdi.obj: $(COMMDIR)\docmdi.cpp
docview.obj: $(COMMDIR)\docview.cpp docview.obj: $(COMMDIR)\docview.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
dpycmn.obj: $(COMMDIR)\dpycmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
dseldlg.obj: $(COMMDIR)\dseldlg.cpp dseldlg.obj: $(COMMDIR)\dseldlg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -792,9 +800,6 @@ nbkbase.obj: $(COMMDIR)\nbkbase.cpp
object.obj: $(COMMDIR)\object.cpp object.obj: $(COMMDIR)\object.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
odbc.obj: $(COMMDIR)\odbc.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
paper.obj: $(COMMDIR)\paper.cpp paper.obj: $(COMMDIR)\paper.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -822,6 +827,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

@@ -46,6 +46,7 @@ ALL_SOURCES = \
generic/treectlg.cpp \ generic/treectlg.cpp \
generic/treelay.cpp \ generic/treelay.cpp \
generic/wizard.cpp \ generic/wizard.cpp \
common/accesscmn.cpp \
common/appcmn.cpp \ common/appcmn.cpp \
common/artprov.cpp \ common/artprov.cpp \
common/artstd.cpp \ common/artstd.cpp \
@@ -72,6 +73,7 @@ ALL_SOURCES = \
common/dobjcmn.cpp \ common/dobjcmn.cpp \
common/docmdi.cpp \ common/docmdi.cpp \
common/docview.cpp \ common/docview.cpp \
common/dpycmn.cpp \
common/dseldlg.cpp \ common/dseldlg.cpp \
common/dynarray.cpp \ common/dynarray.cpp \
common/dynlib.cpp \ common/dynlib.cpp \
@@ -131,7 +133,6 @@ ALL_SOURCES = \
common/mstream.cpp \ common/mstream.cpp \
common/nbkbase.cpp \ common/nbkbase.cpp \
common/object.cpp \ common/object.cpp \
common/odbc.cpp \
common/paper.cpp \ common/paper.cpp \
common/popupcmn.cpp \ common/popupcmn.cpp \
common/prntbase.cpp \ common/prntbase.cpp \
@@ -141,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 \
@@ -234,6 +236,7 @@ ALL_SOURCES = \
ALL_HEADERS = \ ALL_HEADERS = \
accel.h \ accel.h \
access.h \
app.h \ app.h \
arrimpl.cpp \ arrimpl.cpp \
artprov.h \ artprov.h \
@@ -267,7 +270,6 @@ ALL_HEADERS = \
ctrlsub.h \ ctrlsub.h \
cursor.h \ cursor.h \
dataobj.h \ dataobj.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -290,6 +292,7 @@ ALL_HEADERS = \
dir.h \ dir.h \
dirctrl.h \ dirctrl.h \
dirdlg.h \ dirdlg.h \
display.h \
dnd.h \ dnd.h \
docmdi.h \ docmdi.h \
docview.h \ docview.h \
@@ -364,6 +367,7 @@ ALL_HEADERS = \
listimpl.cpp \ listimpl.cpp \
log.h \ log.h \
longlong.h \ longlong.h \
math.h \
matrix.h \ matrix.h \
mdi.h \ mdi.h \
memconf.h \ memconf.h \
@@ -380,7 +384,6 @@ ALL_HEADERS = \
mstream.h \ mstream.h \
notebook.h \ notebook.h \
object.h \ object.h \
odbc.h \
ownerdrw.h \ ownerdrw.h \
palette.h \ palette.h \
panel.h \ panel.h \
@@ -399,6 +402,7 @@ ALL_HEADERS = \
quantize.h \ quantize.h \
radiobox.h \ radiobox.h \
radiobut.h \ radiobut.h \
rawbmp.h \
regex.h \ regex.h \
region.h \ region.h \
resource.h \ resource.h \
@@ -439,7 +443,6 @@ ALL_HEADERS = \
tglbtn.h \ tglbtn.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tipdlg.h \ tipdlg.h \
tipwin.h \ tipwin.h \
@@ -476,6 +479,7 @@ ALL_HEADERS = \
zipstrm.h \ zipstrm.h \
zstream.h \ zstream.h \
msw/accel.h \ msw/accel.h \
msw/access.h \
msw/app.h \ msw/app.h \
msw/bitmap.h \ msw/bitmap.h \
msw/bmpbuttn.h \ msw/bmpbuttn.h \
@@ -490,8 +494,6 @@ ALL_HEADERS = \
msw/colour.h \ msw/colour.h \
msw/combobox.h \ msw/combobox.h \
msw/control.h \ msw/control.h \
msw/curico.h \
msw/curicop.h \
msw/cursor.h \ msw/cursor.h \
msw/dc.h \ msw/dc.h \
msw/dcclient.h \ msw/dcclient.h \
@@ -501,7 +503,6 @@ ALL_HEADERS = \
msw/dde.h \ msw/dde.h \
msw/dialog.h \ msw/dialog.h \
msw/dib.h \ msw/dib.h \
msw/dibutils.h \
msw/dirdlg.h \ msw/dirdlg.h \
msw/dragimag.h \ msw/dragimag.h \
msw/enhmeta.h \ msw/enhmeta.h \
@@ -511,7 +512,6 @@ ALL_HEADERS = \
msw/fontdlg.h \ msw/fontdlg.h \
msw/frame.h \ msw/frame.h \
msw/gauge95.h \ msw/gauge95.h \
msw/gaugemsw.h \
msw/gccpriv.h \ msw/gccpriv.h \
msw/gdiimage.h \ msw/gdiimage.h \
msw/gdiobj.h \ msw/gdiobj.h \
@@ -635,6 +635,7 @@ ALL_HEADERS = \
COMMONOBJS = \ COMMONOBJS = \
parser.o \ parser.o \
accesscmn.o \
appcmn.o \ appcmn.o \
artprov.o \ artprov.o \
artstd.o \ artstd.o \
@@ -661,6 +662,7 @@ COMMONOBJS = \
dobjcmn.o \ dobjcmn.o \
docmdi.o \ docmdi.o \
docview.o \ docview.o \
dpycmn.o \
dseldlg.o \ dseldlg.o \
dynarray.o \ dynarray.o \
dynlib.o \ dynlib.o \
@@ -720,7 +722,6 @@ COMMONOBJS = \
mstream.o \ mstream.o \
nbkbase.o \ nbkbase.o \
object.o \ object.o \
odbc.o \
paper.o \ paper.o \
popupcmn.o \ popupcmn.o \
prntbase.o \ prntbase.o \
@@ -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

@@ -145,6 +145,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 \
@@ -737,6 +738,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

@@ -128,6 +128,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 \
@@ -330,7 +331,6 @@ ALL_HEADERS = \
ctrlsub.h \ ctrlsub.h \
cursor.h \ cursor.h \
dataobj.h \ dataobj.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -504,7 +504,6 @@ ALL_HEADERS = \
tglbtn.h \ tglbtn.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tipdlg.h \ tipdlg.h \
tipwin.h \ tipwin.h \
@@ -801,6 +800,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

@@ -758,6 +758,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
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -912,3 +953,4 @@ HWND wxTLWHiddenParentModule::GetHWND()
return ms_hwnd; return ms_hwnd;
} }

View File

@@ -176,6 +176,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 \
@@ -278,7 +279,6 @@ ALL_HEADERS = \
ctrlsub.h \ ctrlsub.h \
cursor.h \ cursor.h \
dataobj.h \ dataobj.h \
date.h \
datetime.h \ datetime.h \
datetime.inl \ datetime.inl \
datstrm.h \ datstrm.h \
@@ -452,7 +452,6 @@ ALL_HEADERS = \
tglbtn.h \ tglbtn.h \
thread.h \ thread.h \
thrimpl.cpp \ thrimpl.cpp \
time.h \
timer.h \ timer.h \
tipdlg.h \ tipdlg.h \
tipwin.h \ tipwin.h \
@@ -750,6 +749,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

@@ -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

@@ -1047,8 +1047,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);
@@ -1078,6 +1082,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);
}; };
@@ -1107,6 +1123,7 @@ public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
%readonly %readonly
%{ %{
#if 0 #if 0