trunk 20080912
[gitenigma.git] / src / sselect.h
blobb1f644f3efdde3e3a7a3835b9052027f059b9a6f
1 #ifndef __sselect_h
2 #define __sselect_h
4 #include <lib/gui/ewindow.h>
5 #include <lib/gui/listbox.h>
6 #include <lib/gui/statusbar.h>
7 #include <lib/dvb/epgcache.h>
8 #include <src/channelinfo.h>
10 #include <lib/dvb/service.h>
12 class eService;
13 class eLabel;
15 class eEPGStyleSelector: public eListBoxWindow<eListBoxEntryText>
17 int ssel;
18 public:
19 eEPGStyleSelector(int ssel=0);
20 int eventHandler( const eWidgetEvent &event );
21 void entrySelected( eListBoxEntryText* e );
24 class eListBoxEntryService: public eListBoxEntry
26 friend class eServiceSelector;
27 friend class eListBoxExt<eListBoxEntryService>;
28 friend struct moveFirstChar;
29 friend struct moveServiceNum;
30 friend struct moveServicePath;
31 friend struct _selectService;
32 friend struct updateEPGChangedService;
33 friend struct renumber;
34 eString sort;
35 static gFont serviceFont, descrFont, numberFont;
36 static int maxNumSize;
37 static gPixmap *folder, *marker, *locked, *newfound;
38 eTextPara *numPara, *namePara, *descrPara;
39 int nameXOffs, descrXOffs, numYOffs, nameYOffs, descrYOffs;
40 int flags;
41 int num;
42 int curEventId;
43 public:
44 const eString &getText() const { return sort; }
45 static eListBoxEntryService *selectedToMove;
46 static std::set<eServiceReference> hilitedEntrys;
47 static int nownextEPG;
48 int getNum() const { return num; }
49 void invalidate();
50 void invalidateDescr();
51 static int getEntryHeight();
52 eServiceReference service;
53 enum { flagShowNumber=1, flagOwnNumber=2, flagIsReturn=4, flagSameTransponder=8 };
54 eListBoxEntryService(eListBoxExt<eListBoxEntryService> *lb, const eServiceReference &service, int flags, int num=-1);
55 ~eListBoxEntryService();
57 bool operator<(const eListBoxEntry &r) const
59 if (flags & flagIsReturn)
60 return 1;
61 else if (((eListBoxEntryService&)r).flags & flagIsReturn)
62 return 0;
63 else if (service.getSortKey() == ((eListBoxEntryService&)r).service.getSortKey())
64 return sort < ((eListBoxEntryService&)r).sort;
65 else // sort andersrum
66 return service.getSortKey() > ((eListBoxEntryService&)r).service.getSortKey();
68 protected:
69 const eString &redraw(gPainter *rc, const eRect &rect, gColor, gColor, gColor, gColor, int hilited);
72 class eServiceSelector: public eWindow
74 eServiceReference selected;
75 eServiceReference *result;
76 eListBoxExt<eListBoxEntryService> *services, *bouquets;
78 eLabel *key[4];
79 const eWidget *rfocus;
81 eChannelInfo* ci;
83 eServicePath path;
85 void addService(const eServiceReference &service);
86 void addBouquet(const eServiceReference &service);
87 int style, lastSelectedStyle;
88 int serviceentryflags;
90 char BrowseChar;
91 eTimer BrowseTimer;
92 eTimer ciDelay;
94 eListBoxEntryService *goUpEntry;
95 private:
96 void pathUp();
97 void fillServiceList(const eServiceReference &ref);
98 void fillBouquetList(const eServiceReference &ref);
99 void serviceSelected(eListBoxEntryService *entry);
100 void bouquetSelected(eListBoxEntryService *entry);
101 void serviceSelChanged(eListBoxEntryService *entry);
102 void bouquetSelChanged( eListBoxEntryService *entry);
103 void ResetBrowseChar();
104 void gotoChar(char c);
105 void updateCi();
106 void init_eServiceSelector();
107 void SwitchNowNext();
109 public:
110 void EPGUpdated();
111 int eventHandler(const eWidgetEvent &event);
112 void setKeyDescriptions(bool editMode=false);
113 void forEachServiceRef( Signal1<void,const eServiceReference&>, bool );
114 int movemode;
115 int editMode;
116 int plockmode;
117 enum { styleInvalid, styleCombiColumn, styleSingleColumn, styleMultiColumn };
118 enum { dirNo, dirUp, dirDown, dirFirst, dirLast };
120 eServiceSelector();
121 ~eServiceSelector();
123 enum { listAll, listSatellites, listProvider, listBouquets };
124 Signal2<eServicePath,int,int> getRoot;
125 Signal2<int,eServiceReference,int> getFirstBouquetServiceNum;
127 Signal1<void,const eServiceReference &> addServiceToPlaylist; // add service to the Playlist
128 Signal2<void,eServiceReference*,int> addServiceToUserBouquet; // add current service to selected User Bouquet
130 Signal1<void,int> setMode; // set TV, Radio or File
132 Signal1<void,eServiceSelector*> removeServiceFromUserBouquet, // remove service from selected User Bouquet
133 showMenu, // shows the contextmenu
134 toggleStyle, // switch service selector style
135 renameService, renameBouquet,
136 deletePressed, newMarkerPressed,
137 copyToBouquetList;
139 Signal3<void,
140 const eServiceReference &, // path
141 const eServiceReference &, // service to move
142 const eServiceReference & // service AFTER moved service
143 > moveEntry;
145 Signal1<void,eServiceReferenceDVB>showEPGList;
147 const eServicePath &getPath() { return path; }
148 void setPath(const eServicePath &path, const eServiceReference &select=eServiceReference());
150 int getStyle() { return style; }
151 void setStyle(int newStyle=-1, bool force=false);
152 void actualize();
153 bool selectService(const eServiceReference &ref);
154 bool selectService(int num);
155 bool selectServiceRecursive( eServiceReference &ref );
156 bool selServiceRec( eServiceReference &ref );
157 int getServiceNum( const eServiceReference &ref);
158 void enterDirectory(const eServiceReference &ref);
159 const eServiceReference &getSelected() { return selected; }
160 const eServiceReference *choose(int irc=-1);
161 const eServiceReference *next();
162 const eServiceReference *prev();
163 void removeCurrent(bool=false);
164 void invalidateCurrent(eServiceReference ref=eServiceReference());
165 void updateNumbers();
166 void showMultiEPG();
168 int toggleMoveMode(); // enable / disable move entry Mode ( only in userBouquets )
169 int toggleEditMode(); // enable / disable edit UserBouquet Mode
172 #endif