KStyles
Keramik::TilePainter Class Reference
#include <pixmaploader.h>

Public Types | |
enum | PaintMode { PaintNormal, PaintMask, PaintFullBlend, PaintTrivialMask } |
Public Member Functions | |
void | draw (QPainter *p, const QRect &rect, const QColor &color, const QColor &bg, bool disabled=false, PaintMode mode=PaintNormal) |
void | draw (QPainter *p, int x, int y, int width, int height, const QColor &color, const QColor &bg, bool disabled=false, PaintMode mode=PaintNormal) |
TilePainter (int name) | |
virtual | ~TilePainter () |
Protected Types | |
enum | TileMode { Fixed, Scaled, Tiled } |
Protected Member Functions | |
TileMode | columnMode (unsigned int col) const |
unsigned int | columns () const |
TileMode | rowMode (unsigned int row) const |
unsigned int | rows () const |
virtual int | tileName (unsigned int, unsigned int) const |
Protected Attributes | |
TileMode | colMde [5] |
unsigned int | m_columns |
unsigned int | m_rows |
TileMode | rowMde [5] |
Detailed Description
Definition at line 117 of file pixmaploader.h.
Member Enumeration Documentation
Definition at line 123 of file pixmaploader.h.
enum Keramik::TilePainter::TileMode [protected] |
Constructor & Destructor Documentation
Keramik::TilePainter::TilePainter | ( | int | name | ) | [inline] |
Definition at line 120 of file pixmaploader.h.
virtual Keramik::TilePainter::~TilePainter | ( | ) | [inline, virtual] |
Definition at line 121 of file pixmaploader.h.
Member Function Documentation
TileMode Keramik::TilePainter::columnMode | ( | unsigned int | col | ) | const [inline, protected] |
Definition at line 168 of file pixmaploader.h.
unsigned int Keramik::TilePainter::columns | ( | ) | const [inline, protected] |
Definition at line 141 of file pixmaploader.h.
void Keramik::TilePainter::draw | ( | QPainter * | p, | |
const QRect & | rect, | |||
const QColor & | color, | |||
const QColor & | bg, | |||
bool | disabled = false , |
|||
PaintMode | mode = PaintNormal | |||
) | [inline] |
Definition at line 133 of file pixmaploader.h.
void TilePainter::draw | ( | QPainter * | p, | |
int | x, | |||
int | y, | |||
int | width, | |||
int | height, | |||
const QColor & | color, | |||
const QColor & | bg, | |||
bool | disabled = false , |
|||
PaintMode | mode = PaintNormal | |||
) |
Definition at line 307 of file pixmaploader.cpp.
TileMode Keramik::TilePainter::rowMode | ( | unsigned int | row | ) | const [inline, protected] |
Definition at line 173 of file pixmaploader.h.
unsigned int Keramik::TilePainter::rows | ( | ) | const [inline, protected] |
Definition at line 142 of file pixmaploader.h.
virtual int Keramik::TilePainter::tileName | ( | unsigned int | , | |
unsigned int | ||||
) | const [inline, protected, virtual] |
The idea behind all this stuff is that for performance reasons, we want to use only integers to refer to widgets.
So we give each widget a base ID that's divisible by 256, and have all the various tiles be referred to as that ID + some small number.
genembed generates and assigns the base widget IDs, and maps various pixmaps suffixes into the adjustment numbers; using that info it writes out the tables mapping the IDs to pixmaps, and keramikrc.h, which provides nice symbolic constants for base IDs.
When painting, however, we essentially represent the widget as a table, providing fixed/tiled/stretched modes for each column and row. So to draw the widget knowing its base ID, we need to know how many rows and columns there, what the scaling modes are, and how to get to each of the tiles -- i.e. the tiles' offset from the base ID.
The various painter subclasses simply fill in most of that info into the members here during their construction, and implement the virtual tileName to get the offsets.
Note that the IDs and offsets are separated since we can reuse the same code in many cases by splitting the widget identify from tile identity (as there are many different widgets that have the same or similar tile layout)
Reimplemented in Keramik::RectTilePainter, Keramik::RowPainter, Keramik::ProgressBarPainter, Keramik::ActiveTabPainter, Keramik::InactiveTabPainter, Keramik::ScrollBarPainter, and Keramik::SpinBoxPainter.
Definition at line 166 of file pixmaploader.h.
Member Data Documentation
TileMode Keramik::TilePainter::colMde[5] [protected] |
Definition at line 179 of file pixmaploader.h.
unsigned int Keramik::TilePainter::m_columns [protected] |
Definition at line 180 of file pixmaploader.h.
unsigned int Keramik::TilePainter::m_rows [protected] |
Definition at line 181 of file pixmaploader.h.
TileMode Keramik::TilePainter::rowMde[5] [protected] |
Definition at line 179 of file pixmaploader.h.
The documentation for this class was generated from the following files: