Add file icon to file dialog
This commit is contained in:
parent
f31e97edde
commit
b1063f83d9
2 changed files with 7 additions and 9 deletions
BIN
libs/ui/resources/file.png
Normal file
BIN
libs/ui/resources/file.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
|
|
@ -14,6 +14,7 @@
|
|||
#include <psemek/util/unicode.hpp>
|
||||
|
||||
#include <psemek/ui/resources/folder_png.hpp>
|
||||
#include <psemek/ui/resources/file_png.hpp>
|
||||
#include <psemek/ui/resources/back_png.hpp>
|
||||
|
||||
namespace psemek::ui
|
||||
|
|
@ -76,11 +77,8 @@ namespace psemek::ui
|
|||
folder_.load(gfx::read_png(io::memory_istream(resources::folder_png.data)));
|
||||
folder_.linear_filter();
|
||||
|
||||
{
|
||||
gfx::pixmap_rgba empty({folder_.width(), folder_.height()}, gfx::color_rgba{0, 0, 0, 0});
|
||||
empty_.load(empty);
|
||||
empty_.nearest_filter();
|
||||
}
|
||||
file_.load(gfx::read_png(io::memory_istream(resources::file_png.data)));
|
||||
file_.linear_filter();
|
||||
}
|
||||
|
||||
gfx::texture_view_2d get(std::string_view const & id) const override
|
||||
|
|
@ -89,15 +87,15 @@ namespace psemek::ui
|
|||
return gfx::texture_view_2d{&back_};
|
||||
if (id == "folder")
|
||||
return gfx::texture_view_2d{&folder_};
|
||||
if (id == "empty")
|
||||
return gfx::texture_view_2d{&empty_};
|
||||
if (id == "file")
|
||||
return gfx::texture_view_2d{&file_};
|
||||
return {};
|
||||
}
|
||||
|
||||
private:
|
||||
gfx::texture_2d back_;
|
||||
gfx::texture_2d folder_;
|
||||
gfx::texture_2d empty_;
|
||||
gfx::texture_2d file_;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -240,7 +238,7 @@ namespace psemek::ui
|
|||
if (std::filesystem::is_directory(entry.path()))
|
||||
contents_str += "[image:folder]";
|
||||
else
|
||||
contents_str += "[image:empty]";
|
||||
contents_str += "[image:file]";
|
||||
|
||||
contents_str += "[link:" + util::to_string(index++) + "]";
|
||||
contents_str += entry.path().filename().string() + "[/link]\n";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue