24#include "kdialogbase.h"
32#include <tqwhatsthis.h>
34#include <tqfocusdata.h>
36#include <tdeapplication.h>
39#include <kiconloader.h>
41#include <tdeglobalsettings.h>
42#include <kseparator.h>
46#include "kdialogbase_priv.h"
47#include "kdialogbase_priv.moc"
51int KDialogBaseButton::id()
56template class TQPtrList<KDialogBaseButton>;
63struct SButton :
public TQt
74 void resize(
bool sameWidth,
int margin,
int spacing,
int orientation );
81 TQPtrList<KDialogBaseButton> list;
85class KDialogBase::KDialogBasePrivate {
87 KDialogBasePrivate() : bDetails(false), bFixed(false), bSettingDetails(false), detailsWidget(0) { }
92 TQWidget *detailsWidget;
95 TQString detailsButton;
100 const TQString &caption,
int buttonMask,
104 :
KDialog( parent, name, modal, (WFlags)WStyle_DialogBorder ),
105 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
106 mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
107 mButtonOrientation(TQt::Horizontal), d(new KDialogBasePrivate)
115 makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
123 TQWidget *parent,
const char *name,
bool modal,
124 bool separator,
const KGuiItem &user1,
126 :
KDialog( parent, name, modal, (WFlags)WStyle_DialogBorder ),
127 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
128 mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
129 mButtonOrientation(TQt::Horizontal), d(new KDialogBasePrivate)
140 if( !mJanus || !mJanus->
isValid() ) {
return; }
143 makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
151 const TQString &caption,
int buttonMask,
155 :
KDialog( parent, name, modal, f ),
156 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
157 mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
158 mButtonOrientation(TQt::Horizontal), d(new KDialogBasePrivate)
169 if( !mJanus || !mJanus->
isValid() ) {
return; }
172 makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
180 TQWidget *parent,
const char *name,
bool modal,
181 bool separator,
const KGuiItem &yes,
183 :
KDialog( parent, name, modal, (WFlags)WStyle_DialogBorder ),
184 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
185 mIsActivated(false), mShowTile(false), mMessageBoxMode(true),
186 mButtonOrientation(TQt::Horizontal),mEscapeButton(escapeButton),
187 d(new KDialogBasePrivate)
198 makeButtonBox( buttonMask, defaultButton,
199 no.text().isEmpty() ? KStdGuiItem::no() : no,
200 yes.text().isEmpty() ? KStdGuiItem::yes() : yes );
203 KStdGuiItem::cancel() :
cancel );
223void SButton::resize(
bool sameWidth,
int margin,
224 int spacing,
int orientation )
231 for( p = list.first(); p; p = list.next() )
233 const TQSize s( p->sizeHint() );
234 if( s.height() > h ) { h = s.height(); }
235 if( s.width() > w ) { w = s.width(); }
238 if( orientation == TQt::Horizontal )
240 for( p = list.first(); p; p = list.next() )
242 TQSize s( p->sizeHint() );
243 if( sameWidth ) { s.setWidth( w ); }
244 p->setFixedWidth( s.width() );
245 t += s.width() + spacing;
248 box->setMinimumHeight( margin*2 + h );
249 box->setMinimumWidth( margin*2 + t - spacing );
254 for( p = list.first(); p; p = list.next() )
256 TQSize s( p->sizeHint() );
258 p->setFixedSize( s );
259 t += s.height() + spacing;
261 box->setMinimumHeight( margin*2 + t - spacing );
262 box->setMinimumWidth( margin*2 + w );
269 for( p = list.first(); p; p = list.next() )
293void KDialogBase::setupLayout()
302 if( mButtonOrientation == TQt::Horizontal )
304 mTopLayout =
new TQBoxLayout(
this, TQBoxLayout::TopToBottom,
309 mTopLayout =
new TQBoxLayout(
this, TQBoxLayout::LeftToRight,
315 mTopLayout->addWidget( mUrlHelp, 0, AlignRight );
320 mTopLayout->addWidget( mJanus, 10 );
322 else if( mMainWidget )
324 mTopLayout->addWidget( mMainWidget, 10 );
327 if ( d->detailsWidget )
329 mTopLayout->addWidget( d->detailsWidget );
334 mTopLayout->addWidget( mActionSep );
339 mTopLayout->addWidget( d->mButton.box );
347 if( mButtonOrientation != orientation )
349 mButtonOrientation = orientation;
352 mActionSep->
setOrientation( mButtonOrientation == TQt::Horizontal ?
353 TQFrame::HLine : TQFrame::VLine );
355 if( mButtonOrientation == TQt::Vertical )
360 setButtonStyle( d->mButton.style );
372void KDialogBase::makeRelay()
384 connect( tqApp, TQ_SIGNAL(aboutToQuit()), mTile, TQ_SLOT(cleanup()) );
398 mActionSep->setFocusPolicy(TQWidget::NoFocus);
399 mActionSep->
setOrientation( mButtonOrientation == TQt::Horizontal ?
400 TQFrame::HLine : TQFrame::VLine );
409 delete mActionSep; mActionSep = 0;
422 return ( mJanus ? mJanus->
plainPage() : 0 );
432 setFixedSize( sizeHint() );
434 resize( sizeHint() );
437TQSize KDialogBase::sizeHint()
const
439 return d->minSize.expandedTo( minimumSizeHint() ) + d->incSize;
442TQSize KDialogBase::minimumSizeHint()
const
447 const TQSize zeroByS(0, s);
457 s2 = mUrlHelp->minimumSize() + zeroByS;
459 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
460 s1.rheight() += s2.rheight();
469 else if( mMainWidget )
471 s2 = mMainWidget->sizeHint() + zeroByS;
472 s2 = s2.expandedTo( mMainWidget->minimumSize() );
473 s2 = s2.expandedTo( mMainWidget->minimumSizeHint() );
476 s2 = TQSize( 100, 100+s );
481 s2 = TQSize( 100, 100+s );
483 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
484 s1.rheight() += s2.rheight();
486 if (d->detailsWidget && d->bDetails)
488 s2 = d->detailsWidget->sizeHint() + zeroByS;
489 s2 = s2.expandedTo( d->detailsWidget->minimumSize() );
490 s2 = s2.expandedTo( d->detailsWidget->minimumSizeHint() );
491 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
492 s1.rheight() += s2.rheight();
500 s1.rheight() += mActionSep->minimumSize().height() + s;
508 s2 = d->mButton.box->minimumSize();
509 if( mButtonOrientation == TQt::Horizontal )
511 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
512 s1.rheight() += s2.rheight();
516 s1.rwidth() += s2.rwidth();
517 s1.rheight() = TQMAX( s1.rheight(), s2.rheight() );
533 setFixedSize( sizeHint() );
540 d->bFixed = noResize;
548 d->bFixed = noResize;
553void KDialogBase::makeButtonBox(
int buttonMask, ButtonCode defaultButton,
557 if( buttonMask == 0 )
563 if( buttonMask &
Cancel ) { buttonMask &= ~Close; }
564 if( buttonMask &
Apply ) { buttonMask &= ~Try; }
565 if( buttonMask &
Details ) { buttonMask &= ~Default; }
567 if( !mMessageBoxMode )
572 d->mButton.box =
new TQWidget(
this );
574 d->mButton.mask = buttonMask;
575 if( d->mButton.mask &
Help )
579 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotHelp()) );
581 if( d->mButton.mask &
Default )
585 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotDefault()) );
587 if( d->mButton.mask &
Details )
590 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotDetails()) );
593 if( d->mButton.mask &
User3 )
596 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotUser3()) );
598 if( d->mButton.mask &
User2 )
601 if( mMessageBoxMode )
603 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotYes()) );
607 connect( pb, TQ_SIGNAL(clicked()),
this, TQ_SLOT(
slotUser2()) );
610 if( d->mButton.mask &
User1 )
613 if( mMessageBoxMode )
615 connect( pb, TQ_SIGNAL(clicked()),
this, TQ_SLOT(
slotNo()) );
619 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotUser1()) );
622 if( d->mButton.mask &
Ok )
624 KPushButton *pb = d->mButton.append(
Ok, KStdGuiItem::ok() );
625 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotOk()) );
627 if( d->mButton.mask &
Apply )
630 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotApply()) );
631 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
applyPressed()) );
633 if( d->mButton.mask &
Try )
637 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotTry()) );
639 if( d->mButton.mask &
Cancel )
642 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotCancel()) );
644 if( d->mButton.mask &
Close )
647 connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(
slotClose()) );
655 setButtonFocus( pb,
true,
false );
659 setButtonStyle( TDEGlobalSettings::buttonLayout() );
664void KDialogBase::setButtonStyle(
int style )
666 if( !d->mButton.box )
671 if( style < 0 || style >= ActionStyleMAX ) { style = ActionStyle0; }
672 d->mButton.style = style;
674 const unsigned int *layout;
678 static const unsigned int layoutRule[5][6] =
687 layout = layoutRule[ d->mButton.style ];
689 else if (mButtonOrientation == TQt::Horizontal)
691 static const unsigned int layoutRule[5][10] =
693 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Ok,
Apply|
Try,
Cancel|
Close},
694 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Cancel|
Close,
Apply|
Try,
Ok},
695 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Apply|
Try,
Cancel|
Close,
Ok},
696 {
Ok,
Apply|
Try,
Cancel|
Close,
User3,
User2,
User1,
Stretch,
Default,
Help,
Details},
700 layout = layoutRule[ d->mButton.style ];
704 static const unsigned int layoutRule[5][10] =
706 {
Ok,
Apply|
Try,
User1,
User2,
User3,
Stretch,
Default,
Cancel|
Close,
Help,
Details},
708 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Cancel|
Close,
Apply|
Try,
Ok},
709 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Apply|
Try,
Cancel|
Close,
Ok},
710 {
Ok,
Apply|
Try,
Cancel|
Close,
User3,
User2,
User1,
Stretch,
Default,
Help,
Details},
714 layout = layoutRule[ d->mButton.style ];
717 if( d->mButton.box->layout() )
719 delete d->mButton.box->layout();
723 if( mButtonOrientation == TQt::Horizontal )
725 lay =
new TQBoxLayout( d->mButton.box, TQBoxLayout::LeftToRight, 0,
730 lay =
new TQBoxLayout( d->mButton.box, TQBoxLayout::TopToBottom, 0,
735 TQPushButton *prevButton = 0;
736 TQPushButton *newButton;
738 for(
int i=0; i<layoutMax; ++i )
745 else if (layout[i] &
Filler)
747 if (d->mButton.mask & layout[i])
751 lay->addSpacing(newButton->sizeHint().width());
755 else if( d->mButton.mask &
Help & layout[i] )
758 lay->addWidget( newButton ); ++numButton;
760 else if( d->mButton.mask &
Default & layout[i] )
763 lay->addWidget( newButton ); ++numButton;
765 else if( d->mButton.mask &
User3 & layout[i] )
768 lay->addWidget( newButton ); ++numButton;
770 else if( d->mButton.mask &
User2 & layout[i] )
773 lay->addWidget( newButton ); ++numButton;
775 else if( d->mButton.mask &
User1 & layout[i] )
778 lay->addWidget( newButton ); ++numButton;
780 else if( d->mButton.mask &
Ok & layout[i] )
783 lay->addWidget( newButton ); ++numButton;
785 else if( d->mButton.mask &
Apply & layout[i] )
788 lay->addWidget( newButton ); ++numButton;
790 else if( d->mButton.mask &
Try & layout[i] )
793 lay->addWidget( newButton ); ++numButton;
795 else if( d->mButton.mask &
Cancel & layout[i] )
798 lay->addWidget( newButton ); ++numButton;
800 else if( d->mButton.mask &
Close & layout[i] )
803 lay->addWidget( newButton ); ++numButton;
805 else if( d->mButton.mask &
Details & layout[i] )
808 lay->addWidget( newButton ); ++numButton;
823 setTabOrder( prevButton, newButton );
825 prevButton = newButton;
828 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
834 return d->mButton.button(
id);
843 pb->setEnabled( state );
871 state ? pb->show() : pb->hide();
895 const TQString &tooltip,
896 const TQString &quickhelp )
904 const TQString whatsThis = i18n(
""
905 "If you press the <b>OK</b> button, all changes\n"
906 "you made will be used to proceed.");
908 pb->setText( text.isEmpty() ? i18n(
"&OK") : text );
909 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
911 TQToolTip::add( pb, tooltip.isEmpty() ? i18n(
"Accept settings") : tooltip );
912 TQWhatsThis::add( pb, quickhelp.isEmpty() ? whatsThis : quickhelp );
923 const TQString &tooltip,
924 const TQString &quickhelp )
932 const TQString whatsThis = i18n(
""
933 "When clicking <b>Apply</b>, the settings will be\n"
934 "handed over to the program, but the dialog\n"
935 "will not be closed. "
936 "Use this to try different settings. ");
938 pb->setText( text.isEmpty() ? i18n(
"&Apply") : text );
939 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
941 TQToolTip::add( pb, tooltip.isEmpty() ? i18n(
"Apply settings") : tooltip );
942 TQWhatsThis::add( pb, quickhelp.isEmpty() ? whatsThis : quickhelp );
953 const TQString& tooltip,
954 const TQString& quickhelp )
962 pb->setText( text.isEmpty() ? i18n(
"&Cancel") : text );
963 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
965 TQToolTip::add( pb, tooltip );
966 TQWhatsThis::add( pb, quickhelp );
982 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
988 if (!d->bSettingDetails && (
id ==
Details))
990 d->detailsButton = text;
998 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
1009 TQToolTip::remove( pb );
1011 TQToolTip::add( pb, text );
1022 TQWhatsThis::remove( pb );
1024 TQWhatsThis::add( pb, text );
1029void KDialogBase::setButtonFocus( TQPushButton *p,
bool isDefault,
bool isFocus )
1031 p->setDefault( isDefault );
1098 kapp->invokeHelp( mAnchor, mHelpApp );
1114 delete d->detailsWidget;
1115 d->detailsWidget = detailsWidget;
1116 if (d->detailsWidget->parentWidget() !=
this)
1117 d->detailsWidget->reparent(
this, TQPoint(0,0));
1118 d->detailsWidget->hide();
1123 if (!d->bSettingDetails)
1129 if (d->detailsButton.isEmpty())
1130 d->detailsButton = i18n(
"&Details");
1131 d->bSettingDetails =
true;
1132 d->bDetails = showDetails;
1137 if (d->detailsWidget)
1140 layout()->setEnabled(
false);
1142 d->detailsWidget->show();
1145 layout()->activate();
1146 layout()->setEnabled(
true);
1153 if (d->detailsWidget)
1155 d->detailsWidget->hide();
1158 layout()->activate();
1161 d->bSettingDetails =
false;
1218 done( mMessageBoxMode ? (
int)
Cancel : (int)Rejected );
1250 mUrlHelp =
new KURLLabel(
this,
"url" );
1254 if( mShowTile && mTile->get() )
1256 mUrlHelp->setBackgroundPixmap(*mTile->get());
1258 mUrlHelp->setMinimumHeight( fontMetrics().height() +
marginHint() );
1259 connect(mUrlHelp,TQ_SIGNAL(leftClickedURL(
const TQString &)),
1269 delete mUrlHelp; mUrlHelp = 0;
1288 mHelpLinkText = text;
1297 const TQPixmap &pixmap )
1299 return ( mJanus ? mJanus->
addPage( itemName, header, pixmap ) : 0);
1303 const TQPixmap &pixmap )
1305 return ( mJanus ? mJanus->
addPage( items, header, pixmap ) : 0);
1310 const TQString &header,
const TQPixmap &pixmap )
1312 return ( mJanus ? mJanus->
addVBoxPage( itemName, header, pixmap) : 0);
1316 const TQString &header,
const TQPixmap &pixmap )
1318 return ( mJanus ? mJanus->
addVBoxPage( items, header, pixmap) : 0);
1323 const TQString &header,
1324 const TQPixmap &pixmap )
1326 return ( mJanus ? mJanus->
addHBoxPage( itemName, header, pixmap ) : 0);
1330 const TQString &header,
1331 const TQPixmap &pixmap )
1333 return ( mJanus ? mJanus->
addHBoxPage( items, header, pixmap ) : 0);
1338 const TQString &itemName,
1339 const TQString &header,
const TQPixmap &pixmap )
1341 return ( mJanus ? mJanus->
addGridPage( n, dir, itemName, header, pixmap) : 0);
1345 const TQStringList &items,
1346 const TQString &header,
const TQPixmap &pixmap )
1348 return ( mJanus ? mJanus->
addGridPage( n, dir, items, header, pixmap) : 0);
1361 if( mJanus || mMainWidget )
1363 printMakeMainWidgetError();
1375 if( mJanus || mMainWidget )
1377 printMakeMainWidgetError();
1390 if( mJanus || mMainWidget )
1392 printMakeMainWidgetError();
1405 if( mJanus || mMainWidget )
1407 printMakeMainWidgetError();
1411 TQGrid *
mainWidget =
new TQGrid( n, dir,
this );
1418void KDialogBase::printMakeMainWidgetError()
1422 kdDebug() <<
"makeMainWidget: Illegal mode (wrong constructor)" <<
endl;
1424 else if( mMainWidget )
1426 kdDebug() <<
"makeMainWidget: Main widget already defined" <<
endl;
1437 mMainWidget = widget;
1442 mMainWidget = widget;
1448 if( mMainWidget != NULL )
1450 TQFocusData* fd = focusData();
1451 TQWidget* prev = fd->last();
1452 for( TQPtrListIterator<KDialogBaseButton> it( d->mButton.list );
1457 setTabOrder( prev, *it );
1472 return ( mJanus ? mJanus->
showPage(index) :
false);
1484 return ( mJanus ? mJanus->
pageIndex( widget) : -1);
1493 r.setTop(
marginHint() + (mUrlHelp ? mUrlHelp->height() : 0) );
1495 int h = (!mActionSep ? 0 : mActionSep->minimumSize().height()+
marginHint());
1496 if( d->mButton.box )
1498 r.setBottom( height() - d->mButton.box->minimumSize().height() - h );
1502 r.setBottom( height() - h );
1516 uly += mUrlHelp->minimumSize().height();
1520 lry = d->mButton.box ? d->mButton.box->minimumSize().height() : 0;
1523 lry += mActionSep->minimumSize().height() +
marginHint();
1530 int ulx, uly, lrx, lry;
1532 return TQSize(ulx+w+lrx,uly+h+lry);
1538 return ( mHelpLinkText.isNull() ? i18n(
"Get help...") : mHelpLinkText );
1559 if( e->state() == 0 )
1561 if( e->key() == Key_F1 )
1571 if( e->key() == Key_Escape )
1583 else if( e->key() == Key_F1 && e->state() == ShiftButton )
1585 TQWhatsThis::enterWhatsThisMode();
1591 else if ( e->state() == ControlButton &&
1592 (e->key() == Key_Return || e->key() == Key_Enter) )
1606 TQDialog::keyPressEvent(e);
1614 if (!ev->spontaneous())
1625 if( pb && isShown() ) {
1628 TQDialog::closeEvent( e );
1634 switch ( mEscapeButton ) {
1639 if ( mMessageBoxMode )
1645 if ( mMessageBoxMode )
1664 return ( !mTile || mTile->get() );
1672 return ( mTile ? mTile->get() : 0);
1687 if( !mTile || !mTile->get() )
1689 TQPixmap nullPixmap;
1690 setBackgroundPixmap(nullPixmap);
1691 if( d->mButton.box )
1693 d->mButton.box->setBackgroundPixmap(nullPixmap);
1694 d->mButton.box->setBackgroundMode(PaletteBackground);
1696 setBackgroundMode(PaletteBackground);
1700 const TQPixmap *pix = mTile->get();
1701 setBackgroundPixmap(*pix);
1702 if( d->mButton.box )
1704 d->mButton.box->setBackgroundPixmap(*pix);
1714 if( !mShowTile || !mTile || !mTile->get() )
1716 setBackgroundMode(PaletteBackground);
1717 if( d->mButton.box )
1719 d->mButton.box->setBackgroundMode(PaletteBackground);
1723 mUrlHelp->setBackgroundMode(PaletteBackground);
1728 const TQPixmap *pix = mTile->get();
1729 setBackgroundPixmap(*pix);
1730 if( d->mButton.box )
1732 d->mButton.box->setBackgroundPixmap(*pix);
1736 mUrlHelp->setBackgroundPixmap(*pix);
1748 const TQString& groupName )
const
1751 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
1752 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
1754 w = sizeHint().width();
1755 h = sizeHint().height();
1758 w = config.
readNumEntry( TQString::fromLatin1(
"Width %1").arg( desk.width()), w );
1759 h = config.
readNumEntry( TQString::fromLatin1(
"Height %1").arg( desk.height()), h );
1761 return TQSize( w, h );
1774 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
1775 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
1778 TQSize sizeToSave = size();
1780 config.
writeEntry( TQString::fromLatin1(
"Width %1").arg( desk.width()),
1781 TQString::number( sizeToSave.width()),
true, global);
1782 config.
writeEntry( TQString::fromLatin1(
"Height %1").arg( desk.height()),
1783 TQString::number( sizeToSave.height()),
true, global);
1787KDialogBaseButton::KDialogBaseButton(
const KGuiItem &item,
int key,
1788 TQWidget *parent,
const char *name )
1796KDialogBaseTile::KDialogBaseTile( TQObject *parent,
const char *name )
1797 : TQObject( parent,
name ), mPixmap(0)
1802KDialogBaseTile::~KDialogBaseTile()
1808void KDialogBaseTile::set(
const TQPixmap *pix )
1818 mPixmap =
new TQPixmap(*pix);
1826 emit pixmapChanged();
1830const TQPixmap *KDialogBaseTile::get()
const
1836void KDialogBaseTile::cleanup()
1838 delete mPixmap; mPixmap = 0;
1841void KDialogBase::virtual_hook(
int id,
void* data )
1842{ KDialog::virtual_hook(
id, data ); }
1844#include "kdialogbase.moc"
Used internally by KDialogBase.
void enableButtonCancel(bool state)
Enable or disable (gray out) the Cancel button.
virtual void slotCancel()
Activated when the Cancel button has been clicked.
void setButtonOK(const KGuiItem &item=KStdGuiItem::ok())
Sets the appearance of the OK button.
void enableButton(ButtonCode id, bool state)
Enable or disable (gray out) a general action button.
TQWidget * mainWidget()
Returns the main widget if any.
bool showPage(int index)
Sets the page with index to be displayed.
void setButtonCancel(const KGuiItem &item=KStdGuiItem::cancel())
Sets the appearance of the Cancel button.
void helpClicked()
The Help button was pressed.
void cancelClicked()
The Cancel button was pressed.
virtual void slotApply()
Activated when the Apply button has been clicked.
virtual void closeEvent(TQCloseEvent *e)
Detects when a dialog is being closed from the window manager controls.
void setButtonGuiItem(ButtonCode id, const KGuiItem &item)
Sets the KGuiItem directly for the button instead of using 3 methods to set the text,...
virtual void slotYes()
Activated when the Yes button has been clicked.
TQVBox * addVBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
void showButton(ButtonCode id, bool state)
Hide or display a general action button.
void setButtonTip(ButtonCode id, const TQString &text)
Sets the tooltip text of any button.
void apply()
Do not use this signal.
void unfoldTreeList(bool persist=false)
This function has only effect in TreeList mode.
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
TQSize configDialogSize(const TQString &groupName) const
read the dialogs size from the configuration according to the screen size.
void setButtonApplyText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) KDE_DEPRECATED
void enableButtonSeparator(bool state)
Hide or display the a separator line drawn between the action buttons an the main widget.
void aboutToShowDetails()
The detailsWidget is about to get shown.
void addWidgetBelowList(TQWidget *widget)
Add a widget at the bottom of the TreeList/IconList.
void showButtonApply(bool state)
Hide or display the Apply button.
void yesClicked()
The Yes button was pressed.
void setButtonApply(const KGuiItem &item=KStdGuiItem::apply())
Sets the appearance of the Apply button.
virtual void slotTry()
Activated when the Try button has been clicked.
void applyClicked()
The Apply button was pressed.
void updateGeometry()
Updates the margins and spacings.
TQFrame * plainPage()
Retrieve the empty page when the predefined layout is used in Plain mode.
void setHelp(const TQString &anchor, const TQString &appname=TQString::null)
Sets the help path and topic.
TQHBox * addHBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
void enableButtonApply(bool state)
Enable or disable (gray out) the Apply button.
void setShowIconsInTreeList(bool state)
This function has only effect in TreeList mode.
void enableButtonOK(bool state)
Enable or disable (gray out) the OK button.
virtual void slotUser3()
Activated when the User3 button has been clicked.
TQRect getContentsRect() const KDE_DEPRECATED
void defaultClicked()
The Default button was pressed.
virtual void slotNo()
Activated when the Yes button has been clicked.
void setButtonWhatsThis(ButtonCode id, const TQString &text)
Sets the "What's this?" text of any button.
void setTreeListAutoResize(bool state)
This function has only effect in TreeList mode.
void hidden()
The dialog is about to be hidden.
void tryClicked()
The Try button was pressed.
void setEscapeButton(ButtonCode id)
Sets the button that will be activated when the Escape key is pressed.
void setFolderIcon(const TQStringList &path, const TQPixmap &pixmap)
Sets the icon used in TreeList Mode for the given path.
virtual void slotClose()
Activated when the Close button has been clicked.
static bool haveBackgroundTile()
Check whether the background tile is set or not.
virtual void applyPressed()
void user2Clicked()
The User2 button was pressed.
TQGrid * addGridPage(int n, Orientation dir, const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
void setButtonCancelText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) KDE_DEPRECATED
void delayedDestruct()
Destruct the Dialog delayed.
void enableLinkedHelp(bool state)
Display or hide the help link area on the top of the dialog.
TQPushButton * actionButton(ButtonCode id)
Returns the action button that corresponds to the id.
KDialogBase(TQWidget *parent=0, const char *name=0, bool modal=true, const TQString &caption=TQString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
Constructor for the standard mode where you must specify the main widget with setMainWidget() .
int activePageIndex() const
Returns the index of the active page.
TQSize calculateSize(int w, int h) const
Calculate the size hint for the dialog.
void setButtonBoxOrientation(int orientation)
Sets the orientation of the button box.
void aboutToShowPage(TQWidget *page)
A page is about to be shown.
void showTile(bool state)
Enable hiding of the background tile (if any).
void saveDialogSize(const TQString &groupName, bool global=false)
save the dialogs size dependant on the screen dimension either to the global or application config fi...
virtual void slotUser1()
Activated when the User1 button has been clicked.
void setInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
void showButtonCancel(bool state)
Hide or display the Cancel button.
TQVBox * makeVBoxMainWidget()
Make a main widget.
@ User3
Show User defined button 3.
@ Default
Show Default button.
@ Close
Show Close-button.
@ Details
Show Details button.
@ NoDefault
Used when specifying a default button; indicates that no button should be marked by default.
@ User2
Show User defined button 2.
@ Apply
Show Apply button.
@ User1
Show User defined button 1.
@ Cancel
Show Cancel-button.
TQFrame * addPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList , IconList or Tabbed mode.
void addButtonBelowList(const TQString &text, TQObject *recv, const char *slot)
Add a button at the bottom of the TreeList/IconList.
void setHelpLinkText(const TQString &text)
Sets the text that is shown as the linked text.
void setRootIsDecorated(bool state)
This function has only effect in TreeList mode.
void showButtonOK(bool state)
Hide or display the OK button.
void okClicked()
The OK button was pressed.
static const TQPixmap * backgroundTile()
Returns a pointer to the background tile if there is one.
void incInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
void user1Clicked()
The User1 button was pressed.
virtual void hideEvent(TQHideEvent *)
Emits the hidden signal.
void disableResize()
Convenience method.
TQString helpLinkText() const
Returns the help link text.
void user3Clicked()
The User3 button was pressed.
void setIconListAllVisible(bool state)
This function has only effect in IconList mode.
TQGrid * makeGridMainWidget(int n, Orientation dir)
Make a main widget.
void getBorderWidths(int &ulx, int &uly, int &lrx, int &lry) const KDE_DEPRECATED
void helpClickedSlot(const TQString &)
Connected to help link label.
void finished()
The dialog has finished.
void noClicked()
The No button was pressed.
static const TQPixmap * getBackgroundTile() KDE_DEPRECATED
virtual void slotHelp()
Activated when the Help button has been clicked.
virtual void slotDefault()
Activated when the Default button has been clicked.
int pageIndex(TQWidget *widget) const
Returns the index of a page created with addPage(), addVBoxPage(), addHBoxPage() or addGridPage().
void setButtonOKText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) KDE_DEPRECATED
void updateBackground()
This method is called automatically whenever the background has changed.
void slotDelayedDestruct()
Deletes the dialog immediately.
void setDetails(bool showDetails)
Sets the status of the Details button.
void setDetailsWidget(TQWidget *detailsWidget)
Sets the widget that gets shown when "Details" is enabled.
virtual void slotDetails()
Activated when the Details button has been clicked.
TQFrame * makeMainWidget()
Make a main widget.
static void setBackgroundTile(const TQPixmap *pix)
Sets the background tile.
virtual void slotUser2()
Activated when the User2 button has been clicked.
~KDialogBase()
Destructor.
virtual void adjustSize()
Adjust the size of the dialog to fit the contents just before TQDialog::exec() or TQDialog::show() is...
virtual void slotOk()
Activated when the Ok button has been clicked.
virtual void keyPressEvent(TQKeyEvent *e)
Maps some keys to the actions buttons.
void cancel()
Force closing the dialog, setting its result code to the one Esc would set.
TQHBox * makeHBoxMainWidget()
Make a main widget.
void closeClicked()
The Close button was pressed.
void setButtonText(ButtonCode id, const TQString &text)
Sets the text of any button.
Dialog with extended non-modal support and methods for KDE standard compliance.
static int marginHint()
Return the number of pixels you shall use between a dialog edge and the outermost widget(s) according...
static int spacingHint()
Return the number of pixels you shall use between widgets inside a dialog according to the KDE standa...
virtual void setCaption(const TQString &caption)
Make a KDE compliant caption.
void layoutHintChanged()
Emitted when the margin size and/or spacing size have changed.
An abstract class for GUI data such as ToolTip and Icon.
Standard horizontal or vertical separator.
void setOrientation(int orient)
Set the orientation of the separator to orient.
A drop-in replacement for TQLabel that displays hyperlinks.
void setFloat(bool do_float=true)
Turns on or off the "float" feature.
void setUnderline(bool on=true)
Turns on or off the underlining.
int readNumEntry(const TQString &pKey, int nDefault=0) const
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
static TDEConfig * config()
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)
TQString name(StdAccel id)