Compile with wxUSE_DYNLIB_CLASS and wxUSE_WXDIB set to 0

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-01-21 16:47:30 +00:00
parent 14d776932c
commit 64c288fa47
22 changed files with 76 additions and 14 deletions

View File

@@ -238,4 +238,23 @@
# endif # endif
#endif /* wxUSE_DYNAMIC_LOADER */ #endif /* wxUSE_DYNAMIC_LOADER */
#if !wxUSE_DYNLIB_CLASS
# if wxUSE_UXTHEME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS"
# else
# undef wxUSE_UXTHEME
# define wxUSE_UXTHEME 0
# endif
# endif
# if wxUSE_MEDIACTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MEDIACTRL requires wxUSE_DYNLIB_CLASS"
# else
# undef wxUSE_MEDIACTRL
# define wxUSE_MEDIACTRL 0
# endif
# endif
#endif /* wxUSE_DYNLIB_CLASS */
#endif /* _WX_MSW_CHKCONF_H_ */ #endif /* _WX_MSW_CHKCONF_H_ */

View File

@@ -165,7 +165,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
bmp = node->GetData()->CreateBitmap(id, client, size); bmp = node->GetData()->CreateBitmap(id, client, size);
if ( bmp.Ok() ) if ( bmp.Ok() )
{ {
#if wxUSE_IMAGE #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
if ( size != wxDefaultSize && if ( size != wxDefaultSize &&
(bmp.GetWidth() != size.x || bmp.GetHeight() != size.y) ) (bmp.GetWidth() != size.x || bmp.GetHeight() != size.y) )
{ {

View File

@@ -223,7 +223,7 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id,
{ {
wxBitmap bmp = wxDefaultArtProvider_CreateBitmap(id); wxBitmap bmp = wxDefaultArtProvider_CreateBitmap(id);
#if wxUSE_IMAGE #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
if (bmp.Ok()) if (bmp.Ok())
{ {
// fit into transparent image with desired size hint from the client // fit into transparent image with desired size hint from the client

View File

@@ -227,8 +227,10 @@ wxMemoryFSHandler::AddFile(const wxString& filename,
const wxBitmap& bitmap, const wxBitmap& bitmap,
long type) long type)
{ {
#if !defined(__WXMSW__) || wxUSE_WXDIB
wxImage img = bitmap.ConvertToImage(); wxImage img = bitmap.ConvertToImage();
AddFile(filename, img, type); AddFile(filename, img, type);
#endif
} }
#endif // wxUSE_IMAGE #endif // wxUSE_IMAGE

View File

@@ -56,7 +56,7 @@ void wxIconBundle::AddIcon( const wxString& file, long type )
void wxIconBundle::AddIcon( const wxString& WXUNUSED(file), long WXUNUSED(type) ) void wxIconBundle::AddIcon( const wxString& WXUNUSED(file), long WXUNUSED(type) )
#endif #endif
{ {
#if wxUSE_IMAGE #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
size_t count = wxImage::GetImageCount( file, type ); size_t count = wxImage::GetImageCount( file, type );
size_t i; size_t i;
wxImage image; wxImage image;

View File

@@ -100,6 +100,7 @@ static bool DoRegionUnion(wxRegion& region,
bool wxRegion::Union(const wxBitmap& bmp) bool wxRegion::Union(const wxBitmap& bmp)
{ {
#if (!defined(__WXMSW__) || wxUSE_WXDIB)
if (bmp.GetMask()) if (bmp.GetMask())
{ {
wxImage image = bmp.ConvertToImage(); wxImage image = bmp.ConvertToImage();
@@ -111,6 +112,7 @@ bool wxRegion::Union(const wxBitmap& bmp)
0); 0);
} }
else else
#endif
{ {
return Union(0, 0, bmp.GetWidth(), bmp.GetHeight()); return Union(0, 0, bmp.GetWidth(), bmp.GetHeight());
} }
@@ -120,12 +122,16 @@ bool wxRegion::Union(const wxBitmap& bmp,
const wxColour& transColour, const wxColour& transColour,
int tolerance) int tolerance)
{ {
#if (!defined(__WXMSW__) || wxUSE_WXDIB)
wxImage image = bmp.ConvertToImage(); wxImage image = bmp.ConvertToImage();
return DoRegionUnion(*this, image, return DoRegionUnion(*this, image,
transColour.Red(), transColour.Red(),
transColour.Green(), transColour.Green(),
transColour.Blue(), transColour.Blue(),
tolerance); tolerance);
#else
return false;
#endif
} }
#else #else

View File

@@ -1483,7 +1483,7 @@ wxImageList *wxFileIconsTable::GetSmallImageList()
return m_smallImageList; return m_smallImageList;
} }
#if wxUSE_MIMETYPE && wxUSE_IMAGE #if wxUSE_MIMETYPE && wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
// VS: we don't need this function w/o wxMimeTypesManager because we'll only have // VS: we don't need this function w/o wxMimeTypesManager because we'll only have
// one icon and we won't resize it // one icon and we won't resize it
@@ -1643,7 +1643,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime)
{ {
m_smallImageList->Add(bmp); m_smallImageList->Add(bmp);
} }
#if wxUSE_IMAGE #if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
else else
{ {
wxImage img = bmp.ConvertToImage(); wxImage img = bmp.ConvertToImage();

View File

@@ -154,7 +154,7 @@ bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor)
dc2.SelectObject(wxNullBitmap); dc2.SelectObject(wxNullBitmap);
#if wxUSE_IMAGE_IN_DRAGIMAGE #if wxUSE_IMAGE_IN_DRAGIMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB)
// Make the bitmap masked // Make the bitmap masked
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(255, 255, 255); image.SetMaskColour(255, 255, 255);

View File

@@ -446,6 +446,7 @@ wxHtmlImageCell::wxHtmlImageCell(wxWindow *window, wxFSFile *input,
void wxHtmlImageCell::SetImage(const wxImage& img) void wxHtmlImageCell::SetImage(const wxImage& img)
{ {
#if !defined(__WXMSW__) || wxUSE_WXDIB
if ( img.Ok() ) if ( img.Ok() )
{ {
delete m_bitmap; delete m_bitmap;
@@ -471,6 +472,7 @@ void wxHtmlImageCell::SetImage(const wxImage& img)
*/ */
m_bitmap = new wxBitmap(img); m_bitmap = new wxBitmap(img);
} }
#endif
} }
#if wxUSE_GIF && wxUSE_TIMER #if wxUSE_GIF && wxUSE_TIMER
@@ -497,6 +499,7 @@ void wxHtmlImageCell::AdvanceAnimation(wxTimer *timer)
if ( m_window->GetClientRect().Intersects(rect) && if ( m_window->GetClientRect().Intersects(rect) &&
m_gifDecoder->ConvertToImage(&img) ) m_gifDecoder->ConvertToImage(&img) )
{ {
#if !defined(__WXMSW__) || wxUSE_WXDIB
if ( (int)m_gifDecoder->GetWidth() != m_Width || if ( (int)m_gifDecoder->GetWidth() != m_Width ||
(int)m_gifDecoder->GetHeight() != m_Height || (int)m_gifDecoder->GetHeight() != m_Height ||
m_gifDecoder->GetLeft() != 0 || m_gifDecoder->GetTop() != 0 ) m_gifDecoder->GetLeft() != 0 || m_gifDecoder->GetTop() != 0 )
@@ -508,6 +511,7 @@ void wxHtmlImageCell::AdvanceAnimation(wxTimer *timer)
true /* use mask */); true /* use mask */);
} }
else else
#endif
SetImage(img); SetImage(img);
m_window->Refresh(img.HasMask(), &rect); m_window->Refresh(img.HasMask(), &rect);
} }

View File

@@ -341,9 +341,11 @@ TAG_HANDLER_BEGIN(BODY, "BODY")
wxInputStream *is = fileBgImage->GetStream(); wxInputStream *is = fileBgImage->GetStream();
if ( is ) if ( is )
{ {
#if !defined(__WXMSW__) || wxUSE_WXDIB
wxImage image(*is); wxImage image(*is);
if ( image.Ok() ) if ( image.Ok() )
m_WParser->GetWindow()->SetBackgroundImage(image); m_WParser->GetWindow()->SetBackgroundImage(image);
#endif
} }
} }
} }

View File

@@ -588,7 +588,8 @@ int wxApp::GetComCtl32Version()
// we're prepared to handle the errors // we're prepared to handle the errors
wxLogNull noLog; wxLogNull noLog;
#if wxUSE_DYNLIB_CLASS
// do we have it? // do we have it?
wxDynamicLibrary dllComCtl32(_T("comctl32.dll"), wxDL_VERBATIM); wxDynamicLibrary dllComCtl32(_T("comctl32.dll"), wxDL_VERBATIM);
@@ -646,6 +647,7 @@ int wxApp::GetComCtl32Version()
} }
} }
} }
#endif
} }
return s_verComCtl32; return s_verComCtl32;

View File

@@ -483,7 +483,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
// Create from XPM data // Create from XPM data
bool wxBitmap::CreateFromXpm(const char **data) bool wxBitmap::CreateFromXpm(const char **data)
{ {
#if wxUSE_IMAGE && wxUSE_XPM #if wxUSE_IMAGE && wxUSE_XPM && wxUSE_WXDIB
Init(); Init();
wxCHECK_MSG( data != NULL, false, wxT("invalid bitmap data") ) wxCHECK_MSG( data != NULL, false, wxT("invalid bitmap data") )
@@ -1011,7 +1011,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
return handler->LoadFile(this, filename, type, -1, -1); return handler->LoadFile(this, filename, type, -1, -1);
} }
#if wxUSE_IMAGE #if wxUSE_IMAGE && wxUSE_WXDIB
else // no bitmap handler found else // no bitmap handler found
{ {
wxImage image; wxImage image;
@@ -1055,7 +1055,7 @@ bool wxBitmap::SaveFile(const wxString& filename,
{ {
return handler->SaveFile(this, filename, type, palette); return handler->SaveFile(this, filename, type, palette);
} }
#if wxUSE_IMAGE #if wxUSE_IMAGE && wxUSE_WXDIB
else // no bitmap handler found else // no bitmap handler found
{ {
// FIXME what about palette? shouldn't we use it? // FIXME what about palette? shouldn't we use it?

View File

@@ -209,11 +209,15 @@ wxCursor::wxCursor(const wxImage& image)
HCURSOR hcursor = wxBitmapToHCURSOR( wxBitmap(imageSized), HCURSOR hcursor = wxBitmapToHCURSOR( wxBitmap(imageSized),
hotSpotX, hotSpotY ); hotSpotX, hotSpotY );
#if wxUSE_WXDIB
if ( !hcursor ) if ( !hcursor )
{ {
wxLogWarning(_("Failed to create cursor.")); wxLogWarning(_("Failed to create cursor."));
return; return;
} }
#else
HCURSOR hcursor = 0;
#endif
m_refData = new wxCursorRefData(hcursor, true /* delete it later */); m_refData = new wxCursorRefData(hcursor, true /* delete it later */);
} }

View File

@@ -111,6 +111,7 @@ wxDatePickerCtrl::Create(wxWindow *parent,
return false; return false;
} }
#if wxUSE_DYNLIB_CLASS
INITCOMMONCONTROLSEX icex; INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex); icex.dwSize = sizeof(icex);
icex.dwICC = ICC_DATE_CLASSES; icex.dwICC = ICC_DATE_CLASSES;
@@ -126,6 +127,7 @@ wxDatePickerCtrl::Create(wxWindow *parent,
} }
s_initDone = true; s_initDone = true;
#endif
} }

View File

@@ -25,7 +25,7 @@
#include "wx/msw/debughlp.h" #include "wx/msw/debughlp.h"
#if wxUSE_DBGHELP #if wxUSE_DBGHELP && wxUSE_DYNLIB_CLASS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants

View File

@@ -236,10 +236,14 @@ bool wxDragImage::Create(const wxString& str, const wxCursor& cursor)
dc2.SelectObject(wxNullBitmap); dc2.SelectObject(wxNullBitmap);
#if wxUSE_WXDIB
// Make the bitmap masked // Make the bitmap masked
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(255, 255, 255); image.SetMaskColour(255, 255, 255);
return Create(wxBitmap(image), cursor); return Create(wxBitmap(image), cursor);
#else
return false;
#endif
} }
#if wxUSE_TREECTRL #if wxUSE_TREECTRL

View File

@@ -290,6 +290,7 @@ bool wxImageList::Draw(int index,
// Get the bitmap // Get the bitmap
wxBitmap wxImageList::GetBitmap(int index) const wxBitmap wxImageList::GetBitmap(int index) const
{ {
#if wxUSE_WXDIB
int bmp_width = 0, bmp_height = 0; int bmp_width = 0, bmp_height = 0;
GetSize(index, bmp_width, bmp_height); GetSize(index, bmp_width, bmp_height);
@@ -320,8 +321,10 @@ wxBitmap wxImageList::GetBitmap(int index) const
image = bitmap.ConvertToImage(); image = bitmap.ConvertToImage();
image.SetMaskColour(r, g, b); image.SetMaskColour(r, g, b);
bitmap = wxBitmap(image); bitmap = wxBitmap(image);
#else
wxBitmap bitmap;
return bitmap; return bitmap;
#endif
} }
// Get the icon // Get the icon

View File

@@ -844,7 +844,11 @@ void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
memdc.SelectObject(bmp); memdc.SelectObject(bmp);
// if there is no special brush just use the solid background colour // if there is no special brush just use the solid background colour
#if wxUSE_UXTHEME
HBRUSH hbr = (HBRUSH)m_hbrBackground; HBRUSH hbr = (HBRUSH)m_hbrBackground;
#else
HBRUSH hbr = 0;
#endif
wxBrush brush; wxBrush brush;
if ( !hbr ) if ( !hbr )
{ {

View File

@@ -106,6 +106,8 @@ static ShellFunctions gs_shellFuncs;
static void ResolveShellFunctions() static void ResolveShellFunctions()
{ {
#if wxUSE_DYNLIB_CLASS
// start with the newest functions, fall back to the oldest ones // start with the newest functions, fall back to the oldest ones
#ifdef __WXWINCE__ #ifdef __WXWINCE__
wxString shellDllName(_T("coredll")); wxString shellDllName(_T("coredll"));
@@ -153,6 +155,7 @@ static void ResolveShellFunctions()
// because we also link to it statically, so it's ok // because we also link to it statically, so it's ok
gs_shellFuncs.initialized = true; gs_shellFuncs.initialized = true;
#endif
} }
// ============================================================================ // ============================================================================

View File

@@ -656,7 +656,7 @@ bool wxToolBar::Realize()
if ( m_disabledImgList ) if ( m_disabledImgList )
{ {
wxBitmap bmpDisabled = tool->GetDisabledBitmap(); wxBitmap bmpDisabled = tool->GetDisabledBitmap();
#if wxUSE_IMAGE #if wxUSE_IMAGE && wxUSE_WXDIB
if ( !bmpDisabled.Ok() ) if ( !bmpDisabled.Ok() )
{ {
// no disabled bitmap specified but we still need to // no disabled bitmap specified but we still need to

View File

@@ -49,7 +49,9 @@
// Dynamic library function defs. // Dynamic library function defs.
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#if wxUSE_DYNLIB_CLASS
static wxDynamicLibrary s_mprLib; static wxDynamicLibrary s_mprLib;
#endif
typedef DWORD (WINAPI* WNetOpenEnumPtr)(DWORD, DWORD, DWORD, LPNETRESOURCE, LPHANDLE); typedef DWORD (WINAPI* WNetOpenEnumPtr)(DWORD, DWORD, DWORD, LPNETRESOURCE, LPHANDLE);
typedef DWORD (WINAPI* WNetEnumResourcePtr)(HANDLE, LPDWORD, LPVOID, LPDWORD); typedef DWORD (WINAPI* WNetEnumResourcePtr)(HANDLE, LPDWORD, LPVOID, LPDWORD);
@@ -378,6 +380,7 @@ wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset)
{ {
::InterlockedExchange(&s_cancelSearch, FALSE); // reset ::InterlockedExchange(&s_cancelSearch, FALSE); // reset
#if wxUSE_DYNLIB_CLASS
if (!s_mprLib.IsLoaded() && s_mprLib.Load(_T("mpr.dll"))) if (!s_mprLib.IsLoaded() && s_mprLib.Load(_T("mpr.dll")))
{ {
#ifdef UNICODE #ifdef UNICODE
@@ -389,6 +392,7 @@ wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset)
#endif #endif
s_pWNetCloseEnum = (WNetCloseEnumPtr)s_mprLib.GetSymbol(_T("WNetCloseEnum")); s_pWNetCloseEnum = (WNetCloseEnumPtr)s_mprLib.GetSymbol(_T("WNetCloseEnum"));
} }
#endif
wxArrayString list; wxArrayString list;

View File

@@ -1091,8 +1091,11 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
return wxNullBitmap; return wxNullBitmap;
} }
if (!(size == wxDefaultSize)) img.Rescale(size.x, size.y); if (!(size == wxDefaultSize)) img.Rescale(size.x, size.y);
#if !defined(__WXMSW__) || wxUSE_WXDIB
return wxBitmap(img); return wxBitmap(img);
#else
return wxBitmap();
#endif
} }