20 #include "sidepixmap.h"
22 #include <tqpainter.h>
23 #include <kstandarddirs.h>
25 SidePixmap::SidePixmap(TQWidget *parent,
const char *name)
26 : TQFrame(parent, name)
29 setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
31 m_side.load(locate(
"data",
"tdeprint/side.png"));
32 m_tileup.load(locate(
"data",
"tdeprint/tileup.png"));
33 m_tiledown.load(locate(
"data",
"tdeprint/tiledown.png"));
35 setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Minimum));
38 bool SidePixmap::isValid()
40 return (!m_side.isNull() && !m_tileup.isNull() && !m_tiledown.isNull()
41 && (m_side.width() == m_tileup.width())
42 && (m_side.width() == m_tiledown.width()));
45 TQSize SidePixmap::sizeHint()
const
47 return (TQSize(m_side.width()+lineWidth(), 300+lineWidth()));
50 void SidePixmap::drawContents(TQPainter *p)
52 TQRect r = contentsRect();
53 if (r.height() <= m_side.height())
56 int yoffset = (m_side.height()-r.height())/2;
57 p->drawPixmap(r.left(), r.top(), m_side, 0, yoffset, r.width(), r.height());
63 int hh = (((r.height()-m_side.height())/2)/3)*3;
65 p->drawTiledPixmap(r.left(), r.top(), r.width(), hh, m_tileup);
66 p->drawPixmap(r.left(), r.top()+hh, m_side);
67 p->drawTiledPixmap(r.left(), r.top()+m_side.height()+hh, r.width(), r.height()-m_side.height()-hh, m_tiledown);