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:
10
configure.in
10
configure.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__)
|
||||
@@ -1469,7 +1469,7 @@ case "${host}" in
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if test "$wxUSE_GUI" = "yes"; then
|
||||
if test "$wxUSE_UNIX" = "yes"; then
|
||||
dnl defines HAVE_X11_XKBLIB_H
|
||||
@@ -2275,7 +2275,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"
|
||||
@@ -2850,7 +2850,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}"
|
||||
|
||||
@@ -5355,7 +5355,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)"
|
||||
|
@@ -221,6 +221,7 @@ protocol.cpp Common Socket,Base
|
||||
quantize.cpp Common
|
||||
radiocmn.cpp Common
|
||||
regex.cpp Common Base
|
||||
rgncmn.cpp Common
|
||||
resource.cpp Common
|
||||
sckaddr.cpp Common Socket,Base
|
||||
sckfile.cpp Common Socket,Base
|
||||
|
@@ -63,6 +63,9 @@ All GUI ports:
|
||||
- use typesafe Get* instead
|
||||
wxListBase::operator wxList&()
|
||||
- use typesafe lists instead
|
||||
- Added wxTLW::SetShape with implementations for wxMSW and wxGTK (so
|
||||
far).
|
||||
|
||||
|
||||
Unix:
|
||||
|
||||
|
@@ -52,7 +52,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)}
|
||||
@@ -73,7 +73,7 @@ wxFrame processes the following events:
|
||||
\twocolitem{\helpref{wxEVT\_SIZE}{wxsizeevent}}{If the frame has exactly one
|
||||
child window, not counting the status and toolbar, this child is resized to
|
||||
take the entire frame client area. If two or more windows are present, they
|
||||
should be laid out explicitly either by manually handling wxEVT\_SIZE or using
|
||||
should be laid out explicitly either by manually handling wxEVT\_SIZE or using
|
||||
\helpref{sizers}{sizeroverview}}
|
||||
|
||||
\twocolitem{\helpref{wxEVT\_MENU\_HIGHLIGHT}{wxmenuevent}}{The default
|
||||
@@ -466,7 +466,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:
|
||||
@@ -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}.
|
||||
|
||||
\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}}
|
||||
@@ -628,7 +639,7 @@ to hide in full-screen mode:
|
||||
|
||||
This function has not been tested with MDI frames.
|
||||
|
||||
Note that showing a frame full screen also actually
|
||||
Note that showing a frame full screen also actually
|
||||
\helpref{Show()s}{wxwindowshow} if it hadn't been shown yet.
|
||||
|
||||
\wxheading{See also}
|
||||
|
@@ -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.
|
||||
|
@@ -44,19 +44,26 @@ 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
|
||||
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); }
|
||||
@@ -64,7 +71,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); }
|
||||
@@ -72,7 +79,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)
|
||||
@@ -81,7 +88,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); }
|
||||
@@ -89,16 +96,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;
|
||||
@@ -108,7 +115,20 @@ 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);
|
||||
@@ -118,7 +138,7 @@ public:
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
||||
|
||||
|
||||
public:
|
||||
wxRegionIterator();
|
||||
wxRegionIterator(const wxRegion& region);
|
||||
@@ -129,13 +149,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;
|
||||
|
@@ -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);
|
||||
|
@@ -108,6 +108,11 @@ public:
|
||||
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!
|
||||
#if WXWIN_COMPATIBILITY_2
|
||||
bool Iconized() const { return IsIconized(); }
|
||||
|
@@ -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);
|
||||
|
||||
|
14
samples/configure
vendored
14
samples/configure
vendored
@@ -693,15 +693,20 @@ trap 'rm -fr `echo "
|
||||
mobile/Makefile
|
||||
mobile/wxedit/Makefile
|
||||
mobile/styles/Makefile
|
||||
newgrid/Makefile
|
||||
multimon/Makefile
|
||||
nativedlg/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 +852,20 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
||||
mobile/Makefile
|
||||
mobile/wxedit/Makefile
|
||||
mobile/styles/Makefile
|
||||
newgrid/Makefile
|
||||
multimon/Makefile
|
||||
nativedlg/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
|
||||
|
@@ -76,6 +76,7 @@ AC_OUTPUT([
|
||||
resource/Makefile
|
||||
rotate/Makefile
|
||||
sashtest/Makefile
|
||||
shaped/Makefile
|
||||
scroll/Makefile
|
||||
scrollsub/Makefile
|
||||
sockets/Makefile
|
||||
|
7
samples/shaped/.cvsignore
Normal file
7
samples/shaped/.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
shapedM5.mcp
|
||||
shapedM*Data
|
||||
*Classic?Debug*
|
||||
*Classic?Release*
|
||||
*Carbon?Debug*
|
||||
*Carbon?Release*
|
||||
shaped
|
16
samples/shaped/Makefile.in
Normal file
16
samples/shaped/Makefile.in
Normal 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)
|
47
samples/shaped/descrip.mms
Normal file
47
samples/shaped/descrip.mms
Normal 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
|
10
samples/shaped/makefile.b32
Normal file
10
samples/shaped/makefile.b32
Normal 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
|
||||
|
14
samples/shaped/makefile.bcc
Normal file
14
samples/shaped/makefile.bcc
Normal 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
|
||||
|
10
samples/shaped/makefile.dos
Normal file
10
samples/shaped/makefile.dos
Normal 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
|
||||
|
10
samples/shaped/makefile.g95
Normal file
10
samples/shaped/makefile.g95
Normal 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
|
||||
|
37
samples/shaped/makefile.sc
Normal file
37
samples/shaped/makefile.sc
Normal 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
|
||||
|
14
samples/shaped/makefile.sl
Normal file
14
samples/shaped/makefile.sl
Normal 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
|
||||
|
35
samples/shaped/makefile.twn
Normal file
35
samples/shaped/makefile.twn
Normal 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
|
23
samples/shaped/makefile.unx
Normal file
23
samples/shaped/makefile.unx
Normal 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)
|
11
samples/shaped/makefile.vc
Normal file
11
samples/shaped/makefile.vc
Normal 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
|
||||
|
11
samples/shaped/makefile.wat
Normal file
11
samples/shaped/makefile.wat
Normal 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
223
samples/shaped/shaped.cpp
Normal 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
154
samples/shaped/shaped.dsp
Normal 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
2
samples/shaped/shaped.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "wx/msw/wx.rc"
|
||||
|
3685
samples/shaped/shapedM5.xml
Normal file
3685
samples/shaped/shapedM5.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
samples/shaped/star.png
Normal file
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
118
src/common/rgncmn.cpp
Normal 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;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
@@ -97,7 +97,6 @@ ALL_HEADERS = \
|
||||
cmdline.h \
|
||||
confbase.h \
|
||||
config.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -139,6 +138,7 @@ ALL_HEADERS = \
|
||||
listimpl.cpp \
|
||||
log.h \
|
||||
longlong.h \
|
||||
math.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
@@ -163,7 +163,6 @@ ALL_HEADERS = \
|
||||
textfile.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tokenzr.h \
|
||||
txtstrm.h \
|
||||
|
@@ -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 \
|
||||
@@ -309,7 +310,6 @@ ALL_HEADERS = \
|
||||
ctrlsub.h \
|
||||
cursor.h \
|
||||
dataobj.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -483,7 +483,6 @@ ALL_HEADERS = \
|
||||
tglbtn.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tipdlg.h \
|
||||
tipwin.h \
|
||||
@@ -740,6 +739,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -513,10 +513,10 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
m_fsIsShowing = show;
|
||||
|
||||
GdkWindow *window = m_widget->window;
|
||||
wxX11FullScreenMethod method =
|
||||
wxX11FullScreenMethod method =
|
||||
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
|
||||
(WXWindow)GDK_ROOT_WINDOW());
|
||||
|
||||
|
||||
if (show)
|
||||
{
|
||||
m_fsSaveFlag = style;
|
||||
@@ -538,7 +538,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
gdk_window_set_decorations(window, (GdkWMDecoration)0);
|
||||
gdk_window_set_functions(window, (GdkWMFunction)0);
|
||||
}
|
||||
|
||||
|
||||
gdk_window_get_origin (m_widget->window, &root_x, &root_y);
|
||||
gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
|
||||
&width, &height, NULL);
|
||||
@@ -561,12 +561,12 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
|
||||
gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
|
||||
}
|
||||
|
||||
|
||||
wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
|
||||
(WXWindow)GDK_ROOT_WINDOW(),
|
||||
(WXWindow)GDK_WINDOW_XWINDOW(window),
|
||||
show, &m_fsSaveFrame, method);
|
||||
|
||||
|
||||
SetSize(m_fsSaveFrame.x, m_fsSaveFrame.y,
|
||||
m_fsSaveFrame.width, m_fsSaveFrame.height);
|
||||
}
|
||||
@@ -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
|
||||
|
@@ -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 \
|
||||
@@ -309,7 +310,6 @@ ALL_HEADERS = \
|
||||
ctrlsub.h \
|
||||
cursor.h \
|
||||
dataobj.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -483,7 +483,6 @@ ALL_HEADERS = \
|
||||
tglbtn.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tipdlg.h \
|
||||
tipwin.h \
|
||||
@@ -740,6 +739,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -513,10 +513,10 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
m_fsIsShowing = show;
|
||||
|
||||
GdkWindow *window = m_widget->window;
|
||||
wxX11FullScreenMethod method =
|
||||
wxX11FullScreenMethod method =
|
||||
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
|
||||
(WXWindow)GDK_ROOT_WINDOW());
|
||||
|
||||
|
||||
if (show)
|
||||
{
|
||||
m_fsSaveFlag = style;
|
||||
@@ -538,7 +538,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
gdk_window_set_decorations(window, (GdkWMDecoration)0);
|
||||
gdk_window_set_functions(window, (GdkWMFunction)0);
|
||||
}
|
||||
|
||||
|
||||
gdk_window_get_origin (m_widget->window, &root_x, &root_y);
|
||||
gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
|
||||
&width, &height, NULL);
|
||||
@@ -561,12 +561,12 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
|
||||
gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
|
||||
}
|
||||
|
||||
|
||||
wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
|
||||
(WXWindow)GDK_ROOT_WINDOW(),
|
||||
(WXWindow)GDK_WINDOW_XWINDOW(window),
|
||||
show, &m_fsSaveFrame, method);
|
||||
|
||||
|
||||
SetSize(m_fsSaveFrame.x, m_fsSaveFrame.y,
|
||||
m_fsSaveFrame.width, m_fsSaveFrame.height);
|
||||
}
|
||||
@@ -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
|
||||
|
@@ -141,6 +141,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -765,6 +766,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -71,7 +71,7 @@ static long gs_lastWhen = 0;
|
||||
|
||||
extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
|
||||
|
||||
static const EventTypeSpec eventList[] =
|
||||
static const EventTypeSpec eventList[] =
|
||||
{
|
||||
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
|
||||
|
||||
@@ -100,15 +100,15 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
|
||||
|
||||
wxWindow* focus = wxWindow::FindFocus() ;
|
||||
char charCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 modifiers ;
|
||||
Point point ;
|
||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||
|
||||
EventRef rawEvent ;
|
||||
|
||||
|
||||
GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ;
|
||||
|
||||
|
||||
GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
|
||||
GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||
GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||
@@ -120,7 +120,7 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventTextInputUnicodeForKeyEvent :
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
focus , message , modifiers , when , point.h , point.v ) )
|
||||
{
|
||||
result = noErr ;
|
||||
@@ -137,7 +137,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
|
||||
wxWindow* focus = wxWindow::FindFocus() ;
|
||||
char charCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 modifiers ;
|
||||
Point point ;
|
||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||
@@ -153,14 +153,14 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
{
|
||||
case kEventRawKeyRepeat :
|
||||
case kEventRawKeyDown :
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
focus , message , modifiers , when , point.h , point.v ) )
|
||||
{
|
||||
result = noErr ;
|
||||
}
|
||||
break ;
|
||||
case kEventRawKeyUp :
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent(
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent(
|
||||
focus , message , modifiers , when , point.h , point.v ) )
|
||||
{
|
||||
result = noErr ;
|
||||
@@ -216,7 +216,7 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
||||
UInt32 modifiers = 0;
|
||||
EventMouseButton button = 0 ;
|
||||
UInt32 click = 0 ;
|
||||
|
||||
|
||||
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
|
||||
sizeof( Point ), NULL, &point );
|
||||
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL,
|
||||
@@ -225,10 +225,10 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
||||
sizeof( EventMouseButton ), NULL, &button );
|
||||
GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL,
|
||||
sizeof( UInt32 ), NULL, &click );
|
||||
|
||||
|
||||
if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
|
||||
modifiers += btnState ;
|
||||
|
||||
|
||||
WindowRef window ;
|
||||
short windowPart = ::FindWindow(point, &window);
|
||||
|
||||
@@ -256,9 +256,9 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
@@ -269,10 +269,10 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
|
||||
UInt32 attributes;
|
||||
WindowRef windowRef ;
|
||||
wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
|
||||
|
||||
|
||||
GetEventParameter( event, kEventParamDirectObject, typeWindowRef, NULL,
|
||||
sizeof( WindowRef ), NULL, &windowRef );
|
||||
|
||||
|
||||
switch( GetEventKind( event ) )
|
||||
{
|
||||
case kEventWindowUpdate :
|
||||
@@ -301,9 +301,9 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
|
||||
|
||||
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
|
||||
sizeof( newContentRect ), NULL, &newContentRect );
|
||||
|
||||
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
|
||||
newContentRect.right - newContentRect.left ,
|
||||
|
||||
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
|
||||
newContentRect.right - newContentRect.left ,
|
||||
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
|
||||
|
||||
result = noErr;
|
||||
@@ -395,13 +395,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 ;
|
||||
@@ -439,14 +439,14 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
|
||||
wxToolTip::NotifyWindowDelete(m_macWindow) ;
|
||||
wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
|
||||
}
|
||||
|
||||
|
||||
#if TARGET_CARBON
|
||||
if ( m_macEventHandler )
|
||||
{
|
||||
::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
|
||||
m_macEventHandler = NULL ;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
wxRemoveMacWindowAssociation( this ) ;
|
||||
|
||||
@@ -468,7 +468,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
|
||||
|
||||
bool wxTopLevelWindowMac::IsMaximized() const
|
||||
{
|
||||
return false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::Iconize(bool iconize)
|
||||
@@ -501,40 +501,40 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name )
|
||||
const wxString& name )
|
||||
{
|
||||
SetName(name);
|
||||
m_windowStyle = style;
|
||||
m_isShown = FALSE;
|
||||
|
||||
|
||||
// create frame.
|
||||
|
||||
|
||||
Rect theBoundsRect;
|
||||
|
||||
|
||||
m_x = (int)pos.x;
|
||||
m_y = (int)pos.y;
|
||||
if ( m_y < 50 )
|
||||
m_y = 50 ;
|
||||
if ( m_x < 20 )
|
||||
m_x = 20 ;
|
||||
|
||||
|
||||
m_width = size.x;
|
||||
if (m_width == -1)
|
||||
if (m_width == -1)
|
||||
m_width = 20;
|
||||
m_height = size.y;
|
||||
if (m_height == -1)
|
||||
if (m_height == -1)
|
||||
m_height = 20;
|
||||
|
||||
|
||||
::SetRect(&theBoundsRect, m_x, m_y , m_x + m_width, m_y + m_height);
|
||||
|
||||
|
||||
// translate the window attributes in the appropriate window class and attributes
|
||||
|
||||
|
||||
WindowClass wclass = 0;
|
||||
WindowAttributes attr = kWindowNoAttributes ;
|
||||
|
||||
|
||||
if ( HasFlag( wxFRAME_TOOL_WINDOW) )
|
||||
{
|
||||
if (
|
||||
if (
|
||||
HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
|
||||
HasFlag( wxSYSTEM_MENU ) || HasFlag( wxCAPTION ) ||
|
||||
HasFlag(wxTINY_CAPTION_HORIZ) || HasFlag(wxTINY_CAPTION_VERT)
|
||||
@@ -557,7 +557,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
}
|
||||
else if ( HasFlag( wxCAPTION ) )
|
||||
{
|
||||
wclass = kDocumentWindowClass ;
|
||||
wclass = kDocumentWindowClass ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -575,7 +575,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
|
||||
{
|
||||
attr |= kWindowFullZoomAttribute ;
|
||||
@@ -589,20 +589,20 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
{
|
||||
attr |= kWindowCloseBoxAttribute ;
|
||||
}
|
||||
|
||||
|
||||
::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ;
|
||||
wxAssociateWinWithMacWindow( m_macWindow , this ) ;
|
||||
UMASetWTitle( (WindowRef)m_macWindow , title ) ;
|
||||
::CreateRootControl( (WindowRef)m_macWindow , (ControlHandle*)&m_macRootControl ) ;
|
||||
#if TARGET_CARBON
|
||||
InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
|
||||
InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));
|
||||
InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));
|
||||
#endif
|
||||
m_macFocus = NULL ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXHWND *window , wxWindowMac** rootwin)
|
||||
void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXHWND *window , wxWindowMac** rootwin)
|
||||
{
|
||||
((Point*)localOrigin)->h = 0;
|
||||
((Point*)localOrigin)->v = 0;
|
||||
@@ -619,7 +619,7 @@ void wxTopLevelWindowMac::Clear()
|
||||
wxWindow::Clear() ;
|
||||
}
|
||||
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
{
|
||||
return m_macRootControl ;
|
||||
}
|
||||
@@ -631,7 +631,7 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
||||
|
||||
BeginUpdate( (WindowRef)m_macWindow ) ;
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle diffRgn = NewRgn() ;
|
||||
if ( updateRgn && diffRgn )
|
||||
{
|
||||
@@ -664,15 +664,15 @@ void wxTopLevelWindowMac::Lower()
|
||||
::SendBehind( (WindowRef)m_macWindow , NULL ) ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp )
|
||||
{
|
||||
wxMouseEvent event(wxEVT_LEFT_DOWN);
|
||||
bool isDown = !(modifiers & btnState) ; // 1 is for up
|
||||
bool controlDown = modifiers & controlKey ; // for simulating right mouse
|
||||
|
||||
|
||||
event.m_leftDown = isDown && !controlDown;
|
||||
|
||||
|
||||
event.m_middleDown = FALSE;
|
||||
event.m_rightDown = isDown && controlDown;
|
||||
|
||||
@@ -703,8 +703,8 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
Point localwhere ;
|
||||
localwhere.h = x ;
|
||||
localwhere.v = y ;
|
||||
|
||||
GrafPtr port ;
|
||||
|
||||
GrafPtr port ;
|
||||
::GetPort( &port ) ;
|
||||
::SetPort( UMAGetWindowPort( (WindowRef)m_macWindow ) ) ;
|
||||
::GlobalToLocal( &localwhere ) ;
|
||||
@@ -749,7 +749,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
event.m_y = y ;
|
||||
event.SetEventObject( wxTheApp->s_captureWindow ) ;
|
||||
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
||||
|
||||
|
||||
if ( kind == mouseUp )
|
||||
{
|
||||
wxTheApp->s_captureWindow = NULL ;
|
||||
@@ -769,7 +769,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
|
||||
void wxTopLevelWindowMac::MacMouseDown( WXEVENTREF ev , short part)
|
||||
{
|
||||
MacFireMouseEvent( mouseDown , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
MacFireMouseEvent( mouseDown , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
|
||||
}
|
||||
|
||||
@@ -777,9 +777,9 @@ void wxTopLevelWindowMac::MacMouseUp( WXEVENTREF ev , short part)
|
||||
{
|
||||
switch (part)
|
||||
{
|
||||
case inContent:
|
||||
case inContent:
|
||||
{
|
||||
MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
|
||||
}
|
||||
break ;
|
||||
@@ -790,9 +790,9 @@ void wxTopLevelWindowMac::MacMouseMoved( WXEVENTREF ev , short part)
|
||||
{
|
||||
switch (part)
|
||||
{
|
||||
case inContent:
|
||||
case inContent:
|
||||
{
|
||||
MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
|
||||
}
|
||||
break ;
|
||||
@@ -806,11 +806,11 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating )
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
|
||||
event.m_timeStamp = timestamp ;
|
||||
event.SetEventObject(this);
|
||||
|
||||
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
|
||||
UMAHighlightAndActivateWindow( (WindowRef)m_macWindow , inIsActivating ) ;
|
||||
|
||||
|
||||
// Early versions of MacOS X don't refresh backgrounds properly,
|
||||
// so refresh the whole window on activation and deactivation.
|
||||
long osVersion = UMAGetSystemVersion();
|
||||
@@ -822,7 +822,7 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating )
|
||||
|
||||
#if !TARGET_CARBON
|
||||
|
||||
void wxTopLevelWindowMac::MacKeyDown( WXEVENTREF ev )
|
||||
void wxTopLevelWindowMac::MacKeyDown( WXEVENTREF ev )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -840,7 +840,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
|
||||
@@ -860,7 +860,7 @@ bool wxTopLevelWindowMac::Show(bool show)
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh() ;
|
||||
Refresh() ;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -872,24 +872,24 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
int former_y = m_y ;
|
||||
int former_w = m_width ;
|
||||
int former_h = m_height ;
|
||||
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
int actualX = x;
|
||||
int actualY = y;
|
||||
|
||||
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
|
||||
|
||||
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
|
||||
actualWidth = m_minWidth;
|
||||
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
|
||||
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
|
||||
actualHeight = m_minHeight;
|
||||
if ((m_maxWidth != -1) && (actualWidth > m_maxWidth))
|
||||
if ((m_maxWidth != -1) && (actualWidth > m_maxWidth))
|
||||
actualWidth = m_maxWidth;
|
||||
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
|
||||
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
|
||||
actualHeight = m_maxHeight;
|
||||
|
||||
bool doMove = false ;
|
||||
bool doResize = false ;
|
||||
|
||||
|
||||
if ( actualX != former_x || actualY != former_y )
|
||||
{
|
||||
doMove = true ;
|
||||
@@ -908,17 +908,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 ;
|
||||
@@ -945,7 +945,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -956,28 +956,28 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
* has been true for any part of the update rgn the background is erased in the entire region
|
||||
* not just in the specified rect.
|
||||
*
|
||||
* In order to achive this, we also have an internal m_macNoEraseUpdateRgn, all rects that have
|
||||
* In order to achive this, we also have an internal m_macNoEraseUpdateRgn, all rects that have
|
||||
* the eraseBackground flag set to false are also added to this rgn. upon receiving an update event
|
||||
* the update rgn is compared to the m_macNoEraseUpdateRgn and in case they differ, every window
|
||||
* will get the eraseBackground event first
|
||||
*/
|
||||
|
||||
void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground )
|
||||
|
||||
void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground )
|
||||
{
|
||||
GrafPtr formerPort ;
|
||||
GetPort( &formerPort ) ;
|
||||
SetPortWindowPort( (WindowRef)m_macWindow ) ;
|
||||
|
||||
|
||||
m_macNeedsErasing |= eraseBackground ;
|
||||
|
||||
|
||||
// if we already know that we will have to erase, there's no need to track the rest
|
||||
if ( !m_macNeedsErasing)
|
||||
{
|
||||
// we end only here if eraseBackground is false
|
||||
// if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
|
||||
// we will have to erase anyway
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle diffRgn = NewRgn() ;
|
||||
if ( updateRgn && diffRgn )
|
||||
{
|
||||
@@ -995,7 +995,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
|
||||
DisposeRgn( updateRgn );
|
||||
if ( diffRgn )
|
||||
DisposeRgn( diffRgn );
|
||||
|
||||
|
||||
if ( !m_macNeedsErasing )
|
||||
{
|
||||
RgnHandle rectRgn = NewRgn() ;
|
||||
@@ -1012,3 +1012,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
|
||||
SetPort( formerPort ) ;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -141,6 +141,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -765,6 +766,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -71,7 +71,7 @@ static long gs_lastWhen = 0;
|
||||
|
||||
extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
|
||||
|
||||
static const EventTypeSpec eventList[] =
|
||||
static const EventTypeSpec eventList[] =
|
||||
{
|
||||
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
|
||||
|
||||
@@ -100,15 +100,15 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
|
||||
|
||||
wxWindow* focus = wxWindow::FindFocus() ;
|
||||
char charCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 modifiers ;
|
||||
Point point ;
|
||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||
|
||||
EventRef rawEvent ;
|
||||
|
||||
|
||||
GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ;
|
||||
|
||||
|
||||
GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
|
||||
GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||
GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||
@@ -120,7 +120,7 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventTextInputUnicodeForKeyEvent :
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
focus , message , modifiers , when , point.h , point.v ) )
|
||||
{
|
||||
result = noErr ;
|
||||
@@ -137,7 +137,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
|
||||
wxWindow* focus = wxWindow::FindFocus() ;
|
||||
char charCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 keyCode ;
|
||||
UInt32 modifiers ;
|
||||
Point point ;
|
||||
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
|
||||
@@ -153,14 +153,14 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
|
||||
{
|
||||
case kEventRawKeyRepeat :
|
||||
case kEventRawKeyDown :
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
|
||||
focus , message , modifiers , when , point.h , point.v ) )
|
||||
{
|
||||
result = noErr ;
|
||||
}
|
||||
break ;
|
||||
case kEventRawKeyUp :
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent(
|
||||
if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent(
|
||||
focus , message , modifiers , when , point.h , point.v ) )
|
||||
{
|
||||
result = noErr ;
|
||||
@@ -216,7 +216,7 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
||||
UInt32 modifiers = 0;
|
||||
EventMouseButton button = 0 ;
|
||||
UInt32 click = 0 ;
|
||||
|
||||
|
||||
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
|
||||
sizeof( Point ), NULL, &point );
|
||||
GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL,
|
||||
@@ -225,10 +225,10 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
||||
sizeof( EventMouseButton ), NULL, &button );
|
||||
GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL,
|
||||
sizeof( UInt32 ), NULL, &click );
|
||||
|
||||
|
||||
if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
|
||||
modifiers += btnState ;
|
||||
|
||||
|
||||
WindowRef window ;
|
||||
short windowPart = ::FindWindow(point, &window);
|
||||
|
||||
@@ -256,9 +256,9 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
@@ -269,10 +269,10 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
|
||||
UInt32 attributes;
|
||||
WindowRef windowRef ;
|
||||
wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
|
||||
|
||||
|
||||
GetEventParameter( event, kEventParamDirectObject, typeWindowRef, NULL,
|
||||
sizeof( WindowRef ), NULL, &windowRef );
|
||||
|
||||
|
||||
switch( GetEventKind( event ) )
|
||||
{
|
||||
case kEventWindowUpdate :
|
||||
@@ -301,9 +301,9 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
|
||||
|
||||
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
|
||||
sizeof( newContentRect ), NULL, &newContentRect );
|
||||
|
||||
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
|
||||
newContentRect.right - newContentRect.left ,
|
||||
|
||||
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
|
||||
newContentRect.right - newContentRect.left ,
|
||||
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
|
||||
|
||||
result = noErr;
|
||||
@@ -395,13 +395,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 ;
|
||||
@@ -439,14 +439,14 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
|
||||
wxToolTip::NotifyWindowDelete(m_macWindow) ;
|
||||
wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
|
||||
}
|
||||
|
||||
|
||||
#if TARGET_CARBON
|
||||
if ( m_macEventHandler )
|
||||
{
|
||||
::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
|
||||
m_macEventHandler = NULL ;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
wxRemoveMacWindowAssociation( this ) ;
|
||||
|
||||
@@ -468,7 +468,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
|
||||
|
||||
bool wxTopLevelWindowMac::IsMaximized() const
|
||||
{
|
||||
return false ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::Iconize(bool iconize)
|
||||
@@ -501,40 +501,40 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name )
|
||||
const wxString& name )
|
||||
{
|
||||
SetName(name);
|
||||
m_windowStyle = style;
|
||||
m_isShown = FALSE;
|
||||
|
||||
|
||||
// create frame.
|
||||
|
||||
|
||||
Rect theBoundsRect;
|
||||
|
||||
|
||||
m_x = (int)pos.x;
|
||||
m_y = (int)pos.y;
|
||||
if ( m_y < 50 )
|
||||
m_y = 50 ;
|
||||
if ( m_x < 20 )
|
||||
m_x = 20 ;
|
||||
|
||||
|
||||
m_width = size.x;
|
||||
if (m_width == -1)
|
||||
if (m_width == -1)
|
||||
m_width = 20;
|
||||
m_height = size.y;
|
||||
if (m_height == -1)
|
||||
if (m_height == -1)
|
||||
m_height = 20;
|
||||
|
||||
|
||||
::SetRect(&theBoundsRect, m_x, m_y , m_x + m_width, m_y + m_height);
|
||||
|
||||
|
||||
// translate the window attributes in the appropriate window class and attributes
|
||||
|
||||
|
||||
WindowClass wclass = 0;
|
||||
WindowAttributes attr = kWindowNoAttributes ;
|
||||
|
||||
|
||||
if ( HasFlag( wxFRAME_TOOL_WINDOW) )
|
||||
{
|
||||
if (
|
||||
if (
|
||||
HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
|
||||
HasFlag( wxSYSTEM_MENU ) || HasFlag( wxCAPTION ) ||
|
||||
HasFlag(wxTINY_CAPTION_HORIZ) || HasFlag(wxTINY_CAPTION_VERT)
|
||||
@@ -557,7 +557,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
}
|
||||
else if ( HasFlag( wxCAPTION ) )
|
||||
{
|
||||
wclass = kDocumentWindowClass ;
|
||||
wclass = kDocumentWindowClass ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -575,7 +575,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )
|
||||
{
|
||||
attr |= kWindowFullZoomAttribute ;
|
||||
@@ -589,20 +589,20 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
|
||||
{
|
||||
attr |= kWindowCloseBoxAttribute ;
|
||||
}
|
||||
|
||||
|
||||
::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ;
|
||||
wxAssociateWinWithMacWindow( m_macWindow , this ) ;
|
||||
UMASetWTitle( (WindowRef)m_macWindow , title ) ;
|
||||
::CreateRootControl( (WindowRef)m_macWindow , (ControlHandle*)&m_macRootControl ) ;
|
||||
#if TARGET_CARBON
|
||||
InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
|
||||
InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));
|
||||
InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));
|
||||
#endif
|
||||
m_macFocus = NULL ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXHWND *window , wxWindowMac** rootwin)
|
||||
void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXHWND *window , wxWindowMac** rootwin)
|
||||
{
|
||||
((Point*)localOrigin)->h = 0;
|
||||
((Point*)localOrigin)->v = 0;
|
||||
@@ -619,7 +619,7 @@ void wxTopLevelWindowMac::Clear()
|
||||
wxWindow::Clear() ;
|
||||
}
|
||||
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
|
||||
{
|
||||
return m_macRootControl ;
|
||||
}
|
||||
@@ -631,7 +631,7 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
||||
|
||||
BeginUpdate( (WindowRef)m_macWindow ) ;
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle diffRgn = NewRgn() ;
|
||||
if ( updateRgn && diffRgn )
|
||||
{
|
||||
@@ -664,15 +664,15 @@ void wxTopLevelWindowMac::Lower()
|
||||
::SendBehind( (WindowRef)m_macWindow , NULL ) ;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp )
|
||||
{
|
||||
wxMouseEvent event(wxEVT_LEFT_DOWN);
|
||||
bool isDown = !(modifiers & btnState) ; // 1 is for up
|
||||
bool controlDown = modifiers & controlKey ; // for simulating right mouse
|
||||
|
||||
|
||||
event.m_leftDown = isDown && !controlDown;
|
||||
|
||||
|
||||
event.m_middleDown = FALSE;
|
||||
event.m_rightDown = isDown && controlDown;
|
||||
|
||||
@@ -703,8 +703,8 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
Point localwhere ;
|
||||
localwhere.h = x ;
|
||||
localwhere.v = y ;
|
||||
|
||||
GrafPtr port ;
|
||||
|
||||
GrafPtr port ;
|
||||
::GetPort( &port ) ;
|
||||
::SetPort( UMAGetWindowPort( (WindowRef)m_macWindow ) ) ;
|
||||
::GlobalToLocal( &localwhere ) ;
|
||||
@@ -749,7 +749,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
event.m_y = y ;
|
||||
event.SetEventObject( wxTheApp->s_captureWindow ) ;
|
||||
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
||||
|
||||
|
||||
if ( kind == mouseUp )
|
||||
{
|
||||
wxTheApp->s_captureWindow = NULL ;
|
||||
@@ -769,7 +769,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
|
||||
|
||||
void wxTopLevelWindowMac::MacMouseDown( WXEVENTREF ev , short part)
|
||||
{
|
||||
MacFireMouseEvent( mouseDown , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
MacFireMouseEvent( mouseDown , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
|
||||
}
|
||||
|
||||
@@ -777,9 +777,9 @@ void wxTopLevelWindowMac::MacMouseUp( WXEVENTREF ev , short part)
|
||||
{
|
||||
switch (part)
|
||||
{
|
||||
case inContent:
|
||||
case inContent:
|
||||
{
|
||||
MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
|
||||
}
|
||||
break ;
|
||||
@@ -790,9 +790,9 @@ void wxTopLevelWindowMac::MacMouseMoved( WXEVENTREF ev , short part)
|
||||
{
|
||||
switch (part)
|
||||
{
|
||||
case inContent:
|
||||
case inContent:
|
||||
{
|
||||
MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v ,
|
||||
((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
|
||||
}
|
||||
break ;
|
||||
@@ -806,11 +806,11 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating )
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
|
||||
event.m_timeStamp = timestamp ;
|
||||
event.SetEventObject(this);
|
||||
|
||||
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
|
||||
UMAHighlightAndActivateWindow( (WindowRef)m_macWindow , inIsActivating ) ;
|
||||
|
||||
|
||||
// Early versions of MacOS X don't refresh backgrounds properly,
|
||||
// so refresh the whole window on activation and deactivation.
|
||||
long osVersion = UMAGetSystemVersion();
|
||||
@@ -822,7 +822,7 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating )
|
||||
|
||||
#if !TARGET_CARBON
|
||||
|
||||
void wxTopLevelWindowMac::MacKeyDown( WXEVENTREF ev )
|
||||
void wxTopLevelWindowMac::MacKeyDown( WXEVENTREF ev )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -840,7 +840,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
|
||||
@@ -860,7 +860,7 @@ bool wxTopLevelWindowMac::Show(bool show)
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh() ;
|
||||
Refresh() ;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -872,24 +872,24 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
int former_y = m_y ;
|
||||
int former_w = m_width ;
|
||||
int former_h = m_height ;
|
||||
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
int actualX = x;
|
||||
int actualY = y;
|
||||
|
||||
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
|
||||
|
||||
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
|
||||
actualWidth = m_minWidth;
|
||||
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
|
||||
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
|
||||
actualHeight = m_minHeight;
|
||||
if ((m_maxWidth != -1) && (actualWidth > m_maxWidth))
|
||||
if ((m_maxWidth != -1) && (actualWidth > m_maxWidth))
|
||||
actualWidth = m_maxWidth;
|
||||
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
|
||||
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
|
||||
actualHeight = m_maxHeight;
|
||||
|
||||
bool doMove = false ;
|
||||
bool doResize = false ;
|
||||
|
||||
|
||||
if ( actualX != former_x || actualY != former_y )
|
||||
{
|
||||
doMove = true ;
|
||||
@@ -908,17 +908,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 ;
|
||||
@@ -945,7 +945,7 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -956,28 +956,28 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
||||
* has been true for any part of the update rgn the background is erased in the entire region
|
||||
* not just in the specified rect.
|
||||
*
|
||||
* In order to achive this, we also have an internal m_macNoEraseUpdateRgn, all rects that have
|
||||
* In order to achive this, we also have an internal m_macNoEraseUpdateRgn, all rects that have
|
||||
* the eraseBackground flag set to false are also added to this rgn. upon receiving an update event
|
||||
* the update rgn is compared to the m_macNoEraseUpdateRgn and in case they differ, every window
|
||||
* will get the eraseBackground event first
|
||||
*/
|
||||
|
||||
void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground )
|
||||
|
||||
void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground )
|
||||
{
|
||||
GrafPtr formerPort ;
|
||||
GetPort( &formerPort ) ;
|
||||
SetPortWindowPort( (WindowRef)m_macWindow ) ;
|
||||
|
||||
|
||||
m_macNeedsErasing |= eraseBackground ;
|
||||
|
||||
|
||||
// if we already know that we will have to erase, there's no need to track the rest
|
||||
if ( !m_macNeedsErasing)
|
||||
{
|
||||
// we end only here if eraseBackground is false
|
||||
// if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
|
||||
// we will have to erase anyway
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
|
||||
RgnHandle updateRgn = NewRgn();
|
||||
RgnHandle diffRgn = NewRgn() ;
|
||||
if ( updateRgn && diffRgn )
|
||||
{
|
||||
@@ -995,7 +995,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
|
||||
DisposeRgn( updateRgn );
|
||||
if ( diffRgn )
|
||||
DisposeRgn( diffRgn );
|
||||
|
||||
|
||||
if ( !m_macNeedsErasing )
|
||||
{
|
||||
RgnHandle rectRgn = NewRgn() ;
|
||||
@@ -1012,3 +1012,7 @@ void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackgro
|
||||
SetPort( formerPort ) ;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -48,6 +48,7 @@ ALL_SOURCES = \
|
||||
generic/treectlg.cpp \
|
||||
generic/treelay.cpp \
|
||||
generic/wizard.cpp \
|
||||
common/accesscmn.cpp \
|
||||
common/appcmn.cpp \
|
||||
common/artprov.cpp \
|
||||
common/artstd.cpp \
|
||||
@@ -75,6 +76,7 @@ ALL_SOURCES = \
|
||||
common/dobjcmn.cpp \
|
||||
common/docmdi.cpp \
|
||||
common/docview.cpp \
|
||||
common/dpycmn.cpp \
|
||||
common/dseldlg.cpp \
|
||||
common/dynarray.cpp \
|
||||
common/dynlib.cpp \
|
||||
@@ -134,7 +136,6 @@ ALL_SOURCES = \
|
||||
common/mstream.cpp \
|
||||
common/nbkbase.cpp \
|
||||
common/object.cpp \
|
||||
common/odbc.cpp \
|
||||
common/paper.cpp \
|
||||
common/popupcmn.cpp \
|
||||
common/prntbase.cpp \
|
||||
@@ -144,6 +145,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -234,6 +236,7 @@ ALL_SOURCES = \
|
||||
|
||||
ALL_HEADERS = \
|
||||
accel.h \
|
||||
access.h \
|
||||
app.h \
|
||||
arrimpl.cpp \
|
||||
artprov.h \
|
||||
@@ -267,7 +270,6 @@ ALL_HEADERS = \
|
||||
ctrlsub.h \
|
||||
cursor.h \
|
||||
dataobj.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -290,6 +292,7 @@ ALL_HEADERS = \
|
||||
dir.h \
|
||||
dirctrl.h \
|
||||
dirdlg.h \
|
||||
display.h \
|
||||
dnd.h \
|
||||
docmdi.h \
|
||||
docview.h \
|
||||
@@ -364,6 +367,7 @@ ALL_HEADERS = \
|
||||
listimpl.cpp \
|
||||
log.h \
|
||||
longlong.h \
|
||||
math.h \
|
||||
matrix.h \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
@@ -380,7 +384,6 @@ ALL_HEADERS = \
|
||||
mstream.h \
|
||||
notebook.h \
|
||||
object.h \
|
||||
odbc.h \
|
||||
ownerdrw.h \
|
||||
palette.h \
|
||||
panel.h \
|
||||
@@ -399,6 +402,7 @@ ALL_HEADERS = \
|
||||
quantize.h \
|
||||
radiobox.h \
|
||||
radiobut.h \
|
||||
rawbmp.h \
|
||||
regex.h \
|
||||
region.h \
|
||||
resource.h \
|
||||
@@ -439,7 +443,6 @@ ALL_HEADERS = \
|
||||
tglbtn.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tipdlg.h \
|
||||
tipwin.h \
|
||||
@@ -560,6 +563,7 @@ ALL_HEADERS = \
|
||||
protocol/protocol.h
|
||||
|
||||
COMMONOBJS = \
|
||||
accesscmn.o \
|
||||
appcmn.o \
|
||||
artprov.o \
|
||||
artstd.o \
|
||||
@@ -587,6 +591,7 @@ COMMONOBJS = \
|
||||
dobjcmn.o \
|
||||
docmdi.o \
|
||||
docview.o \
|
||||
dpycmn.o \
|
||||
dseldlg.o \
|
||||
dynarray.o \
|
||||
dynlib.o \
|
||||
@@ -646,7 +651,6 @@ COMMONOBJS = \
|
||||
mstream.o \
|
||||
nbkbase.o \
|
||||
object.o \
|
||||
odbc.o \
|
||||
paper.o \
|
||||
popupcmn.o \
|
||||
prntbase.o \
|
||||
@@ -656,6 +660,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -90,6 +90,7 @@ GENERICOBJS= accel.obj &
|
||||
|
||||
COMMONOBJS = &
|
||||
y_tab.obj &
|
||||
accesscmn.obj &
|
||||
appcmn.obj &
|
||||
artprov.obj &
|
||||
artstd.obj &
|
||||
@@ -117,6 +118,7 @@ COMMONOBJS = &
|
||||
dobjcmn.obj &
|
||||
docmdi.obj &
|
||||
docview.obj &
|
||||
dpycmn.obj &
|
||||
dseldlg.obj &
|
||||
dynarray.obj &
|
||||
dynlib.obj &
|
||||
@@ -176,7 +178,6 @@ COMMONOBJS = &
|
||||
mstream.obj &
|
||||
nbkbase.obj &
|
||||
object.obj &
|
||||
odbc.obj &
|
||||
paper.obj &
|
||||
popupcmn.obj &
|
||||
prntbase.obj &
|
||||
@@ -186,6 +187,7 @@ COMMONOBJS = &
|
||||
radiocmn.obj &
|
||||
regex.obj &
|
||||
resource.obj &
|
||||
rgncmn.obj &
|
||||
sckaddr.obj &
|
||||
sckfile.obj &
|
||||
sckipc.obj &
|
||||
@@ -534,6 +536,9 @@ win32.obj: $(UNIVTHEMEDIR)\win32.cpp
|
||||
########################################################
|
||||
# Common objects (always compiled)
|
||||
|
||||
accesscmn.obj: $(COMMDIR)\accesscmn.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
appcmn.obj: $(COMMDIR)\appcmn.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
@@ -615,6 +620,9 @@ docmdi.obj: $(COMMDIR)\docmdi.cpp
|
||||
docview.obj: $(COMMDIR)\docview.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
dpycmn.obj: $(COMMDIR)\dpycmn.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
dseldlg.obj: $(COMMDIR)\dseldlg.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
@@ -792,9 +800,6 @@ nbkbase.obj: $(COMMDIR)\nbkbase.cpp
|
||||
object.obj: $(COMMDIR)\object.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
odbc.obj: $(COMMDIR)\odbc.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
paper.obj: $(COMMDIR)\paper.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
@@ -822,6 +827,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) $<
|
||||
|
||||
|
@@ -46,6 +46,7 @@ ALL_SOURCES = \
|
||||
generic/treectlg.cpp \
|
||||
generic/treelay.cpp \
|
||||
generic/wizard.cpp \
|
||||
common/accesscmn.cpp \
|
||||
common/appcmn.cpp \
|
||||
common/artprov.cpp \
|
||||
common/artstd.cpp \
|
||||
@@ -72,6 +73,7 @@ ALL_SOURCES = \
|
||||
common/dobjcmn.cpp \
|
||||
common/docmdi.cpp \
|
||||
common/docview.cpp \
|
||||
common/dpycmn.cpp \
|
||||
common/dseldlg.cpp \
|
||||
common/dynarray.cpp \
|
||||
common/dynlib.cpp \
|
||||
@@ -131,7 +133,6 @@ ALL_SOURCES = \
|
||||
common/mstream.cpp \
|
||||
common/nbkbase.cpp \
|
||||
common/object.cpp \
|
||||
common/odbc.cpp \
|
||||
common/paper.cpp \
|
||||
common/popupcmn.cpp \
|
||||
common/prntbase.cpp \
|
||||
@@ -141,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 \
|
||||
@@ -234,6 +236,7 @@ ALL_SOURCES = \
|
||||
|
||||
ALL_HEADERS = \
|
||||
accel.h \
|
||||
access.h \
|
||||
app.h \
|
||||
arrimpl.cpp \
|
||||
artprov.h \
|
||||
@@ -267,7 +270,6 @@ ALL_HEADERS = \
|
||||
ctrlsub.h \
|
||||
cursor.h \
|
||||
dataobj.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -290,6 +292,7 @@ ALL_HEADERS = \
|
||||
dir.h \
|
||||
dirctrl.h \
|
||||
dirdlg.h \
|
||||
display.h \
|
||||
dnd.h \
|
||||
docmdi.h \
|
||||
docview.h \
|
||||
@@ -364,6 +367,7 @@ ALL_HEADERS = \
|
||||
listimpl.cpp \
|
||||
log.h \
|
||||
longlong.h \
|
||||
math.h \
|
||||
matrix.h \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
@@ -380,7 +384,6 @@ ALL_HEADERS = \
|
||||
mstream.h \
|
||||
notebook.h \
|
||||
object.h \
|
||||
odbc.h \
|
||||
ownerdrw.h \
|
||||
palette.h \
|
||||
panel.h \
|
||||
@@ -399,6 +402,7 @@ ALL_HEADERS = \
|
||||
quantize.h \
|
||||
radiobox.h \
|
||||
radiobut.h \
|
||||
rawbmp.h \
|
||||
regex.h \
|
||||
region.h \
|
||||
resource.h \
|
||||
@@ -439,7 +443,6 @@ ALL_HEADERS = \
|
||||
tglbtn.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tipdlg.h \
|
||||
tipwin.h \
|
||||
@@ -476,6 +479,7 @@ ALL_HEADERS = \
|
||||
zipstrm.h \
|
||||
zstream.h \
|
||||
msw/accel.h \
|
||||
msw/access.h \
|
||||
msw/app.h \
|
||||
msw/bitmap.h \
|
||||
msw/bmpbuttn.h \
|
||||
@@ -490,8 +494,6 @@ ALL_HEADERS = \
|
||||
msw/colour.h \
|
||||
msw/combobox.h \
|
||||
msw/control.h \
|
||||
msw/curico.h \
|
||||
msw/curicop.h \
|
||||
msw/cursor.h \
|
||||
msw/dc.h \
|
||||
msw/dcclient.h \
|
||||
@@ -501,7 +503,6 @@ ALL_HEADERS = \
|
||||
msw/dde.h \
|
||||
msw/dialog.h \
|
||||
msw/dib.h \
|
||||
msw/dibutils.h \
|
||||
msw/dirdlg.h \
|
||||
msw/dragimag.h \
|
||||
msw/enhmeta.h \
|
||||
@@ -511,7 +512,6 @@ ALL_HEADERS = \
|
||||
msw/fontdlg.h \
|
||||
msw/frame.h \
|
||||
msw/gauge95.h \
|
||||
msw/gaugemsw.h \
|
||||
msw/gccpriv.h \
|
||||
msw/gdiimage.h \
|
||||
msw/gdiobj.h \
|
||||
@@ -635,6 +635,7 @@ ALL_HEADERS = \
|
||||
|
||||
COMMONOBJS = \
|
||||
parser.o \
|
||||
accesscmn.o \
|
||||
appcmn.o \
|
||||
artprov.o \
|
||||
artstd.o \
|
||||
@@ -661,6 +662,7 @@ COMMONOBJS = \
|
||||
dobjcmn.o \
|
||||
docmdi.o \
|
||||
docview.o \
|
||||
dpycmn.o \
|
||||
dseldlg.o \
|
||||
dynarray.o \
|
||||
dynlib.o \
|
||||
@@ -720,7 +722,6 @@ COMMONOBJS = \
|
||||
mstream.o \
|
||||
nbkbase.o \
|
||||
object.o \
|
||||
odbc.o \
|
||||
paper.o \
|
||||
popupcmn.o \
|
||||
prntbase.o \
|
||||
@@ -730,6 +731,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -145,6 +145,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -737,6 +738,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -128,6 +128,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -330,7 +331,6 @@ ALL_HEADERS = \
|
||||
ctrlsub.h \
|
||||
cursor.h \
|
||||
dataobj.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -504,7 +504,6 @@ ALL_HEADERS = \
|
||||
tglbtn.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tipdlg.h \
|
||||
tipwin.h \
|
||||
@@ -801,6 +800,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -758,6 +758,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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -912,3 +953,4 @@ HWND wxTLWHiddenParentModule::GetHWND()
|
||||
return ms_hwnd;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -176,6 +176,7 @@ ALL_SOURCES = \
|
||||
common/radiocmn.cpp \
|
||||
common/regex.cpp \
|
||||
common/resource.cpp \
|
||||
common/rgncmn.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckfile.cpp \
|
||||
common/sckipc.cpp \
|
||||
@@ -278,7 +279,6 @@ ALL_HEADERS = \
|
||||
ctrlsub.h \
|
||||
cursor.h \
|
||||
dataobj.h \
|
||||
date.h \
|
||||
datetime.h \
|
||||
datetime.inl \
|
||||
datstrm.h \
|
||||
@@ -452,7 +452,6 @@ ALL_HEADERS = \
|
||||
tglbtn.h \
|
||||
thread.h \
|
||||
thrimpl.cpp \
|
||||
time.h \
|
||||
timer.h \
|
||||
tipdlg.h \
|
||||
tipwin.h \
|
||||
@@ -750,6 +749,7 @@ COMMONOBJS = \
|
||||
radiocmn.o \
|
||||
regex.o \
|
||||
resource.o \
|
||||
rgncmn.o \
|
||||
sckaddr.o \
|
||||
sckfile.o \
|
||||
sckipc.o \
|
||||
|
@@ -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);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@@ -1047,8 +1047,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);
|
||||
@@ -1078,6 +1082,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);
|
||||
};
|
||||
|
||||
|
||||
@@ -1107,6 +1123,7 @@ public:
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
%readonly
|
||||
%{
|
||||
#if 0
|
||||
|
Reference in New Issue
Block a user