Example #1
0
/* static */
status_t
MenuPrivate::CreateBitmaps()
{
	BRect smallRect(0, 0, 16, 10);
	BRect largeRect(0, 0, 21, 10);
	try {
		sMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
		sMenuItemControl = new BBitmap(smallRect, B_CMAP8);
		sMenuItemOption = new BBitmap(smallRect, B_CMAP8);	
		sMenuItemShift = new BBitmap(largeRect, B_CMAP8);
	} catch (...) {
		return B_NO_MEMORY;
	}
	
	sMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
		17, 0, B_CMAP8);
	sMenuItemControl->ImportBits(kCtrlBits, sizeof(kCtrlBits),
		17, 0, B_CMAP8);
	sMenuItemOption->ImportBits(kOptBits, sizeof(kOptBits),
		17, 0, B_CMAP8);
	sMenuItemShift->ImportBits(kShiftBits, sizeof(kShiftBits),
		22, 0, B_CMAP8);
	
	return B_OK;
}
Example #2
0
void ColorChoice::Draw(wxDC& dc, const wxRect& rect,
                       const wxColour & color, const wxString & label) const
{
    wxRect smallRect(rect);
    smallRect.Deflate(popupPadding);
    // Make a box for the color
    int h = smallRect.GetHeight();
    wxRect colorRect = wxRect(smallRect.GetTopLeft(), wxSize(h * 1.5, h));
    smallRect.Offset(colorRect.width + popupPadding, 0);
    dc.SetBrush(wxBrush(color, wxSOLID));
    dc.SetPen(*wxBLACK_PEN);
    dc.DrawRectangle(colorRect);
    dc.DrawLabel(label, smallRect, wxALIGN_CENTER_VERTICAL);
}