Fixes and function additions
- Fixed Text pos at NoCollapse flag - Fix Button Input Api (HandleScrolling after layout Update) - Add getter for IO and Current Menu - Add AdObject func wrappers to Menu
This commit is contained in:
@@ -103,6 +103,8 @@ class PD_UI7_API Layout {
|
|||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
fvec2 DbgScrollOffset() { return ScrollOffset; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Menu;
|
friend class Menu;
|
||||||
friend class Context;
|
friend class Context;
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ class PD_UI7_API Menu {
|
|||||||
void HandleTitlebarActions();
|
void HandleTitlebarActions();
|
||||||
void DrawBaseLayout();
|
void DrawBaseLayout();
|
||||||
|
|
||||||
|
void AddObject(PD::UI7::Container::Ref obj) { pLayout->AddObject(obj); }
|
||||||
|
void AddObjectEx(PD::UI7::Container::Ref obj, PD::u32 flags) {
|
||||||
|
pLayout->AddObjectEx(obj, flags);
|
||||||
|
}
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
/** Data Section */
|
/** Data Section */
|
||||||
|
|||||||
@@ -55,10 +55,12 @@ class PD_UI7_API Context {
|
|||||||
|
|
||||||
PD_SHARED(Context);
|
PD_SHARED(Context);
|
||||||
|
|
||||||
|
IO::Ref GetIO() { return pIO; }
|
||||||
void AddViewPort(const ID& id, const ivec4& vp);
|
void AddViewPort(const ID& id, const ivec4& vp);
|
||||||
void UseViewPort(const ID& id);
|
void UseViewPort(const ID& id);
|
||||||
void Update();
|
void Update();
|
||||||
bool BeginMenu(const ID& id, UI7MenuFlags flags = 0, bool* pShow = nullptr);
|
bool BeginMenu(const ID& id, UI7MenuFlags flags = 0, bool* pShow = nullptr);
|
||||||
|
Menu::Ref CurrentMenu() { return pCurrent; }
|
||||||
void EndMenu();
|
void EndMenu();
|
||||||
void AboutMenu(bool* show = nullptr);
|
void AboutMenu(bool* show = nullptr);
|
||||||
void MetricsMenu(bool* show = nullptr);
|
void MetricsMenu(bool* show = nullptr);
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ PD_UI7_API void Menu::HandleScrolling() {
|
|||||||
pLayout->ScrollOffset.y = std::clamp(
|
pLayout->ScrollOffset.y = std::clamp(
|
||||||
pLayout->ScrollStart.y + pIO->InputHandler->DragSourcePos.y -
|
pLayout->ScrollStart.y + pIO->InputHandler->DragSourcePos.y -
|
||||||
pIO->InputHandler->DragPosition.y,
|
pIO->InputHandler->DragPosition.y,
|
||||||
20.f, pLayout->MaxPosition.y - 220);
|
-20.f, pLayout->MaxPosition.y - 220);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -279,12 +279,12 @@ PD_UI7_API void Menu::DrawBaseLayout() {
|
|||||||
l->pLayer = 21;
|
l->pLayer = 21;
|
||||||
/** Inline if statement to shift the Text if collapse sym is shown */
|
/** Inline if statement to shift the Text if collapse sym is shown */
|
||||||
/** What the hell is this code btw (didn't found a better way) */
|
/** What the hell is this code btw (didn't found a better way) */
|
||||||
l->DrawText(self->FinalPos() + fvec2(Flags & UI7MenuFlags_NoClose
|
l->DrawText(self->FinalPos() + fvec2((Flags & UI7MenuFlags_NoCollapse)
|
||||||
? 0
|
? pIO->FramePadding.x
|
||||||
: (TitleBarHeight -
|
: (TitleBarHeight -
|
||||||
pIO->FramePadding.y * 2 +
|
pIO->FramePadding.y * 2 +
|
||||||
(io->FramePadding.x * 2)),
|
(io->FramePadding.x * 2)),
|
||||||
0),
|
2),
|
||||||
pID.GetName(), io->Theme->Get(UI7Color_Text));
|
pID.GetName(), io->Theme->Get(UI7Color_Text));
|
||||||
});
|
});
|
||||||
r->SetSize(fvec2(pLayout->GetSize().x, TitleBarHeight));
|
r->SetSize(fvec2(pLayout->GetSize().x, TitleBarHeight));
|
||||||
@@ -344,11 +344,11 @@ PD_UI7_API void Menu::Update() {
|
|||||||
TitleBarHeight = 0.f;
|
TitleBarHeight = 0.f;
|
||||||
pLayout->WorkRect.y = 5.f;
|
pLayout->WorkRect.y = 5.f;
|
||||||
}
|
}
|
||||||
|
DrawBaseLayout();
|
||||||
|
pLayout->Update();
|
||||||
if (Flags & UI7MenuFlags_VtScrolling || Flags & UI7MenuFlags_HzScrolling) {
|
if (Flags & UI7MenuFlags_VtScrolling || Flags & UI7MenuFlags_HzScrolling) {
|
||||||
HandleScrolling();
|
HandleScrolling();
|
||||||
}
|
}
|
||||||
DrawBaseLayout();
|
|
||||||
pLayout->Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PD_UI7_API bool Menu::BeginTreeNode(const ID& id) {
|
PD_UI7_API bool Menu::BeginTreeNode(const ID& id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user