mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:05:07 +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:
parent
f4b8e4966f
commit
d466f2634d
10 changed files with 120 additions and 63 deletions
|
@ -1,5 +1,9 @@
|
|||
#include <LibGUI/GVariant.h>
|
||||
|
||||
GVariant::GVariant()
|
||||
{
|
||||
}
|
||||
|
||||
GVariant::~GVariant()
|
||||
{
|
||||
switch (m_type) {
|
||||
|
@ -48,6 +52,12 @@ GVariant::GVariant(const GraphicsBitmap& value)
|
|||
AK::retain_if_not_null(m_value.as_bitmap);
|
||||
}
|
||||
|
||||
GVariant::GVariant(Color color)
|
||||
: m_type(Type::Color)
|
||||
{
|
||||
m_value.as_color = color.value();
|
||||
}
|
||||
|
||||
bool GVariant::operator==(const GVariant& other) const
|
||||
{
|
||||
if (m_type != other.m_type)
|
||||
|
@ -63,6 +73,8 @@ bool GVariant::operator==(const GVariant& other) const
|
|||
return as_string() == other.as_string();
|
||||
case Type::Bitmap:
|
||||
return m_value.as_bitmap == other.m_value.as_bitmap;
|
||||
case Type::Color:
|
||||
return m_value.as_color == other.m_value.as_color;
|
||||
case Type::Invalid:
|
||||
break;
|
||||
}
|
||||
|
@ -85,6 +97,8 @@ bool GVariant::operator<(const GVariant& other) const
|
|||
case Type::Bitmap:
|
||||
// FIXME: Maybe compare bitmaps somehow differently?
|
||||
return m_value.as_bitmap < other.m_value.as_bitmap;
|
||||
case Type::Color:
|
||||
return m_value.as_color < other.m_value.as_color;
|
||||
case Type::Invalid:
|
||||
break;
|
||||
}
|
||||
|
@ -104,6 +118,8 @@ String GVariant::to_string() const
|
|||
return as_string();
|
||||
case Type::Bitmap:
|
||||
return "[GraphicsBitmap]";
|
||||
case Type::Color:
|
||||
return as_color().to_string();
|
||||
case Type::Invalid:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue