1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 23:28:12 +00:00

LibGUI: Add GTableModel::Role::ForegroundColor.

This makes it possible to specify the text color for each table cell.
Use this to make the IRCClient show unread window list items in red.
This commit is contained in:
Andreas Kling 2019-03-18 04:54:07 +01:00
parent f4b8e4966f
commit d466f2634d
10 changed files with 120 additions and 63 deletions

View file

@ -151,18 +151,18 @@ GVariant DirectoryTableModel::data(const GModelIndex& index, Role role) const
}
ASSERT_NOT_REACHED();
}
ASSERT(role == Role::Display);
switch (index.column()) {
case Column::Icon: return icon_for(entry);
case Column::Name: return entry.name;
case Column::Size: return (int)entry.size;
case Column::Owner: return name_for_uid(entry.uid);
case Column::Group: return name_for_gid(entry.gid);
case Column::Permissions: return permission_string(entry.mode);
case Column::Inode: return (int)entry.inode;
if (role == Role::Display) {
switch (index.column()) {
case Column::Icon: return icon_for(entry);
case Column::Name: return entry.name;
case Column::Size: return (int)entry.size;
case Column::Owner: return name_for_uid(entry.uid);
case Column::Group: return name_for_gid(entry.gid);
case Column::Permissions: return permission_string(entry.mode);
case Column::Inode: return (int)entry.inode;
}
}
ASSERT_NOT_REACHED();
return { };
}
void DirectoryTableModel::update()