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/util/unicode.hpp>
|
||||||
|
|
||||||
#include <psemek/ui/resources/folder_png.hpp>
|
#include <psemek/ui/resources/folder_png.hpp>
|
||||||
|
#include <psemek/ui/resources/file_png.hpp>
|
||||||
#include <psemek/ui/resources/back_png.hpp>
|
#include <psemek/ui/resources/back_png.hpp>
|
||||||
|
|
||||||
namespace psemek::ui
|
namespace psemek::ui
|
||||||
|
|
@ -76,11 +77,8 @@ namespace psemek::ui
|
||||||
folder_.load(gfx::read_png(io::memory_istream(resources::folder_png.data)));
|
folder_.load(gfx::read_png(io::memory_istream(resources::folder_png.data)));
|
||||||
folder_.linear_filter();
|
folder_.linear_filter();
|
||||||
|
|
||||||
{
|
file_.load(gfx::read_png(io::memory_istream(resources::file_png.data)));
|
||||||
gfx::pixmap_rgba empty({folder_.width(), folder_.height()}, gfx::color_rgba{0, 0, 0, 0});
|
file_.linear_filter();
|
||||||
empty_.load(empty);
|
|
||||||
empty_.nearest_filter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::texture_view_2d get(std::string_view const & id) const override
|
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_};
|
return gfx::texture_view_2d{&back_};
|
||||||
if (id == "folder")
|
if (id == "folder")
|
||||||
return gfx::texture_view_2d{&folder_};
|
return gfx::texture_view_2d{&folder_};
|
||||||
if (id == "empty")
|
if (id == "file")
|
||||||
return gfx::texture_view_2d{&empty_};
|
return gfx::texture_view_2d{&file_};
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gfx::texture_2d back_;
|
gfx::texture_2d back_;
|
||||||
gfx::texture_2d folder_;
|
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()))
|
if (std::filesystem::is_directory(entry.path()))
|
||||||
contents_str += "[image:folder]";
|
contents_str += "[image:folder]";
|
||||||
else
|
else
|
||||||
contents_str += "[image:empty]";
|
contents_str += "[image:file]";
|
||||||
|
|
||||||
contents_str += "[link:" + util::to_string(index++) + "]";
|
contents_str += "[link:" + util::to_string(index++) + "]";
|
||||||
contents_str += entry.path().filename().string() + "[/link]\n";
|
contents_str += entry.path().filename().string() + "[/link]\n";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue