kpresenter

KPrShadowDialogImpl.cpp

00001 // -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
00002 #include <qspinbox.h>
00003 #include <qgroupbox.h>
00004 #include <qlayout.h>
00005 #include <qbuttongroup.h>
00006 
00007 #include <kcolorbutton.h>
00008 #include <klocale.h>
00009 
00010 #include "KPrShadowDialogImpl.h"
00011 #include "KPrTextPreview.h"
00012 
00013 KPrShadowDialogImpl::KPrShadowDialogImpl( QWidget *parent, const char* name )
00014     : ShadowDialogBase( parent, name )
00015 {
00016     _preview = new KPrTextPreview( previewPanel );
00017     QHBoxLayout *lay = new QHBoxLayout( previewPanel, previewPanel->lineWidth(), 0 );
00018     lay->addWidget( _preview );
00019     distanceSpinBox->setSuffix(i18n("pt"));
00020     ltButton->setPixmap( BarIcon( "shadowLU" ) );
00021     tButton->setPixmap( BarIcon( "shadowU" ) );
00022     rtButton->setPixmap( BarIcon( "shadowRU" ) );
00023     rButton->setPixmap( BarIcon( "shadowR" ) );
00024     rbButton->setPixmap( BarIcon( "shadowRB" ) );
00025     bButton->setPixmap( BarIcon( "shadowB" ) );
00026     lbButton->setPixmap( BarIcon( "shadowLB" ) );
00027     lButton->setPixmap( BarIcon( "shadowL" ) );
00028 
00029     connect( colorButton, SIGNAL( changed( const QColor& ) ),
00030              SLOT( colorChanged( const QColor& ) ) );
00031 }
00032 
00033 void KPrShadowDialogImpl::setShadowDirection( ShadowDirection d )
00034 {
00035     _preview->setShadowDirection( d );
00036     directionGroup->setButton( d );
00037 }
00038 
00039 void KPrShadowDialogImpl::setShadowDistance( int d )
00040 {
00041     _preview->setShadowDistance( d );
00042     distanceSpinBox->setValue( d );
00043 }
00044 
00045 void KPrShadowDialogImpl::setShadowColor( const QColor &c )
00046 {
00047     _preview->setShadowColor( c );
00048     colorButton->setColor( c );
00049 }
00050 
00051 void KPrShadowDialogImpl::colorChanged( const QColor& c )
00052 {
00053     _preview->setShadowColor( c );
00054 }
00055 
00056 void KPrShadowDialogImpl::directionChanged( int d )
00057 {
00058     _preview->setShadowDirection( (ShadowDirection)d );
00059 }
00060 
00061 void KPrShadowDialogImpl::distanceChanged( int d )
00062 {
00063     _preview->setShadowDistance( d );
00064 }
00065 
00066 void KPrShadowDialogImpl::applyClicked()
00067 {
00068     emit apply();
00069 }
00070 
00071 void KPrShadowDialogImpl::okClicked()
00072 {
00073     applyClicked();
00074     accept();
00075 }
00076 
00077 ShadowDirection KPrShadowDialogImpl::shadowDirection()
00078 {
00079     return (ShadowDirection) ( directionGroup->id( directionGroup->selected() ) );
00080 }
00081 
00082 int KPrShadowDialogImpl::shadowDistance()
00083 {
00084     return distanceSpinBox->value();
00085 }
00086 
00087 QColor KPrShadowDialogImpl::shadowColor()
00088 {
00089     return colorButton->color();
00090 }
00091 #include "KPrShadowDialogImpl.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys