mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:28:11 +00:00
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.
This commit is contained in:
parent
43bb7aad4c
commit
be604652ae
13 changed files with 16 additions and 7 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue