LibGUI: Add GIcon::default_icon(name).
This is a convenience helper to instantiate a GIcon like so: auto icon = GIcon::default_icon("filetype-image"); This will give you the "filetype-image" icon in both 16x16 and 32x32 sizes.
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/be604652aef
@ -57,12 +57,12 @@ DirectoryModel::DirectoryModel()
|
||||
{
|
||||
create_thread(thumbnail_thread, this);
|
||||
|
||||
m_directory_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/folder16.png"), GraphicsBitmap::load_from_file("/res/icons/32x32/folder.png"));
|
||||
m_file_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/file16.png"), GraphicsBitmap::load_from_file("/res/icons/32x32/file.png"));
|
||||
m_symlink_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/link16.png"));
|
||||
m_socket_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/socket16.png"));
|
||||
m_executable_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/executable16.png"), GraphicsBitmap::load_from_file("/res/icons/32x32/filetype-executable.png"));
|
||||
m_filetype_image_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-image.png"), GraphicsBitmap::load_from_file("/res/icons/32x32/filetype-image.png"));
|
||||
m_directory_icon = GIcon::default_icon("filetype-folder");
|
||||
m_file_icon = GIcon::default_icon("filetype-unknown");
|
||||
m_symlink_icon = GIcon::default_icon("filetype-symlink");
|
||||
m_socket_icon = GIcon::default_icon("filetype-socket");
|
||||
m_executable_icon = GIcon::default_icon("filetype-executable");
|
||||
m_filetype_image_icon = GIcon::default_icon("filetype-image");
|
||||
|
||||
setpwent();
|
||||
while (auto* passwd = getpwent())
|
||||
|
@ -71,7 +71,7 @@ GWindow* make_launcher_window()
|
||||
|
||||
new LauncherButton("/res/icons/Terminal.png", "/bin/Terminal", widget);
|
||||
new LauncherButton("/res/icons/FontEditor.png", "/bin/FontEditor", widget);
|
||||
new LauncherButton("/res/icons/folder32.png", "/bin/FileManager", widget);
|
||||
new LauncherButton("/res/icons/32x32/filetype-folder.png", "/bin/FileManager", widget);
|
||||
new LauncherButton("/res/icons/TextEditor.png", "/bin/TextEditor", widget);
|
||||
|
||||
return window;
|
||||
|
Before Width: | Height: | Size: 879 B After Width: | Height: | Size: 879 B |
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 904 B |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 335 B |
Before Width: | Height: | Size: 335 B |
@ -61,3 +61,10 @@ void GIconImpl::set_bitmap_for_size(int size, RetainPtr<GraphicsBitmap>&& bitmap
|
||||
}
|
||||
m_bitmaps.set(size, move(bitmap));
|
||||
}
|
||||
|
||||
GIcon GIcon::default_icon(const String& name)
|
||||
{
|
||||
auto bitmap16 = GraphicsBitmap::load_from_file(String::format("/res/icons/16x16/%s.png", name.characters()));
|
||||
auto bitmap32 = GraphicsBitmap::load_from_file(String::format("/res/icons/32x32/%s.png", name.characters()));
|
||||
return GIcon(move(bitmap16), move(bitmap32));
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ public:
|
||||
GIcon(const GIcon&);
|
||||
~GIcon() { }
|
||||
|
||||
static GIcon default_icon(const String&);
|
||||
|
||||
GIcon& operator=(const GIcon& other)
|
||||
{
|
||||
m_impl = other.m_impl.copy_ref();
|
||||
|