Blame view

epsilon-master/apps/statistics/multiple_data_view.h 1.32 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
43
44
45
46
47
48
49
50
  #ifndef STATISTICS_MULTIPLE_DATA_VIEW_H
  #define STATISTICS_MULTIPLE_DATA_VIEW_H
  
  #include <escher.h>
  #include "store.h"
  #include "../shared/banner_view.h"
  #include "../shared/curve_view.h"
  
  namespace Statistics {
  
  class MultipleDataView : public View {
  public:
    static constexpr int k_defaultSelectedBar = 0;
    MultipleDataView(Store * store) :
      m_store(store),
      m_displayBanner(false)
    {}
    // Data views
    void selectDataView(int index);
    void deselectDataView(int index);
    virtual Shared::CurveView * dataViewAtIndex(int index) = 0;
    Shared::BannerView * editableBannerView() { return const_cast<Shared::BannerView *>(bannerView()); }
  
    // Index/series
    int indexOfSubviewAtSeries(int series);
    virtual int seriesOfSubviewAtIndex(int index) = 0;
  
    // Display
    void setDisplayBanner(bool display) { m_displayBanner = display; }
    virtual void reload();
  
    // View
    int numberOfSubviews() const override;
  protected:
    virtual const Shared::BannerView * bannerView() const = 0;
    void layoutSubviews() override;
    virtual void layoutDataSubviews();
    View * subviewAtIndex(int index) override;
    virtual void changeDataViewSelection(int index, bool select);
    KDRect bannerFrame() const;
    Store * m_store;
  private:
    void layoutBanner();
    void drawRect(KDContext * ctx, KDRect rect) const override;
    bool m_displayBanner;
  };
  
  }
  
  #endif