11 m_selectedTabIndex(-1)
16 return m_numberOfTabs;
27 assert(m_numberOfTabs < k_maxNumberOfTabs);
28 uint8_t tabIndex = m_numberOfTabs;
35 assert(index < m_numberOfTabs);
36 if (m_activeTabIndex == index) {
39 if (m_activeTabIndex >= 0) {
40 m_cells[m_activeTabIndex].
setActive(
false);
42 m_activeTabIndex = index;
43 m_cells[m_activeTabIndex].
setActive(
true);
47 assert(index < m_numberOfTabs);
48 if (m_selectedTabIndex == index) {
51 if (m_selectedTabIndex >= 0) {
54 m_selectedTabIndex = index;
55 if (m_selectedTabIndex >= 0) {
60 int TabView::numberOfSubviews()
const {
61 return m_numberOfTabs;
64 View * TabView::subviewAtIndex(
int index) {
65 assert(index < m_numberOfTabs);
66 return &m_cells[index];
69 void TabView::layoutSubviews() {
71 for (
int i=0; i<m_numberOfTabs; i++) {
75 for (
int i=0; i<m_numberOfTabs; i++) {
78 if (i == m_numberOfTabs - 1) {
86 widthUsed += tabWidth;
90 #if ESCHER_VIEW_LOGGING 91 const char * TabView::className()
const {
95 void TabView::logAttributes(std::ostream &os)
const {
96 View::logAttributes(os);
97 os <<
" numberOfTabs=\"" << (int)m_numberOfTabs <<
"\"";
98 os <<
" activeTabIndex=\"" << (int)m_activeTabIndex <<
"\"";
void setFrame(KDRect frame)
constexpr KDCoordinate width() const
void markRectAsDirty(KDRect rect)
void setSelected(bool selected)
constexpr KDColor KDColorWhite
KDSize minimalSizeForOptimalDisplay() const override
void setActiveIndex(int index)
void fillRect(KDRect rect, KDColor color)
void setSelectedIndex(int index)
KDCoordinate width() const
void setNamedController(ViewController *controller)
void drawRect(KDContext *ctx, KDRect rect) const override
KDCoordinate height() const
void addTab(ViewController *controller)
void setActive(bool active)