More tinkering

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2001-12-21 18:15:53 +00:00
parent 3a50d19cae
commit 54a96d029f
5 changed files with 59 additions and 15 deletions

View File

@ -83,8 +83,12 @@ they are one and the same binary.
Status
======
The minimal sample is almost fully-functional, apart from minor
menu presentation issues (no borders, for example).
The minimal sample is almost fully-functional, apart from some
presentation issues (no menu borders and status bar in the wrong
place.
The widgets sample is crashing in DeleteObject (see notes below).
Implementation Notes
====================
@ -103,6 +107,7 @@ in due course. But implementing missing functionality in this way
is preferably to proliferating many #ifdefs in the
wxMSW/wxMicroWindows port itself.
Things missing from MicroWindows that need to be worked around
==============================================================
@ -131,6 +136,13 @@ So how can we convert from wxImage to wxBitmap in MicroWindows?
Well, a simple-minded way would be to use CreateCompatibleBitmap
which returns an HBITMAP, select it into an HDC, and draw
the pixels from the wxImage to the HDC one by one with SetPixel.
This is now implemented, but without any mask handling, which will
be needed.
Unfortunately, there's a crash in malloc, within DeleteObject, when
passed a bitmap created by CreateCompatibleBitmap, but only after a few
deletions. This has yet to be tracked down, maybe by trying to create/delete
some wxBitmaps from XPMs, from within e.g. the minimal sample.
Other missing features

View File

@ -50,8 +50,8 @@ LIBNAME =
include $(TOP)/Makefile.rules
# List of objects to compile
OBJS = button.o combobox.o gauge.o listbox.o notebook.o radiobox.o slider.o spinbtn.o \
static.o textctrl.o widgets.o
OBJS = widgets.o button.o # combobox.o gauge.o listbox.o notebook.o radiobox.o # slider.o spinbtn.o \
static.o textctrl.o
all: widgets

View File

@ -88,6 +88,7 @@ void wxBitmapRefData::Free()
if ( m_hBitmap)
{
// printf("About to delete bitmap %d\n", (int) (HBITMAP) m_hBitmap);
if ( !::DeleteObject((HBITMAP)m_hBitmap) )
{
wxLogLastError(wxT("DeleteObject(hbitmap)"));
@ -380,6 +381,7 @@ bool wxBitmap::Create(int w, int h, int d)
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{
#ifdef __WXMICROWIN__
m_refData = new wxBitmapRefData();
// Initial attempt at a simple-minded implementation.
// The bitmap will always be created at the screen depth,
@ -390,6 +392,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
int screenDepth = ::GetDeviceCaps(hScreenDC, BITSPIXEL);
HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, image.GetWidth(), image.GetHeight());
// printf("Created bitmap %d\n", (int) hBitmap);
if (hBitmap == NULL)
{
::ReleaseDC(NULL, hScreenDC);
@ -416,8 +419,6 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
::SelectObject(hMemDC, hOldBitmap);
::DeleteDC(hMemDC);
m_refData = new wxBitmapRefData();
SetWidth(image.GetWidth());
SetHeight(image.GetHeight());
SetDepth(screenDepth);
@ -428,6 +429,11 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
SetPalette(image.GetPalette());
#endif // wxUSE_PALETTE
#if WXWIN_COMPATIBILITY_2
// check the wxBitmap object
GetBitmapData()->SetOk();
#endif // WXWIN_COMPATIBILITY_2
return TRUE;
#else
@ -1020,7 +1026,7 @@ void wxBitmap::SetMask(wxMask *mask)
wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
{
#ifdef __WXMICROWIN__
return wxBitmap();
return *this;
#else
wxMemoryDC memDC;
wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth());

View File

@ -341,6 +341,8 @@ cleanwx:
-$(RM) ../generic/*.bak
-$(RM) ../univ/*.o
-$(RM) ../univ/*.bak
-$(RM) ../univ/themes/*.o
-$(RM) ../univ/themes/*.bak
-$(RM) ../unix/*.o
-$(RM) ../unix/*.bak
-$(RM) ../html/*.o

View File

@ -2195,7 +2195,13 @@ wxBitmap wxWin32Renderer::GetIndicator(IndicatorType indType, int flags)
: IndicatorStatus_Unchecked;
const char **xpm = bmpIndicators[indType][indState][indStatus];
return xpm ? wxBitmap(xpm) : wxNullBitmap;
if (xpm)
{
wxBitmap bmp(xpm);
return bmp;
}
else
return wxNullBitmap;
}
void wxWin32Renderer::DrawCheckOrRadioButton(wxDC& dc,
@ -2254,10 +2260,19 @@ void wxWin32Renderer::DrawRadioButton(wxDC& dc,
wxAlignment align,
int indexAccel)
{
DrawCheckOrRadioButton(dc, label,
bitmap.Ok() ? bitmap : GetRadioBitmap(flags),
if (bitmap.Ok())
DrawCheckOrRadioButton(dc, label,
bitmap,
rect, flags, align, indexAccel,
FOCUS_RECT_OFFSET_Y); // default focus rect offset
FOCUS_RECT_OFFSET_Y); // default focus rect offset
else
{
wxBitmap rbitmap(GetRadioBitmap(flags));
DrawCheckOrRadioButton(dc, label,
rbitmap,
rect, flags, align, indexAccel,
FOCUS_RECT_OFFSET_Y); // default focus rect offset
}
}
void wxWin32Renderer::DrawCheckButton(wxDC& dc,
@ -2268,10 +2283,19 @@ void wxWin32Renderer::DrawCheckButton(wxDC& dc,
wxAlignment align,
int indexAccel)
{
DrawCheckOrRadioButton(dc, label,
bitmap.Ok() ? bitmap : GetCheckBitmap(flags),
rect, flags, align, indexAccel,
0); // no focus rect offset for checkboxes
if (bitmap.Ok())
DrawCheckOrRadioButton(dc, label,
bitmap,
rect, flags, align, indexAccel,
0); // no focus rect offset for checkboxes
else
{
wxBitmap cbitmap(GetCheckBitmap(flags));
DrawCheckOrRadioButton(dc, label,
cbitmap,
rect, flags, align, indexAccel,
0); // no focus rect offset for checkboxes
}
}
// ----------------------------------------------------------------------------