Blame view

build3/apps/shared/tab_table_controller.cpp 1.11 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  #include "tab_table_controller.h"
  
  namespace Shared {
  
  TabTableController::TabTableController(Responder * parentResponder, TableViewDataSource * dataSource) :
    DynamicViewController(parentResponder),
    m_dataSource(dataSource)
  {
  }
  
  void TabTableController::didBecomeFirstResponder() {
    app()->setFirstResponder(selectableTableView());
  }
  
  void TabTableController::viewWillAppear() {
    DynamicViewController::viewWillAppear();
    selectableTableView()->reloadData();
  }
  
  void TabTableController::willExitResponderChain(Responder * nextFirstResponder) {
    if (nextFirstResponder == tabController()) {
      selectableTableView()->deselectTable();
      selectableTableView()->scrollToCell(0,0);
    }
  }
  
  SelectableTableView * TabTableController::selectableTableView() {
    return (SelectableTableView *)view();
  }
  
  View * TabTableController::loadView() {
    return new SelectableTableView(this, m_dataSource, 0, 0,  Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin, this, nullptr, true, true, Palette::WallScreenDark);
  }
  
  void TabTableController::unloadView(View * view) {
    delete view;
  }
  
  }