aboutsummaryrefslogtreecommitdiff
path: root/core/src/UI/UI_Items.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/UI/UI_Items.cpp')
-rw-r--r--core/src/UI/UI_Items.cpp45
1 files changed, 34 insertions, 11 deletions
diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp
index 624f942..8633c1f 100644
--- a/core/src/UI/UI_Items.cpp
+++ b/core/src/UI/UI_Items.cpp
@@ -10,7 +10,8 @@
namespace {
-enum class ActionResult {
+enum class ActionResult
+{
Confirmed,
Canceled,
Pending,
@@ -19,9 +20,16 @@ enum class ActionResult {
/// \param list Item list that the item is in.
/// \param item A non-null pointer to the currently being edited item. It should not change until this function returns a non-\c ActionResult::Pending value.
template <class T>
-ActionResult ItemEditor(ItemList<T>& list, T* item) {
- constexpr bool kHasDescription = requires(T t) { t.GetDescription(); };
- constexpr bool kHasEmail = requires(T t) { t.GetEmail(); };
+ActionResult ItemEditor(ItemList<T>& list, T* item)
+{
+ constexpr bool kHasDescription = requires(T t)
+ {
+ t.GetDescription();
+ };
+ constexpr bool kHasEmail = requires(T t)
+ {
+ t.GetEmail();
+ };
auto ls = LocaleStrings::Instance.get();
auto& uis = UIState::GetInstance();
@@ -88,11 +96,24 @@ ActionResult ItemEditor(ItemList<T>& list, T* item) {
}
template <class T>
-void ItemListEntries(ItemList<T>& list, int& selectedIdx) {
- constexpr bool kHasDescription = requires(T t) { t.GetDescription(); };
- constexpr bool kHasEmail = requires(T t) { t.GetEmail(); };
- constexpr bool kHasStock = requires(T t) { t.GetPrice(); };
- constexpr bool kHasPrice = requires(T t) { t.GetPrice(); };
+void ItemListEntries(ItemList<T>& list, int& selectedIdx)
+{
+ constexpr bool kHasDescription = requires(T t)
+ {
+ t.GetDescription();
+ };
+ constexpr bool kHasEmail = requires(T t)
+ {
+ t.GetEmail();
+ };
+ constexpr bool kHasStock = requires(T t)
+ {
+ t.GetPrice();
+ };
+ constexpr bool kHasPrice = requires(T t)
+ {
+ t.GetPrice();
+ };
constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail + kHasStock + kHasPrice;
auto ls = LocaleStrings::Instance.get();
@@ -148,7 +169,8 @@ void ItemListEntries(ItemList<T>& list, int& selectedIdx) {
}
template <class T>
-void ItemListEditor(ItemList<T>& list) {
+void ItemListEditor(ItemList<T>& list)
+{
auto ls = LocaleStrings::Instance.get();
bool opened = true;
@@ -216,7 +238,8 @@ void ItemListEditor(ItemList<T>& list) {
}
} // namespace
-void UI::ItemsTab() {
+void UI::ItemsTab()
+{
auto ls = LocaleStrings::Instance.get();
auto& uis = UIState::GetInstance();