]> git.vomp.tv Git - vompclient.git/blob - wselectlist.h
Fix text corruption in live TV OSD clock
[vompclient.git] / wselectlist.h
1 /*
2     Copyright 2004-2020 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef WSELECTLIST_H
21 #define WSELECTLIST_H
22
23 #include <vector>
24
25 #include "defines.h"
26 #include "boxx.h"
27
28 typedef struct
29 {
30   char* text;
31   void* data;
32   TVMediaInfo* pict;
33 } wsloption;
34
35 class WSelectList : public Boxx
36 {
37   public:
38     WSelectList();
39     virtual ~WSelectList();
40     void clear();
41     void addColumn(int x);
42     int getColumn(int x);
43
44     void setNoLoop();
45     void setShowSelOption(bool set) { showseloption = set; }
46     void setDarkSelOption(bool set) { darkseloption = set; }
47     int addOption(const char* text, void* data, int selected, TVMediaInfo* pict = NULL);
48     int addOption(const std::string& text, void* data, int selected, TVMediaInfo* pict = NULL);
49     void draw();
50     void setBackgroundColour(const DrawStyle& colour);
51     void setLinesPerOption(float lines) { linesPerOption = lines; }
52
53     void down();
54     void up();
55     void pageUp();
56     void pageDown();
57
58     int getTopOption();
59     int getNumOptions();
60     int getBottomOption();     // actually returns bottom + 1 i.e. the one just past display ?!
61     int getNumOptionsDisplayable();
62     int getCurrentOption();
63     void* getCurrentOptionData();
64
65     void hintSetCurrent(int index);
66     void hintSetTop(int index);
67
68     virtual bool mouseMove(int x, int y);
69     virtual bool mouseLBDOWN(int x, int y);
70     virtual bool mouseAndroidScroll(int x, int y, int sx, int sy);
71
72   private:
73     void drawOptionLine(char* text, int xpos, int ypos, int width, const DrawStyle& colour, TVMediaInfo* pict);
74     int getMouseLine(int x, int y);
75
76     DrawStyle backgroundColour;
77     std::vector<wsloption> options;
78     int selectedOption{};
79     int topOption{};
80     int numOptionsDisplayable{};
81     int columns[10];
82     int numColumns{};
83     int noLoop{};
84     bool showseloption{true};
85     bool darkseloption{};
86     float linesPerOption{1};
87     UINT gap{1};
88 };
89
90 #endif