introduced wxICON_DEFAULT_TYPE and wxBITMAP_DEFAULT_TYPE; documented these default argument values; matched the wxBitmap and wxIcon interfaces to their real implementations; revised icon.h interface header
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -226,27 +226,41 @@ protected: | ||||
|  | ||||
| #endif // wxUSE_BITMAP_BASE | ||||
|  | ||||
|  | ||||
| // the wxBITMAP_DEFAULT_TYPE constant defines the default argument value | ||||
| // for wxBitmap's ctor and wxBitmap::LoadFile() functions. | ||||
| #if defined(__WXPALMOS__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_BMP_RESOURCE | ||||
|     #include "wx/palmos/bitmap.h" | ||||
| #elif defined(__WXMSW__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_BMP_RESOURCE | ||||
|     #include "wx/msw/bitmap.h" | ||||
| #elif defined(__WXMOTIF__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_XPM | ||||
|     #include "wx/x11/bitmap.h" | ||||
| #elif defined(__WXGTK20__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_XPM | ||||
|     #include "wx/gtk/bitmap.h" | ||||
| #elif defined(__WXGTK__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_XPM | ||||
|     #include "wx/gtk1/bitmap.h" | ||||
| #elif defined(__WXX11__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_XPM | ||||
|     #include "wx/x11/bitmap.h" | ||||
| #elif defined(__WXMGL__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_RESOURCE | ||||
|     #include "wx/mgl/bitmap.h" | ||||
| #elif defined(__WXDFB__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_RESOURCE | ||||
|     #include "wx/dfb/bitmap.h" | ||||
| #elif defined(__WXMAC__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_PICT_RESOURCE | ||||
|     #include "wx/osx/bitmap.h" | ||||
| #elif defined(__WXCOCOA__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_BMP_RESOURCE | ||||
|     #include "wx/cocoa/bitmap.h" | ||||
| #elif defined(__WXPM__) | ||||
|     #define wxBITMAP_DEFAULT_TYPE    wxBITMAP_TYPE_BMP_RESOURCE | ||||
|     #include "wx/os2/bitmap.h" | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -75,7 +75,7 @@ public: | ||||
|     // Initialize with XPM data | ||||
|     wxBitmap(const char* const* bits); | ||||
|     // Load a file or resource | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|     // Construct from Cocoa's NSImage | ||||
|     wxBitmap(NSImage* cocoaNSImage); | ||||
|     // Construct from Cocoa's NSBitmapImageRep | ||||
| @@ -104,7 +104,7 @@ public: | ||||
|     bool Create(NSImage* cocoaNSImage); | ||||
|     bool Create(NSBitmapImageRep* cocoaNSBitmapImageRep); | ||||
|     virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); | ||||
|     virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|     virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; | ||||
|  | ||||
|     // copies the contents and mask of the given (colour) icon to the bitmap | ||||
|   | ||||
| @@ -28,7 +28,7 @@ public: | ||||
|     wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); } | ||||
|     wxBitmap(int width, int height, int depth = -1); | ||||
|     wxBitmap(const char bits[], int width, int height, int depth = 1); | ||||
|     wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | ||||
|     wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|     wxBitmap(const char* const* bits); | ||||
| #if wxUSE_IMAGE | ||||
|     wxBitmap(const wxImage& image, int depth = -1); | ||||
| @@ -52,7 +52,7 @@ public: | ||||
|  | ||||
|     virtual bool SaveFile(const wxString &name, wxBitmapType type, | ||||
|                           const wxPalette *palette = (wxPalette *) NULL) const; | ||||
|     virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | ||||
|     virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
| #if wxUSE_PALETTE | ||||
|     virtual wxPalette *GetPalette() const; | ||||
|   | ||||
| @@ -18,10 +18,6 @@ | ||||
| // wxIcon | ||||
| //----------------------------------------------------------------------------- | ||||
|  | ||||
| #ifndef wxICON_DEFAULT_BITMAP_TYPE | ||||
| #define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_XPM | ||||
| #endif | ||||
|  | ||||
| class WXDLLIMPEXP_CORE wxIcon: public wxBitmap | ||||
| { | ||||
| public: | ||||
| @@ -35,7 +31,7 @@ public: | ||||
|     // For compatibility with wxMSW where desired size is sometimes required to | ||||
|     // distinguish between multiple icons in a resource. | ||||
|     wxIcon( const wxString& filename, | ||||
|             wxBitmapType type = wxICON_DEFAULT_BITMAP_TYPE, | ||||
|             wxBitmapType type = wxICON_DEFAULT_TYPE, | ||||
|             int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : | ||||
|         wxBitmap(filename, type) | ||||
|     { | ||||
| @@ -46,6 +42,10 @@ public: | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, | ||||
|                   int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1) | ||||
|         { return LoadFile(name, flags); } | ||||
|  | ||||
|     // create from bitmap (which should have a mask unless it's monochrome): | ||||
|     // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | ||||
|     // ctors, assignment operators...), but it's ok to have such function | ||||
|   | ||||
| @@ -59,7 +59,7 @@ public: | ||||
|     wxBitmap(char** data) | ||||
|     { *this = wxBitmap(wx_const_cast(const char* const*, data)); } | ||||
| #endif | ||||
|     wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); | ||||
|     wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); | ||||
| #if wxUSE_IMAGE | ||||
|     wxBitmap( const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH ) | ||||
|         { (void)CreateFromImage(image, depth); } | ||||
| @@ -86,7 +86,7 @@ public: | ||||
|  | ||||
|     bool SaveFile(const wxString &name, wxBitmapType type, | ||||
|                           const wxPalette *palette = (wxPalette *)NULL) const; | ||||
|     bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM ); | ||||
|     bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
| #if wxUSE_PALETTE | ||||
|     wxPalette *GetPalette() const; | ||||
|   | ||||
| @@ -75,7 +75,7 @@ public: | ||||
|         *this = wxBitmap(wx_const_cast(const char* const*, data)); | ||||
|     } | ||||
| #endif | ||||
|     wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); | ||||
|     wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); | ||||
|     wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } | ||||
|     virtual ~wxBitmap(); | ||||
|  | ||||
| @@ -97,7 +97,7 @@ public: | ||||
|  | ||||
|     bool SaveFile(const wxString &name, wxBitmapType type, | ||||
|                           const wxPalette *palette = (wxPalette *)NULL) const; | ||||
|     bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM ); | ||||
|     bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
| #if wxUSE_PALETTE | ||||
|     wxPalette *GetPalette() const; | ||||
|   | ||||
| @@ -14,6 +14,23 @@ | ||||
|  | ||||
| #include "wx/iconloc.h" | ||||
|  | ||||
|  | ||||
| // the wxICON_DEFAULT_TYPE (the wxIcon equivalent of wxBITMAP_DEFAULT_TYPE) | ||||
| // constant defines the default argument value for wxIcon ctor and wxIcon::LoadFile() | ||||
| // functions. | ||||
| #if defined(__WXMSW__) | ||||
|   #define wxICON_DEFAULT_TYPE   wxBITMAP_TYPE_ICO_RESOURCE | ||||
| #elif defined(__WXMGL__) | ||||
|   #define wxICON_DEFAULT_TYPE   wxBITMAP_TYPE_ICO_RESOURCE | ||||
| #elif defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON | ||||
|   #define wxICON_DEFAULT_TYPE   wxBITMAP_TYPE_ICON_RESOURCE | ||||
| #else | ||||
|   #define wxICON_DEFAULT_TYPE   wxBITMAP_TYPE_XPM | ||||
| #endif | ||||
|  | ||||
| // a more readable way to tell | ||||
| #define wxICON_SCREEN_DEPTH     (-1) | ||||
|  | ||||
| #if defined(__WXPALMOS__) | ||||
|   #include "wx/generic/icon.h" | ||||
| #elif defined(__WXMSW__) | ||||
| @@ -27,7 +44,6 @@ | ||||
| #elif defined(__WXX11__) | ||||
|   #include "wx/generic/icon.h" | ||||
| #elif defined(__WXMGL__) | ||||
|   #define wxICON_DEFAULT_BITMAP_TYPE wxBITMAP_TYPE_ICO_RESOURCE | ||||
|   #include "wx/generic/icon.h" | ||||
| #elif defined(__WXDFB__) | ||||
|   #include "wx/generic/icon.h" | ||||
|   | ||||
| @@ -30,7 +30,7 @@ public: | ||||
|     wxBitmap(int width, int height, int depth = -1); | ||||
|     wxBitmap(const char bits[], int width, int height, int depth = 1); | ||||
|     wxBitmap(const char* const* bits); | ||||
|     wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | ||||
|     wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|     wxBitmap(const wxImage& image, int depth = -1); | ||||
|     virtual ~wxBitmap() {} | ||||
|  | ||||
| @@ -48,7 +48,7 @@ public: | ||||
|     virtual wxBitmap GetSubBitmap(const wxRect& rect) const; | ||||
|  | ||||
|     virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; | ||||
|     virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | ||||
|     virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
|     virtual wxPalette *GetPalette() const; | ||||
|     virtual void SetPalette(const wxPalette& palette); | ||||
|   | ||||
| @@ -63,7 +63,7 @@ public: | ||||
| #endif | ||||
|  | ||||
|     // Load a file or resource | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
|     // New constructor for generalised creation from data | ||||
|     wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); | ||||
| @@ -120,7 +120,7 @@ public: | ||||
|     wxBitmap GetSubBitmap( const wxRect& rect ) const; | ||||
|  | ||||
|     // NB: This should not be called from user code. It is for wx internal | ||||
|     // use only.  | ||||
|     // use only. | ||||
|     wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const; | ||||
|  | ||||
|     // copies the contents and mask of the given (colour) icon to the bitmap | ||||
| @@ -139,7 +139,7 @@ public: | ||||
|     virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); | ||||
|     virtual bool Create(int width, int height, const wxDC& dc); | ||||
|     virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); | ||||
|     virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|     virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; | ||||
|  | ||||
|     wxBitmapRefData *GetBitmapData() const | ||||
|   | ||||
| @@ -54,7 +54,7 @@ public: | ||||
| #endif | ||||
|         // from resource/file | ||||
|     wxIcon(const wxString& name, | ||||
|            wxBitmapType type = wxBITMAP_TYPE_ICO_RESOURCE, | ||||
|            wxBitmapType type = wxICON_DEFAULT_TYPE, | ||||
|            int desiredWidth = -1, int desiredHeight = -1); | ||||
|  | ||||
|     wxIcon(const wxIconLocation& loc); | ||||
| @@ -62,7 +62,7 @@ public: | ||||
|     virtual ~wxIcon(); | ||||
|  | ||||
|     virtual bool LoadFile(const wxString& name, | ||||
|                           wxBitmapType type = wxBITMAP_TYPE_ICO_RESOURCE, | ||||
|                           wxBitmapType type = wxICON_DEFAULT_TYPE, | ||||
|                           int desiredWidth = -1, int desiredHeight = -1); | ||||
|  | ||||
|     // implementation only from now on | ||||
|   | ||||
| @@ -97,7 +97,7 @@ public: | ||||
|  | ||||
|     // Load a resource | ||||
|     wxBitmap( int             nId | ||||
|              ,wxBitmapType    lType = wxBITMAP_TYPE_BMP_RESOURCE | ||||
|              ,wxBitmapType    lType = wxBITMAP_DEFAULT_TYPE | ||||
|             ); | ||||
|  | ||||
|     // For compatiability with other ports, under OS/2 does same as default ctor | ||||
| @@ -161,10 +161,10 @@ public: | ||||
|                         ,int   nDepth = 1 | ||||
|                        ); | ||||
|     virtual bool LoadFile( int             nId | ||||
|                           ,wxBitmapType    lType = wxBITMAP_TYPE_BMP_RESOURCE | ||||
|                           ,wxBitmapType    lType = wxBITMAP_DEFAULT_TYPE | ||||
|                          ); | ||||
|     virtual bool LoadFile( const wxString& rName | ||||
|                           ,wxBitmapType    lType = wxBITMAP_TYPE_XPM | ||||
|                           ,wxBitmapType    lType = wxBITMAP_DEFAULT_TYPE | ||||
|                          ); | ||||
|     virtual bool SaveFile( const wxString&  rName | ||||
|                           ,wxBitmapType     lType | ||||
|   | ||||
| @@ -96,7 +96,7 @@ public: | ||||
|     wxBitmap(const char* const* bits); | ||||
|  | ||||
|     // Load a file or resource | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_PICT_RESOURCE); | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
|     // Constructor for generalised creation from data | ||||
|     wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); | ||||
| @@ -120,7 +120,7 @@ public: | ||||
|     virtual bool Create(int width, int height, int depth = -1); | ||||
|     virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); | ||||
|     // virtual bool Create( WXHICON icon) ; | ||||
|     virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|     virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; | ||||
|  | ||||
|     wxBitmapRefData *GetBitmapData() const | ||||
|   | ||||
| @@ -22,8 +22,8 @@ public: | ||||
|  | ||||
|     wxIcon(const char* const* data); | ||||
|     wxIcon(const char bits[], int width , int height ); | ||||
|     wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, | ||||
|          int desiredWidth = -1, int desiredHeight = -1); | ||||
|     wxIcon(const wxString& name, int flags = wxICON_DEFAULT_TYPE, | ||||
|            int desiredWidth = -1, int desiredHeight = -1); | ||||
|     wxIcon(const wxIconLocation& loc) | ||||
|     { | ||||
|       LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); | ||||
| @@ -33,10 +33,8 @@ public: | ||||
|  | ||||
|     virtual ~wxIcon(); | ||||
|  | ||||
|     bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , | ||||
|       int desiredWidth /* = -1 */ , int desiredHeight = -1); | ||||
|     bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) | ||||
|       { return LoadFile( name , flags , -1 , -1 ) ; } | ||||
|     bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, | ||||
|                   int desiredWidth = -1, int desiredHeight = -1); | ||||
|  | ||||
|  | ||||
|     // create from bitmap (which should have a mask unless it's monochrome): | ||||
|   | ||||
| @@ -48,7 +48,7 @@ public: | ||||
|     wxBitmap(const char* const* data); | ||||
|  | ||||
|     // Load a file or resource | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); | ||||
|  | ||||
|     // New constructor for generalised creation from data | ||||
|     wxBitmap(const void* data, long type, int width, int height, int depth = 1); | ||||
| @@ -114,7 +114,7 @@ public: | ||||
|     virtual bool Create(int width, int height, int depth = -1); | ||||
|     virtual bool Create(int width, int height, const wxDC& dc); | ||||
|     virtual bool Create(const void* data, long type, int width, int height, int depth = 1); | ||||
|     virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); | ||||
|     virtual bool LoadFile(const wxString& name, long type = wxBITMAP_DEFAULT_TYPE); | ||||
|     virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); | ||||
|  | ||||
|     wxBitmapRefData *GetBitmapData() const | ||||
|   | ||||
| @@ -76,7 +76,7 @@ public: | ||||
|         *this = wxBitmap(wx_const_cast(const char* const*, data)); | ||||
|     } | ||||
| #endif | ||||
|     wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM ); | ||||
|     wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); | ||||
|     virtual ~wxBitmap(); | ||||
|  | ||||
|     static void InitStandardHandlers(); | ||||
| @@ -106,7 +106,7 @@ public: | ||||
|     wxBitmap GetSubBitmap( const wxRect& rect ) const; | ||||
|  | ||||
|     bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL ) const; | ||||
|     bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM ); | ||||
|     bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); | ||||
|  | ||||
|     wxPalette *GetPalette() const; | ||||
|     wxPalette *GetColourMap() const | ||||
|   | ||||
		Reference in New Issue
	
	Block a user