diff --git a/src/apps/debuganalyzer/gui/ColorCheckBox.cpp b/src/apps/debuganalyzer/gui/ColorCheckBox.cpp new file mode 100644 index 0000000000..1a77f41616 --- /dev/null +++ b/src/apps/debuganalyzer/gui/ColorCheckBox.cpp @@ -0,0 +1,53 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "ColorCheckBox.h" + +#include + + +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); +} diff --git a/src/apps/debuganalyzer/gui/ColorCheckBox.h b/src/apps/debuganalyzer/gui/ColorCheckBox.h new file mode 100644 index 0000000000..e2b129eea4 --- /dev/null +++ b/src/apps/debuganalyzer/gui/ColorCheckBox.h @@ -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 +#include + + +class BCheckBox; + + +#include + +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 diff --git a/src/apps/debuganalyzer/gui/Jamfile b/src/apps/debuganalyzer/gui/Jamfile index f3916d11e8..8033297e8c 100644 --- a/src/apps/debuganalyzer/gui/Jamfile +++ b/src/apps/debuganalyzer/gui/Jamfile @@ -9,6 +9,7 @@ UseHeaders $(HAIKU_DEBUG_ANALYZER_HEADERS) ; MergeObject DebugAnalyzer_gui.o : AbstractGeneralPage.cpp + ColorCheckBox.cpp SubWindow.cpp SubWindowManager.cpp :