A check box with a small color indicator.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30668 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
25398949d1
commit
ba8490bedf
53
src/apps/debuganalyzer/gui/ColorCheckBox.cpp
Normal file
53
src/apps/debuganalyzer/gui/ColorCheckBox.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "ColorCheckBox.h"
|
||||
|
||||
#include <SpaceLayoutItem.h>
|
||||
|
||||
|
||||
ColorCheckBox::ColorCheckBox(const char* label, const rgb_color& color,
|
||||
BMessage* message)
|
||||
:
|
||||
BGroupView(B_HORIZONTAL),
|
||||
fColor(color)
|
||||
{
|
||||
SetFlags(Flags() | B_WILL_DRAW);
|
||||
|
||||
fCheckBox = new BCheckBox(label, message);
|
||||
GroupLayout()->AddView(fCheckBox, 0);
|
||||
AddChild(BSpaceLayoutItem::CreateHorizontalStrut(15));
|
||||
AddChild(BSpaceLayoutItem::CreateGlue());
|
||||
}
|
||||
|
||||
|
||||
BCheckBox*
|
||||
ColorCheckBox::CheckBox() const
|
||||
{
|
||||
return fCheckBox;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorCheckBox::SetTarget(const BMessenger& target)
|
||||
{
|
||||
fCheckBox->SetTarget(target);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ColorCheckBox::Draw(BRect updateRect)
|
||||
{
|
||||
BGroupView::Draw(updateRect);
|
||||
|
||||
BRect rect(Bounds());
|
||||
rect.left += fCheckBox->Frame().right + 5;
|
||||
rect.right = rect.left + 9;
|
||||
rect.top = floorf((rect.top + rect.bottom) / 2);
|
||||
rect.bottom = rect.top + 1;
|
||||
|
||||
SetHighColor(fColor);
|
||||
FillRect(rect);
|
||||
}
|
35
src/apps/debuganalyzer/gui/ColorCheckBox.h
Normal file
35
src/apps/debuganalyzer/gui/ColorCheckBox.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef COLOR_CHECK_BOX_H
|
||||
#define COLOR_CHECK_BOX_H
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <GroupView.h>
|
||||
|
||||
|
||||
class BCheckBox;
|
||||
|
||||
|
||||
#include <SpaceLayoutItem.h>
|
||||
|
||||
class ColorCheckBox : public BGroupView {
|
||||
public:
|
||||
ColorCheckBox(const char* label,
|
||||
const rgb_color& color,
|
||||
BMessage* message = NULL);
|
||||
|
||||
BCheckBox* CheckBox() const;
|
||||
|
||||
void SetTarget(const BMessenger& target);
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
private:
|
||||
BCheckBox* fCheckBox;
|
||||
rgb_color fColor;
|
||||
};
|
||||
|
||||
|
||||
#endif // COLOR_CHECK_BOX_H
|
@ -9,6 +9,7 @@ UseHeaders $(HAIKU_DEBUG_ANALYZER_HEADERS) ;
|
||||
MergeObject DebugAnalyzer_gui.o
|
||||
:
|
||||
AbstractGeneralPage.cpp
|
||||
ColorCheckBox.cpp
|
||||
SubWindow.cpp
|
||||
SubWindowManager.cpp
|
||||
:
|
||||
|
Loading…
Reference in New Issue
Block a user