More tinkering
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -83,8 +83,12 @@ they are one and the same binary.
|
|||||||
Status
|
Status
|
||||||
======
|
======
|
||||||
|
|
||||||
The minimal sample is almost fully-functional, apart from minor
|
The minimal sample is almost fully-functional, apart from some
|
||||||
menu presentation issues (no borders, for example).
|
presentation issues (no menu borders and status bar in the wrong
|
||||||
|
place.
|
||||||
|
|
||||||
|
The widgets sample is crashing in DeleteObject (see notes below).
|
||||||
|
|
||||||
|
|
||||||
Implementation Notes
|
Implementation Notes
|
||||||
====================
|
====================
|
||||||
@@ -103,6 +107,7 @@ in due course. But implementing missing functionality in this way
|
|||||||
is preferably to proliferating many #ifdefs in the
|
is preferably to proliferating many #ifdefs in the
|
||||||
wxMSW/wxMicroWindows port itself.
|
wxMSW/wxMicroWindows port itself.
|
||||||
|
|
||||||
|
|
||||||
Things missing from MicroWindows that need to be worked around
|
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
|
Well, a simple-minded way would be to use CreateCompatibleBitmap
|
||||||
which returns an HBITMAP, select it into an HDC, and draw
|
which returns an HBITMAP, select it into an HDC, and draw
|
||||||
the pixels from the wxImage to the HDC one by one with SetPixel.
|
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
|
Other missing features
|
||||||
|
@@ -50,8 +50,8 @@ LIBNAME =
|
|||||||
include $(TOP)/Makefile.rules
|
include $(TOP)/Makefile.rules
|
||||||
|
|
||||||
# List of objects to compile
|
# List of objects to compile
|
||||||
OBJS = button.o combobox.o gauge.o listbox.o notebook.o radiobox.o slider.o spinbtn.o \
|
OBJS = widgets.o button.o # combobox.o gauge.o listbox.o notebook.o radiobox.o # slider.o spinbtn.o \
|
||||||
static.o textctrl.o widgets.o
|
static.o textctrl.o
|
||||||
|
|
||||||
all: widgets
|
all: widgets
|
||||||
|
|
||||||
|
@@ -88,6 +88,7 @@ void wxBitmapRefData::Free()
|
|||||||
|
|
||||||
if ( m_hBitmap)
|
if ( m_hBitmap)
|
||||||
{
|
{
|
||||||
|
// printf("About to delete bitmap %d\n", (int) (HBITMAP) m_hBitmap);
|
||||||
if ( !::DeleteObject((HBITMAP)m_hBitmap) )
|
if ( !::DeleteObject((HBITMAP)m_hBitmap) )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("DeleteObject(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 )
|
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
||||||
{
|
{
|
||||||
#ifdef __WXMICROWIN__
|
#ifdef __WXMICROWIN__
|
||||||
|
m_refData = new wxBitmapRefData();
|
||||||
|
|
||||||
// Initial attempt at a simple-minded implementation.
|
// Initial attempt at a simple-minded implementation.
|
||||||
// The bitmap will always be created at the screen depth,
|
// 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);
|
int screenDepth = ::GetDeviceCaps(hScreenDC, BITSPIXEL);
|
||||||
|
|
||||||
HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, image.GetWidth(), image.GetHeight());
|
HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, image.GetWidth(), image.GetHeight());
|
||||||
|
// printf("Created bitmap %d\n", (int) hBitmap);
|
||||||
if (hBitmap == NULL)
|
if (hBitmap == NULL)
|
||||||
{
|
{
|
||||||
::ReleaseDC(NULL, hScreenDC);
|
::ReleaseDC(NULL, hScreenDC);
|
||||||
@@ -416,8 +419,6 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
|||||||
::SelectObject(hMemDC, hOldBitmap);
|
::SelectObject(hMemDC, hOldBitmap);
|
||||||
::DeleteDC(hMemDC);
|
::DeleteDC(hMemDC);
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData();
|
|
||||||
|
|
||||||
SetWidth(image.GetWidth());
|
SetWidth(image.GetWidth());
|
||||||
SetHeight(image.GetHeight());
|
SetHeight(image.GetHeight());
|
||||||
SetDepth(screenDepth);
|
SetDepth(screenDepth);
|
||||||
@@ -428,6 +429,11 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
|||||||
SetPalette(image.GetPalette());
|
SetPalette(image.GetPalette());
|
||||||
#endif // wxUSE_PALETTE
|
#endif // wxUSE_PALETTE
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2
|
||||||
|
// check the wxBitmap object
|
||||||
|
GetBitmapData()->SetOk();
|
||||||
|
#endif // WXWIN_COMPATIBILITY_2
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -1020,7 +1026,7 @@ void wxBitmap::SetMask(wxMask *mask)
|
|||||||
wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
|
wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
|
||||||
{
|
{
|
||||||
#ifdef __WXMICROWIN__
|
#ifdef __WXMICROWIN__
|
||||||
return wxBitmap();
|
return *this;
|
||||||
#else
|
#else
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth());
|
wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth());
|
||||||
|
@@ -341,6 +341,8 @@ cleanwx:
|
|||||||
-$(RM) ../generic/*.bak
|
-$(RM) ../generic/*.bak
|
||||||
-$(RM) ../univ/*.o
|
-$(RM) ../univ/*.o
|
||||||
-$(RM) ../univ/*.bak
|
-$(RM) ../univ/*.bak
|
||||||
|
-$(RM) ../univ/themes/*.o
|
||||||
|
-$(RM) ../univ/themes/*.bak
|
||||||
-$(RM) ../unix/*.o
|
-$(RM) ../unix/*.o
|
||||||
-$(RM) ../unix/*.bak
|
-$(RM) ../unix/*.bak
|
||||||
-$(RM) ../html/*.o
|
-$(RM) ../html/*.o
|
||||||
|
@@ -2195,7 +2195,13 @@ wxBitmap wxWin32Renderer::GetIndicator(IndicatorType indType, int flags)
|
|||||||
: IndicatorStatus_Unchecked;
|
: IndicatorStatus_Unchecked;
|
||||||
|
|
||||||
const char **xpm = bmpIndicators[indType][indState][indStatus];
|
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,
|
void wxWin32Renderer::DrawCheckOrRadioButton(wxDC& dc,
|
||||||
@@ -2254,10 +2260,19 @@ void wxWin32Renderer::DrawRadioButton(wxDC& dc,
|
|||||||
wxAlignment align,
|
wxAlignment align,
|
||||||
int indexAccel)
|
int indexAccel)
|
||||||
{
|
{
|
||||||
|
if (bitmap.Ok())
|
||||||
DrawCheckOrRadioButton(dc, label,
|
DrawCheckOrRadioButton(dc, label,
|
||||||
bitmap.Ok() ? bitmap : GetRadioBitmap(flags),
|
bitmap,
|
||||||
rect, flags, align, indexAccel,
|
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,
|
void wxWin32Renderer::DrawCheckButton(wxDC& dc,
|
||||||
@@ -2268,10 +2283,19 @@ void wxWin32Renderer::DrawCheckButton(wxDC& dc,
|
|||||||
wxAlignment align,
|
wxAlignment align,
|
||||||
int indexAccel)
|
int indexAccel)
|
||||||
{
|
{
|
||||||
|
if (bitmap.Ok())
|
||||||
DrawCheckOrRadioButton(dc, label,
|
DrawCheckOrRadioButton(dc, label,
|
||||||
bitmap.Ok() ? bitmap : GetCheckBitmap(flags),
|
bitmap,
|
||||||
rect, flags, align, indexAccel,
|
rect, flags, align, indexAccel,
|
||||||
0); // no focus rect offset for checkboxes
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user