libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / stylededit / ColorMenuItem.cpp
blobe5baa0e1041ebb78c3eee034c011b0444c6aac28
1 /*
2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Mattias Sundblad
7 * Andrew Bachmann
8 */
10 #include "ColorMenuItem.h"
12 #include <Message.h>
13 #include <Rect.h>
16 ColorMenuItem::ColorMenuItem(const char* label, rgb_color color,
17 BMessage *message)
19 BMenuItem(label, message, 0, 0),
20 fItemColor(color)
22 message->AddData("color", B_RGB_COLOR_TYPE, &color, sizeof(rgb_color));
26 void
27 ColorMenuItem::DrawContent()
29 BMenu* menu = Menu();
30 if (menu) {
31 rgb_color menuColor = menu->HighColor();
32 BRect colorSquare(Frame());
34 if (colorSquare.Width() > colorSquare.Height()) {
35 // large button
36 colorSquare.left += 8;
37 colorSquare.top += 2;
38 colorSquare.bottom -= 2;
40 colorSquare.right = colorSquare.left + colorSquare.Height();
41 if (IsMarked()) {
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();