Source Code (Use browser search to find items of interest.)
Class Index
kiconedit'KNoteBook (./kdegraphics/kiconedit/knotebook.h:64)
class KNoteBook : public KDialog
{
Q_OBJECT
public:
/**
* Constructs a KNoteBook.
*
* A modal notebook can be created like this:
* <pre>
* KNoteBook *nb = new KNoteBook(this, "notebook", true);
* connect(nb, SIGNAL(okclicked()), SLOT(nb->hide()));
* connect(nb, SIGNAL(okclicked()), SLOT(readNewInput()));
* </pre>
*
* A very simple program where the main window is a KNoteBook with one tab
* and one page inserted could look like this:
* <pre>
* int main(int argc, char **argv)
* {
* KApplication a(argc,argv,"knotebooktest"); // create an application object
* KNoteBook *nb = new KNoteBook(); // create the notebook
* nb->setCancelButton(); // add a Cancel button and connect it to the quit() slot
* QObject::connect( nb, SIGNAL(cancelclicked()), &a, SLOT(quit()) );
*
* QTab *tab = new QTab; // create a QTab to hold the tab data
* tab->label = "A tab";
* tab->enabled = true;
* nb->addTab( tab );
* QLabel *l = new QLabel(nb);
* l->setAlignment(AlignCenter);
* l->setText("This is a QLabel as a page");
* l->setMinimumSize(400, 300);
* KWizardPage *p = new KWizardPage;
* p->w = l;
* p->title.setNum("A page title");
* p->enabled = true;
* nb->addPage( p );
*
* a.setMainWidget(nb);
* nb->adjustSize();
* nb->show();
* return a.exec();
* }
</pre>
* @see QDialog::QDialog
*
* @param parent The parent of the notebook.
*
* @param name The internal name.
*
* @param modal If modal is true the notebook wil become a modal dialog.
*
* @param f Window flags.
*/
KNoteBook(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
/**
* Destructor
*/
~KNoteBook();
/**
* Adds a new tab to the notebook and creates a new @ref KWizard to hold the pages.
* The tabs are numbered from 0 to n where 0 is the tab first added and n is the
* tab last added. if you add 4 tabs the last tab will be number 3.
* Subsequent calls to @ref addPage will add pages to this tab until a new call to addTab().
*
* @param tab The QTab containing the tab data.
*
* @param p The optional KWizardPage containing the page data.If 'p' is not 0 it
* will be added as a new page.
* This is equivalent to @ref addPage (p);
* @return Returns the id of the new tab.
*/
int addTab(QTab *tab, KWizardPage *p = 0L);
/**
* Adds a new page to the last added tab.
* The pages are numbered from 0 to n where 1 is the page first added and n is the
* page last added. Subsequent calls to @ref addPage will add pages to the last added
* tab until a new call to addTab().
*
* @param p The KWizardPage containing the page data..
*
* @return Returns the id of the new page. The id is relative to the KWizard, NOT
* the KNoteBook.
*/
int addPage(KWizardPage *p);
/**
* Turn to another tab. This method calls @ref showSection to show the corresponding KWizard.
*
* @param tab The tab to turn to
*/
void gotoTab(int tab);
QSize sizeHint() { return minimumSize(); };
void adjustSize() { resize(sizeHint()); };
/**
* Adds a Cancel button to the bottom of the dialog. The text will be a translated
* version of the string '&Cancel' thereby giving it the shortcut key 'c'.
* If any buttons are added a space will be created at the bottom of the dialog
* to fit the buttons. When clicked the button will emit the @ref cancelclicked signal.
* @see KLocale#translate
*/
void setCancelButton();
/**
* Adds a Cancel button to the bottom of the dialog.
* @param text A user supplied text to write to the button.
*/
void setCancelButton(const QString& text);
/**
* Adds a Default button to the bottom of the dialog. The text will be a translated
* version of the string '&Default' thereby giving it the shortcut key 'd'.
* If any buttons are added a space will be created at the bottom of the dialog
* to fit the buttons. When clicked the button will emit the @ref defaultclicked signal.
* @see KLocal::translate
*/
void setDefaultButton();
/**
* Adds a Default button to the bottom of the dialog.
* @param text A user supplied text to write to the button.
*/
void setDefaultButton(const QString& text);
/**
* Adds a Help button to the bottom right of the dialog. The text will be a translated
* version of the string '&Help' thereby giving it the shortcut key 'h'.
* If any buttons are added a space will be created at the bottom of the dialog
* to fit the buttons. When clicked the button will emit the @ref helpclicked signal.
*/
void setHelpButton();
/**
* Adds a Help button to the bottom of the dialog. This button will generate the
* signal @ref helpclicked where the int is the page to which the help was requested.
* @param text A user supplied text to write to the button.
*/
void setHelpButton(const QString& text);
/**
* Adds an Ok button to the bottom right of the dialog. The text will be a translated
* version of the string '&Ok' thereby giving it the shortcut key 'o'.
* If any buttons are added a space will be created at the bottom of the dialog
* to fit the buttons. When clicked the button will emit the @ref okclicked signal.
*/
void setOkButton();
/**
* Adds an Ok button to the bottom of the dialog. This button will generate the
* signal @ref okclicked where the int is the page to which the help was requested.
* @param text A user supplied text to write to the button.
*/
void setOkButton(const QString&);
/**
* Get Ok button.
* @return Returns the Ok buttonwidget or 0L if no button is added.
*/
QButton *getOkButton();
/**
* Get Cancel button.
* @return Returns the Cancel buttonwidget or 0L if no button is added.
*/
QButton *getCancelButton();
/**
* Get Default button.
* @return Returns the Default buttonwidget or 0L if no button is added.
*/
QButton *getDefaultButton();
/**
* Get Help button.
* @return Returns the Help buttonwidget or 0L if no button is added.
*/
QButton *getHelpButton();
/**
* Let direction buttons reflect page.
* @param state If state is true the direction buttons (Previous and Next) will have the
* title of the corresponding page.
* @see #directionsReflectsPage
*/
void setDirectionsReflectsPage(bool state);
/**
* @return Returns whether the direction buttons reflects the title of the corresponding page.
*
* @see #setDirectionsReflectsPage(bool state)
*/
bool directionsReflectsPage();
/**
* En/Disable the popup menu.
* @param state If state is true a menu containing the pages in the wizard
* will popup when the user RMB-clicks on the page-title.
*/
void setEnablePopupMenu(bool state);
/**
* Returns whether the menu is enabled or not.
* @return 'true' if the menu is enabled, otherwise 'false'.
*/
bool enablePopupMenu();
/**
* Get the popup menu.
* @return Returns the handle of the popup menu.
*/
QPopupMenu *getMenu();
/**
* En/Disable the arrowbuttons.
* @param state If state is true two arrows will appear to the right of the title.
* @see #enableArrowButtons
* @see KWizard#setEnableArrowButtons.
*/
void setEnableArrowButtons(bool state);
/**
* @return Returns whether the arrow buttons are enabled or not.
* @see #setEnableArrowButtons
* @see KWizard#enableArrowButtons.
*/
bool enableArrowButtons();
/**
* Returns the handle of the tab bar.
*/
KTabBar *getTabBar();
/**
* Returns the number of tabs in the notebook.
*/
int numTabs();
/**
* En/Disable a tab in the notebook. If a tab is disabled it is not selectable
* from the tab bar. If the user reaches a disabled tab by traversing through
* the pages the notebook will jump to the next enabled tab.
*/
void setTabEnabled(int tab, bool state);
/**
* @return Returns whether the tab is enabled or not.
* @see #setTabEnabled
*/
bool isTabEnabled(int tab);
/**
* En/Disable a page in a section (tab) in the notebook
* @see KWizard#setPageEnabled
*/
void setPageEnabled(int tab, int page, bool state);
/**
* @return Returns whether a page in a section (tab) is enabled or not.
* @see #setTabEnabled
*/
bool isPageEnabled(int tab, int page);
signals:
/**
* This signal is emitted when the user clicks on the Ok button.
*/
void okclicked();
/**
* This signal is emitted when the user clicks on the Cancel button.
*/
void cancelclicked();
/**
* This signal is emitted when the user clicks on the Default button.
*/
void defaultclicked(int);
/**
* This signal is emitted when the user clicks on the Help button.
* The int is the page which was showing when help was requested.
* @see #setHelpButton
*/
void helpclicked(int);
protected slots:
/**
* Called by @ref gotoTab to show the appropriate KWizard.
*/
void showSection(int);
/**
* If the menu is enabled by @ref enablePopupMenu this method will let the menu
* popup at 'pos'.
* @internal
*/
void popupMenu(QPoint pos);
/**
* @internal
*/
void menuChoice(int);
/**
* @internal
*/
void menuChoiceRedirect(int);
/**
* @internal
*/
void directionButton(bool, bool);
/**
* @internal
*/
void okClicked();
/**
* @internal
*/
void cancelClicked();
/**
* @internal
*/
void defaultClicked();
/**
* @internal
*/
void helpClicked();
/**
* @internal
*/
void tabScroll( ArrowType );
protected:
/**
* @internal
*/
void init();
/**
* @internal
*/
void resizeEvent(QResizeEvent *);
/**
* @internal
*/
void paintEvent(QPaintEvent *);
/*
@internal
bool eventFilter( QObject *, QEvent * );
*/
/**
* @internal
*/
void setSizes();
/**
* @internal
*/
QSize childSize();
/**
* @internal
*/
KNoteBookProtected *pnote;
/**
* @internal
*/
QList<KWizard> *sections;
};
kiconedit'KNoteBook::KNoteBook() (./kdegraphics/kiconedit/knotebook.cpp:45)
KNoteBook::KNoteBook(QWidget *parent, const char *name,
bool modal, WFlags f)
: KDialog(parent, name, modal, f)
{
initMetaObject();
init();
}
kiconedit'KNoteBook::~KNoteBook() (./kdegraphics/kiconedit/knotebook.cpp:53)
KNoteBook::~KNoteBook()
{
//debug("KNoteBook - destructor");
delete pnote;
delete sections;
//debug("KNoteBook - destructor done");
}
kiconedit'KNoteBook::init() (./kdegraphics/kiconedit/knotebook.cpp:61)
void KNoteBook::init()
{
//debug("KNoteBook::init");
sections = new QList<KWizard>;
sections->setAutoDelete(true);
pnote = new KNoteBookProtected;
pnote->directionsreflectspage = pnote->enablepopupmenu = pnote->enablearrowbuttons = false;
pnote->current = -1;
pnote->numtabs = 0;
pnote->currentwiz = 0L;
pnote->ok = pnote->cancel = pnote->def = pnote->help = 0L;
pnote->tabbar = new KTabBar(this);
connect( pnote->tabbar, SIGNAL(selected(int)), SLOT( showSection(int)) );
connect( pnote->tabbar, SIGNAL(scrolled(ArrowType)),
SLOT( tabScroll(ArrowType)) );
//debug("tabbar");
pnote->menu = new QPopupMenu();
connect( pnote->menu, SIGNAL(highlighted(int)), SLOT( menuChoice(int)) );
connect( pnote->menu, SIGNAL(activatedRedirect(int)), SLOT( menuChoiceRedirect(int)) );
//debug("init - done");
}
kiconedit'KNoteBook::menuChoice() (./kdegraphics/kiconedit/knotebook.cpp:84)
void KNoteBook::menuChoice(int c)
{
//debug("Activated: %d", c);
pnote->currentmenu = c;
}
kiconedit'KNoteBook::tabScroll() (./kdegraphics/kiconedit/knotebook.cpp:90)
void KNoteBook::tabScroll( ArrowType )
{
//debug("KNoteBook::tabScroll");
// fake a resize event to trigger child widget moves
//QResizeEvent r( size(), size() );
//resizeEvent( &r );
//repaint(true);
}
kiconedit'KNoteBook::menuChoiceRedirect() (./kdegraphics/kiconedit/knotebook.cpp:99)
void KNoteBook::menuChoiceRedirect(int c)
{
//debug("ActivatedRedirect: %d", c);
if(pnote->tabbar->isTabEnabled(pnote->currentmenu) &&
sections->at(pnote->currentmenu)->isPageEnabled(c))
{
gotoTab(pnote->currentmenu);
pnote->currentwiz->gotoPage(c);
}
}
kiconedit'KNoteBook::addTab() (./kdegraphics/kiconedit/knotebook.cpp:110)
int KNoteBook::addTab(QTab *tab, KWizardPage *p)
{
//debug("addTab");
int id = 0;
KWizard *wiz = new KWizard(this, 0, false); // non-modal wizard
wiz->setDirectionsReflectsPage(pnote->directionsreflectspage);
wiz->setEnableArrowButtons(pnote->enablearrowbuttons);
wiz->hide();
//debug("KWizard created");
sections->append(wiz);
if(!pnote->numtabs) // the first tab
{
pnote->current = 0;
pnote->currentwiz = wiz;
}
pnote->numtabs++;
connect( wiz, SIGNAL(popup(QPoint)), SLOT(popupMenu(QPoint)) );
connect( wiz, SIGNAL(nomorepages(bool, bool)), SLOT(directionButton(bool, bool)) );
//tab->id = pnote->numtabs;
//debug("Before adding to tabbar");
id = pnote->tabbar->addTab(tab);
pnote->menu->insertItem(tab->label, wiz->getMenu(), id);
pnote->menu->setItemEnabled(id, tab->enabled);
//debug("After adding to tabbar");
if(p)
wiz->addPage(p);
setSizes();
//debug("addTab - done");
return id;
}
kiconedit'KNoteBook::addPage() (./kdegraphics/kiconedit/knotebook.cpp:146)
int KNoteBook::addPage(KWizardPage *p)
{
if(!pnote->numtabs)
{
debug("Trying to add page when no KWizards are added!");
return -1;
}
KWizard *wiz = sections->at(pnote->numtabs-1);
CHECK_PTR(wiz);
return (wiz->addPage(p));
}
kiconedit'KNoteBook::gotoTab() (./kdegraphics/kiconedit/knotebook.cpp:159)
void KNoteBook::gotoTab(int t)
{
int i = 0;
if(t < 0 || t >= pnote->numtabs || t == pnote->current)
return;
else if(t > pnote->current)
for(i = t; i < pnote->numtabs; i++)
{
if(pnote->tabbar->isTabEnabled(i))
break;
}
else
for(i = t; i >= 0; i--)
{
if(pnote->tabbar->isTabEnabled(i))
break;
}
//debug("gototab: %d", i);
if(pnote->tabbar->isTabEnabled(i))
pnote->tabbar->setCurrentTab(i);
}
kiconedit'KNoteBook::setCancelButton() (./kdegraphics/kiconedit/knotebook.cpp:181)
void KNoteBook::setCancelButton()
{
setCancelButton(i18n("&Cancel"));
}
kiconedit'KNoteBook::setCancelButton() (./kdegraphics/kiconedit/knotebook.cpp:186)
void KNoteBook::setCancelButton(const QString& name)
{
if(!pnote->cancel)
{
pnote->cancel = new QPushButton(name, this);
pnote->cancel->show();
connect( pnote->cancel, SIGNAL(clicked()), SLOT(cancelClicked()));
}
else
pnote->cancel->setText(name);
setSizes();
}
kiconedit'KNoteBook::getCancelButton() (./kdegraphics/kiconedit/knotebook.cpp:199)
QButton *KNoteBook::getCancelButton()
{
return pnote->cancel;
}
kiconedit'KNoteBook::setDefaultButton() (./kdegraphics/kiconedit/knotebook.cpp:204)
void KNoteBook::setDefaultButton()
{
setDefaultButton(i18n("&Default"));
}
kiconedit'KNoteBook::setDefaultButton() (./kdegraphics/kiconedit/knotebook.cpp:209)
void KNoteBook::setDefaultButton(const QString& name)
{
if(!pnote->def)
{
pnote->def = new QPushButton(name, this);
pnote->def->show();
connect( pnote->def, SIGNAL(clicked()), SLOT(defaultClicked()));
}
else
pnote->def->setText(name);
setSizes();
}
kiconedit'KNoteBook::getDefaultButton() (./kdegraphics/kiconedit/knotebook.cpp:222)
QButton *KNoteBook::getDefaultButton()
{
return pnote->def;
}
kiconedit'KNoteBook::setHelpButton() (./kdegraphics/kiconedit/knotebook.cpp:227)
void KNoteBook::setHelpButton()
{
setHelpButton(i18n("&Help"));
}
kiconedit'KNoteBook::setHelpButton() (./kdegraphics/kiconedit/knotebook.cpp:232)
void KNoteBook::setHelpButton(const QString& name)
{
if(!pnote->help)
{
pnote->help = new QPushButton(name, this);
pnote->help->show();
connect( pnote->help, SIGNAL(clicked()), SLOT(helpClicked()));
}
else
pnote->help->setText(name);
setSizes();
}
kiconedit'KNoteBook::getHelpButton() (./kdegraphics/kiconedit/knotebook.cpp:245)
QButton *KNoteBook::getHelpButton()
{
return pnote->help;
}
kiconedit'KNoteBook::setOkButton() (./kdegraphics/kiconedit/knotebook.cpp:250)
void KNoteBook::setOkButton()
{
setOkButton(i18n("&OK"));
}
kiconedit'KNoteBook::setOkButton() (./kdegraphics/kiconedit/knotebook.cpp:255)
void KNoteBook::setOkButton(const QString& name)
{
if(!pnote->ok)
{
pnote->ok = new QPushButton(name, this);
pnote->ok->show();
connect( pnote->ok, SIGNAL(clicked()), SLOT(okClicked()));
}
else
pnote->ok->setText(name);
setSizes();
}
kiconedit'KNoteBook::getOkButton() (./kdegraphics/kiconedit/knotebook.cpp:268)
QButton *KNoteBook::getOkButton()
{
return pnote->ok;
}
kiconedit'KNoteBook::okClicked() (./kdegraphics/kiconedit/knotebook.cpp:273)
void KNoteBook::okClicked()
{
emit okclicked();
}
kiconedit'KNoteBook::cancelClicked() (./kdegraphics/kiconedit/knotebook.cpp:278)
void KNoteBook::cancelClicked()
{
emit cancelclicked();
}
kiconedit'KNoteBook::defaultClicked() (./kdegraphics/kiconedit/knotebook.cpp:283)
void KNoteBook::defaultClicked()
{
emit defaultclicked(pnote->current);
}
kiconedit'KNoteBook::helpClicked() (./kdegraphics/kiconedit/knotebook.cpp:288)
void KNoteBook::helpClicked()
{
emit helpclicked(pnote->current);
}
kiconedit'KNoteBook::showSection() (./kdegraphics/kiconedit/knotebook.cpp:293)
void KNoteBook::showSection(int s)
{
//debug("showSection: %d", s);
pnote->current = s;
pnote->currentwiz->hide();
pnote->currentwiz = sections->at(s);
pnote->currentwiz->gotoPage(0);
pnote->currentwiz->adjustSize();
// fake a resize event to trigger child widget moves
QResizeEvent r( size(), size() );
resizeEvent( &r );
pnote->currentwiz->show();
}
kiconedit'KNoteBook::popupMenu() (./kdegraphics/kiconedit/knotebook.cpp:307)
void KNoteBook::popupMenu(QPoint pos)
{
if(pnote->enablepopupmenu)
{
pnote->menu->popup(pos);
}
}
kiconedit'KNoteBook::childSize() (./kdegraphics/kiconedit/knotebook.cpp:315)
QSize KNoteBook::childSize()
{
//debug("Calculating sizes");
QSize size(0,0);
//int x = 0, y = 0;
for(int i = 0; i < pnote->numtabs; i++)
{
QSize csize = sections->at(i)->sizeHint();
if(csize.isNull())
csize = sections->at(i)->size();
if(size.height() < csize.height())
size.setHeight(csize.height());
if(size.width() < csize.width())
size.setWidth(csize.width());
//debug("Child size: %d x %d", size.width(), size.height());
}
return size;
}
kiconedit'KNoteBook::setEnableArrowButtons() (./kdegraphics/kiconedit/knotebook.cpp:335)
void KNoteBook::setEnableArrowButtons(bool state)
{
pnote->enablearrowbuttons = state;
for(int i = 0; i < pnote->numtabs; i++)
sections->at(i)->setEnableArrowButtons(state);
}
kiconedit'KNoteBook::enableArrowButtons() (./kdegraphics/kiconedit/knotebook.cpp:342)
bool KNoteBook::enableArrowButtons()
{
return pnote->enablearrowbuttons;
}
kiconedit'KNoteBook::setDirectionsReflectsPage() (./kdegraphics/kiconedit/knotebook.cpp:347)
void KNoteBook::setDirectionsReflectsPage(bool state)
{
pnote->directionsreflectspage = state;
for(int i = 0; i < pnote->numtabs; i++)
sections->at(i)->setDirectionsReflectsPage(state);
setSizes();
}
kiconedit'KNoteBook::directionsReflectsPage() (./kdegraphics/kiconedit/knotebook.cpp:355)
bool KNoteBook::directionsReflectsPage()
{
return pnote->directionsreflectspage;
}
kiconedit'KNoteBook::setEnablePopupMenu() (./kdegraphics/kiconedit/knotebook.cpp:360)
void KNoteBook::setEnablePopupMenu(bool state)
{
pnote->enablepopupmenu = state;
}
kiconedit'KNoteBook::enablePopupMenu() (./kdegraphics/kiconedit/knotebook.cpp:365)
bool KNoteBook::enablePopupMenu()
{
return pnote->enablepopupmenu;
}
kiconedit'KNoteBook::getMenu() (./kdegraphics/kiconedit/knotebook.cpp:370)
QPopupMenu *KNoteBook::getMenu()
{
return pnote->menu;
}
kiconedit'KNoteBook::getTabBar() (./kdegraphics/kiconedit/knotebook.cpp:375)
KTabBar *KNoteBook::getTabBar()
{
return pnote->tabbar;
}
kiconedit'KNoteBook::setTabEnabled() (./kdegraphics/kiconedit/knotebook.cpp:380)
void KNoteBook::setTabEnabled(int tab, bool state)
{
pnote->tabbar->setTabEnabled( tab, state );
pnote->menu->setItemEnabled( tab, state );
}
kiconedit'KNoteBook::setPageEnabled() (./kdegraphics/kiconedit/knotebook.cpp:386)
void KNoteBook::setPageEnabled(int tab, int page, bool state)
{
sections->at(tab)->setPageEnabled( page, state );
}
kiconedit'KNoteBook::isTabEnabled() (./kdegraphics/kiconedit/knotebook.cpp:391)
bool KNoteBook::isTabEnabled(int tab)
{
return pnote->tabbar->isTabEnabled(tab);
}
kiconedit'KNoteBook::isPageEnabled() (./kdegraphics/kiconedit/knotebook.cpp:396)
bool KNoteBook::isPageEnabled(int tab, int page)
{
return sections->at(tab)->isPageEnabled(page);
}
kiconedit'KNoteBook::numTabs() (./kdegraphics/kiconedit/knotebook.cpp:401)
int KNoteBook::numTabs()
{
return pnote->numtabs;
}
kiconedit'KNoteBook::directionButton() (./kdegraphics/kiconedit/knotebook.cpp:406)
void KNoteBook::directionButton(bool changetab, bool forward)
{
//debug("directionButton");
QButton *button, *arrow;
QString str;
if(changetab)
{
if(forward)
{
//debug("changing to tab: %d", current+1);
gotoTab(pnote->current+1);
button = pnote->currentwiz->getPreviousButton();
arrow = pnote->currentwiz->getLeftArrow();
if(pnote->directionsreflectspage)
{
str = "<< ";
str += sections->at(pnote->current-1)->getTitle(sections->at(pnote->current-1)->numPages()-1);
button->setText(str);
}
else
button->setText("<< " + i18n("&Previous"));
//debug("Setting previous to: %s", str.ascii());
button->show();
if(pnote->enablearrowbuttons)
arrow->show();
}
else
{
//debug("changing to tab: %d", pnote->current-1);
gotoTab(pnote->current-1);
pnote->currentwiz->gotoPage(pnote->currentwiz->numPages()-1);
button = pnote->currentwiz->getNextButton();
arrow = pnote->currentwiz->getRightArrow();
if(pnote->directionsreflectspage)
{
str = sections->at(pnote->current+1)->getTitle(0);
str += " >>";
button->setText(str);
}
else
button->setText(i18n("&Next") + " >>");
//debug("Setting next to: %s", str.ascii());
button->show();
if(pnote->enablearrowbuttons)
arrow->show();
}
}
else
{
//debug("dont change tab");
if(forward)
{
button = pnote->currentwiz->getNextButton();
arrow = pnote->currentwiz->getRightArrow();
if((pnote->current+1) >= pnote->numtabs)
{
button->hide();
if(pnote->enablearrowbuttons)
arrow->hide();
}
else
{
str = sections->at(pnote->current+1)->getTitle(0);
str += " >>";
//debug("Setting next to: %s", str.ascii());
button->setText(str);
button->show();
if(pnote->enablearrowbuttons)
arrow->show();
}
}
else
{
button = pnote->currentwiz->getPreviousButton();
arrow = pnote->currentwiz->getLeftArrow();
if((pnote->current) == 0)
{
button->hide();
if(pnote->enablearrowbuttons)
arrow->hide();
}
else
{
str = "<< ";
str += sections->at(pnote->current-1)->getTitle(sections->at(pnote->current-1)->numPages()-1);
//debug("Setting previous to: %s", str.ascii());
button->setText(str);
button->show();
if(pnote->enablearrowbuttons)
arrow->show();
}
}
}
}
kiconedit'KNoteBook::setSizes() (./kdegraphics/kiconedit/knotebook.cpp:502)
void KNoteBook::setSizes()
{
//debug("setSizes");
QSize childsize = childSize();
int extra = 16;
bool f = false;
if(pnote->ok)
{
pnote->ok->adjustSize();
f = true;
extra += pnote->ok->height();
}
if(pnote->cancel)
{
pnote->cancel->adjustSize();
if(!f)
{
f = true;
extra += pnote->cancel->height();
}
}
if(pnote->def)
{
pnote->def->adjustSize();
if(!f)
{
f = true;
extra += pnote->def->height();
}
}
if(pnote->help)
{
pnote->help->adjustSize();
if(!f)
extra += pnote->help->height();
}
pnote->tabbar->adjustSize();
int y = pnote->tabbar->height() + childsize.height() + extra;
int x = 16 + childsize.width();
setMinimumSize(x, y);
resize(x, y);
//debug("setSizes - done");
}
kiconedit'KNoteBook::resizeEvent() (./kdegraphics/kiconedit/knotebook.cpp:548)
void KNoteBook::resizeEvent(QResizeEvent *)
{
//debug("KNote, resizing");
pnote->tabbar->setGeometry( 2, 2, width()-3, pnote->tabbar->sizeHint().height());
// Check to see if there are any buttons.
QPushButton *tmp = 0L;
int x = 8, y = pnote->tabbar->height() + 7;
int cx = width() - 14, cy = height()-(pnote->tabbar->height()+14);
if( pnote->ok && pnote->ok->isVisible() )
tmp = pnote->ok;
else if(pnote->cancel && pnote->cancel->isVisible())
tmp = pnote->cancel;
else if(pnote->def && pnote->def->isVisible())
tmp = pnote->def;
else if(pnote->help && pnote->help->isVisible())
tmp = pnote->help;
if(tmp)
cy -= (tmp->height());
if(pnote->currentwiz)
pnote->currentwiz->setGeometry( x, y, cx, cy );
int offs = 2;
if(pnote->ok && pnote->ok->isVisible())
{
pnote->ok->setGeometry(offs, height()-(pnote->ok->height()+2),
pnote->ok->width(), pnote->ok->height());
offs += 5 + pnote->ok->width();
}
if(pnote->cancel && pnote->cancel->isVisible())
{
pnote->cancel->setGeometry(offs, height()-(pnote->cancel->height()+2),
pnote->cancel->width(), pnote->cancel->height());
offs += 5 + pnote->cancel->width();
}
if(pnote->def && pnote->def->isVisible())
pnote->def->setGeometry(offs, height()-(pnote->def->height()+2),
pnote->def->width(), pnote->def->height());
if(pnote->help && pnote->help->isVisible())
pnote->help->setGeometry(width()-(pnote->help->width()+1),
height()-(pnote->help->height()+2),
pnote->help->width(), pnote->help->height());
//debug("KNote, resize - done");
}
kiconedit'KNoteBook::paintEvent() (./kdegraphics/kiconedit/knotebook.cpp:596)
void KNoteBook::paintEvent(QPaintEvent *)
{
//debug("KNoteBook::paintEvent");
// Check to see if there are any buttons.
QPushButton *tmp = 0L;
int w = width(), h = height(), s = 2;
int tw = pnote->tabbar->width();
int boffs = 4, toffs = pnote->tabbar->height() + 1;
if( pnote->ok && pnote->ok->isVisible() )
tmp = pnote->ok;
else if(pnote->cancel && pnote->cancel->isVisible())
tmp = pnote->cancel;
else if(pnote->def && pnote->def->isVisible())
tmp = pnote->def;
else if(pnote->help && pnote->help->isVisible())
tmp = pnote->help;
if(tmp)
boffs = tmp->height() + 4;
// start painting widget
QPainter paint;
paint.begin( this );
QPen pen( white, 1 );
paint.setPen( pen );
// left outer
paint.drawLine( s, h-(boffs), s, toffs-1);
// top outer
paint.drawLine( tw+s , toffs, w-s, toffs);
// right inner
paint.drawLine( w-(s*3) , toffs+(s*2)+1, w-(s*3), h-(boffs+(s+1)));
// bottom inner
paint.drawLine( (s*3)+1 , h-(boffs+(s*2)-1), w-(s*3), h-(boffs+(s*2)-1));
pen.setColor( black );
paint.setPen( pen );
// right outer
paint.drawLine( w-s , toffs+1, w-s, h-(boffs));
// bottom outer
paint.drawLine( w-s , h-(boffs), s+1, h-(boffs));
// left inner
paint.drawLine( s*3 , h-(boffs+(s+1)), s*3, toffs+((s*2)+1) );
// top inner
paint.drawLine( (s*3)+1, toffs+(s*2), w-(s*3), toffs+(s*2));
paint.end();
}
/*
// Grab QDialogs keypresses if non-modal
bool KNoteBook::eventFilter( QObject *obj, QEvent *e )
{
if ( e->type() == Event_KeyPress && obj == this && !testWFlags(WType_Modal))
{
QKeyEvent *k = (QKeyEvent*)e;
if(k->key() == Key_Escape || k->key() == Key_Return || k->key() == Key_Enter)
return true;
}
return false;
}
*/