Move things from crosslang to here
This commit is contained in:
@ -61,6 +61,7 @@ namespace Tesses::Framework::SDL2
|
||||
constexpr uint64_t VIEWFLAG_TABSTOP=(uint64_t)1<<3;
|
||||
constexpr uint64_t VIEWFLAG_INTERCEPT_TAB=(uint64_t)1<<4;
|
||||
constexpr uint64_t VIEWFLAG_CHECKED=(uint64_t)1<<5;
|
||||
constexpr uint64_t VIEWFLAG_TOUCHED=(uint64_t)1<<6;
|
||||
class GUIPopup;
|
||||
class GUIWindow;
|
||||
class ContainerView;
|
||||
@ -96,6 +97,8 @@ namespace Tesses::Framework::SDL2
|
||||
|
||||
ContainerView* parent;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
bool GetViewFlag(uint64_t flag)
|
||||
{
|
||||
@ -124,6 +127,11 @@ namespace Tesses::Framework::SDL2
|
||||
virtual std::string GetId();
|
||||
virtual View* FindViewById(std::string id);
|
||||
friend class ContainerView;
|
||||
|
||||
virtual std::pair<int,int> PreferedMinSize();
|
||||
|
||||
std::pair<int,int> GetCordFromEvent(SDL_Event& event);
|
||||
|
||||
};
|
||||
class ContainerView : public View {
|
||||
public:
|
||||
@ -210,11 +218,15 @@ namespace Tesses::Framework::SDL2
|
||||
|
||||
friend class GUI;
|
||||
friend class GUIPopup;
|
||||
friend class View;
|
||||
|
||||
void SetText(std::string text);
|
||||
|
||||
void SetView(Tesses::Framework::Serialization::Json::JToken json);
|
||||
|
||||
SDL_Window* GetSDLWindow();
|
||||
SDL_Renderer* GetSDLRenderer();
|
||||
|
||||
View* CreateViewFromJson(Tesses::Framework::Serialization::Json::JObject json);
|
||||
};
|
||||
|
||||
|
||||
24
include/TessesFramework/SDL2/Views/EditTextView.hpp
Normal file
24
include/TessesFramework/SDL2/Views/EditTextView.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class EditTextView : 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;
|
||||
size_t cursorPos;
|
||||
size_t cursorEnd;
|
||||
public:
|
||||
EditTextView();
|
||||
EditTextView(std::string hint);
|
||||
virtual std::string GetHint();
|
||||
virtual void SetHint(std::string hint);
|
||||
virtual void SetText(std::string text);
|
||||
virtual void TypeText(std::string text);
|
||||
virtual std::pair<int,int> PreferedMinSize();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
22
include/TessesFramework/SDL2/Views/PictureView.hpp
Normal file
22
include/TessesFramework/SDL2/Views/PictureView.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class PictureView : public View {
|
||||
SDL_Texture* tex;
|
||||
bool ownsTex;
|
||||
SDL_Surface* surf;
|
||||
bool ownsSurf;
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
public:
|
||||
PictureView();
|
||||
void SetPicture(SDL_Texture* tex, bool owns=true);
|
||||
void SetPicture(SDL_Surface* surface,bool owns=true);
|
||||
~PictureView();
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user