Add main screen
This commit is contained in:
@@ -130,6 +130,8 @@ namespace Tesses::BigScreen {
|
||||
|
||||
int MinHeight();
|
||||
};
|
||||
|
||||
|
||||
class Button : public Widget, public std::enable_shared_from_this<Button>
|
||||
{
|
||||
private:
|
||||
@@ -192,7 +194,6 @@ namespace Tesses::BigScreen {
|
||||
SDL_Renderer* renderer;
|
||||
|
||||
std::shared_ptr<Widget> page;
|
||||
bool running=true;
|
||||
Widget* current = nullptr;
|
||||
std::shared_ptr<FontCache> fc;
|
||||
SDL_Color color=COLOR_BGLIGHT;
|
||||
@@ -209,13 +210,16 @@ namespace Tesses::BigScreen {
|
||||
|
||||
void Run();
|
||||
~BigScreenWindow();
|
||||
std::shared_ptr<Widget> GetWidget();
|
||||
void SetWidget(std::shared_ptr<Widget> widget);
|
||||
void DrawRectThick(SDL_Rect rect, int sz);
|
||||
std::shared_ptr<BigScreenWindow> GetRoot();
|
||||
|
||||
void SetBackColor(SDL_Color color);
|
||||
void SetBackColor(std::string color);
|
||||
|
||||
|
||||
void SetPage(std::string name, std::shared_ptr<Widget> widget);
|
||||
void Close();
|
||||
};
|
||||
|
||||
|
||||
@@ -230,15 +234,57 @@ namespace Tesses::BigScreen {
|
||||
|
||||
int tex_w = -1, tex_h = -1;
|
||||
|
||||
bool controls=false;
|
||||
bool paused = false;
|
||||
bool seeking=false;
|
||||
|
||||
public:
|
||||
mpv_handle* GetMPVHandle();
|
||||
VideoPlayerWidget();
|
||||
EventResult Event(SDL_Event& event,SDL_Rect& rect);
|
||||
void SetPrev(std::shared_ptr<Widget> w);
|
||||
std::shared_ptr<Widget> GetPrev();
|
||||
void Draw(SDL_Rect& rect);
|
||||
void LoadFile(std::string file);
|
||||
~VideoPlayerWidget();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class TextBox : public Widget, public std::enable_shared_from_this<TextBox>
|
||||
{
|
||||
private:
|
||||
std::string text;
|
||||
public:
|
||||
TextBox()=default;
|
||||
EventResult Event(SDL_Event& event,SDL_Rect& rect);
|
||||
void Draw(SDL_Rect& rect);
|
||||
std::string GetText();
|
||||
void SetText(std::string text);
|
||||
int MinWidth();
|
||||
int MinHeight();
|
||||
|
||||
class TextBoxDialog : public Widget {
|
||||
std::shared_ptr<TextBox> tb;
|
||||
std::shared_ptr<Widget> page;
|
||||
std::shared_ptr<VGrid> grid;
|
||||
size_t cursor;
|
||||
|
||||
bool shift=false;
|
||||
int x=0;
|
||||
int y=-1;
|
||||
|
||||
void Append(char c);
|
||||
void HandleKey();
|
||||
|
||||
public:
|
||||
TextBoxDialog(std::shared_ptr<TextBox> tb, std::shared_ptr<Widget> page);
|
||||
EventResult Event(SDL_Event& event,SDL_Rect& rect);
|
||||
void Draw(SDL_Rect& rect);
|
||||
~TextBoxDialog()=default;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class Clipper {
|
||||
SDL_Rect theRect;
|
||||
|
||||
Reference in New Issue
Block a user