]> git.saurik.com Git - wxWidgets.git/commitdiff
Adapted wxPGComboBox margins setup to changes in wxComboCtrl
authorJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 9 Sep 2009 17:26:46 +0000 (17:26 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 9 Sep 2009 17:26:46 +0000 (17:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61868 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/editors.cpp

index a05bed43d0c6c5927bf61ffc58350fe24cba6407..12fa961484ed264398814d1d9d237ccd22cf68fd 100644 (file)
 #endif
 
 // Number added to image width for SetCustomPaintWidth
-#define ODCB_CUST_PAINT_MARGIN               9
+#define ODCB_CUST_PAINT_MARGIN               6
 
 // Milliseconds to wait for two mouse-ups after focus inorder
 // to trigger a double-click.
@@ -786,23 +786,28 @@ bool wxPGChoiceEditor_SetCustomPaintWidth( wxPropertyGrid* propGrid, wxPGComboBo
     wxPGProperty* property = propGrid->GetSelectedProperty();
     wxASSERT( property );
 
+    wxSize imageSize;
+    bool res;
+
     if ( cmnVal >= 0 )
     {
         // Yes, a common value is being selected
         property->SetCommonValue( cmnVal );
-        wxSize imageSize = propGrid->GetCommonValue(cmnVal)->
+        imageSize = propGrid->GetCommonValue(cmnVal)->
                             GetRenderer()->GetImageSize(property, 1, cmnVal);
-        if ( imageSize.x ) imageSize.x += ODCB_CUST_PAINT_MARGIN;
-        cb->SetCustomPaintWidth( imageSize.x );
-        return false;
+        res = false;
     }
     else
     {
-        wxSize imageSize = propGrid->GetImageSize(property, -1);
-        if ( imageSize.x ) imageSize.x += ODCB_CUST_PAINT_MARGIN;
-        cb->SetCustomPaintWidth( imageSize.x );
-        return true;
+        imageSize = propGrid->GetImageSize(property, -1);
+        res = true;
     }
+
+    if ( imageSize.x )
+        imageSize.x += ODCB_CUST_PAINT_MARGIN;
+    cb->SetCustomPaintWidth( imageSize.x );
+
+    return res;
 }
 
 // CreateControls calls this with CB_READONLY in extraStyle