palladium/include/pd/ui7/container/container.hpp
tobid7 f87c103d8d # Stage 1.8
- Renderer now vould use more screen Objects
- Register default Top and Bottom Screens (for Overlays and UI7)
- Make ToHex an Inline header func
- Add GetCompilerVersion
- Add Library Compile And Version Info to common
- Remove z of vertex object and shader in position
- Add Container base and SubContainers to UI7
- Add abillity to Join Multiple Objects in Same Line and Center them
- Fix LayerOrder Bug for updating texts in DrawList
2025-02-02 20:32:07 +01:00

55 lines
1.3 KiB
C++

#pragma once
#include <pd/common/common.hpp>
#include <pd/common/strings.hpp>
#include <pd/controls/hid.hpp>
#include <pd/maths/vec.hpp>
#include <pd/ui7/drawlist.hpp>
namespace PD {
namespace UI7 {
class Container : public SmartCtor<Container> {
public:
Container() {}
Container(const vec2& pos, const vec2& size) : pos(pos), size(size) {}
Container(const vec4& box) : pos(box.xy()), size(box.zw()) {}
~Container() {}
void Init(LI::Renderer::Ref r, UI7::DrawList::Ref l, UI7::Theme* lt) {
list = l;
linked_theme = lt;
ren = r;
}
void SetPos(const vec2& pos) { this->pos = pos; }
void SetSize(const vec2& size) { this->size = size; }
vec2 GetPos() { return pos; }
vec2 GetSize() { return size; }
bool Skippable() const { return skippable; }
void HandleScrolling(vec2 scrolling, vec4 viewport);
virtual void HandleInput(Hid::Ref inp) {}
virtual void Draw() {}
void UnlockInput() { inp_done = false; }
u32 GetID() const { return id; }
void SetID(u32 id) { this->id = id; }
protected:
/// used to skip Input/Render preocessing ot not
bool skippable = false;
bool inp_done = false;
Screen::Ref screen;
vec2 pos;
vec2 size;
UI7::DrawList::Ref list;
UI7::Theme* linked_theme;
LI::Renderer::Ref ren;
u32 id = 0;
};
} // namespace UI7
} // namespace PD