Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Protected Member Functions | Static Protected Attributes
ScListBoxPixmap< pixWidth, pixHeight > Class Template Reference

#include <sclistboxpixmap.h>

Inheritance diagram for ScListBoxPixmap< pixWidth, pixHeight >:
Inheritance graph
[legend]
Collaboration diagram for ScListBoxPixmap< pixWidth, pixHeight >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ScListBoxPixmap (void)
virtual int width (const QListBox *) const
virtual int height (const QListBox *) const
virtual void paint (QPainter *)

Protected Member Functions

virtual void redraw (void)=0

Static Protected Attributes

static auto_ptr< QPixmap > pmap

Detailed Description

template<unsigned int pixWidth, unsigned int pixHeight>
class ScListBoxPixmap< pixWidth, pixHeight >

Definition at line 19 of file sclistboxpixmap.h.


Constructor & Destructor Documentation

template<unsigned int pixWidth, unsigned int pixHeight>
ScListBoxPixmap< pixWidth, pixHeight >::ScListBoxPixmap ( void  )

Definition at line 36 of file sclistboxpixmap.h.

                                                          : QListBoxItem()
{
       if (!pmap.get())
       {
              pmap.reset( new QPixmap(pixWidth, pixHeight) );
       }
};

Member Function Documentation

template<unsigned int pixWidth, unsigned int pixHeight>
int ScListBoxPixmap< pixWidth, pixHeight >::height ( const QListBox *  lb) const [virtual]

Definition at line 53 of file sclistboxpixmap.h.

{
       int h;
       if ( text().isEmpty() )
              h = pmap->height();
    else
              h = QMAX( pmap->height(), lb->fontMetrics().lineSpacing() + 2 );
    return QMAX( h, QApplication::globalStrut().height() );
};
template<unsigned int pixWidth, unsigned int pixHeight>
void ScListBoxPixmap< pixWidth, pixHeight >::paint ( QPainter *  qpainter) [virtual]

Reimplemented in SCRIBUS_API, and SCRIBUS_API.

Definition at line 64 of file sclistboxpixmap.h.

{
       int yPos;
       redraw();
       int itemHeight = height( listBox() );
       if ( !pmap->isNull() ) {
              yPos = ( itemHeight - pmap->height() ) / 2;
              qpainter->drawPixmap( 3, yPos, *pmap);
    }
    if ( !text().isEmpty() ) {
              QFontMetrics fm = qpainter->fontMetrics();
              yPos = ( ( itemHeight - fm.height() ) / 2 ) + fm.ascent();
              qpainter->drawText( pmap->width() + 5, yPos, text() );
    }
};
template<unsigned int pixWidth, unsigned int pixHeight>
virtual void ScListBoxPixmap< pixWidth, pixHeight >::redraw ( void  ) [protected, pure virtual]
template<unsigned int pixWidth, unsigned int pixHeight>
int ScListBoxPixmap< pixWidth, pixHeight >::width ( const QListBox *  lb) const [virtual]

Definition at line 45 of file sclistboxpixmap.h.

{
       if ( text().isEmpty() )
              return QMAX( pmap->width() + 6, QApplication::globalStrut().width() );
    return QMAX( pmap->width() + lb->fontMetrics().width(text()) + 6,QApplication::globalStrut().width() );
};

Member Data Documentation

template<unsigned int pixWidth, unsigned int pixHeight>
auto_ptr< QPixmap > ScListBoxPixmap< pixWidth, pixHeight >::pmap [static, protected]

Definition at line 27 of file sclistboxpixmap.h.


The documentation for this class was generated from the following file: