2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
10 #include "ColorMenuItem.h"
16 ColorMenuItem::ColorMenuItem(const char* label
, rgb_color color
,
19 BMenuItem(label
, message
, 0, 0),
22 message
->AddData("color", B_RGB_COLOR_TYPE
, &color
, sizeof(rgb_color
));
27 ColorMenuItem::DrawContent()
31 rgb_color menuColor
= menu
->HighColor();
32 BRect
colorSquare(Frame());
34 if (colorSquare
.Width() > colorSquare
.Height()) {
36 colorSquare
.left
+= 8;
38 colorSquare
.bottom
-= 2;
40 colorSquare
.right
= colorSquare
.left
+ colorSquare
.Height();
42 menu
->SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR
));
43 menu
->StrokeRect(colorSquare
);
45 colorSquare
.InsetBy(1, 1);
46 menu
->SetHighColor(fItemColor
);
47 menu
->FillRect(colorSquare
);
48 menu
->SetHighColor(menuColor
);
49 menu
->MovePenBy(colorSquare
.right
+ 5.0f
, 4.0f
);
50 BMenuItem::DrawContent();