format documents
This commit is contained in:
@@ -23,9 +23,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include <pd/ui7/container/container.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
|
||||
@@ -56,8 +56,7 @@ class PD_API Context {
|
||||
void AddViewPort(const ID& id, const ivec4& vp);
|
||||
void UseViewPort(const ID& id);
|
||||
void Update();
|
||||
Menu* BeginMenu(const ID& id, UI7MenuFlags flags = 0,
|
||||
bool* pShow = nullptr);
|
||||
Menu* BeginMenu(const ID& id, UI7MenuFlags flags = 0, bool* pShow = nullptr);
|
||||
Menu* CurrentMenu() { return pCurrent; }
|
||||
void EndMenu();
|
||||
void AboutMenu(bool* show = nullptr);
|
||||
|
||||
@@ -33,8 +33,7 @@ PD_API void ColorEdit::HandleInput() {
|
||||
}
|
||||
// Assert(screen.get(), "Screen is not set up!");
|
||||
// if (screen->ScreenType() == Screen::Bottom) {
|
||||
if (io->InputHandler.DragObject(this->GetID() + 2,
|
||||
fvec4(FinalPos(), size))) {
|
||||
if (io->InputHandler.DragObject(this->GetID() + 2, fvec4(FinalPos(), size))) {
|
||||
if (io->InputHandler.DragReleasedAW) {
|
||||
is_shown = !is_shown;
|
||||
}
|
||||
@@ -55,8 +54,7 @@ PD_API void ColorEdit::Draw() {
|
||||
}
|
||||
layout->SetPosition(FinalPos());
|
||||
layout->AddObjectEx(
|
||||
new DynObj(
|
||||
[=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
|
||||
new DynObj([=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
|
||||
thiz->SetSize(layout->GetSize());
|
||||
// l->Layer(30);
|
||||
l->PathRect(thiz->GetPos(), thiz->GetPos() + thiz->GetSize(),
|
||||
@@ -64,8 +62,8 @@ PD_API void ColorEdit::Draw() {
|
||||
l->PathFill(io->Theme.Get(UI7Color_FrameBackground));
|
||||
}),
|
||||
UI7LytAdd_Front | UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle);
|
||||
auto obj = new DynObj(
|
||||
[=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
|
||||
auto obj =
|
||||
new DynObj([=, this](UI7::IO* io, Li::Drawlist* l, Container* thiz) {
|
||||
l->PathRect(thiz->FinalPos(), thiz->FinalPos() + io->ItemRowHeight,
|
||||
io->FrameRounding);
|
||||
l->PathFill(*color_ref);
|
||||
|
||||
@@ -31,8 +31,8 @@ PD_API void Container::HandleScrolling(fvec2 scrolling, fvec4 viewport) {
|
||||
}
|
||||
last_use = PD::Os::GetTime();
|
||||
pos -= fvec2(0, scrolling.y);
|
||||
skippable = !Li::Math::InBounds(
|
||||
pos, size,
|
||||
skippable =
|
||||
!Li::Math::InBounds(pos, size,
|
||||
fvec4(viewport.x, viewport.y, viewport.x + viewport.z,
|
||||
viewport.y + viewport.w));
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <pd/ui7/container/dragdata.hpp>
|
||||
#include <pd/ui7/container/label.hpp>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
@@ -93,8 +93,8 @@ PD_API void DragData<T>::Draw() {
|
||||
// list->LayerDown();
|
||||
off_x += td.x + io->ItemSpace.x + io->FramePadding.x;
|
||||
}
|
||||
list->DrawText(FinalPos() + fvec2(off_x, io->FramePadding.y * 0.5), label.c_str(),
|
||||
io->Theme.Get(UI7Color_Text));
|
||||
list->DrawText(FinalPos() + fvec2(off_x, io->FramePadding.y * 0.5),
|
||||
label.c_str(), io->Theme.Get(UI7Color_Text));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <pd/ui7/container/label.hpp>
|
||||
#include <pd/ui7/container/slider.hpp>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
@@ -57,8 +57,8 @@ PD_API void Slider<T>::HandleInput() {
|
||||
fvec4(FinalPos() + fvec2(2, 0), fvec2(width, GetSize().y)))) {
|
||||
if (!io->InputHandler.DragReleasedAW) {
|
||||
*data = std::clamp(
|
||||
T(max * (std::clamp(io->InputHandler.DragLastPosition.x - xps, 0.f,
|
||||
width) /
|
||||
T(max *
|
||||
(std::clamp(io->InputHandler.DragLastPosition.x - xps, 0.f, width) /
|
||||
width)),
|
||||
this->min, this->max);
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,8 +22,8 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <pd/core/core.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
#include <pd/drivers/drivers.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
|
||||
namespace PD {
|
||||
PD_API void UI7::IO::Update() {
|
||||
|
||||
+6
-7
@@ -21,9 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <pd/ui7/containers.hpp>
|
||||
#include <pd/ui7/menu.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
@@ -84,8 +84,8 @@ PD_API void Menu::ColorEdit(const std::string& label, u32& clr) {
|
||||
|
||||
PD_API void Menu::Separator() {
|
||||
// Dynamic Objects are very simple...
|
||||
Container* r = new DynObj(
|
||||
[=, this](UI7::IO* io, Li::Drawlist* l, UI7::Container* self) {
|
||||
Container* r =
|
||||
new DynObj([=, this](UI7::IO* io, Li::Drawlist* l, UI7::Container* self) {
|
||||
l->DrawRectFilled(self->FinalPos(), self->GetSize(),
|
||||
pIO.Theme.Get(UI7Color_TextDead));
|
||||
});
|
||||
@@ -394,13 +394,12 @@ PD_API bool Menu::BeginTreeNode(const ID& id) {
|
||||
l->DrawTriangleFilled(ts, ts + pl[0], ts + pl[1],
|
||||
io->Theme.Get(UI7Color_FrameBackground));
|
||||
|
||||
l->DrawText(self->FinalPos() + fvec2(10 + io->ItemSpace.x, 0), id.GetName().c_str(),
|
||||
io->Theme.Get(UI7Color_Text));
|
||||
l->DrawText(self->FinalPos() + fvec2(10 + io->ItemSpace.x, 0),
|
||||
id.GetName().c_str(), io->Theme.Get(UI7Color_Text));
|
||||
});
|
||||
/** Yes this new function handler was created for tree nodes */
|
||||
r->AddInputHandler([=, this](IO* io, Container* self) {
|
||||
if (io->InputHandler.DragObject(
|
||||
ID(pID.GetName() + id.GetName()),
|
||||
if (io->InputHandler.DragObject(ID(pID.GetName() + id.GetName()),
|
||||
fvec4(self->FinalPos(), self->GetSize()))) {
|
||||
if (io->InputHandler.DragReleased) {
|
||||
n->second = !n->second;
|
||||
|
||||
+2
-4
@@ -51,8 +51,7 @@ PD_API void Context::UseViewPort(const ID& id) {
|
||||
pIO.CurrentViewPort = pIO.ViewPorts[id.RawID()];
|
||||
}
|
||||
|
||||
PD_API Menu* Context::BeginMenu(const ID& id, UI7MenuFlags flags,
|
||||
bool* pShow) {
|
||||
PD_API Menu* Context::BeginMenu(const ID& id, UI7MenuFlags flags, bool* pShow) {
|
||||
if (pCurrent) {
|
||||
PDERR("UI7: You are already in {} Menu!", pCurrent->pID.GetName());
|
||||
return nullptr;
|
||||
@@ -256,8 +255,7 @@ PD_API void Context::MetricsMenu(bool* show) {
|
||||
m->Label(std::format("Cursor: {}", pMenus[it]->pLayout.Cursor));
|
||||
if (m->BeginTreeNode(
|
||||
"ID Objects (" +
|
||||
std::to_string(pMenus[it]->pLayout.IDObjects.size()) +
|
||||
")")) {
|
||||
std::to_string(pMenus[it]->pLayout.IDObjects.size()) + ")")) {
|
||||
for (auto& jt : pMenus[it]->pLayout.IDObjects) {
|
||||
m->Label(std::format("{:08X}", jt->GetID()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user