From 3e6858cdcb9278b36446466c346d984e7e306553 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sun, 16 Mar 2008 16:47:57 +0000 Subject: [PATCH] introduce wxBrushStyle enum and replace 'int style' occurrences in wxBrush code with 'wxBrushStyle style'; the change is backward compatible and documented in changes.txt git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 32 ++++++----- include/wx/brush.h | 102 +++++++++++++++++++++++++++++++++- include/wx/cocoa/brush.h | 6 +- include/wx/defs.h | 30 +--------- include/wx/dfb/brush.h | 6 +- include/wx/gdicmn.h | 3 +- include/wx/gtk/brush.h | 6 +- include/wx/gtk1/brush.h | 6 +- include/wx/mac/carbon/brush.h | 6 +- include/wx/mgl/brush.h | 6 +- include/wx/msw/brush.h | 6 +- include/wx/os2/brush.h | 16 +++--- include/wx/palmos/brush.h | 6 +- include/wx/x11/brush.h | 6 +- src/common/gdicmn.cpp | 4 +- src/dfb/brush.cpp | 12 ++-- src/generic/listctrl.cpp | 8 +-- src/gtk/brush.cpp | 38 ++++++------- src/gtk1/brush.cpp | 12 ++-- src/mac/carbon/brush.cpp | 36 ++++++------ src/mgl/brush.cpp | 8 +-- src/msw/brush.cpp | 16 +++--- src/os2/brush.cpp | 4 +- src/palmos/brush.cpp | 6 +- src/x11/brush.cpp | 12 ++-- 25 files changed, 233 insertions(+), 160 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 3020e542fa..34c968e069 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -152,6 +152,7 @@ Changes in behaviour which may result in compilation errors next/previous control sibling instead. + Deprecated methods and their replacements ----------------------------------------- @@ -170,9 +171,12 @@ Deprecated methods and their replacements use simpler OnExec() version which is called with wxString argument - wxMenuItem::GetLabel has been deprecated in favour of wxMenuItem::GetItemLabelText - wxMenuItem::GetText has been deprecated in favour of wxMenuItem::GetItemLabel -- wxMenuItem::GetLabelFromText has been deprecated in favour of wxMenuItem::GetLabelText +- wxMenuItem::GetLabelFromText has been deprecated in favour of wxMenuItem::GetLabelText - wxMenuItem::SetText has been deprecated in favour of wxMenuItem::SetItemLabel - +- wxBrush::SetStyle and wxBrush:GetStyle as well as the wxBrush ctor now take + a wxBrushStyle value instead of a plain "int style". + Use the new wxBrush style names (wxBRUSHSTYLE_XXX) instead of the old deprecated + wxXXX styles (which are still available however). Major new features in this release ---------------------------------- @@ -839,7 +843,7 @@ All (GUI): - wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls. - Added wxTopLevelWindow::SetTransparent and CanSetTransparent, with implementations (so far) for wxMSW and wxMac. -- Allow customizing individual grid lines appearance (Søren Lassen). +- Allow customizing individual grid lines appearance (S�ren Lassen). - Fixed middle click events generation in generic wxTreeCtrl (Olly Betts). - Added wxEVT_MOUSE_CAPTURE_LOST event that must be handled by all windows that CaptureMouse() is called on. @@ -1002,7 +1006,7 @@ wxX11: - Invisible text problem fixed. - Bitmap clipping with masks and scaling improved. - Fixed a crash bug in the generic timer. -- Implemented child process termination notifications (David Björkevik) +- Implemented child process termination notifications (David Bj�rkevik) Unix: @@ -1040,7 +1044,7 @@ All (GUI): - Added wxXmlResource::Unload(). - Possibility of modeless wxWizard dialog (with presentation in sample). - Fixed a rare crash due to malformed HTML in wxHTML (Xavier Nodet). -- Ctrl+mouse wheel changes zoom factor in print preview (Zbigniew Zagórski). +- Ctrl+mouse wheel changes zoom factor in print preview (Zbigniew Zag�rski). - Cross-compile now supported for wxGTK, wxX11 and wxMotif. - Cygwin compilation of wxX11, wxGTK and wxMotif now supported. - Now reads "help" parameter for all windows (context help text). @@ -1055,7 +1059,7 @@ wxMSW: - Fixed wxSlider::GetSelEnd() (Atilim Cetin). - Fixed accelerators of menu items added to already attached submenus. - Position of wxEVT_MOUSEWHEEL events is now in client, not screen, coordinates. -- Handle absence of wxListCtrl column image better (Zbigniew Zagórski). +- Handle absence of wxListCtrl column image better (Zbigniew Zag�rski). - Fixed asynchronous playback of large sound files in wxSound. - Added wxDynamicLibrary::GetSymbolAorW(). - Fixed default size of wxStaticText controls with border being too small. @@ -1338,8 +1342,8 @@ All: use accessors methods now (Mart Raudsepp) - new classes for reading and writing ZIP files (M.J.Wetherell) - large files support for wxFFile (M.J.Wetherell) -- classes in the manual are now cross-referenced (Zbigniew Zagórski) -- Norwegian (Bokmål) translation added (Hans F. Nordhaug) +- classes in the manual are now cross-referenced (Zbigniew Zag�rski) +- Norwegian (Bokm�l) translation added (Hans F. Nordhaug) - wxDynamicLibrary::HasSymbol() added - added wxEXEC_NODISABLE flag to be used with wxExecute(wxEXEC_SYNC) - added wxTextInputStream::operator>>(wchar_t) for compilers which support this @@ -1388,7 +1392,7 @@ All (GUI): - added wxMediaCtrl - added wxDatePickerCtrl - wxHtmlWindow now supports background images given in tag -- wxSplitterWindow now supports gravity parameter (Zbigniew Zagórski) +- wxSplitterWindow now supports gravity parameter (Zbigniew Zag�rski) - recursive wxSizer::GetItem returns item of given window, sizer or nth index - wxLayoutConstraints now use best size, not current size, for AsIs() condition - wxSizer::Add/Insert etc. now returns pointer to wxSizerItem just added and this @@ -1696,7 +1700,7 @@ wxODBC: All: -- event table macros now do some minimal type safety checks (Michael Sögtrop) +- event table macros now do some minimal type safety checks (Michael S�gtrop) - added wxGzipInput/OutputStream, bug fixes in wxZlibStreams (M.J.Wetherell) - wxDateTime::ParseDateTime() implemented (Linus McCabe) - wxHTTP::GetResponse() added (David Nock) @@ -1729,7 +1733,7 @@ All (GUI): - added some support for C++ exceptions in the library (do read the manual!) - added wxListCtrl::GetViewRect() - added wxTextCtrl::MarkDirty() -- wxToolBar::ToggleTool() now works for radio buttons (Dag Ågren) +- wxToolBar::ToggleTool() now works for radio buttons (Dag �gren) - wxListCtrl now sends an END_LABEL event if editing was cancelled, too - bug in wxRect ctor from two [out of order] wxPoints fixed (Steve Cornett) - status text is now restored after wxMenu help is shown in it @@ -1860,7 +1864,7 @@ All: wxBase: - added Watcom makefiles -- fixed bug with searching in sorted arrays (Jürgen Palm) +- fixed bug with searching in sorted arrays (J�rgen Palm) All GUI ports: @@ -2421,7 +2425,7 @@ All (GUI): - polygon support in wxRegion (Klaas Holwerda) - wxStreamToTextRedirector to allow easily redirect cout to wxTextCtrl added - fixed bug with using wxExecute() to capture huge amounts of output -- new wxCalendarCtrl styles added (Søren Erland Vestø) +- new wxCalendarCtrl styles added (S�ren Erland Vest�) - wxWizard changes: loading from WXR support, help button (Robert Cavanaugh) - wxDirSelector() added (Paul A. Thiessen) - wxGrid cell editing veto support (Roger Gammans) @@ -2529,7 +2533,7 @@ wxBase: - wxZipFSHandler::FindFirst() and FindNext() now correctly list directories - wxMimeTypesManager now can create file associations too (Chris Elliott) - wxCopyFile() respects the file permissions (Roland Scholz) -- wxFTP::GetFileSize() added (Søren Erland Vestø) +- wxFTP::GetFileSize() added (S�ren Erland Vest�) - wxDateTime::IsSameDate() bug fixed - wxTimeSpan::Format() now behaves more as expected, see docs - wxLocale now provides much more convenient API for setting language and diff --git a/include/wx/brush.h b/include/wx/brush.h index 0c862b7e75..69b187b7dc 100644 --- a/include/wx/brush.h +++ b/include/wx/brush.h @@ -16,16 +16,114 @@ #include "wx/object.h" #include "wx/gdiobj.h" +// NOTE: these values cannot be combined together! +enum wxBrushStyle +{ +#ifdef WXWIN_COMPATIBILITY_2_8 + /* start of deprecated values */ + wxSOLID = 100, + wxDOT, + wxLONG_DASH, + wxSHORT_DASH, + wxDOT_DASH, + wxUSER_DASH, + wxTRANSPARENT, + wxSTIPPLE_MASK_OPAQUE, + wxSTIPPLE_MASK, + wxSTIPPLE, + wxBDIAGONAL_HATCH, + wxCROSSDIAG_HATCH, + wxFDIAGONAL_HATCH, + wxCROSS_HATCH, + wxHORIZONTAL_HATCH, + wxVERTICAL_HATCH, + wxFIRST_HATCH = wxBDIAGONAL_HATCH, + wxLAST_HATCH = wxVERTICAL_HATCH, + /* end of deprecated values */ + + wxBRUSHSTYLE_SOLID = wxSOLID, + wxBRUSHSTYLE_DOT = wxDOT, + wxBRUSHSTYLE_LONG_DASH = wxLONG_DASH, + wxBRUSHSTYLE_SHORT_DASH = wxSHORT_DASH, + wxBRUSHSTYLE_DOT_DASH = wxDOT_DASH, + wxBRUSHSTYLE_USER_DOT = wxUSER_DASH, + + wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT, + + /* Brush Stippling. */ + wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE, + /* mask is used for blitting monochrome using text fore and back ground colors */ + + wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK, + /* mask is used for masking areas in the stipple bitmap (TO DO) */ + + wxBRUSHSTYLE_STIPPLE = wxSTIPPLE, + /* drawn with a Pen, and without any Brush -- and it can be stippled. */ + + /* In wxWidgets < 2.6 use WX_HATCH macro */ + /* to verify these wx*_HATCH are in style */ + /* of wxBrush. In wxWidgets >= 2.6 use */ + /* wxBrush::IsHatch() instead. */ + wxBRUSHSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH, + wxBRUSHSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH, + wxBRUSHSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH, + wxBRUSHSTYLE_CROSS_HATCH = wxCROSS_HATCH, + wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH, + wxBRUSHSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH, + + wxBRUSHSTYLE_FIRST_HATCH = wxFIRST_HATCH, + wxBRUSHSTYLE_LAST_HATCH = wxLAST_HATCH, + + wxBRUSHSTYLE_MAX +#else + wxBRUSHSTYLE_SOLID, + wxBRUSHSTYLE_DOT, + wxBRUSHSTYLE_LONG_DASH, + wxBRUSHSTYLE_SHORT_DASH, + wxBRUSHSTYLE_DOT_DASH, + wxBRUSHSTYLE_USER_DOT, + + wxBRUSHSTYLE_TRANSPARENT, + + /* Brush Stippling. */ + wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE, + /* mask is used for blitting monochrome using text fore and back ground colors */ + + wxBRUSHSTYLE_STIPPLE_MASK, + /* mask is used for masking areas in the stipple bitmap (TO DO) */ + + wxBRUSHSTYLE_STIPPLE, + /* drawn with a Pen, and without any Brush -- and it can be stippled. */ + + /* In wxWidgets < 2.6 use WX_HATCH macro */ + /* to verify these wx*_HATCH are in style */ + /* of wxBrush. In wxWidgets >= 2.6 use */ + /* wxBrush::IsHatch() instead. */ + wxBRUSHSTYLE_BDIAGONAL_HATCH, + wxBRUSHSTYLE_CROSSDIAG_HATCH, + wxBRUSHSTYLE_FDIAGONAL_HATCH, + wxBRUSHSTYLE_CROSS_HATCH, + wxBRUSHSTYLE_HORIZONTAL_HATCH, + wxBRUSHSTYLE_VERTICAL_HATCH, + + wxBRUSHSTYLE_FIRST_HATCH = wxBRUSHSTYLE_BDIAGONAL_HATCH, + wxBRUSHSTYLE_LAST_HATCH = wxBRUSHSTYLE_VERTICAL_HATCH, + + wxBRUSHSTYLE_MAX +#endif +}; + + // wxBrushBase class WXDLLEXPORT wxBrushBase: public wxGDIObject { public: virtual ~wxBrushBase() { } - virtual int GetStyle() const = 0; + virtual wxBrushStyle GetStyle() const = 0; virtual bool IsHatch() const - { return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); } + { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); } }; #if defined(__WXPALMOS__) diff --git a/include/wx/cocoa/brush.h b/include/wx/cocoa/brush.h index facbc7194d..a3d41f8e98 100644 --- a/include/wx/cocoa/brush.h +++ b/include/wx/cocoa/brush.h @@ -29,7 +29,7 @@ class WXDLLEXPORT wxBrush: public wxBrushBase // ------------------------------------------------------------------------ public: wxBrush(); - wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); @@ -38,7 +38,7 @@ public: // ------------------------------------------------------------------------ virtual void SetColour(const wxColour& col) ; virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ; - virtual void SetStyle(int style) ; + virtual void SetStyle(wxBrushStyle style) ; virtual void SetStipple(const wxBitmap& stipple) ; // comparison @@ -49,7 +49,7 @@ public: // accessors wxColour GetColour() const; - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxBitmap *GetStipple() const; // wxCocoa diff --git a/include/wx/defs.h b/include/wx/defs.h index 0c3848a2a3..4098c98525 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1993,7 +1993,7 @@ enum /* IDs used by generic file dialog (13 consecutive starting from this value) */ wxID_FILEDLGG = 5900, - + /* IDs used by generic file ctrl (4 consecutive starting from this value) */ wxID_FILECTRL = 5950, @@ -2100,32 +2100,6 @@ enum wxITALIC, wxSLANT, - /* Pen styles */ - wxSOLID = 100, - wxDOT, - wxLONG_DASH, - wxSHORT_DASH, - wxDOT_DASH, - wxUSER_DASH, - - wxTRANSPARENT, - - /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ - /* Note also that stippling a Pen IS meaningfull, because a Line is */ - wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ - wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ - /* drawn with a Pen, and without any Brush -- and it can be stippled. */ - wxSTIPPLE = 110, - - wxBDIAGONAL_HATCH, /* In wxWidgets < 2.6 use WX_HATCH macro */ - wxCROSSDIAG_HATCH, /* to verify these wx*_HATCH are in style */ - wxFDIAGONAL_HATCH, /* of wxBrush. In wxWidgets >= 2.6 use */ - wxCROSS_HATCH, /* wxBrush::IsHatch() instead. */ - wxHORIZONTAL_HATCH, - wxVERTICAL_HATCH, - wxFIRST_HATCH = wxBDIAGONAL_HATCH, - wxLAST_HATCH = wxVERTICAL_HATCH, - wxJOIN_BEVEL = 120, wxJOIN_MITER, wxJOIN_ROUND, @@ -2659,7 +2633,7 @@ typedef HIShapeRef WXHRGN; #endif -#if defined( __WXCOCOA__ ) || defined(__WXMAC__) +#if defined( __WXCOCOA__ ) || defined(__WXMAC__) /* Definitions of 32-bit/64-bit types * These are typedef'd exactly the same way in newer OS X headers so diff --git a/include/wx/dfb/brush.h b/include/wx/dfb/brush.h index 926df84299..ece3093439 100644 --- a/include/wx/dfb/brush.h +++ b/include/wx/dfb/brush.h @@ -32,19 +32,19 @@ class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase { public: wxBrush() {} - wxBrush(const wxColour &colour, int style = wxSOLID); + wxBrush(const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap &stippleBitmap); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxColour& GetColour() const; wxBitmap *GetStipple() const; void SetColour(const wxColour& col); void SetColour(unsigned char r, unsigned char g, unsigned char b); - void SetStyle(int style); + void SetStyle(wxBrushStyle style); void SetStipple(const wxBitmap& stipple); protected: diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 8e5bf5ffd1..a3904b73d2 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -22,6 +22,7 @@ #include "wx/fontenc.h" #include "wx/hashmap.h" #include "wx/math.h" +#include "wx/brush.h" // --------------------------------------------------------------------------- // forward declarations @@ -631,7 +632,7 @@ public: class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase { public: - wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID); + wxBrush *FindOrCreateBrush(const wxColour& colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); #if WXWIN_COMPATIBILITY_2_6 wxDEPRECATED( void AddBrush(wxBrush*) ); wxDEPRECATED( void RemoveBrush(wxBrush*) ); diff --git a/include/wx/gtk/brush.h b/include/wx/gtk/brush.h index f733ecea5f..977574e18f 100644 --- a/include/wx/gtk/brush.h +++ b/include/wx/gtk/brush.h @@ -22,20 +22,20 @@ class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase public: wxBrush() { } - wxBrush( const wxColour &colour, int style = wxSOLID ); + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); wxBrush( const wxBitmap &stippleBitmap ); virtual ~wxBrush(); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxColour &GetColour() const; wxBitmap *GetStipple() const; void SetColour( const wxColour& col ); void SetColour( unsigned char r, unsigned char g, unsigned char b ); - void SetStyle( int style ); + void SetStyle( wxBrushStyle style ); void SetStipple( const wxBitmap& stipple ); protected: diff --git a/include/wx/gtk1/brush.h b/include/wx/gtk1/brush.h index 2f7def8807..a184c8f3b1 100644 --- a/include/wx/gtk1/brush.h +++ b/include/wx/gtk1/brush.h @@ -32,20 +32,20 @@ class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase public: wxBrush() { } - wxBrush( const wxColour &colour, int style = wxSOLID ); + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); wxBrush( const wxBitmap &stippleBitmap ); virtual ~wxBrush(); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxColour &GetColour() const; wxBitmap *GetStipple() const; void SetColour( const wxColour& col ); void SetColour( unsigned char r, unsigned char g, unsigned char b ); - void SetStyle( int style ); + void SetStyle( wxBrushStyle style ); void SetStipple( const wxBitmap& stipple ); private: diff --git a/include/wx/mac/carbon/brush.h b/include/wx/mac/carbon/brush.h index e66a86f8d6..d1a2f41d94 100644 --- a/include/wx/mac/carbon/brush.h +++ b/include/wx/mac/carbon/brush.h @@ -23,20 +23,20 @@ class WXDLLEXPORT wxBrush: public wxBrushBase { public: wxBrush(); - wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); virtual void SetColour(const wxColour& col) ; virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ; - virtual void SetStyle(int style) ; + virtual void SetStyle(wxBrushStyle style) ; virtual void SetStipple(const wxBitmap& stipple) ; bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } const wxColour& GetColour() const ; - virtual int GetStyle() const ; + virtual wxBrushStyle GetStyle() const ; wxBitmap *GetStipple() const ; protected: diff --git a/include/wx/mgl/brush.h b/include/wx/mgl/brush.h index afb78bafa5..318018f8cb 100644 --- a/include/wx/mgl/brush.h +++ b/include/wx/mgl/brush.h @@ -31,19 +31,19 @@ class WXDLLEXPORT wxBrush : public wxBrushBase { public: wxBrush() {} - wxBrush(const wxColour &colour, int style = wxSOLID); + wxBrush(const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap &stippleBitmap); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const; - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxColour &GetColour() const; wxBitmap *GetStipple() const; void SetColour(const wxColour& col); void SetColour(unsigned char r, unsigned char g, unsigned char b); - void SetStyle(int style); + void SetStyle(wxBrushStyle style); void SetStipple(const wxBitmap& stipple); // implementation: diff --git a/include/wx/msw/brush.h b/include/wx/msw/brush.h index 5cac035628..8554818c23 100644 --- a/include/wx/msw/brush.h +++ b/include/wx/msw/brush.h @@ -26,20 +26,20 @@ class WXDLLEXPORT wxBrush : public wxBrushBase { public: wxBrush(); - wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); virtual void SetColour(const wxColour& col); virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); - virtual void SetStyle(int style); + virtual void SetStyle(wxBrushStyle style); virtual void SetStipple(const wxBitmap& stipple); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } wxColour GetColour() const; - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxBitmap *GetStipple() const; // return the HBRUSH for this brush diff --git a/include/wx/os2/brush.h b/include/wx/os2/brush.h index cce9af579d..0a0e64f080 100644 --- a/include/wx/os2/brush.h +++ b/include/wx/os2/brush.h @@ -34,11 +34,11 @@ public: } protected: - int m_nStyle; - wxBitmap m_vStipple ; - wxColour m_vColour; - WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with - AREABUNDLE m_vBundle; + wxBrushStyle m_nStyle; + wxBitmap m_vStipple; + wxColour m_vColour; + WXHBRUSH m_hBrush; // in OS/2 GPI this will be the PS the pen is associated with + AREABUNDLE m_vBundle; }; #define M_BRUSHDATA ((wxBrushRefData *)m_refData) @@ -48,7 +48,7 @@ class WXDLLEXPORT wxBrush: public wxBrushBase { public: wxBrush(); - wxBrush(const wxColour& rCol, int nStyle = wxSOLID); + wxBrush(const wxColour& rCol, wxBrushStyle nStyle = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap& rStipple); virtual ~wxBrush(); @@ -58,11 +58,11 @@ public: virtual void SetColour(const wxColour& rColour); virtual void SetColour(unsigned char cRed, unsigned char cGreen, unsigned char cBrush); virtual void SetPS(HPS hPS); - virtual void SetStyle(int nStyle) ; + virtual void SetStyle(wxBrushStyle nStyle); virtual void SetStipple(const wxBitmap& rStipple); inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); }; - virtual int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); }; + virtual wxBrushStyle GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); }; inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); }; inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); }; diff --git a/include/wx/palmos/brush.h b/include/wx/palmos/brush.h index 495ea2e649..2c354a56bb 100644 --- a/include/wx/palmos/brush.h +++ b/include/wx/palmos/brush.h @@ -26,20 +26,20 @@ class WXDLLEXPORT wxBrush : public wxBrushBase { public: wxBrush(); - wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); virtual void SetColour(const wxColour& col); virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); - virtual void SetStyle(int style); + virtual void SetStyle(wxBrushStyle style); virtual void SetStipple(const wxBitmap& stipple); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } wxColour GetColour() const; - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxBitmap *GetStipple() const; // return the HBRUSH for this brush diff --git a/include/wx/x11/brush.h b/include/wx/x11/brush.h index 93ec215aca..49586ad0ce 100644 --- a/include/wx/x11/brush.h +++ b/include/wx/x11/brush.h @@ -31,20 +31,20 @@ class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase public: wxBrush() { } - wxBrush( const wxColour &colour, int style = wxSOLID ); + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); wxBrush( const wxBitmap &stippleBitmap ); virtual ~wxBrush(); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - virtual int GetStyle() const; + virtual wxBrushStyle GetStyle() const; wxColour &GetColour() const; wxBitmap *GetStipple() const; void SetColour( const wxColour& col ); void SetColour( unsigned char r, unsigned char g, unsigned char b ); - void SetStyle( int style ); + void SetStyle( wxBrushStyle style ); void SetStipple( const wxBitmap& stipple ); protected: diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index fa208d6fa2..eb7c32078f 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -758,14 +758,14 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style) return pen; } -wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style) +wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, wxBrushStyle style) { for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() ) { wxBrush * const brush = (wxBrush *) node->GetData (); - if ( brush->GetStyle () == style && brush->GetColour() == colour ) + if ( brush->GetStyle() == style && brush->GetColour() == colour ) return brush; } diff --git a/src/dfb/brush.cpp b/src/dfb/brush.cpp index 6d310fc0bd..51a295f997 100644 --- a/src/dfb/brush.cpp +++ b/src/dfb/brush.cpp @@ -29,7 +29,7 @@ class wxBrushRefData : public wxGDIRefData { public: - wxBrushRefData(const wxColour& clr = wxNullColour, int style = wxSOLID) + wxBrushRefData(const wxColour& clr = wxNullColour, wxBrushStyle style = wxBRUSHSTYLE_SOLID) { m_colour = clr; SetStyle(style); @@ -43,7 +43,7 @@ public: virtual bool IsOk() const { return m_colour.IsOk(); } - void SetStyle(int style) + void SetStyle(wxBrushStyle style) { if ( style != wxSOLID && style != wxTRANSPARENT ) { @@ -55,7 +55,7 @@ public: } wxColour m_colour; - int m_style; + wxBrushStyle m_style; }; //----------------------------------------------------------------------------- @@ -64,7 +64,7 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) -wxBrush::wxBrush(const wxColour &colour, int style) +wxBrush::wxBrush(const wxColour &colour, wxBrushStyle style) { m_refData = new wxBrushRefData(colour, style); } @@ -82,7 +82,7 @@ bool wxBrush::operator==(const wxBrush& brush) const return m_refData == brush.m_refData; } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { if (m_refData == NULL) { @@ -122,7 +122,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) M_BRUSHDATA->m_colour.Set(r, g, b); } -void wxBrush::SetStyle(int style) +void wxBrush::SetStyle(wxBrushStyle style) { AllocExclusive(); M_BRUSHDATA->SetStyle(style); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 05663f5d8f..aef8733fe1 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2135,11 +2135,11 @@ wxListTextCtrlWrapper::wxListTextCtrlWrapper(wxListMainWindow *owner, void wxListTextCtrlWrapper::EndEdit(bool discardChanges) { m_aboutToFinish = true; - + if ( discardChanges ) { m_owner->OnRenameCancelled(m_itemEdited); - + Finish( true ); } else @@ -2158,7 +2158,7 @@ void wxListTextCtrlWrapper::Finish( bool setfocus ) m_owner->ResetTextControl( m_text ); wxPendingDelete.Append( this ); - + if (setfocus) m_owner->SetFocusIgnoringChildren(); } @@ -2215,7 +2215,7 @@ void wxListTextCtrlWrapper::OnKeyUp( wxKeyEvent &event ) sx = mySize.x; m_text->SetSize(sx, wxDefaultCoord); } - + event.Skip(); } diff --git a/src/gtk/brush.cpp b/src/gtk/brush.cpp index 0106125d9a..a57855a31e 100644 --- a/src/gtk/brush.cpp +++ b/src/gtk/brush.cpp @@ -24,9 +24,10 @@ class wxBrushRefData: public wxGDIRefData { public: - wxBrushRefData() + wxBrushRefData(const wxColour& colour = wxNullColour, wxBrushStyle style = wxBRUSHSTYLE_SOLID) { - m_style = 0; + m_style = style; + m_colour = colour; } wxBrushRefData( const wxBrushRefData& data ) @@ -44,9 +45,9 @@ public: m_colour == data.m_colour); } - int m_style; - wxColour m_colour; - wxBitmap m_stipple; + wxBrushStyle m_style; + wxColour m_colour; + wxBitmap m_stipple; }; //----------------------------------------------------------------------------- @@ -55,24 +56,19 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) -wxBrush::wxBrush( const wxColour &colour, int style ) +wxBrush::wxBrush( const wxColour &colour, wxBrushStyle style ) { - m_refData = new wxBrushRefData(); - M_BRUSHDATA->m_style = style; - M_BRUSHDATA->m_colour = colour; + m_refData = new wxBrushRefData(colour, style); } wxBrush::wxBrush( const wxBitmap &stippleBitmap ) { - m_refData = new wxBrushRefData(); - M_BRUSHDATA->m_colour = *wxBLACK; + wxBrushStyle style = wxBRUSHSTYLE_STIPPLE; + if (stippleBitmap.GetMask()) + style = wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE; + m_refData = new wxBrushRefData(*wxBLACK, style); M_BRUSHDATA->m_stipple = stippleBitmap; - - if (M_BRUSHDATA->m_stipple.GetMask()) - M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE; - else - M_BRUSHDATA->m_style = wxSTIPPLE; } wxBrush::~wxBrush() @@ -99,12 +95,12 @@ bool wxBrush::operator==(const wxBrush& brush) const return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData ); } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { if (m_refData == NULL) { wxFAIL_MSG( wxT("invalid brush") ); - return 0; + return wxBRUSHSTYLE_MAX; } return M_BRUSHDATA->m_style; @@ -146,7 +142,7 @@ void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) M_BRUSHDATA->m_colour.Set( r, g, b ); } -void wxBrush::SetStyle( int style ) +void wxBrush::SetStyle( wxBrushStyle style ) { AllocExclusive(); @@ -160,10 +156,10 @@ void wxBrush::SetStipple( const wxBitmap& stipple ) M_BRUSHDATA->m_stipple = stipple; if (M_BRUSHDATA->m_stipple.GetMask()) { - M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE; + M_BRUSHDATA->m_style = wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE; } else { - M_BRUSHDATA->m_style = wxSTIPPLE; + M_BRUSHDATA->m_style = wxBRUSHSTYLE_STIPPLE; } } diff --git a/src/gtk1/brush.cpp b/src/gtk1/brush.cpp index b07c208e2f..908cfd933c 100644 --- a/src/gtk1/brush.cpp +++ b/src/gtk1/brush.cpp @@ -45,9 +45,9 @@ public: m_colour == data.m_colour); } - int m_style; - wxColour m_colour; - wxBitmap m_stipple; + wxBrushStyle m_style; + wxColour m_colour; + wxBitmap m_stipple; }; //----------------------------------------------------------------------------- @@ -56,7 +56,7 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) -wxBrush::wxBrush( const wxColour &colour, int style ) +wxBrush::wxBrush( const wxColour &colour, wxBrushStyle style ) { m_refData = new wxBrushRefData(); M_BRUSHDATA->m_style = style; @@ -100,7 +100,7 @@ bool wxBrush::operator == ( const wxBrush& brush ) const return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData ); } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { if (m_refData == NULL) { @@ -147,7 +147,7 @@ void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) M_BRUSHDATA->m_colour.Set( r, g, b ); } -void wxBrush::SetStyle( int style ) +void wxBrush::SetStyle( wxBrushStyle style ) { AllocExclusive(); diff --git a/src/mac/carbon/brush.cpp b/src/mac/carbon/brush.cpp index f571682680..5de190f1a5 100644 --- a/src/mac/carbon/brush.cpp +++ b/src/mac/carbon/brush.cpp @@ -24,7 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) class WXDLLEXPORT wxBrushRefData: public wxGDIRefData { public: - wxBrushRefData(const wxColour& colour = wxNullColour, int style = wxSOLID); + wxBrushRefData(const wxColour& colour = wxNullColour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrushRefData(const wxBitmap& stipple); wxBrushRefData(const wxBrushRefData& data); virtual ~wxBrushRefData(); @@ -32,24 +32,24 @@ public: bool operator==(const wxBrushRefData& data) const; const wxColour& GetColour() const { return m_colour; } - int GetStyle() const { return m_style; } + wxBrushStyle GetStyle() const { return m_style; } wxBitmap *GetStipple() { return &m_stipple; } - + void SetColour(const wxColour& colour) { m_colour = colour; } - void SetStyle(int style) { m_style = style; } + void SetStyle(wxBrushStyle style) { m_style = style; } void SetStipple(const wxBitmap& stipple) { DoSetStipple(stipple); } - + protected: void DoSetStipple(const wxBitmap& stipple); wxBitmap m_stipple ; wxColour m_colour; - int m_style; + wxBrushStyle m_style; }; #define M_BRUSHDATA ((wxBrushRefData *)m_refData) -wxBrushRefData::wxBrushRefData(const wxColour& colour, int style) +wxBrushRefData::wxBrushRefData(const wxColour& colour, wxBrushStyle style) : m_colour(colour), m_style( style ) { } @@ -95,7 +95,7 @@ wxBrush::~wxBrush() { } -wxBrush::wxBrush(const wxColour& col, int style) +wxBrush::wxBrush(const wxColour& col, wxBrushStyle style) { m_refData = new wxBrushRefData( col, style ); } @@ -112,7 +112,7 @@ wxBrush::wxBrush(const wxBitmap& stipple) bool wxBrush::operator==(const wxBrush& brush) const { const wxBrushRefData *brushData = (wxBrushRefData *)brush.m_refData; - + // an invalid brush is considered to be only equal to another invalid brush return m_refData ? (brushData && *M_BRUSHDATA == *brushData) : !brushData; } @@ -134,21 +134,21 @@ wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const const wxColour& wxBrush::GetColour() const { wxCHECK_MSG( Ok(), wxNullColour, _T("invalid brush") ); - + return M_BRUSHDATA->GetColour(); } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { wxCHECK_MSG( Ok(), 0, _T("invalid brush") ); - + return M_BRUSHDATA->GetStyle(); } wxBitmap *wxBrush::GetStipple() const { wxCHECK_MSG( Ok(), NULL, _T("invalid brush") ); - + return M_BRUSHDATA->GetStipple(); } @@ -159,27 +159,27 @@ wxBitmap *wxBrush::GetStipple() const void wxBrush::SetColour(const wxColour& col) { AllocExclusive(); - + M_BRUSHDATA->SetColour(col); } void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) { AllocExclusive(); - + M_BRUSHDATA->SetColour(wxColour(r, g, b)); } -void wxBrush::SetStyle(int style) +void wxBrush::SetStyle(wxBrushStyle style) { AllocExclusive(); - + M_BRUSHDATA->SetStyle(style); } void wxBrush::SetStipple(const wxBitmap& stipple) { AllocExclusive(); - + M_BRUSHDATA->SetStipple(stipple); } diff --git a/src/mgl/brush.cpp b/src/mgl/brush.cpp index b8f6073f38..fd6f1c3847 100644 --- a/src/mgl/brush.cpp +++ b/src/mgl/brush.cpp @@ -85,7 +85,7 @@ public: m_colour == data.m_colour); } - int m_style; + wxBrushStyle m_style; wxColour m_colour; wxBitmap m_stipple; pixpattern24_t m_pixPattern; @@ -126,7 +126,7 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data) IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) -wxBrush::wxBrush(const wxColour &colour, int style) +wxBrush::wxBrush(const wxColour &colour, wxBrushStyle style) { m_refData = new wxBrushRefData(); M_BRUSHDATA->m_style = style; @@ -166,7 +166,7 @@ bool wxBrush::operator != (const wxBrush& brush) const return m_refData != brush.m_refData; } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { if (m_refData == NULL) { @@ -225,7 +225,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) M_BRUSHDATA->m_colour.Set(r, g, b); } -void wxBrush::SetStyle( int style ) +void wxBrush::SetStyle( wxBrushStyle style ) { AllocExclusive(); M_BRUSHDATA->m_style = style; diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp index b5edb43205..b8e881b81f 100644 --- a/src/msw/brush.cpp +++ b/src/msw/brush.cpp @@ -41,7 +41,7 @@ class WXDLLEXPORT wxBrushRefData: public wxGDIRefData { public: - wxBrushRefData(const wxColour& colour = wxNullColour, int style = wxSOLID); + wxBrushRefData(const wxColour& colour = wxNullColour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); wxBrushRefData(const wxBitmap& stipple); wxBrushRefData(const wxBrushRefData& data); virtual ~wxBrushRefData(); @@ -52,17 +52,17 @@ public: void Free(); const wxColour& GetColour() const { return m_colour; } - int GetStyle() const { return m_style; } + wxBrushStyle GetStyle() const { return m_style; } wxBitmap *GetStipple() { return &m_stipple; } void SetColour(const wxColour& colour) { Free(); m_colour = colour; } - void SetStyle(int style) { Free(); m_style = style; } + void SetStyle(wxBrushStyle style) { Free(); m_style = style; } void SetStipple(const wxBitmap& stipple) { Free(); DoSetStipple(stipple); } private: void DoSetStipple(const wxBitmap& stipple); - int m_style; + wxBrushStyle m_style; wxBitmap m_stipple; wxColour m_colour; HBRUSH m_hBrush; @@ -84,7 +84,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) // wxBrushRefData ctors/dtor // ---------------------------------------------------------------------------- -wxBrushRefData::wxBrushRefData(const wxColour& colour, int style) +wxBrushRefData::wxBrushRefData(const wxColour& colour, wxBrushStyle style) : m_colour(colour) { m_style = style; @@ -226,7 +226,7 @@ wxBrush::wxBrush() { } -wxBrush::wxBrush(const wxColour& col, int style) +wxBrush::wxBrush(const wxColour& col, wxBrushStyle style) { m_refData = new wxBrushRefData(col, style); } @@ -273,7 +273,7 @@ wxColour wxBrush::GetColour() const return M_BRUSHDATA->GetColour(); } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { wxCHECK_MSG( Ok(), 0, _T("invalid brush") ); @@ -312,7 +312,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) M_BRUSHDATA->SetColour(wxColour(r, g, b)); } -void wxBrush::SetStyle(int style) +void wxBrush::SetStyle(wxBrushStyle style) { AllocExclusive(); diff --git a/src/os2/brush.cpp b/src/os2/brush.cpp index 1fcccdab16..73ac78a709 100644 --- a/src/os2/brush.cpp +++ b/src/os2/brush.cpp @@ -60,7 +60,7 @@ wxBrush::~wxBrush() wxBrush::wxBrush( const wxColour& rColour -, int nStyle +, wxBrushStyle nStyle ) { m_refData = new wxBrushRefData; @@ -248,7 +248,7 @@ void wxBrush::SetColour(unsigned char cRed, unsigned char cGreen, unsigned char RealizeResource(); } // end of wxBrush::SetColour -void wxBrush::SetStyle(int nStyle) +void wxBrush::SetStyle(wxBrushStyle nStyle) { AllocExclusive(); M_BRUSHDATA->m_nStyle = nStyle; diff --git a/src/palmos/brush.cpp b/src/palmos/brush.cpp index 6018ae35b2..a80c01b7aa 100644 --- a/src/palmos/brush.cpp +++ b/src/palmos/brush.cpp @@ -50,7 +50,7 @@ wxBrush::wxBrush() { } -wxBrush::wxBrush(const wxColour& col, int style) +wxBrush::wxBrush(const wxColour& col, wxBrushStyle style) { } @@ -90,7 +90,7 @@ wxColour wxBrush::GetColour() const return wxNullColour; } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { return -1; } @@ -117,7 +117,7 @@ void wxBrush::SetColour(unsigned char WXUNUSED(r), unsigned char WXUNUSED(g), un { } -void wxBrush::SetStyle(int WXUNUSED(style)) +void wxBrush::SetStyle(wxBrushStyle WXUNUSED(style)) { } diff --git a/src/x11/brush.cpp b/src/x11/brush.cpp index 7ac5842b35..4a45842abf 100644 --- a/src/x11/brush.cpp +++ b/src/x11/brush.cpp @@ -46,9 +46,9 @@ public: m_colour == data.m_colour); } - int m_style; - wxColour m_colour; - wxBitmap m_stipple; + wxBrushStyle m_style; + wxColour m_colour; + wxBitmap m_stipple; }; //----------------------------------------------------------------------------- @@ -57,7 +57,7 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) -wxBrush::wxBrush( const wxColour &colour, int style ) +wxBrush::wxBrush( const wxColour &colour, wxBrushStyle style ) { m_refData = new wxBrushRefData(); M_BRUSHDATA->m_style = style; @@ -101,7 +101,7 @@ bool wxBrush::operator == ( const wxBrush& brush ) const return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData ); } -int wxBrush::GetStyle() const +wxBrushStyle wxBrush::GetStyle() const { if (m_refData == NULL) { @@ -148,7 +148,7 @@ void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b ) M_BRUSHDATA->m_colour.Set( r, g, b ); } -void wxBrush::SetStyle( int style ) +void wxBrush::SetStyle( wxBrushStyle style ) { AllocExclusive(); -- 2.45.2