Switch to gitea
This commit is contained in:
@ -12,7 +12,7 @@ namespace Tesses::Framework::SDL2::Views
|
||||
public:
|
||||
ButtonView();
|
||||
ButtonView(std::string text);
|
||||
|
||||
virtual std::pair<int,int> PreferedMinSize();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
23
include/TessesFramework/SDL2/Views/DropDownView.hpp
Normal file
23
include/TessesFramework/SDL2/Views/DropDownView.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
#include "ScrollableTextListView.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class DropDownView : public View {
|
||||
|
||||
GUIContainerPopup popup;
|
||||
ScrollableTextListView listView;
|
||||
bool hasSet=false;
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
DropDownView();
|
||||
std::vector<std::string>& GetItems();
|
||||
void SetIndex(int index);
|
||||
int GetIndex();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
24
include/TessesFramework/SDL2/Views/HScrollView.hpp
Normal file
24
include/TessesFramework/SDL2/Views/HScrollView.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class HScrollView : public View {
|
||||
protected:
|
||||
virtual void OnValueChanged(GUIEventArgs& e);
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
HScrollView();
|
||||
HScrollView(uint64_t value, uint64_t min, uint64_t max,uint64_t step=1);
|
||||
uint64_t value;
|
||||
uint64_t min;
|
||||
uint64_t max;
|
||||
uint64_t step;
|
||||
EventList<View*,GUIEventArgs&> ValueChanged;
|
||||
|
||||
std::pair<int,int> PreferedMinSize();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
27
include/TessesFramework/SDL2/Views/HStackView.hpp
Normal file
27
include/TessesFramework/SDL2/Views/HStackView.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class HStackView : public ContainerView {
|
||||
|
||||
std::vector<std::pair<int,std::pair<View*,bool>>> items;
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
HStackView();
|
||||
int spacing=0;
|
||||
|
||||
void Add(int sz, View* view, bool owns=true);
|
||||
void Remove(View* view);
|
||||
void Clear();
|
||||
|
||||
virtual size_t ViewCount();
|
||||
virtual View* GetViewAt(size_t index);
|
||||
|
||||
virtual ~HStackView();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
27
include/TessesFramework/SDL2/Views/MultilineEditTextView.hpp
Normal file
27
include/TessesFramework/SDL2/Views/MultilineEditTextView.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class MultilineEditTextView : public View {
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
std::string hint;
|
||||
std::vector<std::string> lines;
|
||||
SDL_Point topLeft={.x=0,.y=0};
|
||||
SDL_Point cursorPos={.x=0,.y=0};
|
||||
SDL_Point cursorEnd={.x=-1,.y=-1};
|
||||
public:
|
||||
MultilineEditTextView();
|
||||
MultilineEditTextView(std::string hint);
|
||||
virtual std::string GetHint();
|
||||
virtual void SetHint(std::string hint);
|
||||
virtual std::string GetText();
|
||||
virtual void SetText(std::string text);
|
||||
virtual void TypeText(std::string text);
|
||||
virtual std::pair<int,int> PreferedMinSize();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class ScrollableTextListView : public View {
|
||||
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
ScrollableTextListView();
|
||||
size_t firstIndex;
|
||||
int selected;
|
||||
std::vector<std::string> items;
|
||||
|
||||
EventList<View*,GUIEventArgs&> ValueChanged;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@ -15,6 +15,7 @@ namespace Tesses::Framework::SDL2::Views
|
||||
int selected;
|
||||
std::vector<std::string> items;
|
||||
|
||||
EventList<View*,GUIEventArgs&> ValueChanged;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
24
include/TessesFramework/SDL2/Views/VScrollView.hpp
Normal file
24
include/TessesFramework/SDL2/Views/VScrollView.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class VScrollView : public View {
|
||||
protected:
|
||||
virtual void OnValueChanged(GUIEventArgs& e);
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
VScrollView();
|
||||
VScrollView(uint64_t value, uint64_t min, uint64_t max,uint64_t step=1);
|
||||
uint64_t value;
|
||||
uint64_t min;
|
||||
uint64_t max;
|
||||
uint64_t step;
|
||||
EventList<View*,GUIEventArgs&> ValueChanged;
|
||||
|
||||
std::pair<int,int> PreferedMinSize();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
29
include/TessesFramework/SDL2/Views/VStackView.hpp
Normal file
29
include/TessesFramework/SDL2/Views/VStackView.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class VStackView : public ContainerView {
|
||||
|
||||
std::vector<std::pair<int,std::pair<View*,bool>>> items;
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
VStackView();
|
||||
int spacing=0;
|
||||
|
||||
void Add(int sz, View* view, bool owns=true);
|
||||
void Remove(View* view);
|
||||
void Clear();
|
||||
|
||||
virtual size_t ViewCount();
|
||||
virtual View* GetViewAt(size_t index);
|
||||
|
||||
virtual ~VStackView();
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user