8 TabViewController::ContentView::ContentView() :
14 void TabViewController::ContentView::setActiveView(
View * view) {
17 markRectAsDirty(bounds());
20 void TabViewController::ContentView::layoutSubviews() {
25 m_tabView.setFrame(tabViewFrame);
32 m_activeView->setFrame(activeViewFrame);
36 int TabViewController::ContentView::numberOfSubviews()
const {
40 View * TabViewController::ContentView::subviewAtIndex(
int index) {
49 #if ESCHER_VIEW_LOGGING 50 const char * TabViewController::ContentView::className()
const {
51 return "TabViewController::ContentView";
57 m_dataSource(dataSource)
60 assert(two !=
nullptr || (three ==
nullptr && four ==
nullptr));
61 assert(three !=
nullptr || four ==
nullptr);
64 m_children[2] = three;
67 m_numberOfChildren = 0;
68 while (m_numberOfChildren < k_maxNumberOfChildren && m_children[m_numberOfChildren] !=
nullptr) {
79 if (
app()->firstResponder() !=
this) {
85 if (
app()->firstResponder() !=
this) {
95 if (m_dataSource->
selectedTab() < m_numberOfChildren-1) {
112 assert(i >= 0 && i < m_numberOfChildren);
115 m_view.setActiveView(activeVC->
view());
117 m_view.m_tabView.setActiveIndex(i);
130 m_view.m_tabView.setSelectedIndex(i);
152 return m_numberOfChildren;
156 return m_children[index]->
title();
160 if (m_view.m_tabView.numberOfTabs() != m_numberOfChildren) {
161 for (
int i=0; i<m_numberOfChildren; i++) {
162 m_view.m_tabView.addTab(m_children[i]);
168 m_view.setActiveView(m_children[m_dataSource->
activeTab()]->
view());
170 m_view.m_tabView.setActiveIndex(m_dataSource->
activeTab());
179 return m_children[m_dataSource->
activeTab()];
TabViewController(Responder *parentResponder, TabViewDataSource *dataSource, ViewController *one, ViewController *two, ViewController *three, ViewController *four=nullptr)
void willResignFirstResponder() override
void setActiveTab(int8_t index)
static constexpr KDCoordinate TabHeight
void didEnterResponderChain(Responder *previousResponder) override
void viewWillAppear() override
bool handleEvent(Ion::Events::Event event) override
void didBecomeFirstResponder() override
virtual void viewWillAppear()
const char * tabName(uint8_t index)
virtual const char * title()
void setFirstResponder(Responder *responder)
void setSelectedTab(int8_t index)
void setSelectedTab(int index)
virtual void viewDidDisappear()
void setActiveTab(int index)
void viewDidDisappear() override