make XPM data pointer parameter fully const

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2008-01-14 18:16:37 +00:00
parent 872051d89b
commit e45080c10b
17 changed files with 42 additions and 50 deletions

View File

@@ -78,9 +78,7 @@ Creates an icon from an array of bits.
Creates a new icon.
\func{}{wxIcon}{\param{char**}{ bits}}
\func{}{wxIcon}{\param{const char**}{ bits}}
\func{}{wxIcon}{\param{const char* const*}{ bits}}
Creates an icon from XPM data.

View File

@@ -23,8 +23,7 @@ class WXDLLEXPORT wxIcon : public wxGDIObject
public:
wxIcon();
wxIcon(const char **data) { CreateFromXpm(data); }
wxIcon(char **data) { CreateFromXpm((const char**)data); }
wxIcon(const char* const* data) { CreateFromXpm(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);
@@ -52,7 +51,7 @@ public:
int GetHeight() const;
WX_NSImage GetNSImage() const;
bool CreateFromXpm(const char **bits);
bool CreateFromXpm(const char* const* bits);
protected:
virtual wxGDIRefData *CreateGDIRefData() const;

View File

@@ -158,16 +158,16 @@ enum wxStockCursor
#define wxICON(X) wxIcon(wxT(#X))
#elif defined(__WXMGL__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( (const char**) X##_xpm )
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXDFB__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( (const char**) X##_xpm )
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXGTK__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( (const char**) X##_xpm )
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXMAC__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( (const char**) X##_xpm )
#define wxICON(X) wxIcon( X##_xpm )
#elif defined(__WXMOTIF__)
// Initialize from an included XPM
#define wxICON(X) wxIcon( X##_xpm )
@@ -193,7 +193,7 @@ enum wxStockCursor
defined(__WXDFB__) || \
defined(__WXCOCOA__)
// Initialize from an included XPM
#define wxBITMAP(name) wxBitmap( (const char**) name##_xpm )
#define wxBITMAP(name) wxBitmap(name##_xpm)
#else // other platforms
#define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM)
#endif // platform

View File

@@ -27,8 +27,10 @@ class WXDLLIMPEXP_CORE wxIcon: public wxBitmap
public:
wxIcon();
wxIcon( const char **bits, int width=-1, int height=-1 );
wxIcon( char **bits, int width=-1, int height=-1 );
wxIcon(const char* const* bits);
#ifdef wxNEEDS_CHARPP
wxIcon(char **bits);
#endif
// For compatibility with wxMSW where desired size is sometimes required to
// distinguish between multiple icons in a resource.

View File

@@ -25,15 +25,14 @@ public:
const char maskBits[] = NULL);
wxCursor(const wxImage & image) ;
wxCursor(const char **bits) ;
wxCursor(char **bits) ;
wxCursor(const char* const* bits);
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type);
virtual ~wxCursor();
bool CreateFromXpm(const char **bits) ;
bool CreateFromXpm(const char* const* bits);
void MacInstall() const ;

View File

@@ -39,7 +39,7 @@ class WXDLLIMPEXP_FWD_CORE wxDropSource;
// the icon 'name' from an XPM file under GTK, but will expand to something
// else under MSW. If you don't use it, you will have to use #ifdef in the
// application code.
#define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm )
#define wxDROP_ICON(X) wxCursor(X##_xpm)
//-------------------------------------------------------------------------
// wxDropTarget

View File

@@ -20,8 +20,7 @@ class WXDLLEXPORT wxIcon : public wxGDIObject
public:
wxIcon();
wxIcon(const char **data);
wxIcon(char **data);
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);

View File

@@ -24,8 +24,10 @@ public:
wxIcon(const char bits[], int width, int height);
// Initialize with XPM data
wxIcon(const char **data);
wxIcon(const char* const* data);
#ifdef wxNEEDS_CHARPP
wxIcon(char **data);
#endif
wxIcon(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM,
int desiredWidth = -1, int desiredHeight = -1)

View File

@@ -48,10 +48,10 @@ public:
wxIcon(const char bits[], int width, int height);
// from XPM data
wxIcon(const char **data) { CreateIconFromXpm(data); }
wxIcon(char **data) { CreateIconFromXpm((const char **)data); }
wxIcon(const char* const* data) { CreateIconFromXpm(data); }
#ifdef wxNEEDS_CHARPP
wxIcon(char **data) { CreateIconFromXpm(wx_const_cast(const char* const*, data)); }
#endif
// from resource/file
wxIcon(const wxString& name,
long type = wxBITMAP_TYPE_ICO_RESOURCE,
@@ -85,7 +85,7 @@ protected:
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// create from XPM data
void CreateIconFromXpm(const char **data);
void CreateIconFromXpm(const char* const* data);
private:
DECLARE_DYNAMIC_CLASS(wxIcon)

View File

@@ -44,8 +44,10 @@ public:
,int nWidth
,int nHeight
);
inline wxIcon(const char** ppData) { CreateIconFromXpm(ppData); }
inline wxIcon(char** ppData) { CreateIconFromXpm((const char**)ppData); }
wxIcon(const char* const* ppData) { CreateIconFromXpm(ppData); }
#ifdef wxNEEDS_CHARPP
wxIcon(char** ppData) { CreateIconFromXpm(wx_const_cast(const char* const*, ppData)); }
#endif
wxIcon( const wxString& rName
,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
,int nDesiredWidth = -1
@@ -77,7 +79,7 @@ protected:
{
return new wxIconRefData;
}
void CreateIconFromXpm(const char **ppData);
void CreateIconFromXpm(const char* const* ppData);
private:
bool m_bIsXpm;

View File

@@ -110,7 +110,7 @@ wxGDIRefData *wxIcon::CloneGDIRefData(const wxGDIRefData *data) const
return new wxIconRefData(*wx_static_cast(const wxIconRefData *, data));
}
bool wxIcon::CreateFromXpm(const char **xpm)
bool wxIcon::CreateFromXpm(const char* const* xpm)
{
wxBitmap bitmap(xpm);
CopyFromBitmap(bitmap);

View File

@@ -24,15 +24,17 @@
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxIcon::wxIcon(const char* const* bits) :
wxBitmap( bits )
{
}
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
#ifdef wxNEEDS_CHARPP
wxIcon::wxIcon(char **bits) :
wxBitmap( bits )
{
}
#endif
wxIcon::wxIcon() : wxBitmap()
{

View File

@@ -276,16 +276,11 @@ wxCursor::wxCursor( const wxImage &image )
#endif
}
wxCursor::wxCursor(const char **bits)
wxCursor::wxCursor(const char* const* bits)
{
(void) CreateFromXpm(bits);
}
wxCursor::wxCursor(char **bits)
{
(void) CreateFromXpm((const char **)bits);
}
wxGDIRefData *wxCursor::CreateGDIRefData() const
{
return new wxCursorRefData;
@@ -296,7 +291,7 @@ wxGDIRefData *wxCursor::CloneGDIRefData(const wxGDIRefData *data) const
return new wxCursorRefData(*wx_static_cast(const wxCursorRefData *, data));
}
bool wxCursor::CreateFromXpm(const char **bits)
bool wxCursor::CreateFromXpm(const char* const* bits)
{
#if wxUSE_IMAGE
wxCHECK_MSG( bits != NULL, false, wxT("invalid cursor data") );

View File

@@ -90,13 +90,7 @@ wxIcon::wxIcon( const char bits[], int width, int height )
CopyFromBitmap( bmp ) ;
}
wxIcon::wxIcon( const char **bits )
{
wxBitmap bmp( bits ) ;
CopyFromBitmap( bmp ) ;
}
wxIcon::wxIcon( char **bits )
wxIcon::wxIcon(const char* const* bits)
{
wxBitmap bmp( bits ) ;
CopyFromBitmap( bmp ) ;

View File

@@ -30,13 +30,15 @@ wxIcon::wxIcon(const char bits[], int width, int height)
(void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
}
#ifdef wxNEEDS_CHARPP
// Create from XPM data
wxIcon::wxIcon(char **data)
{
(void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
#endif
wxIcon::wxIcon(const char **data)
wxIcon::wxIcon(const char* const* data)
{
(void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}

View File

@@ -128,7 +128,7 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
#endif // __WXMICROWIN__
}
void wxIcon::CreateIconFromXpm(const char **data)
void wxIcon::CreateIconFromXpm(const char* const* data)
{
wxBitmap bmp(data);
CopyFromBitmap(bmp);

View File

@@ -85,9 +85,7 @@ wxIcon::~wxIcon()
{
}
void wxIcon::CreateIconFromXpm(
const char** ppData
)
void wxIcon::CreateIconFromXpm(const char* const* ppData)
{
wxBitmap vBmp(ppData);