Merge branch 'bug_486_add_service_event_progress_to_servicelist'
[enigma2.git] / lib / gui / epositiongauge.h
1 #ifndef __lib_gui_epositiongauge_h
2 #define __lib_gui_epositiongauge_h
3
4 #include <lib/gui/ewidget.h>
5 #include <set>
6
7 typedef long long pts_t;
8
9 class ePixmap;
10
11 class ePositionGauge: public eWidget
12 {
13 public:
14         ePositionGauge(eWidget *parent);
15         ~ePositionGauge();
16         void setLength(const pts_t &len);
17         void setPosition(const pts_t &pos);
18         
19         void setInColor(const gRGB &color); /* foreground? */
20         void setPointer(int which, gPixmap *pixmap, const ePoint &center);
21         void setPointer(int which, ePtr<gPixmap> &pixmap, const ePoint &center);
22         
23         void setInOutList(SWIG_PYOBJECT(ePyObject) list);
24         void setForegroundColor(const gRGB &col);
25         
26         void enableSeekPointer(int enable);
27         void setSeekPosition(const pts_t &pos);
28         
29 #ifndef SWIG
30 protected:
31         int event(int event, void *data=0, void *data2=0);
32 private:
33         void updatePosition();
34         enum ePositionGaugeEvent
35         {
36                 evtChangedPosition = evtUserWidget
37         };
38         ePixmap *m_point_widget, *m_seek_point_widget;
39         ePoint m_point_center, m_seek_point_center;
40         
41         pts_t m_position, m_length, m_seek_position;
42         int m_pos, m_seek_pos;
43         
44                 /* TODO: this is duplicated code from lib/service/servicedvb.h */
45         struct cueEntry
46         {
47                 pts_t where;
48                 unsigned int what;
49                 
50                 bool operator < (const struct cueEntry &o) const
51                 {
52                         return where < o.where;
53                 }
54                 cueEntry(const pts_t &where, unsigned int what) :
55                         where(where), what(what)
56                 {
57                 }
58         };
59         
60         std::multiset<cueEntry> m_cue_entries;
61         int scale(const pts_t &val);
62         
63         int m_have_foreground_color;
64         gRGB m_foreground_color;
65 #endif
66 };
67
68 #endif