[studio] Make StringView params in imguiutil const&
Some checks failed
Build / build (push) Failing after 55s

This commit is contained in:
Gary Talent 2024-12-15 01:17:34 -06:00
parent 626486e034
commit 6744c75280
2 changed files with 22 additions and 22 deletions

View File

@ -34,7 +34,7 @@ ox::Result<T> getDragDropPayload(ox::CStringView name) noexcept {
static_cast<size_t>(payload->DataSize)}); static_cast<size_t>(payload->DataSize)});
} }
ox::Error setDragDropPayload(ox::CStringView name, auto const&obj) noexcept { static ox::Error setDragDropPayload(ox::CStringViewCR name, auto const&obj) noexcept {
oxRequire(buff, ox::writeClaw(obj, ox::ClawFormat::Metal)); oxRequire(buff, ox::writeClaw(obj, ox::ClawFormat::Metal));
ImGui::SetDragDropPayload(name.c_str(), buff.data(), buff.size()); ImGui::SetDragDropPayload(name.c_str(), buff.data(), buff.size());
return {}; return {};
@ -104,7 +104,7 @@ inline auto dragDropTarget(auto const&cb) noexcept {
class ChildStackItem { class ChildStackItem {
public: public:
explicit ChildStackItem(ox::CStringView id, ImVec2 const&sz = {}) noexcept; explicit ChildStackItem(ox::CStringViewCR id, ImVec2 const&sz = {}) noexcept;
~ChildStackItem() noexcept; ~ChildStackItem() noexcept;
}; };
@ -112,7 +112,7 @@ class IDStackItem {
public: public:
explicit IDStackItem(int id) noexcept; explicit IDStackItem(int id) noexcept;
explicit IDStackItem(const char *id) noexcept; explicit IDStackItem(const char *id) noexcept;
explicit IDStackItem(ox::CStringView id) noexcept; explicit IDStackItem(ox::CStringViewCR id) noexcept;
~IDStackItem() noexcept; ~IDStackItem() noexcept;
}; };
@ -126,7 +126,7 @@ class IndentStackItem {
void centerNextWindow(turbine::Context &ctx) noexcept; void centerNextWindow(turbine::Context &ctx) noexcept;
bool PushButton(ox::CStringView lbl, ImVec2 const&btnSz = BtnSz) noexcept; bool PushButton(ox::CStringViewCR lbl, ImVec2 const&btnSz = BtnSz) noexcept;
template<typename Str> template<typename Str>
struct TextInput { struct TextInput {
@ -180,7 +180,7 @@ PopupResponse PopupControlsOkCancel(float popupWidth, bool &popupOpen);
PopupResponse PopupControlsOkCancel(bool &popupOpen); PopupResponse PopupControlsOkCancel(bool &popupOpen);
[[nodiscard]] [[nodiscard]]
bool BeginPopup(turbine::Context &ctx, ox::CStringView popupName, bool &show, ImVec2 const&sz = {285, 0}); bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 const&sz = {285, 0});
/** /**
* *
@ -199,20 +199,20 @@ bool ComboBox(ox::CStringView lbl, ox::Span<const ox::String> list, size_t &sele
* @return true if new value selected, false otherwise * @return true if new value selected, false otherwise
*/ */
bool ComboBox( bool ComboBox(
ox::CStringView lbl, ox::CStringViewCR lbl,
std::function<ox::CStringView(size_t)> const&f, std::function<ox::CStringView(size_t)> const&f,
size_t strCnt, size_t strCnt,
size_t &selectedIdx) noexcept; size_t &selectedIdx) noexcept;
bool FileComboBox( bool FileComboBox(
ox::CStringView lbl, ox::CStringViewCR lbl,
studio::StudioContext &sctx, StudioContext &sctx,
ox::StringView fileExt, ox::StringViewCR fileExt,
size_t &selectedIdx) noexcept; size_t &selectedIdx) noexcept;
bool ListBox( bool ListBox(
ox::CStringView name, ox::CStringViewCR name,
std::function<ox::CStringView(size_t)> const&f, std::function<ox::CStringViewCR(size_t)> const&f,
size_t strCnt, size_t strCnt,
size_t &selIdx) noexcept; size_t &selIdx) noexcept;
@ -223,7 +223,7 @@ bool ListBox(
* @param selIdx * @param selIdx
* @return true if new value selected, false otherwise * @return true if new value selected, false otherwise
*/ */
bool ListBox(ox::CStringView name, ox::Span<const ox::String> const&list, size_t &selIdx) noexcept; bool ListBox(ox::CStringViewCR name, ox::Span<const ox::String> const&list, size_t &selIdx) noexcept;
class FilePicker { class FilePicker {
private: private:

View File

@ -10,7 +10,7 @@
namespace studio::ig { namespace studio::ig {
ChildStackItem::ChildStackItem(ox::CStringView id, ImVec2 const&sz) noexcept { ChildStackItem::ChildStackItem(ox::CStringViewCR id, ImVec2 const&sz) noexcept {
ImGui::BeginChild(id.c_str(), sz); ImGui::BeginChild(id.c_str(), sz);
} }
@ -26,7 +26,7 @@ IDStackItem::IDStackItem(const char *id) noexcept {
ImGui::PushID(id); ImGui::PushID(id);
} }
IDStackItem::IDStackItem(ox::CStringView id) noexcept: IDStackItem(id.c_str()) {} IDStackItem::IDStackItem(ox::CStringViewCR id) noexcept: IDStackItem(id.c_str()) {}
IDStackItem::~IDStackItem() noexcept { IDStackItem::~IDStackItem() noexcept {
ImGui::PopID(); ImGui::PopID();
@ -50,7 +50,7 @@ void centerNextWindow(turbine::Context &ctx) noexcept {
ImGui::SetNextWindowPos(ImVec2(screenW / mod, screenH / mod), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); ImGui::SetNextWindowPos(ImVec2(screenW / mod, screenH / mod), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
} }
bool PushButton(ox::CStringView lbl, ImVec2 const&btnSz) noexcept { bool PushButton(ox::CStringViewCR lbl, ImVec2 const&btnSz) noexcept {
return ImGui::Button(lbl.c_str(), btnSz); return ImGui::Button(lbl.c_str(), btnSz);
} }
@ -77,7 +77,7 @@ PopupResponse PopupControlsOkCancel(bool &popupOpen) {
return PopupControlsOkCancel(ImGui::GetContentRegionAvail().x + 17, popupOpen); return PopupControlsOkCancel(ImGui::GetContentRegionAvail().x + 17, popupOpen);
} }
bool BeginPopup(turbine::Context &ctx, ox::CStringView popupName, bool &show, ImVec2 const&sz) { bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 const&sz) {
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
centerNextWindow(ctx); centerNextWindow(ctx);
ImGui::OpenPopup(popupName.c_str()); ImGui::OpenPopup(popupName.c_str());
@ -105,7 +105,7 @@ bool ComboBox(
} }
bool ComboBox( bool ComboBox(
ox::CStringView lbl, ox::CStringViewCR lbl,
std::function<ox::CStringView(size_t)> const&f, std::function<ox::CStringView(size_t)> const&f,
size_t strCnt, size_t strCnt,
size_t &selectedIdx) noexcept { size_t &selectedIdx) noexcept {
@ -125,17 +125,17 @@ bool ComboBox(
} }
bool FileComboBox( bool FileComboBox(
ox::CStringView lbl, ox::CStringViewCR lbl,
StudioContext &sctx, StudioContext &sctx,
ox::StringView fileExt, ox::StringViewCR fileExt,
size_t &selectedIdx) noexcept { size_t &selectedIdx) noexcept {
auto const&list = sctx.project->fileList(fileExt); auto const&list = sctx.project->fileList(fileExt);
return ComboBox(lbl, list, selectedIdx); return ComboBox(lbl, list, selectedIdx);
} }
bool ListBox( bool ListBox(
ox::CStringView name, ox::CStringViewCR name,
std::function<ox::CStringView(size_t)> const&f, std::function<ox::CStringViewCR(size_t)> const&f,
size_t strCnt, size_t strCnt,
size_t &selIdx) noexcept { size_t &selIdx) noexcept {
auto out = false; auto out = false;
@ -155,7 +155,7 @@ bool ListBox(
return out; return out;
} }
bool ListBox(ox::CStringView name, ox::Span<const ox::String> const&list, size_t &selIdx) noexcept { bool ListBox(ox::CStringViewCR name, ox::Span<const ox::String> const&list, size_t &selIdx) noexcept {
return ListBox(name, [list](size_t i) -> ox::CStringView { return ListBox(name, [list](size_t i) -> ox::CStringView {
return list[i]; return list[i];
}, list.size(), selIdx); }, list.size(), selIdx);