void Spinner::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(whichField & NextButtonFieldMask || whichField & PreviousButtonFieldMask || whichField & EditorFieldMask) { clearChildren(); if(getNextButton() != NULL) { pushToChildren(getNextButton()); } if(getPreviousButton() != NULL) { pushToChildren(getPreviousButton()); } if(getEditor() != NULL) { pushToChildren(getEditor()); } } if(whichField & NextButtonFieldMask) { _NextButtonActionConnection.disconnect(); if(getNextButton() != NULL) { _NextButtonActionConnection = getNextButton()->connectMousePressedActionPerformed(boost::bind(&Spinner::handleNextButtonAction, this, _1)); } } if(whichField & PreviousButtonFieldMask) { _PreviousButtonActionConnection.disconnect(); if(getPreviousButton() != NULL) { _PreviousButtonActionConnection = getPreviousButton()->connectMousePressedActionPerformed(boost::bind(&Spinner::handlePreviousButtonAction, this, _1)); } } }
void KNewIcon::iconOpenStyle(int style) { #ifdef KWIZARD_VERSION getNextButton()->setEnabled(true); openstyle = style; if(style == 0) { setPage(1, scratch); setPage(1, QString(i18n("Create from scratch"))); } else { setPage(1, templ); setPage(1, QString(i18n("Create from template"))); } #endif }
KNewIcon::KNewIcon(QWidget *parent) : KWizard( parent, 0, true) { debug("KNewIcon - constructor"); if(isTopLevel()) debug("isTopLevel"); else debug("not TopLevel"); //hide(); connect(this, SIGNAL(selected(int)), SLOT(checkPage(int))); openstyle = -1; setOkButton(); getNextButton()->setEnabled(false); getOkButton()->setEnabled(false); setCancelButton(); setEnableArrowButtons(true); select = new NewSelect(this); connect(select, SIGNAL(iconopenstyle(int)), SLOT(iconOpenStyle(int))); //scratch = new NewFromScratch(this); scratch = new KResize(this, 0, false, QSize(32, 32)); connect(scratch, SIGNAL(validsize(bool)), SLOT(checkPage(bool))); scratch->hide(); templ = new NewFromTemplate(this); templ->hide(); p1 = new KWizardPage; p1->title = i18n("Select icontype"); p1->w = select; p1->enabled = true; addPage(p1); p2 = new KWizardPage; p2->title = i18n("Create from scratch"); p2->w = scratch; p2->enabled = true; addPage(p2); setCaption(i18n("Create new icon")); resize(400, 250); }
/***************************************************************************\ * Instance methods * \***************************************************************************/ void Spinner::updateLayout(void) { Pnt2f Pos; Vec2f Size; if(getOrientation() == Spinner::VERTICAL_ORIENTATION) { //Next Button if(getNextButton() != NULL) { Size.setValues(getNextButton()->getPreferredSize().x(), getSize().y()/2); if(getNextButton()->getSize() != Size) { getNextButton()->setSize(Size); } Pos.setValues(getSize().x() - getNextButton()->getSize().x(), 0); if(getNextButton()->getPosition() != Pos) { getNextButton()->setPosition(Pos); } } //Previous Button if(getPreviousButton() != NULL) { Size.setValues(getPreviousButton()->getPreferredSize().x(), getSize().y()/2); if(getPreviousButton()->getSize() != Size) { getPreviousButton()->setSize(Size); } Pos.setValues(getSize().x() - getPreviousButton()->getSize().x(), getSize().y()/2); if(getPreviousButton()->getPosition() != Pos) { getPreviousButton()->setPosition(Pos); } } //Editor if(getEditor() != NULL) { Size.setValues(getSize().x() - getNextButton()->getSize().x() - getEditorToButtonOffset(), getSize().y()); if(getEditor()->getSize() != Size) { getEditor()->setSize(Size); } Pos.setValues(0,0); if(getEditor()->getPosition() != Pos) { getEditor()->setPosition(Pos); } } } else { //Next Button if(getNextButton() != NULL) { Size.setValues(getSize().x()/2, getNextButton()->getPreferredSize().y()); if(getNextButton()->getSize() != Size) { getNextButton()->setSize(Size); } Pos.setValues(0, getSize().y() - getNextButton()->getSize().y()); if(getNextButton()->getPosition() != Pos) { getNextButton()->setPosition(Pos); } } //Previous Button if(getPreviousButton() != NULL) { Size.setValues(getSize().x()/2, getPreviousButton()->getPreferredSize().y()); if(getPreviousButton()->getSize() != Size) { getPreviousButton()->setSize(Size); } Pos.setValues(getSize().x()/2, getSize().y() - getPreviousButton()->getSize().y()); if(getPreviousButton()->getPosition() != Pos) { getPreviousButton()->setPosition(Pos); } } //Editor if(getEditor() != NULL) { Size.setValues(getSize().x(), getSize().y() - getNextButton()->getSize().y() - getEditorToButtonOffset()); if(getEditor()->getSize() != Size) { getEditor()->setSize(Size); } Pos.setValues(0,0); if(getEditor()->getPosition() != Pos) { getEditor()->setPosition(Pos); } } } }