• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • management
sidepixmap.cpp
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License version 2 as published by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  **/
19 
20 #include "sidepixmap.h"
21 
22 #include <tqpainter.h>
23 #include <kstandarddirs.h>
24 
25 SidePixmap::SidePixmap(TQWidget *parent, const char *name)
26 : TQFrame(parent, name)
27 {
28  setLineWidth(1);
29  setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
30 
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"));
34 
35  setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Minimum));
36 }
37 
38 bool SidePixmap::isValid()
39 {
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()));
43 }
44 
45 TQSize SidePixmap::sizeHint() const
46 {
47  return (TQSize(m_side.width()+lineWidth(), 300+lineWidth()));
48 }
49 
50 void SidePixmap::drawContents(TQPainter *p)
51 {
52  TQRect r = contentsRect();
53  if (r.height() <= m_side.height())
54  {
55  // case where the main pixmap is enough, just center it
56  int yoffset = (m_side.height()-r.height())/2;
57  p->drawPixmap(r.left(), r.top(), m_side, 0, yoffset, r.width(), r.height());
58  }
59  else
60  {
61  // we need to add tiled pixmap. Make sure we have a multiple
62  // of 3 in the space above to simplifu tiling.
63  int hh = (((r.height()-m_side.height())/2)/3)*3;
64  if (hh > 0)
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);
68  }
69 }

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.8.8
This website is maintained by Timothy Pearson.