#ifndef QPALETTE_H_
#define QPALETTE_H_
#include "KWQBrush.h"
class QColorGroup {
public:
enum ColorRole {
Background,
Foreground,
NColorRoles,
Base = Background
};
QColorGroup() : m_background(Qt::white) { }
QColorGroup(const QColor &b, const QColor &f) : m_background(b), m_foreground(f) { }
const QBrush &brush(ColorRole role) const { return role == Background ? m_background : m_foreground; }
const QColor &color(ColorRole role) const { return brush(role).color(); }
void setColor(ColorRole role, const QColor &color)
{ (role == Background ? m_background : m_foreground).setColor(color); }
const QColor &background() const { return m_background.color(); }
const QColor &foreground() const { return m_foreground.color(); }
const QColor &base() const { return background(); }
bool operator==(const QColorGroup &other) const
{ return m_background == other.m_background && m_foreground == other.m_foreground; }
private:
QBrush m_background;
QBrush m_foreground;
};
class QPalette {
public:
QPalette() { }
QPalette(const QColor &b, const QColor &f) : m_active(b, f) { }
const QColorGroup &active() const { return m_active; }
const QColor &background() const { return m_active.background(); }
const QColor &foreground() const { return m_active.foreground(); }
bool operator==(const QPalette &other) const { return m_active == other.m_active; }
private:
QColorGroup m_active;
};
#endif