]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/statbmp.cpp
allow a - at the beginning of a menu item (would become a separator by default)
[wxWidgets.git] / src / msw / statbmp.cpp
index 1d6bfd0c7ccd566f0fba52da4b5f4d3253fa7a82..86fda57454ec9392b4ca1e02c1d213757942cdaf 100644 (file)
@@ -80,7 +80,7 @@ wxEND_FLAGS( wxStaticBitmapStyle )
 IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBitmap, wxControl,"wx/statbmp.h")
 
 wxBEGIN_PROPERTIES_TABLE(wxStaticBitmap)
-    wxPROPERTY_FLAGS( WindowStyle , wxStaticBitmapStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
+    wxPROPERTY_FLAGS( WindowStyle , wxStaticBitmapStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
 wxEND_PROPERTIES_TABLE()
 
 wxBEGIN_HANDLERS_TABLE(wxStaticBitmap)
@@ -167,6 +167,9 @@ bool wxStaticBitmap::Create(wxWindow *parent,
     // no need to delete the new image
     SetImageNoCopy(image);
 
+    // GetBestSize will work properly now, so set the best size if needed
+    SetBestSize(size);
+    
     return TRUE;
 }
 
@@ -203,15 +206,18 @@ void wxStaticBitmap::Free()
 
 wxSize wxStaticBitmap::DoGetBestSize() const
 {
-    // reuse the current size (as wxWindow does) instead of using some
-    // arbitrary default size (as wxControl, our immediate base class, does)
-    return wxWindow::DoGetBestSize();
+    if ( ImageIsOk() )
+        return wxSize(m_image->GetWidth(), m_image->GetHeight());
+
+    // this is completely arbitrary
+    return wxSize(16, 16);
 }
 
 void wxStaticBitmap::SetImage( const wxGDIImage* image )
 {
     wxGDIImage* convertedImage = ConvertImage( *image );
     SetImageNoCopy( convertedImage );
+    InvalidateBestSize();
 }
 
 void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)