@@ -76,14 +76,21 @@ namespace ImGuiExt {
76
76
};
77
77
78
78
Texture () = default ;
79
- Texture (const ImU8 *buffer, int size, Filter filter = Filter::Nearest, int width = 0 , int height = 0 );
80
- Texture (std::span<const std::byte> bytes, Filter filter = Filter::Nearest, int width = 0 , int height = 0 );
81
- explicit Texture (const char *path, Filter filter = Filter::Nearest);
82
- explicit Texture (const std::fs::path &path, Filter filter = Filter::Nearest);
83
- Texture (unsigned int texture, int width, int height);
84
79
Texture (const Texture&) = delete ;
85
80
Texture (Texture&& other) noexcept ;
86
81
82
+ static Texture fromImage (const ImU8 *buffer, int size, Filter filter = Filter::Nearest);
83
+ static Texture fromImage (std::span<const std::byte> buffer, Filter filter = Filter::Nearest);
84
+ static Texture fromImage (const char *path, Filter filter = Filter::Nearest);
85
+ static Texture fromImage (const std::fs::path &path, Filter filter = Filter::Nearest);
86
+ static Texture fromGLTexture (unsigned int texture, int width, int height);
87
+ static Texture fromBitmap (const ImU8 *buffer, int size, int width, int height, Filter filter = Filter::Nearest);
88
+ static Texture fromBitmap (std::span<const std::byte> buffer, int width, int height, Filter filter = Filter::Nearest);
89
+ static Texture fromSVG (const char *path, int width = 0 , int height = 0 , Filter filter = Filter::Nearest);
90
+ static Texture fromSVG (const std::fs::path &path, int width = 0 , int height = 0 , Filter filter = Filter::Nearest);
91
+ static Texture fromSVG (std::span<const std::byte> buffer, int width = 0 , int height = 0 , Filter filter = Filter::Nearest);
92
+
93
+
87
94
~Texture ();
88
95
89
96
Texture& operator =(const Texture&) = delete ;
@@ -187,8 +194,8 @@ namespace ImGuiExt {
187
194
ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 ());
188
195
ImGui::PushStyleColor (ImGuiCol_FrameBg, ImVec4 ());
189
196
190
- ImGui::PushItemWidth (-FLT_MIN );
191
- ImGui::InputText (" ##" , const_cast <char *>(text.c_str ()), text.size (), ImGuiInputTextFlags_ReadOnly);
197
+ ImGui::PushItemWidth (ImGui::CalcTextSize (text. c_str ()). x + ImGui::GetStyle (). FramePadding . x * 2 );
198
+ ImGui::InputText (" ##" , const_cast <char *>(text.c_str ()), text.size (), ImGuiInputTextFlags_ReadOnly | ImGuiInputTextFlags_NoHorizontalScroll );
192
199
ImGui::PopItemWidth ();
193
200
194
201
ImGui::PopStyleColor ();
@@ -222,7 +229,7 @@ namespace ImGuiExt {
222
229
ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 ());
223
230
ImGui::PushStyleColor (ImGuiCol_FrameBg, ImVec4 ());
224
231
225
- ImGui::PushItemWidth (-FLT_MIN );
232
+ ImGui::PushItemWidth (ImGui::CalcTextSize (text. c_str ()). x + ImGui::GetStyle (). FramePadding . x * 2 );
226
233
ImGui::InputTextMultiline (
227
234
" ##" ,
228
235
const_cast <char *>(text.c_str ()),
0 commit comments