SVN commit 476231 by ingwa: cleaning and a destructor M +25 -3 kotoolbox.cc M +17 -9 kotoolbox.h --- trunk/koffice/lib/kofficeui/kotoolbox.cc #476230:476231 @@ -107,6 +107,7 @@ return button; } + void KoToolBox::setupTools() { int id = 0; @@ -137,6 +138,7 @@ m_numberOfButtons = id; } + void KoToolBox::setOrientation ( Qt::Orientation o ) { if ( barPos() == Floating ) { // when floating, make it a standing toolbox. @@ -151,6 +153,7 @@ } } + void KoToolBox::enableTools(bool enable) { if (m_tools.isEmpty()) return; @@ -185,6 +188,11 @@ } } + +// ---------------------------------------------------------------- +// class ToolArea + + ToolArea::ToolArea(QWidget *parent) : QWidget(parent), m_left(true) { @@ -199,13 +207,19 @@ w = new QWidget(this); m_layout->addWidget(w); + grid = new QGridLayout(w, 2, 2); m_rightRow = new QWidget(w); grid->addWidget(m_rightRow, 0, 0); - m_rightLayout = new QBoxLayout(m_rightRow, QBoxLayout::TopToBottom, 0, 1, 0); } + +ToolArea::~ToolArea() +{ +} + + void ToolArea::add(QWidget *button) { if (m_left) @@ -216,6 +230,7 @@ m_left = !m_left; } + QWidget* ToolArea::getNextParent() { if (m_left) @@ -223,12 +238,19 @@ return m_rightRow; } + void ToolArea::setOrientation ( Qt::Orientation o ) { - QBoxLayout::Direction dir = o != Qt::Horizontal?QBoxLayout::TopToBottom:QBoxLayout::LeftToRight; + QBoxLayout::Direction dir = (o != Qt::Horizontal + ? QBoxLayout::TopToBottom + : QBoxLayout::LeftToRight); m_leftLayout->setDirection(dir); m_rightLayout->setDirection(dir); - m_layout->setDirection(o == Qt::Horizontal?QBoxLayout::TopToBottom:QBoxLayout::LeftToRight); + + m_layout->setDirection(o == Qt::Horizontal + ? QBoxLayout::TopToBottom + : QBoxLayout::LeftToRight); } + #include "kotoolbox.moc" --- trunk/koffice/lib/kofficeui/kotoolbox.h #476230:476231 @@ -16,8 +16,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _KIS_TOOLBOX_H_ -#define _KIS_TOOLBOX_H_ +#ifndef _KO_TOOLBOX_H_ +#define _KO_TOOLBOX_H_ #include #include @@ -88,22 +88,30 @@ KInstance* m_instance; }; + class ToolArea : public QWidget { public: ToolArea(QWidget *parent); - void setOrientation ( Qt::Orientation o ); - void add(QWidget *button); + ~ToolArea(); + + void setOrientation ( Qt::Orientation o ); + void add(QWidget *button); + QWidget* getNextParent(); private: - QPtrList m_children; - QBoxLayout *m_leftLayout, *m_rightLayout, * m_layout; - bool m_left; - QWidget * m_leftRow, * m_rightRow; + QPtrList m_children; + QBoxLayout *m_layout; + QWidget *m_leftRow; + QBoxLayout *m_leftLayout; + QWidget *m_rightRow; + QBoxLayout *m_rightLayout; + + bool m_left; }; -#endif // _KIS_TOOLBOX_H_ +#endif // _KO_TOOLBOX_H_