yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1#ifndef YAZE_APP_CORE_INPUT_H
2#define YAZE_APP_CORE_INPUT_H
3
4#define IMGUI_DEFINE_MATH_OPERATORS
5
6#include <cstddef>
7#include <cstdint>
8#include <functional>
9#include <optional>
10#include <string>
11#include <vector>
12
13#include "absl/strings/string_view.h"
14#include "app/gfx/bitmap.h"
16#include "app/gui/canvas.h"
17#include "app/gui/color.h"
18#include "imgui/imgui.h"
19#include "imgui/misc/cpp/imgui_stdlib.h"
20#include "imgui_memory_editor.h"
21
22namespace yaze {
23namespace app {
24namespace gui {
25
26constexpr ImVec2 kDefaultModalSize = ImVec2(200, 0);
27constexpr ImVec2 kZeroPos = ImVec2(0, 0);
28
29IMGUI_API bool InputHex(const char* label, uint64_t* data);
30IMGUI_API bool InputHex(const char* label, int* data, int num_digits = 4,
31 float input_width = 50.f);
32
33IMGUI_API bool InputHexShort(const char* label, uint32_t* data);
34IMGUI_API bool InputHexWord(const char* label, uint16_t* data,
35 float input_width = 50.f, bool no_step = false);
36IMGUI_API bool InputHexWord(const char* label, int16_t* data,
37 float input_width = 50.f, bool no_step = false);
38IMGUI_API bool InputHexByte(const char* label, uint8_t* data,
39 float input_width = 50.f, bool no_step = false);
40
41IMGUI_API bool InputHexByte(const char* label, uint8_t* data, uint8_t max_value,
42 float input_width = 50.f, bool no_step = false);
43
44IMGUI_API bool ListBox(const char* label, int* current_item,
45 const std::vector<std::string>& items,
46 int height_in_items = -1);
47
48using ItemLabelFlags = enum ItemLabelFlag {
49 Left = 1u << 0u,
50 Right = 1u << 1u,
51 Default = Left,
52};
53
54IMGUI_API void ItemLabel(absl::string_view title, ItemLabelFlags flags);
55
56IMGUI_API ImGuiID GetID(const std::string& id);
57
58void FileDialogPipeline(absl::string_view display_key,
59 absl::string_view file_extensions,
60 std::optional<absl::string_view> button_text,
61 std::function<void()> callback);
62
63} // namespace gui
64} // namespace app
65} // namespace yaze
66
67#endif
bool InputHexByte(const char *label, uint8_t *data, float input_width, bool no_step)
Definition input.cc:176
void ItemLabel(absl::string_view title, ItemLabelFlags flags)
Definition input.cc:196
constexpr ImVec2 kDefaultModalSize
Definition input.h:26
bool InputHex(const char *label, uint64_t *data)
Definition input.cc:143
void FileDialogPipeline(absl::string_view display_key, absl::string_view file_extensions, std::optional< absl::string_view > button_text, std::function< void()> callback)
Definition input.cc:253
bool InputHexShort(const char *label, uint32_t *data)
Definition input.cc:156
ImGuiID GetID(const std::string &id)
Definition input.cc:251
enum ItemLabelFlag { Left=1u<< 0u, Right=1u<< 1u, Default=Left, } ItemLabelFlags
Definition input.h:48
constexpr ImVec2 kZeroPos
Definition input.h:27
bool ListBox(const char *label, int *current_item, const std::vector< std::string > &items, int height_in_items)
Definition input.cc:239
bool InputHexWord(const char *label, uint16_t *data, float input_width, bool no_step)
Definition input.cc:162
Definition common.cc:21