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
====================
is preferably to proliferating many #ifdefs in the
wxMSW/wxMicroWindows port itself.
+
Things missing from MicroWindows that need to be worked around
==============================================================
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
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
if ( m_hBitmap)
{
+ // printf("About to delete bitmap %d\n", (int) (HBITMAP) m_hBitmap);
if ( !::DeleteObject((HBITMAP)m_hBitmap) )
{
wxLogLastError(wxT("DeleteObject(hbitmap)"));
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,
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);
::SelectObject(hMemDC, hOldBitmap);
::DeleteDC(hMemDC);
- m_refData = new wxBitmapRefData();
-
SetWidth(image.GetWidth());
SetHeight(image.GetHeight());
SetDepth(screenDepth);
SetPalette(image.GetPalette());
#endif // wxUSE_PALETTE
+#if WXWIN_COMPATIBILITY_2
+ // check the wxBitmap object
+ GetBitmapData()->SetOk();
+#endif // WXWIN_COMPATIBILITY_2
+
return TRUE;
#else
wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
{
#ifdef __WXMICROWIN__
- return wxBitmap();
+ return *this;
#else
wxMemoryDC memDC;
wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth());
-$(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
: 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,
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
+ else
+ {
+ wxBitmap rbitmap(GetRadioBitmap(flags));
+ DrawCheckOrRadioButton(dc, label,
+ rbitmap,
rect, flags, align, indexAccel,
- FOCUS_RECT_OFFSET_Y); // default focus rect offset
+ FOCUS_RECT_OFFSET_Y); // default focus rect offset
+ }
}
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
+ }
}
// ----------------------------------------------------------------------------