summaryrefslogtreecommitdiffstats
path: root/kregexpeditor/singlecontainerwidget.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /kregexpeditor/singlecontainerwidget.cpp
downloadtdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz
tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kregexpeditor/singlecontainerwidget.cpp')
-rw-r--r--kregexpeditor/singlecontainerwidget.cpp132
1 files changed, 132 insertions, 0 deletions
diff --git a/kregexpeditor/singlecontainerwidget.cpp b/kregexpeditor/singlecontainerwidget.cpp
new file mode 100644
index 0000000..4782dd9
--- /dev/null
+++ b/kregexpeditor/singlecontainerwidget.cpp
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+#ifndef QT_ONLY
+ #include "singlecontainerwidget.moc"
+#endif
+
+#include "singlecontainerwidget.h"
+#include "concwidget.h"
+
+SingleContainerWidget::SingleContainerWidget(RegExpEditorWindow* editorWindow,
+ QWidget* parent, const char* name)
+ : RegExpWidget( editorWindow, parent, name )
+{
+}
+
+bool SingleContainerWidget::updateSelection( bool parentSelected )
+{
+ bool changed = RegExpWidget::updateSelection( parentSelected );
+ changed = _child->updateSelection( _isSelected ) && changed;
+ if (changed)
+ repaint();
+
+ return changed;
+}
+
+bool SingleContainerWidget::hasSelection() const
+{
+ return _isSelected || _child->hasSelection();
+}
+
+void SingleContainerWidget::clearSelection()
+{
+ _isSelected = false;
+ _child->clearSelection();
+}
+
+void SingleContainerWidget::deleteSelection()
+{
+ _child->deleteSelection();
+ update();
+}
+
+void SingleContainerWidget::applyRegExpToSelection( RegExpType type )
+{
+ _child->applyRegExpToSelection( type );
+}
+
+RegExp* SingleContainerWidget::selection() const
+{
+ if ( isSelected() )
+ return regExp();
+ else
+ return _child->selection();
+}
+
+bool SingleContainerWidget::validateSelection() const
+{
+ return _child->validateSelection();
+}
+
+QRect SingleContainerWidget::selectionRect() const
+{
+ if ( _isSelected )
+ return QRect( mapToGlobal( QPoint(0,0) ), size() );
+ else
+ return _child->selectionRect();
+}
+
+RegExpWidget* SingleContainerWidget::widgetUnderPoint( QPoint globalPos, bool justVisibleWidgets )
+{
+ RegExpWidget* wid = _child->widgetUnderPoint( globalPos, justVisibleWidgets );
+ if ( wid )
+ return wid;
+ else {
+ // The child didn't contain the point, then lets see if this widget
+ // itself does.
+ return RegExpWidget::widgetUnderPoint( globalPos, justVisibleWidgets );
+ }
+}
+
+RegExpWidget* SingleContainerWidget::findWidgetToEdit( QPoint globalPos )
+{
+ RegExpWidget* wid = _child->findWidgetToEdit( globalPos );
+ if ( wid )
+ return wid;
+ else if ( QRect(mapToGlobal(QPoint(0,0)), size()).contains( globalPos ) )
+ return this;
+ else
+ return 0;
+}
+
+void SingleContainerWidget::setConcChild( ConcWidget* conc )
+{
+ delete _child;
+ _child = conc;
+}
+
+void SingleContainerWidget::selectWidget( bool sel )
+{
+ RegExpWidget::selectWidget( sel );
+ _child->selectWidget( sel );
+ update();
+}
+
+void SingleContainerWidget::updateAll()
+{
+ _child->updateAll();
+ RegExpWidget::updateAll();
+}
+
+void SingleContainerWidget::updateCursorRecursively()
+{
+ _child->updateCursorRecursively();
+ updateCursorShape();
+}
+
+