some clean up of the code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-09-07 09:01:35 +00:00
parent 88db66e373
commit 8ed57d9312
3 changed files with 52 additions and 52 deletions

View File

@@ -84,8 +84,6 @@ wxList wxBitmap::sm_handlers;
wxBitmap::wxBitmap(void) wxBitmap::wxBitmap(void)
{ {
m_refData = NULL; // new wxBitmapRefData;
if ( wxTheBitmapList ) if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this); wxTheBitmapList->AddBitmap(this);
} }

View File

@@ -149,8 +149,10 @@ void wxButton::SetDefault(void)
if (parent) if (parent)
{ {
SendMessage((HWND) parent->GetHWND(), DM_SETDEFID, m_windowId, 0L); SendMessage((HWND)parent->GetHWND(), DM_SETDEFID, m_windowId, 0L);
} }
SendMessage((HWND)GetHWND(), BM_SETSTYLE, BS_DEFPUSHBUTTON, 1L);
} }
wxString wxButton::GetLabel(void) const wxString wxButton::GetLabel(void) const

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -60,8 +60,8 @@ wxIconRefData::wxIconRefData(void)
wxIconRefData::~wxIconRefData(void) wxIconRefData::~wxIconRefData(void)
{ {
if ( m_hIcon ) if ( m_hIcon )
::DestroyIcon((HICON) m_hIcon); ::DestroyIcon((HICON) m_hIcon);
} }
wxIcon::wxIcon(void) wxIcon::wxIcon(void)
@@ -88,7 +88,7 @@ bool wxIcon::FreeResource(bool force)
if (M_ICONDATA && M_ICONDATA->m_hIcon) if (M_ICONDATA && M_ICONDATA->m_hIcon)
{ {
DestroyIcon((HICON) M_ICONDATA->m_hIcon); DestroyIcon((HICON) M_ICONDATA->m_hIcon);
M_ICONDATA->m_hIcon = (WXHICON) NULL; M_ICONDATA->m_hIcon = (WXHICON) NULL;
} }
return TRUE; return TRUE;
} }
@@ -103,15 +103,15 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
wxBitmapHandler *handler = FindHandler(type); wxBitmapHandler *handler = FindHandler(type);
if ( handler ) if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
else else
return FALSE; return FALSE;
} }
void wxIcon::SetHICON(WXHICON ico) void wxIcon::SetHICON(WXHICON ico)
{ {
if ( !M_ICONDATA ) if ( !M_ICONDATA )
m_refData = new wxIconRefData; m_refData = new wxIconRefData;
M_ICONDATA->m_hIcon = ico; M_ICONDATA->m_hIcon = ico;
} }
@@ -120,28 +120,28 @@ bool wxICOFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
#if USE_RESOURCE_LOADING_IN_MSW #if USE_RESOURCE_LOADING_IN_MSW
if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) ) if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) )
{ {
wxIcon *icon = (wxIcon *)bitmap; wxIcon *icon = (wxIcon *)bitmap;
int width, height; wxIconRefData *data = (wxIconRefData *)icon->GetRefData();
WXHICON hIcon = (WXHICON) ReadIconFile((char *)(const char *)name, wxGetInstance(), &width, &height); data->m_hIcon = (WXHICON)ReadIconFile((char *)name.c_str(), wxGetInstance(),
&data->m_width, &data->m_height);
((wxIconRefData *)icon->GetRefData())->m_hIcon = hIcon; data->m_ok = data->m_hIcon != 0;
((wxIconRefData *)icon->GetRefData())->m_ok = (((wxIconRefData *)icon->GetRefData())->m_hIcon != 0); return data->m_ok;
return ((wxIconRefData *)icon->GetRefData())->m_ok; }
} else
else return FALSE;
return FALSE;
#else #else
return FALSE; return FALSE;
#endif #endif
} }
bool wxICOResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, bool wxICOResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) ) if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) )
{ {
#if defined(__WIN32__) #if defined(__WIN32__)
if (desiredWidth > -1 && desiredHeight > -1) if (desiredWidth > -1 && desiredHeight > -1)
{ {
@@ -150,38 +150,38 @@ bool wxICOResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long
else else
#endif #endif
{ {
M_ICONHANDLERDATA->m_hIcon = (WXHICON) ::LoadIcon(wxGetInstance(), name); M_ICONHANDLERDATA->m_hIcon = (WXHICON) ::LoadIcon(wxGetInstance(), name);
} }
#ifdef __WIN32__ #ifdef __WIN32__
// Win32s doesn't have GetIconInfo function... // Win32s doesn't have GetIconInfo function...
if (M_ICONHANDLERDATA->m_hIcon && wxGetOsVersion()!=wxWIN32S) if (M_ICONHANDLERDATA->m_hIcon && wxGetOsVersion()!=wxWIN32S)
{ {
ICONINFO info ; ICONINFO info ;
if (::GetIconInfo((HICON) M_ICONHANDLERDATA->m_hIcon, &info)) if (::GetIconInfo((HICON) M_ICONHANDLERDATA->m_hIcon, &info))
{ {
HBITMAP ms_bitmap = info.hbmMask ; HBITMAP ms_bitmap = info.hbmMask ;
if (ms_bitmap) if (ms_bitmap)
{ {
BITMAP bm; BITMAP bm;
::GetObject(ms_bitmap, sizeof(BITMAP), (LPSTR) &bm); ::GetObject(ms_bitmap, sizeof(BITMAP), (LPSTR) &bm);
M_ICONHANDLERDATA->m_width = bm.bmWidth; M_ICONHANDLERDATA->m_width = bm.bmWidth;
M_ICONHANDLERDATA->m_height = bm.bmHeight; M_ICONHANDLERDATA->m_height = bm.bmHeight;
} }
if (info.hbmMask) if (info.hbmMask)
::DeleteObject(info.hbmMask) ; ::DeleteObject(info.hbmMask) ;
if (info.hbmColor) if (info.hbmColor)
::DeleteObject(info.hbmColor) ; ::DeleteObject(info.hbmColor) ;
} }
} }
#else #else
M_ICONHANDLERDATA->m_width = 32; M_ICONHANDLERDATA->m_width = 32;
M_ICONHANDLERDATA->m_height = 32; M_ICONHANDLERDATA->m_height = 32;
#endif #endif
M_ICONHANDLERDATA->m_ok = (M_ICONHANDLERDATA->m_hIcon != 0); M_ICONHANDLERDATA->m_ok = (M_ICONHANDLERDATA->m_hIcon != 0);
return M_ICONHANDLERDATA->m_ok; return M_ICONHANDLERDATA->m_ok;
} }
else else
return FALSE; return FALSE;
} }