Blame view

Modif/epsilon-master/apps/shared/tab_table_controller.cpp 1.15 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
40
41
42
  #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 static_cast<SelectableTableView *>(view());
  }
  
  View * TabTableController::loadView() {
    SelectableTableView * selectableTableView = new SelectableTableView(this, m_dataSource, this);
    selectableTableView->setBackgroundColor(Palette::WallScreenDark);
    selectableTableView->setVerticalCellOverlap(0);
    return selectableTableView;
  }
  
  void TabTableController::unloadView(View * view) {
    delete view;
  }
  
  }