+ const wxGTKMenuGeometryInfo& geomInfo = (const wxGTKMenuGeometryInfo&)gi;
+
+ wxRect rect;
+ rect.x = 0;
+ rect.y = y;
+ rect.width = geomInfo.GetSize().x;
+ rect.height = geomInfo.GetItemHeight();
+
+ DoDrawMenuItem(dc, rect, label, flags, indexAccel, accel, bitmap, &geomInfo);
+}
+
+void wxGTKRenderer::DoDrawMenuItem(wxDC& dc,
+ const wxRect& rectOrig,
+ const wxString& label,
+ int flags,
+ int indexAccel,
+ const wxString& accel,
+ const wxBitmap& bitmap,
+ const wxGTKMenuGeometryInfo *geometryInfo)
+{
+ wxRect rect = rectOrig;
+
+ // draw the selected item specially
+ if ( flags & wxCONTROL_SELECTED )
+ {
+ wxRect rectIn;
+ DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn);
+
+ DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT), rectIn);
+ }
+
+ rect.Deflate(MENU_HORZ_MARGIN, MENU_VERT_MARGIN);
+
+ // draw the bitmap: use the bitmap provided or the standard checkmark for
+ // the checkable items
+ if ( geometryInfo )
+ {
+ wxBitmap bmp = bitmap;
+ if ( !bmp.Ok() && (flags & wxCONTROL_CHECKABLE) )
+ {
+ bmp = GetCheckBitmap(flags);
+ }
+
+ if ( bmp.Ok() )
+ {
+ rect.SetRight(geometryInfo->GetLabelOffset());
+ wxControlRenderer::DrawBitmap(dc, bmp, rect);
+ }
+ }
+ //else: menubar items don't have bitmaps
+
+ // draw the label
+ if ( geometryInfo )
+ {
+ rect.x = geometryInfo->GetLabelOffset();
+ rect.SetRight(geometryInfo->GetAccelOffset());
+ }
+
+ DrawLabel(dc, label, rect, flags, wxALIGN_CENTRE_VERTICAL, indexAccel);
+
+ // draw the accel string
+ if ( !accel.empty() )
+ {
+ // menubar items shouldn't have them
+ wxCHECK_RET( geometryInfo, wxT("accel strings only valid for menus") );
+
+ rect.x = geometryInfo->GetAccelOffset();
+ rect.SetRight(geometryInfo->GetSize().x);
+
+ // NB: no accel index here
+ DrawLabel(dc, accel, rect, flags, wxALIGN_CENTRE_VERTICAL);
+ }
+
+ // draw the submenu indicator
+ if ( flags & wxCONTROL_ISSUBMENU )
+ {
+ wxCHECK_RET( geometryInfo, wxT("wxCONTROL_ISSUBMENU only valid for menus") );
+
+ rect.x = geometryInfo->GetSize().x - MENU_RIGHT_MARGIN;
+ rect.width = MENU_RIGHT_MARGIN;
+
+ DrawArrow(dc, wxRIGHT, rect, flags);
+ }