]> git.saurik.com Git - wxWidgets.git/commitdiff
More tinkering
authorJulian Smart <julian@anthemion.co.uk>
Fri, 21 Dec 2001 18:15:53 +0000 (18:15 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 21 Dec 2001 18:15:53 +0000 (18:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/microwin/readme.txt
samples/widgets/makefile.mic
src/msw/bitmap.cpp
src/msw/makefile.mic
src/univ/themes/win32.cpp

index c2572f3d0a44c1996a68cca8e7a0f2799b75cd73..980f125efe93700598b860a6814f56efd0720034 100644 (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
index 2efc49c71a5a5e26c0c2de982cffd17288a954e8..75dd78c8e8e671d94b401caa7f935e87e82ed9e4 100644 (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
 
index 0118ff56bdeac342f0f13becc8329a51aed279cd..97a886aff941f534ec241e9c356c091236b652ad 100644 (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());
index a761c1f2f7f890e71ee10e4a93336457a50ee835..60d21f875ba164803ac6e03cb064599948826e0f 100644 (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
index 3261e10239f09a7652bb784ef810147096d1c75b..3de3e524150274de0fb6a7c7d7a893207772a777 100644 (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
+    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,
@@ -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
+    }
 }
 
 // ----------------------------------------------------------------------------