mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 16:20:49 +01:00
46 lines
994 B
C++
46 lines
994 B
C++
#include <escher/tab_view_cell.h>
|
|
extern "C" {
|
|
#include <assert.h>
|
|
}
|
|
|
|
TabViewCell::TabViewCell() :
|
|
ChildlessView(),
|
|
m_active(false),
|
|
m_selected(false),
|
|
m_name(nullptr)
|
|
{
|
|
}
|
|
|
|
void TabViewCell::setName(const char * name) {
|
|
m_name = name;
|
|
markRectAsDirty(bounds());
|
|
}
|
|
|
|
void TabViewCell::setActive(bool active) {
|
|
m_active = active;
|
|
markRectAsDirty(bounds());
|
|
}
|
|
|
|
void TabViewCell::setSelected(bool selected) {
|
|
m_selected = selected;
|
|
markRectAsDirty(bounds());
|
|
}
|
|
|
|
void TabViewCell::drawRect(KDContext * ctx, KDRect rect) const {
|
|
KDColor text = m_active ? KDColorBlack : KDColorWhite;
|
|
KDColor background = m_active ? KDColorWhite : KDColorBlack;
|
|
ctx->drawString(m_name, KDPointZero, text, background);
|
|
}
|
|
|
|
#if ESCHER_VIEW_LOGGING
|
|
const char * TabViewCell::className() const {
|
|
return "TabViewCell";
|
|
}
|
|
|
|
void TabViewCell::logAttributes(std::ostream &os) const {
|
|
View::logAttributes(os);
|
|
os << " active=\"" << m_active << "\"";
|
|
os << " name=\"" << m_name << "\"";
|
|
}
|
|
#endif
|