]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/menu.cpp
don't call SelectObject() twice in SetBrush() nor SetFont() neither
[wxWidgets.git] / src / univ / menu.cpp
index f760357497313239f475111f694b8c6ffba458dc..0ebba81d1978767532dfe5bab40cfd88f726da66 100644 (file)
@@ -585,6 +585,21 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
             if ( item == GetCurrentItem() )
                 flags |= wxCONTROL_SELECTED;
 
+            wxBitmap bmp;
+
+            if ( !item->IsEnabled() )
+            {
+                bmp = item->GetDisabledBitmap();
+            }
+
+            if ( !bmp.Ok() )
+            {
+                // strangely enough, for unchecked item we use the
+                // "checked" bitmap because this is the default one - this
+                // explains this strange boolean expression
+                bmp = item->GetBitmap(!item->IsCheckable() || item->IsChecked());
+            }
+
             rend->DrawMenuItem
                   (
                      dc,
@@ -592,10 +607,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
                      gi,
                      item->GetLabel(),
                      item->GetAccelString(),
-                     // strangely enough, for unchecked item we use the
-                     // "checked" bitmap because this is the default one - this
-                     // explains this strange boolean expression
-                     item->GetBitmap(!item->IsCheckable() || item->IsChecked()),
+                     bmp,
                      flags,
                      item->GetAccelIndex()
                   );
@@ -1110,7 +1122,7 @@ void wxMenu::EndRadioGroup()
     m_startRadioGroup = -1;
 }
 
-bool wxMenu::DoAppend(wxMenuItem *item)
+wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
 {
     #if 0
     // not used at all
@@ -1158,21 +1170,21 @@ bool wxMenu::DoAppend(wxMenuItem *item)
     }
 
     if ( !wxMenuBase::DoAppend(item) )
-        return FALSE;
+        return NULL;
 
     OnItemAdded(item);
 
-    return TRUE;
+    return item;
 }
 
-bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
 {
     if ( !wxMenuBase::DoInsert(pos, item) )
-        return FALSE;
+        return NULL;
 
     OnItemAdded(item);
 
-    return TRUE;
+    return item;
 }
 
 wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
@@ -1487,6 +1499,8 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu,
     m_radioGroup.start = -1;
     m_isRadioGroupStart = FALSE;
 
+    m_bmpDisabled = wxNullBitmap;
+
     UpdateAccelInfo();
 }