summaryrefslogtreecommitdiffstats
path: root/kmdi
diff options
context:
space:
mode:
Diffstat (limited to 'kmdi')
-rw-r--r--kmdi/CMakeLists.txt60
-rw-r--r--kmdi/Makefile.am20
-rw-r--r--kmdi/TODO4
-rw-r--r--kmdi/kmdi/CMakeLists.txt52
-rw-r--r--kmdi/kmdi/Makefile.am14
-rw-r--r--kmdi/kmdi/dockcontainer.cpp656
-rw-r--r--kmdi/kmdi/dockcontainer.h144
-rw-r--r--kmdi/kmdi/global.h69
-rw-r--r--kmdi/kmdi/guiclient.cpp230
-rw-r--r--kmdi/kmdi/guiclient.h103
-rw-r--r--kmdi/kmdi/mainwindow.cpp451
-rw-r--r--kmdi/kmdi/mainwindow.h199
-rw-r--r--kmdi/kmdi/tabwidget.cpp284
-rw-r--r--kmdi/kmdi/tabwidget.h115
-rw-r--r--kmdi/kmdi/toolviewaccessor.cpp223
-rw-r--r--kmdi/kmdi/toolviewaccessor.h88
-rw-r--r--kmdi/kmdi/toolviewaccessor_p.h60
-rw-r--r--kmdi/kmdichildarea.cpp793
-rw-r--r--kmdi/kmdichildarea.h304
-rw-r--r--kmdi/kmdichildfrm.cpp1409
-rw-r--r--kmdi/kmdichildfrm.h446
-rw-r--r--kmdi/kmdichildfrmcaption.cpp322
-rw-r--r--kmdi/kmdichildfrmcaption.h145
-rw-r--r--kmdi/kmdichildview.cpp774
-rw-r--r--kmdi/kmdichildview.h615
-rw-r--r--kmdi/kmdidefines.h117
-rw-r--r--kmdi/kmdidockcontainer.cpp858
-rw-r--r--kmdi/kmdidockcontainer.h167
-rw-r--r--kmdi/kmdidocumentviewtabwidget.cpp148
-rw-r--r--kmdi/kmdidocumentviewtabwidget.h125
-rw-r--r--kmdi/kmdifocuslist.cpp70
-rw-r--r--kmdi/kmdifocuslist.h42
-rw-r--r--kmdi/kmdiguiclient.cpp320
-rw-r--r--kmdi/kmdiguiclient.h146
-rw-r--r--kmdi/kmdiiterator.h51
-rw-r--r--kmdi/kmdilistiterator.h61
-rw-r--r--kmdi/kmdimainfrm.cpp2937
-rw-r--r--kmdi/kmdimainfrm.h884
-rw-r--r--kmdi/kmdinulliterator.h49
-rw-r--r--kmdi/kmditaskbar.cpp394
-rw-r--r--kmdi/kmditaskbar.h219
-rw-r--r--kmdi/kmditoolviewaccessor.cpp269
-rw-r--r--kmdi/kmditoolviewaccessor.h86
-rw-r--r--kmdi/kmditoolviewaccessor_p.h51
-rw-r--r--kmdi/res/filenew.xpm27
-rw-r--r--kmdi/res/kde2_closebutton.xpm22
-rw-r--r--kmdi/res/kde2_maxbutton.xpm22
-rw-r--r--kmdi/res/kde2_minbutton.xpm22
-rw-r--r--kmdi/res/kde2_restorebutton.xpm22
-rw-r--r--kmdi/res/kde2_undockbutton.xpm22
-rw-r--r--kmdi/res/kde2laptop_closebutton.xpm18
-rw-r--r--kmdi/res/kde2laptop_closebutton_menu.xpm25
-rw-r--r--kmdi/res/kde2laptop_maxbutton.xpm18
-rw-r--r--kmdi/res/kde2laptop_minbutton.xpm18
-rw-r--r--kmdi/res/kde2laptop_restorebutton.xpm18
-rw-r--r--kmdi/res/kde2laptop_undockbutton.xpm18
-rw-r--r--kmdi/res/kde_closebutton.xpm30
-rw-r--r--kmdi/res/kde_maxbutton.xpm30
-rw-r--r--kmdi/res/kde_minbutton.xpm30
-rw-r--r--kmdi/res/kde_restorebutton.xpm30
-rw-r--r--kmdi/res/kde_undockbutton.xpm27
-rw-r--r--kmdi/res/win_closebutton.xpm30
-rw-r--r--kmdi/res/win_maxbutton.xpm30
-rw-r--r--kmdi/res/win_minbutton.xpm30
-rw-r--r--kmdi/res/win_restorebutton.xpm30
-rw-r--r--kmdi/res/win_undockbutton.xpm26
-rw-r--r--kmdi/test/Makefile.am10
-rw-r--r--kmdi/test/README16
-rw-r--r--kmdi/test/hello.cpp104
-rw-r--r--kmdi/test/hello.h38
-rw-r--r--kmdi/test/main.cpp103
-rw-r--r--kmdi/test/mainwidget.cpp147
-rw-r--r--kmdi/test/mainwidget.h71
73 files changed, 0 insertions, 15608 deletions
diff --git a/kmdi/CMakeLists.txt b/kmdi/CMakeLists.txt
deleted file mode 100644
index ab54cb550..000000000
--- a/kmdi/CMakeLists.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-#################################################
-#
-# (C) 2010 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
-
-add_subdirectory( kmdi )
-
-include_directories(
- ${TQT_INCLUDE_DIRS}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/res
- ${CMAKE_BINARY_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}/tdefx
- ${CMAKE_SOURCE_DIR}/tdeui
- ${CMAKE_SOURCE_DIR}/kutils
- ${CMAKE_SOURCE_DIR}/kmdi
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### headers ###################################
-
-install( FILES
- kmdichildarea.h kmdichildfrm.h kmdichildfrmcaption.h
- kmdidefines.h kmdiiterator.h kmdilistiterator.h
- kmdimainfrm.h kmdinulliterator.h kmditaskbar.h
- kmdichildview.h kmditoolviewaccessor.h
- DESTINATION ${INCLUDE_INSTALL_DIR} )
-
-
-#### kmdi #######################################
-
-set( target kmdi )
-
-set( ${target}_SRCS
- kmdichildarea.cpp kmdichildfrm.cpp kmdichildfrmcaption.cpp
- kmdichildview.cpp kmdimainfrm.cpp kmditaskbar.cpp
- kmdidockcontainer.cpp kmditoolviewaccessor.cpp
- kmdiguiclient.cpp kmdidocumentviewtabwidget.cpp
- kmdifocuslist.cpp
-)
-
-tde_add_library( ${target} SHARED AUTOMOC
- SOURCES ${${target}_SRCS}
- VERSION 1.0.0
- LINK kmdi2-shared
- DESTINATION ${LIB_INSTALL_DIR}
-)
diff --git a/kmdi/Makefile.am b/kmdi/Makefile.am
deleted file mode 100644
index 5e176dc17..000000000
--- a/kmdi/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-SUBDIRS = kmdi . test
-
-INCLUDES = -I$(top_srcdir)/kmdi/res -I$(top_srcdir)/kutils -I$(top_srcdir) -I$(top_srcdir)/kmdi $(all_includes)
-
-lib_LTLIBRARIES = libkmdi.la
-libkmdi_la_LDFLAGS = $(all_libraries) -version-info 1:0
-libkmdi_la_LIBADD = $(LIB_KPARTS) $(top_builddir)/kutils/libkutils.la $(LIB_TDEUI) $(LIB_QT) $(LIB_TDECORE) $(LIB_X11)
-
-libkmdi_la_SOURCES = kmdichildarea.cpp kmdichildfrm.cpp kmdichildfrmcaption.cpp \
- kmdichildview.cpp kmdimainfrm.cpp kmditaskbar.cpp kmdidockcontainer.cpp \
- kmditoolviewaccessor.cpp kmdiguiclient.cpp kmdidocumentviewtabwidget.cpp \
- kmdifocuslist.cpp
-
-include_HEADERS = kmdichildarea.h kmdichildfrm.h kmdichildfrmcaption.h kmdidefines.h \
- kmdiiterator.h kmdilistiterator.h kmdimainfrm.h kmdinulliterator.h \
- kmditaskbar.h kmdichildview.h kmditoolviewaccessor.h
-
-METASOURCES = AUTO
-
-include ../admin/Doxyfile.am
diff --git a/kmdi/TODO b/kmdi/TODO
deleted file mode 100644
index b04df59db..000000000
--- a/kmdi/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-- fix .xpm file stuff to be more KDE-conform
-- if QDockWindow becomes more protected and virtual than private, change from base class KDockWidget to QDockWindow
-- add splitter mode for Kate-like MDI appearance
-- fix KDE style guide (allow MDI where it is sensefull)
diff --git a/kmdi/kmdi/CMakeLists.txt b/kmdi/kmdi/CMakeLists.txt
deleted file mode 100644
index 2314d79ab..000000000
--- a/kmdi/kmdi/CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-#################################################
-#
-# (C) 2010 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
-
-include_directories(
- ${TQT_INCLUDE_DIRS}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_BINARY_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/kmdi
- ${CMAKE_SOURCE_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}/tdefx
- ${CMAKE_SOURCE_DIR}/tdeui
- ${CMAKE_SOURCE_DIR}/kutils
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### headers ###################################
-
-install( FILES
- global.h mainwindow.h toolviewaccessor.h tabwidget.h
- DESTINATION ${INCLUDE_INSTALL_DIR}/kmdi )
-
-
-#### kmdi2 ######################################
-
-set( target kmdi2 )
-
-set( ${target}_SRCS
- mainwindow.cpp dockcontainer.cpp toolviewaccessor.cpp
- guiclient.cpp tabwidget.cpp
-)
-
-tde_add_library( ${target} SHARED AUTOMOC
- SOURCES ${${target}_SRCS}
- VERSION 1.0.0
- LINK kutils-shared
- DESTINATION ${LIB_INSTALL_DIR}
-)
diff --git a/kmdi/kmdi/Makefile.am b/kmdi/kmdi/Makefile.am
deleted file mode 100644
index 7f16a30dd..000000000
--- a/kmdi/kmdi/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-INCLUDES = -I$(top_srcdir)/kutils -I$(top_srcdir) -I$(top_srcdir)/kmdi $(all_includes)
-
-lib_LTLIBRARIES = libkmdi2.la
-libkmdi2_la_LDFLAGS = $(all_libraries) -version-info 1:0
-libkmdi2_la_LIBADD = $(LIB_KPARTS) $(top_builddir)/kutils/libkutils.la $(LIB_TDEUI) $(LIB_QT) $(LIB_TDECORE)
-
-libkmdi2_la_SOURCES = mainwindow.cpp dockcontainer.cpp toolviewaccessor.cpp guiclient.cpp tabwidget.cpp
-
-kmdiincludedir = $(includedir)/kmdi
-kmdiinclude_HEADERS = global.h mainwindow.h toolviewaccessor.h tabwidget.h
-
-METASOURCES = AUTO
-
-include ../../admin/Doxyfile.am
diff --git a/kmdi/kmdi/dockcontainer.cpp b/kmdi/kmdi/dockcontainer.cpp
deleted file mode 100644
index c9523f230..000000000
--- a/kmdi/kmdi/dockcontainer.cpp
+++ /dev/null
@@ -1,656 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
- Copyright (C) 2002, 2004 Christoph Cullmann <cullmann@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.
-*/
-
-#include "mainwindow.h"
-#include "dockcontainer.h"
-
-#include "dockcontainer.moc"
-
-#include "kdockwidget_private.h"
-
-#include <tqwidgetstack.h>
-#include <tqlayout.h>
-#include <tqtimer.h>
-#include <tqtooltip.h>
-#include <kmultitabbar.h>
-#include <kglobalsettings.h>
-
-#include <kdebug.h>
-#include <kiconloader.h>
-#include <kapplication.h>
-#include <kconfig.h>
-#include <klocale.h>
-
-//TODO: Well, this is already defined in tdeui/kdockwidget.cpp
-static const char* const kmdi_not_close_xpm[]={
-"5 5 2 1",
-"# c black",
-". c None",
-"#####",
-"#...#",
-"#...#",
-"#...#",
-"#####"};
-
-namespace KMDI
-{
-
-
-DockContainer::DockContainer(TQWidget *parent, TQWidget *win, int position, int flags)
-: TQWidget(parent),KDockContainer()
-{
- m_tabSwitching = false;
- m_block=false;
- m_inserted=-1;
- m_mainWin = win;
- oldtab=-1;
- mTabCnt=0;
- m_position = position;
- m_previousTab=-1;
- m_separatorPos = 18000;
- m_movingState=NotMoving;
- m_startEvent=0;
- kdDebug(760)<<"DockContainer created"<<endl;
-
- TQBoxLayout *l;
- m_vertical=!((position==KDockWidget::DockTop) || (position==KDockWidget::DockBottom));
-
- if (!m_vertical)
- l=new TQVBoxLayout(this);
- else
- l=new TQHBoxLayout(this);
-
- l->setAutoAdd(false);
-
- m_tb=new KMultiTabBar(((position==KDockWidget::DockTop) || (position==KDockWidget::DockBottom))?
- KMultiTabBar::Horizontal:KMultiTabBar::Vertical,this);
-
- m_tb->setStyle(KMultiTabBar::KMultiTabBarStyle(flags));
- m_tb->showActiveTabTexts(true);
-
- m_tb->setPosition((position==KDockWidget::DockLeft)?KMultiTabBar::Left:
- (position==KDockWidget::DockBottom)?KMultiTabBar::Bottom:
- (position==KDockWidget::DockTop)?KMultiTabBar::Top:KMultiTabBar::Right);
-
- m_ws=new TQWidgetStack(this);
-
- m_ws->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Expanding));
-
- if ( (position==KDockWidget::DockLeft) || (position==KDockWidget::DockTop))
- {
- l->add(m_tb);
- l->add(m_ws);
- }
- else
- {
- l->add(m_ws);
- l->add(m_tb);
- }
-
- l->activate();
- m_ws->hide();
- m_tb->installEventFilter(this);
-}
-
-void DockContainer::setStyle(int style) {
- if (m_tb) m_tb->setStyle(KMultiTabBar::KMultiTabBarStyle(style));
-}
-
-DockContainer::~DockContainer()
-{
- TQMap<KDockWidget*,int>::iterator it;
- while (m_map.count()) {
- it = m_map.begin();
- KDockWidget *w=it.key();
- if (m_overlapButtons.contains(w)) {
- (::tqqt_cast<KDockWidgetHeader*>(w->getHeader()))->removeButton(m_overlapButtons[w]);
- m_overlapButtons.remove(w);
- }
- m_map.remove(w);
- w->undock();
- }
- deactivated(this);
-}
-
-
-void DockContainer::init()
-{
- bool overlap = isOverlapMode();
- if (m_vertical)
- {
- parentDockWidget()->setForcedFixedWidth(m_tb->width());
- activateOverlapMode(m_tb->width());
- }
- else
- {
- parentDockWidget()->setForcedFixedHeight(m_tb->height());
- activateOverlapMode(m_tb->height());
- }
-
- if (!overlap) deactivateOverlapMode();
-
- // try to restore splitter size
- if ( parentDockWidget() && parentDockWidget()->parent() )
- {
- KDockSplitter *sp= ::tqqt_cast<KDockSplitter*>(parentDockWidget()->
- parent());
- if ( sp )
- sp->setSeparatorPosX( m_separatorPos );
- }
-}
-
-KDockWidget *DockContainer::parentDockWidget()
-{
- return ((KDockWidget*)parent());
-}
-
-void DockContainer::insertWidget (KDockWidget *dwdg, TQPixmap pixmap, const TQString &text, int &)
-{
- KDockWidget* w = (KDockWidget*) dwdg;
- int tab;
- bool alreadyThere=m_map.contains(w);
-
- if (alreadyThere)
- {
- tab=m_map[w];
- if (m_ws->addWidget(w,tab)!=tab) kdDebug(760)<<"ERROR COULDN'T READD WIDGET************"<<endl;
- kdDebug(760)<<"READDED WIDGET***********************************"<<endl;
-/*JOWENN m_tb->setTab(tab,true);
- tabClicked(tab);*/
- }
- else
- {
- tab=m_ws->addWidget(w);
- m_map.insert(w,tab);
- m_revMap.insert(tab,w);
-
-
- if (((KDockWidget*)parentWidget())->mayBeShow())
- ((KDockWidget*)parentWidget())->dockBack();
-
- if (::tqqt_cast<KDockWidgetHeader*>(w->getHeader()))
- {
- kdDebug(760)<<"*** KDockWidgetHeader has been found"<<endl;
-
- KDockWidgetHeader *hdr=::tqqt_cast<KDockWidgetHeader*>(w->getHeader());
-
- KDockButton_Private *btn = new KDockButton_Private( hdr, "OverlapButton" );
-
- TQToolTip::add( btn, i18n("Switch between overlap and side by side mode", "Overlap") );
-
- btn->setToggleButton( true );
- btn->setPixmap( const_cast< const char** >(kmdi_not_close_xpm) );
- hdr->addButton(btn);
- m_overlapButtons.insert(w,btn);
- btn->setOn(!isOverlapMode());
-
- connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(changeOverlapMode()));
- }
-
- m_tb->appendTab(pixmap.isNull()?SmallIcon("misc"):pixmap,tab,w->tabPageLabel());
- m_tb->tab(tab)->installEventFilter( this );
- kdDebug(760)<<"NAMENAMENAMENAME:===========================:"<<w->tabPageLabel()<<endl;
-
-//FB m_tb->setTab(tab,true);
-
- connect(m_tb->tab(tab),TQT_SIGNAL(clicked(int)),this,TQT_SLOT(tabClicked(int)));
-
- kdDebug(760)<<"DockContainer::insertWidget()"<<endl;
-
-//FB m_tb->setTab(oldtab,false);
-
- mTabCnt++;
- m_inserted=tab;
- int dummy=0;
-//FB tabClicked(tab);
- KDockContainer::insertWidget(w,pixmap,text,dummy);
- itemNames.append(w->name());
- tabCaptions.insert(w->name(),w->tabPageLabel());
- tabTooltips.insert(w->name(),w->toolTipString());
-
-
- }
-
-//FB m_ws->raiseWidget(tab);
-}
-
-
-bool DockContainer::eventFilter( TQObject *obj, TQEvent *event )
-{
- if (TQT_BASE_OBJECT(obj)==TQT_BASE_OBJECT(m_tb)) {
- if ( (event->type()==TQEvent::Resize) && (m_ws->isHidden()) ) {
- TQSize size=((TQResizeEvent*)event)->size();
- if (m_vertical)
- parentDockWidget()->setForcedFixedWidth(size.width());
- else
- parentDockWidget()->setForcedFixedHeight(size.height());
- }
- }
- else
- switch ( event->type() ){
- case TQEvent::MouseButtonPress:
- {
- KDockWidget * w=m_revMap[tqt_dynamic_cast<KMultiTabBarTab*>(obj)->id()];
- if (!w) {
- kdDebug()<<"NoWidget"<<endl;
- break;
- }
- if (!w->getHeader()) {
- kdDebug()<<"NO HEADER"<<endl;
- break;
- }
- KDockWidgetHeader *hdr=::tqqt_cast<KDockWidgetHeader*>(w->getHeader());
- if (!hdr) {
- kdDebug()<<"Wrong header type in DockContainer::eventFilter"<<endl;
- break;
- }
- m_dockManager=w->dockManager();
- m_dragPanel=TQT_TQOBJECT(hdr->dragPanel());
- if (m_dragPanel) m_movingState=WaitingForMoveStart;
- delete m_startEvent;
- m_startEvent=new TQMouseEvent(* ((TQMouseEvent*)event));
- }
- break;
- case TQEvent::MouseButtonRelease:
- if (m_movingState==Moving) {
- m_movingState=NotMoving;
- TQApplication::postEvent(m_dragPanel,new TQMouseEvent(* ( (TQMouseEvent*)event)));
- delete m_startEvent;
- m_startEvent=0;
- }
- break;
- case TQEvent::MouseMove:
- if (m_movingState==WaitingForMoveStart) {
- TQPoint p( ((TQMouseEvent*)event)->pos() - m_startEvent->pos() );
- if( p.manhattanLength() > TDEGlobalSettings::dndEventDelay()) {
- m_dockManager->eventFilter(m_dragPanel,TQT_TQEVENT(m_startEvent));
- m_dockManager->eventFilter(m_dragPanel,event);
- m_movingState=Moving;
- }
- } else if (m_movingState==Moving) {
- m_dockManager->eventFilter(m_dragPanel,event);
- }
- break;
- default:
- break;
-
- }
- return false;
-
-}
-
-void DockContainer::showWidget(KDockWidget *w) {
- if (!m_map.contains(w)) return;
-
- kdDebug()<<"KMDI::DockContainer::<showWidget"<<endl;
- int id=m_map[w];
- m_tb->setTab(id,true);
- tabClicked(id);
-
-}
-
-void DockContainer::changeOverlapMode()
-{
- const KDockButton_Private *btn=tqt_dynamic_cast<const KDockButton_Private*>(sender());
-
- kdDebug(760)<<"DockContainer::changeOverlapMode: button=="<<btn<<endl;
-
- if (!btn) return;
-
- if (!btn->isOn()) {
- kdDebug(760)<<"DockContainer::changeOverlapMode: activateOverlapMode"<<endl;
- if (m_vertical) {
- activateOverlapMode(m_tb->width());
- }
- else
- {
- activateOverlapMode(m_tb->height());
- }
- } else {
- kdDebug(760)<<"DockContainer::changeOverlapMode: deactivateOverlapMode"<<endl;
- deactivateOverlapMode();
- }
-
- for (TQMap<KDockWidget*,KDockButton_Private*>::iterator it=m_overlapButtons.begin();
- it!=m_overlapButtons.end();++it)
- it.data()->setOn(!isOverlapMode());
-}
-
-void DockContainer::hideIfNeeded() {
- kdDebug(760)<<"************************* hideIfNeeded *************************"<<endl;
- if (!itemNames.count())
- ((KDockWidget*)parentWidget())->undock();
-}
-
-void DockContainer::removeWidget(KDockWidget* dwdg)
-{
- KDockWidget* w = (KDockWidget*) dwdg;
- if (!m_map.contains(w)) return;
- int id=m_map[w];
- if (m_tb->isTabRaised(id)) {
- //why do we hide the tab if we're just going
- //to remove it? - mattr 2004-10-26
- m_tb->setTab(id,false);
- m_tabSwitching = false;
- tabClicked(id);
- }
- m_tb->removeTab(id);
- m_ws->removeWidget(w);
- m_map.remove(w);
- m_revMap.remove(id);
- if (m_overlapButtons.contains(w)) {
- (::tqqt_cast<KDockWidgetHeader*>(w->getHeader()))->removeButton(m_overlapButtons[w]);
- m_overlapButtons.remove(w);
- }
- KDockContainer::removeWidget(w);
- itemNames.remove(w->name());
- tabCaptions.remove(w->name());
- tabTooltips.remove(w->name());
- if (!itemNames.count())
- ((KDockWidget*)parentWidget())->undock();
-}
-
-void DockContainer::undockWidget(KDockWidget *dwdg)
-{
- KDockWidget* w = (KDockWidget*) dwdg;
-
- if (!m_map.contains(w))
- return;
-
- int id=m_map[w];
- if (m_tb->isTabRaised(id)) {
- kdDebug(760)<<"Wiget has been undocked, setting tab down"<<endl;
- m_tb->setTab(id,false);
- tabClicked(id);
- }
-}
-
-void DockContainer::tabClicked(int t)
-{
- kdDebug(760)<<"DockContainer::tabClicked()"<<endl;
- bool call_makeVisible=!m_tabSwitching;
- m_tabSwitching=true;
- if ((t!=-1) && m_tb->isTabRaised(t))
- {
- if (m_ws->isHidden())
- {
- m_ws->show ();
- parentDockWidget()->restoreFromForcedFixedSize();
- }
- if (!m_ws->widget(t))
- {
- m_revMap[t]->manualDock(parentDockWidget(),KDockWidget::DockCenter,20);
- if (call_makeVisible) m_revMap[t]->makeDockVisible();//manualDock(parentDockWidget(),KDockWidget::DockCenter,20);
- m_tabSwitching=false;
- emit activated(this);
- return;
- }
- m_ws->raiseWidget(t);
- if (m_ws->widget(t)) {
- KDockWidget *tmpDw=::tqqt_cast<KDockWidget*>(m_ws->widget(t));
- if (tmpDw) {
- if (tmpDw->getWidget()) tmpDw->getWidget()->setFocus();
- } else kdDebug(760)<<"Something really weird is going on"<<endl;
- } else
- kdDebug(760)<<"DockContainer::tabClicked(int): m_ws->widget(t)==0 "<<endl;
-
- if (oldtab!=t) m_tb->setTab(oldtab,false);
- m_tabSwitching=true;
- oldtab=t;
- emit activated(this);
- }
- else
- {
- // try save splitter position
- if ( parentDockWidget() && parentDockWidget()->parent() )
- {
- KDockSplitter *sp= ::tqqt_cast<KDockSplitter*>(parentDockWidget()->
- parent());
- if ( sp )
- m_separatorPos = sp->separatorPos();
- }
- m_previousTab=t;
-// oldtab=-1;
- if (m_block) return;
- emit deactivated(this);
- m_block=true;
- if (m_ws->widget(t))
- {
-// ((KDockWidget*)m_ws->widget(t))->undock();
- }
- m_block=false;
- m_ws->hide ();
-
-
- kdDebug(760)<<"Fixed Width:"<<m_tb->width()<<endl;
- if (m_vertical)
- parentDockWidget()->setForcedFixedWidth(m_tb->width()); // strange why it worked before at all
- else
- parentDockWidget()->setForcedFixedHeight(m_tb->height()); // strange why it worked before at all
- }
- m_tabSwitching=false;
-}
-
-void DockContainer::setToolTip (KDockWidget *, TQString &s)
-{
- kdDebug(760)<<"***********************************Setting tooltip for a widget: "<<s<<endl;
-}
-
-void DockContainer::setPixmap(KDockWidget* widget ,const TQPixmap& pixmap)
-{
- int id=m_ws->id(widget);
- if (id==-1) return;
- KMultiTabBarTab *tab=m_tb->tab(id);
- tab->setIcon(pixmap.isNull()?SmallIcon("misc"):pixmap);
-}
-
-void DockContainer::save(TDEConfig* cfg,const TQString& group_or_prefix)
-{
- // group name
- TQString grp=cfg->group();
- cfg->deleteGroup(group_or_prefix+TQString("::%1").arg(parent()->name()));
- cfg->setGroup(group_or_prefix+TQString("::%1").arg(parent()->name()));
-
- // save overlap mode
- cfg->writeEntry("overlapMode",isOverlapMode());
-
- // try to save the splitter position
- if ( parentDockWidget() && parentDockWidget()->parent() )
- {
- KDockSplitter *sp= ::tqqt_cast<KDockSplitter*>(parentDockWidget()->
- parent());
- if ( sp )
- cfg->writeEntry( "separatorPosition", m_separatorPos );
- }
-
- TQPtrList<KMultiTabBarTab>* tl=m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it(*tl);
- TQStringList::Iterator it2=itemNames.begin();
- int i=0;
- for (;it.current()!=0;++it,++it2)
- {
-// cfg->writeEntry(TQString("widget%1").arg(i),m_ws->widget(it.current()->id())->name());
- cfg->writeEntry(TQString("widget%1").arg(i),(*it2));
- TQString s=tabCaptions[*it2];
- if (!s.isEmpty()) {
- cfg->writeEntry(TQString("widget%1-tabCaption").arg(i),s);
- }
- s=tabTooltips[*it2];
- if (!s.isEmpty()) {
- cfg->writeEntry(TQString("widget%1-tabTooltip").arg(i),s);
- }
-// kdDebug(760)<<"****************************************Saving: "<<m_ws->widget(it.current()->id())->name()<<endl;
- if (m_tb->isTabRaised(it.current()->id()))
- cfg->writeEntry(m_ws->widget(it.current()->id())->name(),true);
- ++i;
- }
-
- cfg->setGroup(grp);
-}
-
-void DockContainer::load(TDEConfig* cfg,const TQString& group_or_prefix)
-{
- TQString grp=cfg->group();
- cfg->setGroup(group_or_prefix+TQString("::%1").arg(parent()->name()));
-
- if (cfg->readBoolEntry("overlapMode"))
- activateOverlapMode( m_vertical?m_tb->width():m_tb->height() );
- else
- deactivateOverlapMode();
-
- m_separatorPos = cfg->readNumEntry( "separatorPosition", 18000 ); // = 18%
-
- int i=0;
- TQString raise;
- while (true)
- {
- TQString dwn=cfg->readEntry(TQString("widget%1").arg(i));
- if (dwn.isEmpty()) break;
- kdDebug(760)<<"*************************************************************Configuring dockwidget :"<<dwn<<endl;
- KDockWidget *dw=((KDockWidget*)parent())->dockManager()->getDockWidgetFromName(dwn);
- if (dw)
- {
- TQString s=cfg->readEntry(TQString("widget%1-tabCaption").arg(i));
- if (!s.isEmpty()) {
- dw->setTabPageLabel(s);
- }
- s=cfg->readEntry(TQString("widget%1-tabTooltip").arg(i));
- if (!s.isEmpty()) {
- dw->setToolTipString(s);
- }
- dw->manualDock((KDockWidget*)parent(),KDockWidget::DockCenter);
- }
- if (cfg->readBoolEntry(dwn,false)) raise=dwn;
- i++;
-
- }
-
- TQPtrList<KMultiTabBarTab>* tl=m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it1(*tl);
- m_ws->hide();
- if (m_vertical)
- parentDockWidget()->setForcedFixedWidth(m_tb->width());
- else
- parentDockWidget()->setForcedFixedHeight(m_tb->height());
- for (;it1.current()!=0;++it1)
- {
- m_tb->setTab(it1.current()->id(),false);
- }
- kapp->syncX();
- m_delayedRaise=-1;
-
- for (TQMap<KDockWidget*,KDockButton_Private*>::iterator it=m_overlapButtons.begin();
- it!=m_overlapButtons.end();++it)
- it.data()->setOn(!isOverlapMode());
-
- if (!raise.isEmpty())
- {
- for (TQMap<KDockWidget*,int>::iterator it=m_map.begin();it!=m_map.end();++it)
- {
- if (it.key()->name()==raise)
- {
-/* tabClicked(it.data());
- m_tb->setTab(it.data(),true);
- tabClicked(it.data());
- m_ws->raiseWidget(it.key());
- kapp->sendPostedEvents();
- kapp->syncX();*/
-
- m_delayedRaise=it.data();
- TQTimer::singleShot(0,this,TQT_SLOT(delayedRaise()));
- kdDebug(760)<<"************** raising *******: "<<it.key()->name()<<endl;
- break;
- }
- }
-
- }
- if (m_delayedRaise==-1) TQTimer::singleShot(0,this,TQT_SLOT(init()));
- cfg->setGroup(grp);
-
-}
-
-void DockContainer::delayedRaise()
-{
- m_tb->setTab(m_delayedRaise,true);
- tabClicked(m_delayedRaise);
-}
-
-void DockContainer::collapseOverlapped()
-{
- if (m_tabSwitching) return;
- if (isOverlapMode()){
- TQPtrList<KMultiTabBarTab>* tl=m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it(*tl);
- for(;it.current();++it) {
- if (it.current()->isOn()) {
- kdDebug(760)<<"Lowering TAB"<<endl;
- it.current()->setState(false);
- tabClicked(it.current()->id());
- }
- }
- }
-}
-
-void DockContainer::toggle() {
- kdDebug(760)<<"DockContainer:activate"<<endl;
- if (m_tb->isTabRaised(oldtab)) {
- m_tb->setTab(oldtab,false);
- tabClicked(oldtab);
- // KMDI::MainWindow *mainFrm = tqt_dynamic_cast<KMDI::MainWindow*>(m_mainWin);
- // if (mainFrm && mainFrm->activeWindow() ) // TODO
- // mainFrm->activeWindow()->setFocus();
-
- } else {
- kdDebug(760)<<"DockContainer::toggle(): raising tab"<<endl;
- if (m_tb->tab(m_previousTab)==0) {
- if (m_tb->tabs()->count()==0) return;
- m_previousTab=m_tb->tabs()->getFirst()->id();
- }
- m_tb->setTab(m_previousTab,true);
- tabClicked(m_previousTab);
- }
-}
-
-void DockContainer::prevToolView() {
- TQPtrList<KMultiTabBarTab>* tabs=m_tb->tabs();
- int pos=tabs->findRef(m_tb->tab(oldtab));
- if (pos==-1) return;
- pos--;
- if (pos<0) pos=tabs->count()-1;
- KMultiTabBarTab *tab=tabs->at(pos);
- if (!tab) return; //can never happen here, but who knows
- m_tb->setTab(tab->id(),true);
- tabClicked(tab->id());
-}
-
-void DockContainer::nextToolView() {
- TQPtrList<KMultiTabBarTab>* tabs=m_tb->tabs();
- int pos=tabs->findRef(m_tb->tab(oldtab));
- if (pos==-1) return;
- pos++;
- if (pos>=(int)tabs->count()) pos=0;
- KMultiTabBarTab *tab=tabs->at(pos);
- if (!tab) return; //can never happen here, but who knows
- m_tb->setTab(tab->id(),true);
- tabClicked(tab->id());
-}
-
-}
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/dockcontainer.h b/kmdi/kmdi/dockcontainer.h
deleted file mode 100644
index 9b7478378..000000000
--- a/kmdi/kmdi/dockcontainer.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
- Copyright (C) 2002, 2004 Christoph Cullmann <cullmann@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 _KMDI_DOCK_CONTAINER_
-#define _KMDI_DOCK_CONTAINER_
-
-#include <tqwidget.h>
-#include <tqstringlist.h>
-#include <kdockwidget.h>
-#include <tqmap.h>
-
-# include <kdockwidget_p.h>
-
-#include <tqpushbutton.h>
-
-class TQWidgetStack;
-class KMultiTabBar;
-class KDockButton_Private;
-
-namespace KMDI
-{
-
-class DockContainer: public TQWidget, public KDockContainer
-{
- Q_OBJECT
-
- public:
- DockContainer(TQWidget *parent, TQWidget *win, int position, int flags);
- virtual ~DockContainer();
-
- /** Get the KDockWidget that is our parent */
- KDockWidget *parentDockWidget();
-
- /**
- * Add a widget to this container.
- * \param w the KDockWidget object to add
- * \todo Remove the extra parameters that we don't use?
- */
- virtual void insertWidget (KDockWidget *w, TQPixmap, const TQString &, int &);
-
- /**
- * Show a KDockWidget in our DockContainer
- * \param w the KDockWidget to show
- */
- virtual void showWidget (KDockWidget *w);
-
- /**
- * Set a tooltip for a widget
- *
- * \todo Actually implement it? Right now, it looks just it
- * does exactly nothing
- */
- virtual void setToolTip (KDockWidget *, TQString &);
-
- /**
- * Set a pixmap for one of our dock widgets
- * \param widget the KDockWidget to set the pixmap for
- * \param pixmap the pixmap you want to give the widget
- */
- virtual void setPixmap(KDockWidget* widget, const TQPixmap& pixmap);
-
- /**
- * Undock a widget from the container. This function is called
- * when you've dragged a tab off the dock it's attached to.
- * \param dwdg the KDockWidget to undock
- */
- virtual void undockWidget(KDockWidget* dwdg);
-
- /**
- * Remove a widget from the container. The caller
- * of this function is responsible for deleting the widget after calling
- * this function.
- */
- virtual void removeWidget(KDockWidget*);
-
- void hideIfNeeded();
-
- virtual void save(TDEConfig *,const TQString& group_or_prefix);
- virtual void load(TDEConfig *,const TQString& group_or_prefix);
-
- void setStyle(int);
- protected:
- bool eventFilter(TQObject*,TQEvent*);
-
- public slots:
- void init();
- void collapseOverlapped();
- void toggle();
- void nextToolView();
- void prevToolView();
- protected slots:
- void tabClicked(int);
- void delayedRaise();
- void changeOverlapMode();
- private:
- TQWidget *m_mainWin;
- TQWidgetStack *m_ws;
- KMultiTabBar *m_tb;
- int mTabCnt;
- int oldtab;
- int m_previousTab;
- int m_position;
- int m_separatorPos;
- TQMap<KDockWidget*,int> m_map;
- TQMap<int,KDockWidget*> m_revMap;
- TQMap<KDockWidget*,KDockButton_Private*> m_overlapButtons;
- TQStringList itemNames;
- TQMap<TQString,TQString> tabCaptions;
- TQMap<TQString,TQString> tabTooltips;
- int m_inserted;
- int m_delayedRaise;
- bool m_vertical;
- bool m_block;
- bool m_tabSwitching;
- TQObject *m_dragPanel;
- KDockManager *m_dockManager;
- TQMouseEvent *m_startEvent;
- enum MovingState {NotMoving=0,WaitingForMoveStart,MovingInternal,Moving} m_movingState;
- signals:
- void activated(DockContainer*);
- void deactivated(DockContainer*);
-};
-
-}
-
-#endif
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/global.h b/kmdi/kmdi/global.h
deleted file mode 100644
index 6ea09a93e..000000000
--- a/kmdi/kmdi/global.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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.
-
- Based on:
-
- //----------------------------------------------------------------------------
- // Project : KDE MDI extension
- //
- // begin : 07/1999 by Szymon Stefanek as part of kvirc
- // (an IRC application)
- // changes : 09/1999 by Falk Brettschneider to create an
- // - 06/2000 stand-alone Qt extension set of
- // classes and a Qt-based library
- // : 02/2000 by Massimo Morin (mmorin@schedsys.com)
- // 2000-2003 maintained by the KDevelop project
- // patches : -/2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
- // : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
- //
- // copyright : (C) 1999-2003 by Falk Brettschneider
- // and
- // Szymon Stefanek (stefanek@tin.it)
- // email : falkbr@tdevelop.org (Falk Brettschneider)
- //----------------------------------------------------------------------------
-*/
-
-#ifndef _KMDI_GLOBAL_H_
-#define _KMDI_GLOBAL_H_
-
-/**
- * @short A namespace for the KMDI library
- */
-namespace KMDI
-{
- enum TabWidgetVisibility {
- AlwaysShowTabs = 0,
- ShowWhenMoreThanOneTab = 1,
- NeverShowTabs = 2
- };
-
- /**
- * The style of the toolview tabs
- */
- enum ToolviewStyle {
- /** Show only icons on the toolview tabs. The visible toolviews contain both the icon and text. */
- IconOnly = 0,
- /** Show only the text description on the toolview tabs. */
- TextOnly = 1,
- /** Show both the icon and description on the toolview tabs. */
- TextAndIcon = 3
- };
-}
-
-#endif
diff --git a/kmdi/kmdi/guiclient.cpp b/kmdi/kmdi/guiclient.cpp
deleted file mode 100644
index 64b375ef0..000000000
--- a/kmdi/kmdi/guiclient.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- based on ktoolbarhandler.cpp: Copyright (C) 2002 Simon Hausmann <hausmann@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.
-*/
-
-#include "guiclient.h"
-#include "guiclient.moc"
-
-#include <tqpopupmenu.h>
-#include <kapplication.h>
-#include <kconfig.h>
-#include <ktoolbar.h>
-#include <klocale.h>
-#include <kaction.h>
-#include <tqstring.h>
-#include <kdebug.h>
-#include <kdockwidget.h>
-
-#include "mainwindow.h"
-#include "toolviewaccessor.h"
-#include "toolviewaccessor_p.h"
-
-static const char *actionListName = "show_kmdi_document_tool_view_actions";
-
-static const char *guiDescription = ""
- "<!DOCTYPE kpartgui><kpartgui name=\"KMDIViewActions\">"
- "<MenuBar>"
- " <Menu name=\"window\">"
- " <ActionList name=\"%1\" />"
- " </Menu>"
- "</MenuBar>"
- "</kpartgui>";
-
-static const char *resourceFileName = "kmdiviewactions.rc";
-
-namespace KMDIPrivate
-{
-
-GUIClient::GUIClient (KMDI::MainWindow* mdiMainFrm,const char* name)
- : TQObject ( mdiMainFrm,name )
- , KXMLGUIClient ( mdiMainFrm )
-{
- m_mdiMainFrm=mdiMainFrm;
-
- connect( mdiMainFrm->guiFactory(), TQT_SIGNAL( clientAdded( KXMLGUIClient * ) ),
- this, TQT_SLOT( clientAdded( KXMLGUIClient * ) ) );
-
- /* re-use an existing resource file if it exists. can happen if the user launches the
- * toolbar editor */
- /*
- setXMLFile( resourceFileName );
- */
-
- if ( domDocument().documentElement().isNull() )
- {
- TQString completeDescription = TQString::fromLatin1( guiDescription ).arg( actionListName );
-
- setXML( completeDescription, false /*merge*/ );
- }
-
- if (actionCollection()->kaccel()==0)
- actionCollection()->setWidget(mdiMainFrm);
-
- m_toolMenu=new KActionMenu(i18n("Tool &Views"),actionCollection(),"kmdi_toolview_menu");
-
- m_gotoToolDockMenu=new KActionMenu(i18n("Tool &Docks"),actionCollection(),"kmdi_tooldock_menu");
- m_gotoToolDockMenu->insert(new KAction(i18n("Switch Top Dock"),ALT+CTRL+SHIFT+Key_T,this,TQT_SIGNAL(toggleTop()),
- actionCollection(),"kmdi_activate_top"));
- m_gotoToolDockMenu->insert(new KAction(i18n("Switch Left Dock"),ALT+CTRL+SHIFT+Key_L,this,TQT_SIGNAL(toggleLeft()),
- actionCollection(),"kmdi_activate_left"));
- m_gotoToolDockMenu->insert(new KAction(i18n("Switch Right Dock"),ALT+CTRL+SHIFT+Key_R,this,TQT_SIGNAL(toggleRight()),
- actionCollection(),"kmdi_activate_right"));
- m_gotoToolDockMenu->insert(new KAction(i18n("Switch Bottom Dock"),ALT+CTRL+SHIFT+Key_B,this,TQT_SIGNAL(toggleBottom()),
- actionCollection(),"kmdi_activate_bottom"));
- m_gotoToolDockMenu->insert(new KActionSeparator(actionCollection(),"kmdi_goto_menu_separator"));
- m_gotoToolDockMenu->insert(new KAction(i18n("Previous Tool View"),ALT+CTRL+Key_Left,TQT_TQOBJECT(m_mdiMainFrm),TQT_SLOT(prevToolViewInDock()),
- actionCollection(),"kmdi_prev_toolview"));
- m_gotoToolDockMenu->insert(new KAction(i18n("Next Tool View"),ALT+CTRL+Key_Right,TQT_TQOBJECT(m_mdiMainFrm),TQT_SLOT(nextToolViewInDock()),
- actionCollection(),"kmdi_next_toolview"));
-
- actionCollection()->readShortcutSettings( "Shortcuts", kapp->config() );
-}
-
-GUIClient::~GUIClient()
-{
-// actionCollection()->writeShortcutSettings( "KMDI Shortcuts", kapp->config() );
- for (uint i=0;i<m_toolViewActions.count();i++)
- disconnect(m_toolViewActions.at(i),0,this,0);
-
- m_toolViewActions.setAutoDelete( false );
- m_toolViewActions.clear();
- m_documentViewActions.setAutoDelete( false );
- m_documentViewActions.clear();
-}
-
-void GUIClient::setupActions()
-{
- if ( !factory() || !m_mdiMainFrm )
- return;
-
- unplugActionList( actionListName );
-
- TQPtrList<KAction> addList;
- if (m_toolViewActions.count()<3)
- {
- for (uint i=0;i<m_toolViewActions.count();i++)
- addList.append(m_toolViewActions.at(i));
- }
- else
- addList.append(m_toolMenu);
-
- addList.append(m_gotoToolDockMenu);
-
- kdDebug(760)<<"GUIClient::setupActions: plugActionList"<<endl;
-
- plugActionList( actionListName, addList );
-}
-
-void GUIClient::addToolView(KMDI::ToolViewAccessor* mtva)
-{
- kdDebug(760)<<"*****void GUIClient::addToolView(KMDI::ToolViewAccessor* mtva)*****"<<endl;
-
- TQString aname = TQString("kmdi_toolview_") + mtva->wrappedWidget()->name();
-
- // try to read the action shortcut
- KShortcut sc;
- TDEConfig *cfg = kapp->config();
- TQString _grp = cfg->group();
- cfg->setGroup("Shortcuts");
- sc = KShortcut( cfg->readEntry( aname, "" ) );
- cfg->setGroup( _grp );
-
- KAction *a=new ToggleToolViewAction(i18n("Show %1").arg(mtva->wrappedWidget()->caption()),
- /*TQString::null*/sc,tqt_dynamic_cast<KDockWidget*>(mtva->wrapperWidget()),
- m_mdiMainFrm,actionCollection(), aname.latin1() );
-
- ((ToggleToolViewAction*)a)->setCheckedState(TQString(i18n("Hide %1").arg(mtva->wrappedWidget()->caption())));
-
- connect(a,TQT_SIGNAL(destroyed(TQObject*)),this,TQT_SLOT(actionDeleted(TQObject*)));
-
- m_toolViewActions.append(a);
- m_toolMenu->insert(a);
- mtva->d->action=a;
-
- setupActions();
-}
-
-void GUIClient::actionDeleted(TQObject* a)
-{
- m_toolViewActions.remove(static_cast<KAction*>(a));
- setupActions();
-}
-
-
-void GUIClient::clientAdded( KXMLGUIClient *client )
-{
- if ( client == this )
- setupActions();
-}
-
-ToggleToolViewAction::ToggleToolViewAction ( const TQString& text, const KShortcut& cut,KDockWidget *dw, KMDI::MainWindow *mdiMainFrm,
- TQObject* parent, const char* name )
- : KToggleAction(text,cut,parent,name)
- , m_dw(dw)
- , m_mdiMainFrm(mdiMainFrm)
-{
- if (m_dw)
- {
- connect(this,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotToggled(bool)));
- connect(m_dw->dockManager(),TQT_SIGNAL(change()),this,TQT_SLOT(anDWChanged()));
- connect(m_dw,TQT_SIGNAL(destroyed()),this,TQT_SLOT(slotWidgetDestroyed()));
-
- setChecked(m_dw->mayBeHide());
- }
-}
-
-ToggleToolViewAction::~ToggleToolViewAction()
-{
- unplugAll();
-}
-
-void ToggleToolViewAction::anDWChanged()
-{
- if (isChecked() && m_dw->mayBeShow())
- setChecked(false);
- else if ((!isChecked()) && m_dw->mayBeHide())
- setChecked(true);
- else if (isChecked() && (m_dw->parentDockTabGroup() &&
- ((::tqqt_cast<KDockWidget*>(m_dw->parentDockTabGroup()->
- parent()))->mayBeShow())))
- setChecked(false);
-}
-
-
-void ToggleToolViewAction::slotToggled(bool t)
-{
- if ((!t) && m_dw->mayBeHide() )
- m_dw->undock();
- else
- if ( t && m_dw->mayBeShow() )
- m_mdiMainFrm->makeDockVisible(m_dw);
-}
-
-void ToggleToolViewAction::slotWidgetDestroyed()
-{
- disconnect(m_dw->dockManager(),TQT_SIGNAL(change()),this,TQT_SLOT(anDWChanged()));
- disconnect(this,TQT_SIGNAL(toggled(bool)),0,0);
-
- unplugAll();
- deleteLater();
-}
-
-}
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/guiclient.h b/kmdi/kmdi/guiclient.h
deleted file mode 100644
index c3784fe6e..000000000
--- a/kmdi/kmdi/guiclient.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- based on ktoolbarhandler.cpp: Copyright (C) 2002 Simon Hausmann <hausmann@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 _KMDI_GUICLIENT_H_
-#define _KMDI_GUICLIENT_H_
-
-#include <tqobject.h>
-#include <tqguardedptr.h>
-#include <kxmlguiclient.h>
-#include <kaction.h>
-
-#include <kmdi/global.h>
-
-class KMainWindow;
-class KToolBar;
-
-namespace KMDI {
- class MainWindow;
- class ToolViewAccessor;
-}
-
-class KDockWidget;
-
-namespace KMDIPrivate {
-
-class GUIClientPrivate;
-
-class GUIClient : public TQObject, public KXMLGUIClient
-{
- Q_OBJECT
-
- public:
- GUIClient( KMDI::MainWindow *mdiMainFrm, const char *name = 0 );
- virtual ~GUIClient();
-
- void addToolView(KMDI::ToolViewAccessor*);
-
- private slots:
- void clientAdded( KXMLGUIClient *client );
- void setupActions();
- void actionDeleted(TQObject*);
-
- signals:
- void toggleTop();
- void toggleLeft();
- void toggleRight();
- void toggleBottom();
-
- private:
- GUIClientPrivate *d;
-
- TQGuardedPtr<KMDI::MainWindow> m_mdiMainFrm;
- TQPtrList<KAction> m_toolViewActions;
- TQPtrList<KAction> m_documentViewActions;
-
- KActionMenu *m_docMenu;
- KActionMenu *m_toolMenu;
-
- KActionMenu *m_gotoToolDockMenu;
-};
-
-class ToggleToolViewAction:public KToggleAction
-{
- Q_OBJECT
-
- public:
- ToggleToolViewAction ( const TQString& text, const KShortcut& cut = KShortcut(),
- KDockWidget *dw=0,KMDI::MainWindow *mdiMainFrm=0, TQObject* parent = 0, const char* name = 0 );
-
- virtual ~ToggleToolViewAction();
-
- protected slots:
- void slotToggled(bool);
- void anDWChanged();
- void slotWidgetDestroyed();
-
- private:
- KDockWidget *m_dw;
- KMDI::MainWindow *m_mdiMainFrm;
-};
-
-}
-
-#endif
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/mainwindow.cpp b/kmdi/kmdi/mainwindow.cpp
deleted file mode 100644
index 358791ab0..000000000
--- a/kmdi/kmdi/mainwindow.cpp
+++ /dev/null
@@ -1,451 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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.
-
- Based on:
-
- //----------------------------------------------------------------------------
- // Project : KDE MDI extension
- //
- // begin : 07/1999 by Szymon Stefanek as part of kvirc
- // (an IRC application)
- // changes : 09/1999 by Falk Brettschneider to create an
- // - 06/2000 stand-alone Qt extension set of
- // classes and a Qt-based library
- // : 02/2000 by Massimo Morin (mmorin@schedsys.com)
- // 2000-2003 maintained by the KDevelop project
- // patches : -/2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
- // : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
- //
- // copyright : (C) 1999-2003 by Falk Brettschneider
- // and
- // Szymon Stefanek (stefanek@tin.it)
- // email : falkbr@tdevelop.org (Falk Brettschneider)
- //----------------------------------------------------------------------------
-*/
-
-#include "config.h"
-
-#include "tabwidget.h"
-
-#include <assert.h>
-
-#include <tqcursor.h>
-#include <tqclipboard.h>
-#include <tqobjectlist.h>
-#include <tqpopupmenu.h>
-#include <tqmenubar.h>
-
-#include <kmenubar.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <tdeversion.h>
-#include <tqtabwidget.h>
-#include <klocale.h>
-
-#include <kiconloader.h>
-#include "dockcontainer.h"
-#include "mainwindow.moc"
-
-
-#include <tqtoolbutton.h>
-#include <tqlayout.h>
-#include <tqstring.h>
-#include <tqmap.h>
-#include <tqvaluelist.h>
-
-#include "mainwindow.h"
-#include "dockcontainer.h"
-#include "toolviewaccessor_p.h"
-
-#include "guiclient.h"
-
-namespace KMDIPrivate
-{
- class MainWindowPrivate {
- public:
- MainWindowPrivate() {
- for (int i=0;i<4;i++) {
- activeDockPriority[i]=0;
- m_styleIDEAlMode = 0;
- m_toolviewStyle = 0;
- }
- }
- ~MainWindowPrivate() {}
- KMDI::DockContainer* activeDockPriority[4];
- int m_styleIDEAlMode;
- int m_toolviewStyle;
- };
-}
-
-namespace KMDI
-{
-
-//============ constructor ============//
-MainWindow::MainWindow(TQWidget* parentWidget, const char* name)
- : KParts::DockMainWindow( parentWidget, name)
- , m_toolViews (new TQMap<TQWidget*,KMDI::ToolViewAccessor*>)
- , d(new KMDIPrivate::MainWindowPrivate())
-{
- // setup main dock stuff
- setupMainDock ();
-
- // setup the sidebar framework
- setupToolViews ();
-
- // setup all menu entries
- setupGUIClient ();
-}
-
-//============ ~MainWindow ============//
-MainWindow::~MainWindow()
-{
- delete m_toolViews;
- m_toolViews=0;
-
- delete d;
- d=0;
-}
-
-void MainWindow::setupMainDock ()
-{
- // cover KMdi's childarea by a dockwidget
- KDockWidget *dw = createDockWidget( "mdiAreaCover", TQPixmap(), 0L, "mdi_area_cover");
- dw->setDockWindowTransient(this,true);
- dw->setEnableDocking(KDockWidget::DockNone);
- dw->setDockSite(KDockWidget::DockCorner);
-
- // setup tab widget
- m_tabWidget = new KMDI::TabWidget (dw);
- dw->setWidget(m_tabWidget);
-
- // set this dock to main view
- setView(dw);
- setMainDockWidget(dw);
-
- // connect signals to collapse sidebars
- connect(m_tabWidget,TQT_SIGNAL(focusInEvent()),this,TQT_SIGNAL(collapseOverlapContainers()));
-}
-
-void MainWindow::setupToolViews ()
-{
- m_leftContainer = createDockWidget("KMdiDock::leftDock",SmallIcon("misc"),0L,"Left Dock");
- m_rightContainer = createDockWidget("KMdiDock::rightDock",SmallIcon("misc"),0L,"Right Dock");
- m_topContainer = createDockWidget("KMdiDock::topDock",SmallIcon("misc"),0L,"Top Dock");
- m_bottomContainer = createDockWidget("KMdiDock::bottomDock",SmallIcon("misc"),0L,"Bottom Dock");
-
- KDockWidget *mainDock=getMainDockWidget();
- KDockWidget *w=mainDock;
-
- if (mainDock->parentDockTabGroup()) {
- w=static_cast<KDockWidget*>(TQT_TQWIDGET(mainDock->parentDockTabGroup()->parent()));
- }
-
- TQPtrList<KDockWidget> leftReparentWidgets;
- TQPtrList<KDockWidget> rightReparentWidgets;
- TQPtrList<KDockWidget> bottomReparentWidgets;
- TQPtrList<KDockWidget> topReparentWidgets;
-
- if (mainDock->parentDockTabGroup()) {
- mainDock=static_cast<KDockWidget*>(TQT_TQWIDGET(mainDock->parentDockTabGroup()->parent()));
- }
-
- findToolViewsDockedToMain(&leftReparentWidgets,KDockWidget::DockLeft);
- findToolViewsDockedToMain(&rightReparentWidgets,KDockWidget::DockRight);
- findToolViewsDockedToMain(&bottomReparentWidgets,KDockWidget::DockBottom);
- findToolViewsDockedToMain(&topReparentWidgets,KDockWidget::DockTop);
-
- mainDock->setEnableDocking(KDockWidget::DockNone); //::DockCorner);
- mainDock->setDockSite(KDockWidget::DockCorner);
-
-
- DockContainer *tmpDC;
- m_leftContainer->setWidget(tmpDC=new DockContainer(m_leftContainer, this, KDockWidget::DockLeft, d->m_styleIDEAlMode));
- m_leftContainer->setEnableDocking(KDockWidget::DockLeft);
- m_leftContainer->manualDock(mainDock, KDockWidget::DockLeft,20);
- tmpDC->init();
-
- connect (this,TQT_SIGNAL(toggleLeft()),tmpDC,TQT_SLOT(toggle()));
- connect(this,TQT_SIGNAL(collapseOverlapContainers()),tmpDC,TQT_SLOT(collapseOverlapped()));
- connect(tmpDC,TQT_SIGNAL(activated(DockContainer*)),this,TQT_SLOT(setActiveToolDock(DockContainer*)));
- connect(tmpDC,TQT_SIGNAL(deactivated(DockContainer*)),this,TQT_SLOT(removeFromActiveDockList(DockContainer*)));
-
- m_rightContainer->setWidget(tmpDC=new DockContainer(m_rightContainer, this, KDockWidget::DockRight, d->m_styleIDEAlMode));
- m_rightContainer->setEnableDocking(KDockWidget::DockRight);
- m_rightContainer->manualDock(mainDock, KDockWidget::DockRight,80);
- tmpDC->init();
-
- connect (this,TQT_SIGNAL(toggleRight()),tmpDC,TQT_SLOT(toggle()));
- connect(this,TQT_SIGNAL(collapseOverlapContainers()),tmpDC,TQT_SLOT(collapseOverlapped()));
- connect(tmpDC,TQT_SIGNAL(activated(DockContainer*)),this,TQT_SLOT(setActiveToolDock(DockContainer*)));
- connect(tmpDC,TQT_SIGNAL(deactivated(DockContainer*)),this,TQT_SLOT(removeFromActiveDockList(DockContainer*)));
-
- m_topContainer->setWidget(tmpDC=new DockContainer(m_topContainer, this, KDockWidget::DockTop, d->m_styleIDEAlMode));
- m_topContainer->setEnableDocking(KDockWidget::DockTop);
- m_topContainer->manualDock(mainDock, KDockWidget::DockTop,20);
- tmpDC->init();
-
- connect (this,TQT_SIGNAL(toggleTop()),tmpDC,TQT_SLOT(toggle()));
- connect(this,TQT_SIGNAL(collapseOverlapContainers()),tmpDC,TQT_SLOT(collapseOverlapped()));
- connect(tmpDC,TQT_SIGNAL(activated(DockContainer*)),this,TQT_SLOT(setActiveToolDock(DockContainer*)));
- connect(tmpDC,TQT_SIGNAL(deactivated(DockContainer*)),this,TQT_SLOT(removeFromActiveDockList(DockContainer*)));
-
- m_bottomContainer->setWidget(tmpDC=new DockContainer(m_bottomContainer, this, KDockWidget::DockBottom, d->m_styleIDEAlMode));
- m_bottomContainer->setEnableDocking(KDockWidget::DockBottom);
- m_bottomContainer->manualDock(mainDock, KDockWidget::DockBottom,80);
- tmpDC->init();
-
- connect (this,TQT_SIGNAL(toggleBottom()),tmpDC,TQT_SLOT(toggle()));
- connect(this,TQT_SIGNAL(collapseOverlapContainers()),tmpDC,TQT_SLOT(collapseOverlapped()));
- connect(tmpDC,TQT_SIGNAL(activated(DockContainer*)),this,TQT_SLOT(setActiveToolDock(DockContainer*)));
- connect(tmpDC,TQT_SIGNAL(deactivated(DockContainer*)),this,TQT_SLOT(removeFromActiveDockList(DockContainer*)));
-
- m_leftContainer->setDockSite( KDockWidget::DockCenter );
- m_rightContainer->setDockSite( KDockWidget::DockCenter );
- m_topContainer->setDockSite( KDockWidget::DockCenter );
- m_bottomContainer->setDockSite( KDockWidget::DockCenter );
-
- dockToolViewsIntoContainers(leftReparentWidgets,m_leftContainer);
- dockToolViewsIntoContainers(rightReparentWidgets,m_rightContainer);
- dockToolViewsIntoContainers(bottomReparentWidgets,m_bottomContainer);
- dockToolViewsIntoContainers(topReparentWidgets,m_topContainer);
-
- dockManager->setSpecialLeftDockContainer(m_leftContainer);
- dockManager->setSpecialRightDockContainer(m_rightContainer);
- dockManager->setSpecialTopDockContainer(m_topContainer);
- dockManager->setSpecialBottomDockContainer(m_bottomContainer);
-
- ((DockContainer*) (m_leftContainer->getWidget()))->hideIfNeeded();
- ((DockContainer*) (m_rightContainer->getWidget()))->hideIfNeeded();
- ((DockContainer*) (m_topContainer->getWidget()))->hideIfNeeded();
- ((DockContainer*) (m_bottomContainer->getWidget()))->hideIfNeeded();
-}
-
-void MainWindow::setupGUIClient ()
-{
- m_guiClient = new KMDIPrivate::GUIClient (this);
-
- connect(m_guiClient,TQT_SIGNAL(toggleTop()),this,TQT_SIGNAL(toggleTop()));
- connect(m_guiClient,TQT_SIGNAL(toggleLeft()),this,TQT_SIGNAL(toggleLeft()));
- connect(m_guiClient,TQT_SIGNAL(toggleRight()),this,TQT_SIGNAL(toggleRight()));
- connect(m_guiClient,TQT_SIGNAL(toggleBottom()),this,TQT_SIGNAL(toggleBottom()));
-}
-
-TabWidget *MainWindow::tabWidget ()
-{
- return m_tabWidget;
-}
-
-ToolViewAccessor *MainWindow::createToolWindow()
-{
- return new KMDI::ToolViewAccessor(this);
-}
-
-KMDI::ToolViewAccessor *MainWindow::addToolWindow( TQWidget* pWnd, KDockWidget::DockPosition pos, TQWidget* pTargetWnd, int percent, const TQString& tabToolTip, const TQString& tabCaption)
-{
- TQWidget *tvta=pWnd;
- KDockWidget* pDW = dockManager->getDockWidgetFromName(pWnd->name());
- if (pDW) {
- // probably readDockConfig already created the widgetContainer, use that
- pDW->setWidget(pWnd);
-
- if (pWnd->icon()) {
- pDW->setPixmap(*pWnd->icon());
- }
- pDW->setTabPageLabel((tabCaption==0)?pWnd->caption():tabCaption);
- pDW->setToolTipString(tabToolTip);
- dockManager->removeFromAutoCreateList(pDW);
- pWnd=pDW;
- }
-
- TQRect r=pWnd->geometry();
-
- KMDI::ToolViewAccessor *mtva=new KMDI::ToolViewAccessor(this,pWnd,tabToolTip,(tabCaption==0)?pWnd->caption():tabCaption);
- m_toolViews->insert(tvta,mtva);
-
- if (pos == KDockWidget::DockNone) {
- mtva->d->widgetContainer->setEnableDocking(KDockWidget::DockNone);
- mtva->d->widgetContainer->reparent(this, (WFlags)(WType_TopLevel | WType_Dialog), r.topLeft(), isVisible());
- } else { // add (and dock) the toolview as DockWidget view
- //const TQPixmap& wndIcon = pWnd->icon() ? *(pWnd->icon()) : TQPixmap();
-
- //KDockWidget *pCover=mtva->d->widgetContainer;
-
- mtva->place(pos, pTargetWnd,percent);
- }
-
- return mtva;
-}
-
-void MainWindow::deleteToolWindow( KMDI::ToolViewAccessor *accessor)
-{
- delete accessor;
-}
-
-void MainWindow::deleteToolWindow( TQWidget* pWnd)
-{
- if (!pWnd)
- return;
-
- if (m_toolViews->contains(pWnd)) {
- deleteToolWindow((*m_toolViews)[pWnd]);
- }
-}
-
-void MainWindow::setToolViewStyle(int flag)
-{
- d->m_styleIDEAlMode = flag; // see KMultiTabBar for the first 3 bits
-
- DockContainer *tmpL=::tqqt_cast<KMDI::DockContainer*>(m_leftContainer->getWidget());
- if (tmpL) tmpL->setStyle(flag);
-
- DockContainer *tmpR=::tqqt_cast<KMDI::DockContainer*>(m_rightContainer->getWidget());
- if (tmpR) tmpR->setStyle(flag);
-
- DockContainer *tmpT=::tqqt_cast<KMDI::DockContainer*>(m_topContainer->getWidget());
- if (tmpT) tmpT->setStyle(flag);
-
- DockContainer *tmpB=::tqqt_cast<KMDI::DockContainer*>(m_bottomContainer->getWidget());
- if (tmpB) tmpB->setStyle(flag);
-
- d->m_toolviewStyle = flag;
- bool toolviewExists = false;
- TQMap<TQWidget*,KMDI::ToolViewAccessor*>::Iterator it;
- for (it = m_toolViews->begin(); it != m_toolViews->end(); ++it) {
- KDockWidget *dockWidget = tqt_dynamic_cast<KDockWidget*>(it.data()->wrapperWidget());
- if (dockWidget) {
- if (flag == KMDI::IconOnly)
- {
- dockWidget->setTabPageLabel(" ");
- dockWidget->setPixmap(*(it.data()->wrappedWidget()->icon()));
- } else
- if (flag == KMDI::TextOnly)
- {
- dockWidget->setPixmap(); //FIXME: Does not hide the icon in the IDEAl mode.
- dockWidget->setTabPageLabel(it.data()->wrappedWidget()->caption());
- } else
- if (flag == KMDI::TextAndIcon)
- {
- dockWidget->setPixmap(*(it.data()->wrappedWidget()->icon()));
- dockWidget->setTabPageLabel(it.data()->wrappedWidget()->caption());
- }
- toolviewExists = true;
- }
- }
- if (toolviewExists)
- {
- //workaround for the above FIXME to make switching to TextOnly mode work in IDEAl as well. Be sure that this version of switch* is called.
- if (flag == KMDI::TextOnly)
- {
- /* MainWindow::switchToTabPageMode();
- MainWindow::switchToIDEAlMode();*/ //TODO
- } else
- {
- writeDockConfig();
- readDockConfig();
- }
- }
-}
-
-void MainWindow::dockToolViewsIntoContainers(TQPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container) {
- for ( KDockWidget *dw = widgetsToReparent.first(); dw;
- dw=widgetsToReparent.next()){
- dw->manualDock(container,KDockWidget::DockCenter,20);
- dw->loseFormerBrotherDockWidget();
- }
-}
-
-void MainWindow::findToolViewsDockedToMain(TQPtrList<KDockWidget>* list,KDockWidget::DockPosition dprtmw) {
- KDockWidget *mainDock=getMainDockWidget();
- if (mainDock->parentDockTabGroup()) {
- mainDock=tqt_dynamic_cast<KDockWidget*>(mainDock->parentDockTabGroup()->parent());
- // FIXME: will likely crash below due to unchecked cast
- }
-
- KDockWidget* widget=mainDock->findNearestDockWidget(dprtmw);
- if (widget) {
- if (widget->parentDockTabGroup()) {
- widget=static_cast<KDockWidget*>(TQT_TQWIDGET(widget->parentDockTabGroup()->parent()));
- }
-
- if (widget) {
- KDockTabGroup *tg=tqt_dynamic_cast<KDockTabGroup*>(widget->
- getWidget());
- if (tg) {
- kdDebug(760)<<"KDockTabGroup found"<<endl;
- for (int i=0;i<tg->count();i++)
- list->append((KDockWidget*)static_cast<KDockWidget*>(
- tg->page(i)));
- } else
- list->append((KDockWidget*)widget);
- } else
- kdDebug(760)<<"setupToolViewsForIDEALMode: no widget found"<<endl;
- } else
- kdDebug(760)<<"No main dock widget found"<<endl;
-}
-
-void MainWindow::setActiveToolDock(DockContainer* td) {
- if (td==d->activeDockPriority[0]) return;
- if (d->activeDockPriority[0]==0) {
- d->activeDockPriority[0]=td;
- // d->focusList=new KMdiFocusList(this);
- // if (m_pMdi) d->focusList->addWidgetTree(m_pMdi);
- // if (m_documentTabWidget) d->focusList->addWidgetTree(m_documentTabWidget);
- return;
- }
- for (int dst=3,src=2;src>=0;dst--,src--) {
- if (d->activeDockPriority[src]==td) src--;
- if (src<0) break;
- d->activeDockPriority[dst]=d->activeDockPriority[src];
- }
- d->activeDockPriority[0]=td;
-}
-
-void MainWindow::removeFromActiveDockList(DockContainer* td) {
- for (int i=0;i<4;i++) {
- if (d->activeDockPriority[i]==td) {
- for (;i<3;i++)
- d->activeDockPriority[i]=d->activeDockPriority[i+1];
- d->activeDockPriority[3]=0;
- break;
- }
- }
- /*
- if (d->activeDockPriority[0]==0) {
- if (d->focusList) d->focusList->restore();
- delete d->focusList;
- d->focusList=0;
- }
- */
-}
-
-void MainWindow::prevToolViewInDock() {
- DockContainer* td=d->activeDockPriority[0];
- if (!td) return;
- td->prevToolView();
-}
-
-void MainWindow::nextToolViewInDock() {
- DockContainer* td=d->activeDockPriority[0];
- if (!td) return;
- td->nextToolView();
-}
-
-}
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/mainwindow.h b/kmdi/kmdi/mainwindow.h
deleted file mode 100644
index 953d248de..000000000
--- a/kmdi/kmdi/mainwindow.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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.
-
- Based on:
-
- //----------------------------------------------------------------------------
- // Project : KDE MDI extension
- //
- // begin : 07/1999 by Szymon Stefanek as part of kvirc
- // (an IRC application)
- // changes : 09/1999 by Falk Brettschneider to create an
- // - 06/2000 stand-alone Qt extension set of
- // classes and a Qt-based library
- // : 02/2000 by Massimo Morin (mmorin@schedsys.com)
- // 2000-2003 maintained by the KDevelop project
- // patches : -/2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
- // : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
- //
- // copyright : (C) 1999-2003 by Falk Brettschneider
- // and
- // Szymon Stefanek (stefanek@tin.it)
- // email : falkbr@tdevelop.org (Falk Brettschneider)
- //----------------------------------------------------------------------------
-*/
-
-#ifndef _KMDI_MAINWINDOW_H_
-#define _KMDI_MAINWINDOW_H_
-
-#include <kparts/dockmainwindow.h>
-#include <kmenubar.h>
-#include <kpopupmenu.h>
-
-#include <tqptrlist.h>
-#include <tqrect.h>
-#include <tqapplication.h>
-#include <tqguardedptr.h>
-
-#include <kmdi/global.h>
-
-class TQPopupMenu;
-class TQMenuBar;
-
-#include <kmdi/toolviewaccessor.h>
-
-namespace KMDIPrivate {
- class MainWindowPrivate;
- class GUIClient;
-}
-
-namespace KMDI
-{
-
-class DockContainer;
-class TabWidget;
-
-class KMDI_EXPORT MainWindow : public KParts::DockMainWindow
-{
- Q_OBJECT
-
- friend class KMDI::ToolViewAccessor;
-
- public:
- /**
- * Constructor.
- */
- MainWindow ( TQWidget* parentWidget, const char* name = "");
-
- /**
- * Destructor.
- */
- virtual ~MainWindow ();
-
- public:
- /**
- * get the central tabwidget
- * add all your content as child to this widget
- * or as multiple tabs
- * @return tabwidget in central of window
- */
- TabWidget *tabWidget ();
-
- /**
- * Using this method you have to use the setWidget method of the access object, and it is very recommendet, that you use
- * the widgetContainer() method for the parent of your newly created widget
- * @return created toolview
- */
- KMDI::ToolViewAccessor *createToolWindow();
-
- /**
- * Usually called from addWindow() when adding a tool view window. It reparents the given widget
- * as toplevel and stay-on-top on the application's main widget.
- * @param pWnd widget for the toolview
- * @param pos docking position
- * @param pTargetWnd
- * @param percent
- * @param tabToolTip
- * @param tabCaption
- * @return created toolview
- */
- KMDI::ToolViewAccessor *addToolWindow( TQWidget* pWnd, KDockWidget::DockPosition pos = KDockWidget::DockNone, TQWidget* pTargetWnd = 0L, int percent = 50, const TQString& tabToolTip = 0, const TQString& tabCaption = 0);
-
- /**
- * delete the toolview belonging to the given accessor
- * @param accessor toolview to delete
- */
- void deleteToolWindow( KMDI::ToolViewAccessor *accessor);
-
- /**
- * delete the toolview belonging to the given pWnd
- * @param pWnd toolview to be deleted
- */
- void deleteToolWindow( TQWidget* pWnd);
-
- /**
- * Sets the appearance of the toolview tabs.
- * @param flags See KMDI::ToolviewStyle.
- */
- void setToolViewStyle(int flags);
-
- public slots:
- void prevToolViewInDock();
- void nextToolViewInDock();
-
- signals:
- void collapseOverlapContainers();
-
- protected:
- void findToolViewsDockedToMain(TQPtrList<KDockWidget>* list,KDockWidget::DockPosition dprtmw);
- void dockToolViewsIntoContainers(TQPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container);
-
- private:
- /**
- * setup main dock + tab widget
- */
- void setupMainDock ();
-
- /**
- * setup the sidebars for the toolviews
- * and other internals to get them working
- */
- void setupToolViews ();
-
- /**
- * setup the menuentries
- * must be done AFTER setupToolViews ()
- */
- void setupGUIClient ();
-
- private slots:
- void setActiveToolDock(DockContainer*);
- void removeFromActiveDockList(DockContainer*);
-
- #define protected public
- signals:
- #undef protected
- void toggleTop();
- void toggleLeft();
- void toggleRight();
- void toggleBottom();
-
- protected:
- KMDIPrivate::GUIClient *m_guiClient;
- TQMap <TQWidget*, KMDI::ToolViewAccessor*> *m_toolViews;
-
- KDockWidget *m_leftContainer;
- KDockWidget *m_rightContainer;
- KDockWidget *m_topContainer;
- KDockWidget *m_bottomContainer;
-
- KMDI::TabWidget *m_tabWidget;
-
- private:
- /**
- * private d-pointer for BC
- */
- KMDIPrivate::MainWindowPrivate *d;
-};
-
-}
-
-#endif //_MainWindow_H_
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/tabwidget.cpp b/kmdi/kmdi/tabwidget.cpp
deleted file mode 100644
index 2d9603bf5..000000000
--- a/kmdi/kmdi/tabwidget.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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.
-
- Based on:
-
- //----------------------------------------------------------------------------
- // Project : KDE MDI extension
- //
- // begin : 07/1999 by Szymon Stefanek as part of kvirc
- // (an IRC application)
- // changes : 09/1999 by Falk Brettschneider to create an
- // - 06/2000 stand-alone Qt extension set of
- // classes and a Qt-based library
- // : 02/2000 by Massimo Morin (mmorin@schedsys.com)
- // 2000-2003 maintained by the KDevelop project
- // patches : -/2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
- // : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
- //
- // copyright : (C) 1999-2003 by Falk Brettschneider
- // and
- // Szymon Stefanek (stefanek@tin.it)
- // email : falkbr@tdevelop.org (Falk Brettschneider)
- //----------------------------------------------------------------------------
-*/
-
-#include <ktabbar.h>
-#include <kpopupmenu.h>
-#include <kdebug.h>
-
-#include <tqobjectlist.h>
-
-#include "tabwidget.h"
-#include "tabwidget.moc"
-
-namespace KMDIPrivate
-{
- class TabWidgetPrivate
- {
-
- };
-}
-
-namespace KMDI
-{
-
-TabWidget::TabWidget(TQWidget* parent, const char* name)
- : KTabWidget(parent,name)
- , m_visibility (KMDI::ShowWhenMoreThanOneTab)
- , d (new KMDIPrivate::TabWidgetPrivate())
-{
- installEventFilter (this);
-
- tabBar()->hide();
-
- setHoverCloseButton(true);
-
- connect(this, TQT_SIGNAL(closeRequest(TQWidget*)), this, TQT_SLOT(closeTab(TQWidget*)));
-}
-
-TabWidget::~TabWidget()
-{
- delete d;
- d = 0;
-}
-
-bool TabWidget::eventFilter(TQObject *obj, TQEvent *e )
-{
- if(e->type() == TQEvent::FocusIn)
- {
- emit focusInEvent ();
- }
- else if (e->type() == TQEvent::ChildRemoved)
- {
- // if we lost a child we uninstall ourself as event filter for the lost
- // child and its children
- TQObject* pLostChild = TQT_TQOBJECT(((TQChildEvent*)e)->child());
- if ((pLostChild != 0L) && (pLostChild->isWidgetType())) {
- TQObjectList *list = pLostChild->queryList( TQWIDGET_OBJECT_NAME_STRING );
- list->insert(0, pLostChild); // add the lost child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all lost child widgets
- TQObject * o;
- while ( (o=it.current()) != 0 ) { // for each found object...
- TQWidget* widg = (TQWidget*)o;
- ++it;
- widg->removeEventFilter(this);
- }
- delete list; // delete the list, not the objects
- }
- }
- else if (e->type() == TQEvent::ChildInserted)
- {
- // if we got a new child and we are attached to the MDI system we
- // install ourself as event filter for the new child and its children
- // (as we did when we were added to the MDI system).
- TQObject* pNewChild = TQT_TQOBJECT(((TQChildEvent*)e)->child());
- if ((pNewChild != 0L) && (pNewChild->isWidgetType()))
- {
- TQWidget* pNewWidget = (TQWidget*)pNewChild;
- if (pNewWidget->testWFlags((WFlags)(WType_Dialog | WShowModal)))
- return false;
- TQObjectList *list = pNewWidget->queryList( TQWIDGET_OBJECT_NAME_STRING );
- list->insert(0, pNewChild); // add the new child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all new child widgets
- TQObject * o;
- while ( (o=it.current()) != 0 ) { // for each found object...
- TQWidget* widg = (TQWidget*)o;
- ++it;
- widg->installEventFilter(this);
- connect(widg, TQT_SIGNAL(destroyed()), this, TQT_SLOT(childDestroyed()));
- }
- delete list; // delete the list, not the objects
- }
- }
-
- return KTabWidget::eventFilter (obj, e);
-}
-
-void TabWidget::childDestroyed()
-{
- // if we lost a child we uninstall ourself as event filter for the lost
- // child and its children
- const TQObject* pLostChild = TQT_TQOBJECT_CONST(sender());
- if ((pLostChild != 0L) && (pLostChild->isWidgetType()))
- {
- TQObjectList *list = ((TQObject*)(pLostChild))->queryList(TQWIDGET_OBJECT_NAME_STRING);
- list->insert(0, pLostChild); // add the lost child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all lost child widgets
- TQObject * obj;
- while ( (obj=it.current()) != 0 ) { // for each found object...
- TQWidget* widg = (TQWidget*)obj;
- ++it;
- widg->removeEventFilter(this);
- }
- delete list; // delete the list, not the objects
- }
-}
-
-void TabWidget::closeTab(TQWidget* w)
-{
- w->close();
-}
-
-void TabWidget::addTab ( TQWidget * child, const TQString & label )
-{
- KTabWidget::addTab(child,label);
- showPage(child);
- maybeShow();
-}
-
-void TabWidget::addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label )
-{
- KTabWidget::addTab(child,iconset,label);
- showPage(child);
- maybeShow();
-}
-
-void TabWidget::addTab ( TQWidget * child, TQTab * tab )
-{
- KTabWidget::addTab(child,tab);
- showPage(child);
- maybeShow();
-}
-
-void TabWidget::insertTab ( TQWidget * child, const TQString & label, int index)
-{
- KTabWidget::insertTab(child,label,index);
- showPage(child);
- maybeShow();
- tabBar()->repaint();
-}
-
-void TabWidget::insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index )
-{
- KTabWidget::insertTab(child,iconset,label,index);
- showPage(child);
- maybeShow();
- tabBar()->repaint();
-}
-
-void TabWidget::insertTab ( TQWidget * child, TQTab * tab, int index)
-{
- KTabWidget::insertTab(child,tab,index);
- showPage(child);
- maybeShow();
- tabBar()->repaint();
-}
-
-void TabWidget::removePage ( TQWidget * w )
-{
- KTabWidget::removePage(w);
- maybeShow();
-}
-
-void TabWidget::updateIconInView( TQWidget *w, TQPixmap icon )
-{
- changeTab(w,icon,tabLabel(w));
-}
-
-void TabWidget::updateCaptionInView( TQWidget *w, const TQString &caption )
-{
- changeTab(w, caption);
-}
-
-void TabWidget::maybeShow()
-{
- switch (m_visibility)
- {
- case KMDI::AlwaysShowTabs:
- tabBar()->show();
-
- // show/hide corner widgets
- if (count() == 0)
- setCornerWidgetVisibility(false);
- else
- setCornerWidgetVisibility(true);
-
- break;
-
- case KMDI::ShowWhenMoreThanOneTab:
- if (count()<2) tabBar()->hide();
- else tabBar()->show();
-
- // show/hide corner widgets
- if (count() < 2)
- setCornerWidgetVisibility(false);
- else
- setCornerWidgetVisibility(true);
-
- break;
-
- case KMDI::NeverShowTabs:
- tabBar()->hide();
- break;
- }
-}
-
-void TabWidget::setCornerWidgetVisibility(bool visible) {
- // there are two corner widgets: on TopLeft and on TopTight!
-
- if (cornerWidget(TQt::TopLeft) ) {
- if (visible)
- cornerWidget(TQt::TopLeft)->show();
- else
- cornerWidget(TQt::TopLeft)->hide();
- }
-
- if (cornerWidget(TQt::TopRight) ) {
- if (visible)
- cornerWidget(TQt::TopRight)->show();
- else
- cornerWidget(TQt::TopRight)->hide();
- }
-}
-
-void TabWidget::setTabWidgetVisibility( KMDI::TabWidgetVisibility visibility )
-{
- m_visibility = visibility;
- maybeShow();
-}
-
-KMDI::TabWidgetVisibility TabWidget::tabWidgetVisibility( ) const
-{
- return m_visibility;
-}
-
-}
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/tabwidget.h b/kmdi/kmdi/tabwidget.h
deleted file mode 100644
index 61f9e7d32..000000000
--- a/kmdi/kmdi/tabwidget.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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.
-
- Based on:
-
- //----------------------------------------------------------------------------
- // Project : KDE MDI extension
- //
- // begin : 07/1999 by Szymon Stefanek as part of kvirc
- // (an IRC application)
- // changes : 09/1999 by Falk Brettschneider to create an
- // - 06/2000 stand-alone Qt extension set of
- // classes and a Qt-based library
- // : 02/2000 by Massimo Morin (mmorin@schedsys.com)
- // 2000-2003 maintained by the KDevelop project
- // patches : -/2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
- // : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
- //
- // copyright : (C) 1999-2003 by Falk Brettschneider
- // and
- // Szymon Stefanek (stefanek@tin.it)
- // email : falkbr@tdevelop.org (Falk Brettschneider)
- //----------------------------------------------------------------------------
-*/
-
-#ifndef _KMDI_TABWIDGET_H_
-#define _KMDI_TABWIDGET_H_
-
-#include <ktabwidget.h>
-#include <kmdi/global.h>
-
-namespace KMDIPrivate
-{
- class TabWidgetPrivate;
-}
-
-namespace KMDI
-{
-
-class KMDI_EXPORT TabWidget : public KTabWidget
-{
- Q_OBJECT
-
- public:
- TabWidget(TQWidget* parent, const char* name=0);
- virtual ~TabWidget();
-
- virtual void addTab ( TQWidget * child, const TQString & label );
-
- virtual void addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label );
-
- virtual void addTab ( TQWidget * child, TQTab * tab );
-
- virtual void insertTab ( TQWidget * child, const TQString & label, int index = -1 );
-
- virtual void insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index = -1 );
-
- virtual void insertTab ( TQWidget * child, TQTab * tab, int index = -1 );
-
- virtual void removePage ( TQWidget * w );
-
- KMDI::TabWidgetVisibility tabWidgetVisibility() const;
-
- void setTabWidgetVisibility( KMDI::TabWidgetVisibility );
-
- bool eventFilter(TQObject *obj, TQEvent *e );
-
- private slots:
- void closeTab(TQWidget* w);
-
- public slots:
- void updateIconInView(TQWidget*,TQPixmap);
- void updateCaptionInView(TQWidget*,const TQString&);
-
- signals:
- void focusInEvent ();
-
- protected slots:
- void childDestroyed ();
-
- private:
- void maybeShow();
- void setCornerWidgetVisibility(bool visible);
-
- private:
- KMDI::TabWidgetVisibility m_visibility;
-
- private:
- /**
- * private d-pointer for BC
- */
- KMDIPrivate::TabWidgetPrivate *d;
-};
-
-}
-
-#endif
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/toolviewaccessor.cpp b/kmdi/kmdi/toolviewaccessor.cpp
deleted file mode 100644
index c0d191ff4..000000000
--- a/kmdi/kmdi/toolviewaccessor.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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.
-*/
-
-#include <kdebug.h>
-
-#include "toolviewaccessor_p.h"
-#include "guiclient.h"
-#include "mainwindow.h"
-
-#include "toolviewaccessor.h"
-#include "toolviewaccessor.moc"
-
-#include "toolviewaccessor_p.h"
-
-namespace KMDI
-{
-
-ToolViewAccessor::ToolViewAccessor( KMDI::MainWindow *parent, TQWidget *widgetToWrap, const TQString& tabToolTip, const TQString& tabCaption)
-: TQObject(parent)
-{
- mdiMainFrm=parent;
- d=new KMDIPrivate::ToolViewAccessorPrivate();
- if (widgetToWrap->inherits("KDockWidget")) {
- d->widgetContainer=tqt_dynamic_cast<KDockWidget*>(widgetToWrap);
- d->widget=d->widgetContainer->getWidget();
- } else {
- d->widget=widgetToWrap;
- TQString finalTabCaption;
- if (tabCaption == 0) {
- finalTabCaption = widgetToWrap->caption();
- if (finalTabCaption.isEmpty() && !widgetToWrap->icon()) {
- finalTabCaption = widgetToWrap->name();
- }
- }
- else {
- finalTabCaption = tabCaption;
- }
- d->widgetContainer= parent->createDockWidget( widgetToWrap->name(),
- (widgetToWrap->icon()?(*(widgetToWrap->icon())):TQPixmap()),
- 0L, // parent
- widgetToWrap->caption(),
- finalTabCaption);
- d->widgetContainer->setWidget(widgetToWrap);
- if (tabToolTip!=0) {
- d->widgetContainer->setToolTipString(tabToolTip);
- }
- }
-
- //mdiMainFrm->m_toolViews.insert(d->widget,this);
- mdiMainFrm->m_guiClient->addToolView(this);
- d->widget->installEventFilter(this);
-}
-
-ToolViewAccessor::ToolViewAccessor( KMDI::MainWindow *parent) : TQObject(parent) {
- mdiMainFrm=parent;
- d=new KMDIPrivate::ToolViewAccessorPrivate();
-}
-
-ToolViewAccessor::~ToolViewAccessor() {
- if (mdiMainFrm->m_toolViews)
- mdiMainFrm->m_toolViews->remove(d->widget);
- delete d;
-
-}
-
-TQWidget *ToolViewAccessor::wrapperWidget() {
- if (!d->widgetContainer) {
- d->widgetContainer=mdiMainFrm->createDockWidget( "ToolViewAccessor::null",TQPixmap());
- connect(d->widgetContainer,TQT_SIGNAL(widgetSet(TQWidget*)),this,TQT_SLOT(setWidgetToWrap(TQWidget*)));
- }
- return d->widgetContainer;
-}
-
-TQWidget *ToolViewAccessor::wrappedWidget() {
- return d->widget;
-}
-
-
-void ToolViewAccessor::setWidgetToWrap(TQWidget *widgetToWrap, const TQString& tabToolTip, const TQString& tabCaption)
-{
- Q_ASSERT(!(d->widget));
- Q_ASSERT(!widgetToWrap->inherits("KDockWidget"));
- disconnect(d->widgetContainer,TQT_SIGNAL(widgetSet(TQWidget*)),this,TQT_SLOT(setWidgetToWrap(TQWidget*)));
- delete d->widget;
- d->widget=widgetToWrap;
- KDockWidget *tmp=d->widgetContainer;
-
- TQString finalTabCaption;
- if (tabCaption == 0) {
- finalTabCaption = widgetToWrap->caption();
- if (finalTabCaption.isEmpty() && !widgetToWrap->icon()) {
- finalTabCaption = widgetToWrap->name();
- }
- }
- else {
- finalTabCaption = tabCaption;
- }
-
- if (!tmp) {
- tmp = mdiMainFrm->createDockWidget( widgetToWrap->name(),
- widgetToWrap->icon()?(*(widgetToWrap->icon())):TQPixmap(),
- 0L, // parent
- widgetToWrap->caption(),
- finalTabCaption );
- d->widgetContainer= tmp;
- if (tabToolTip!=0) {
- d->widgetContainer->setToolTipString(tabToolTip);
- }
- }
- else {
- tmp->setCaption(widgetToWrap->caption());
- tmp->setTabPageLabel(finalTabCaption);
- tmp->setPixmap(widgetToWrap->icon()?(*(widgetToWrap->icon())):TQPixmap());
- tmp->setName(widgetToWrap->name());
- if (tabToolTip!=0) {
- d->widgetContainer->setToolTipString(tabToolTip);
- }
- }
- tmp->setWidget(widgetToWrap);
- mdiMainFrm->m_toolViews->insert(widgetToWrap,this);
- mdiMainFrm->m_guiClient->addToolView(this);
-
- d->widget->installEventFilter(this);
-}
-
-
-bool ToolViewAccessor::eventFilter(TQObject *o, TQEvent *e) {
- if (e->type()==TQEvent::IconChange) {
- d->widgetContainer->setPixmap(d->widget->icon()?(*d->widget->icon()):TQPixmap());
- }
- return false;
-}
-
-void ToolViewAccessor::placeAndShow(KDockWidget::DockPosition pos, TQWidget* pTargetWnd ,int percent)
-{
- place(pos,pTargetWnd,percent);
- show();
-}
-void ToolViewAccessor::place(KDockWidget::DockPosition pos, TQWidget* pTargetWnd ,int percent)
-{
- Q_ASSERT(d->widgetContainer);
- if (!d->widgetContainer) return;
- if (pos == KDockWidget::DockNone) {
- d->widgetContainer->setEnableDocking(KDockWidget::DockNone);
- d->widgetContainer->reparent(mdiMainFrm, (WFlags)(WType_TopLevel | WType_Dialog), TQPoint(0,0), mdiMainFrm->isVisible());
- }
- else { // add (and dock) the toolview as DockWidget view
-
- KDockWidget* pCover = d->widgetContainer;
-
- KDockWidget* pTargetDock = 0L;
- if (pTargetWnd->inherits("KDockWidget") || pTargetWnd->inherits("KDockWidget_Compat::KDockWidget")) {
- pTargetDock = (KDockWidget*) pTargetWnd;
- }
-
- // Should we dock to ourself?
- bool DockToOurself = false;
- if (mdiMainFrm->getMainDockWidget()) {
- if (pTargetWnd == mdiMainFrm->getMainDockWidget()->getWidget()) {
- DockToOurself = true;
- pTargetDock = mdiMainFrm->getMainDockWidget();
- }
- else if (pTargetWnd == mdiMainFrm->getMainDockWidget()) {
- DockToOurself = true;
- pTargetDock = mdiMainFrm->getMainDockWidget();
- }
- }
- // this is not inheriting TQWidget*, its plain impossible that this condition is true
- //if (pTargetWnd == this) DockToOurself = true;
- if (!DockToOurself) if(pTargetWnd != 0L) {
- pTargetDock = mdiMainFrm->dockManager->findWidgetParentDock( pTargetWnd);
- if (!pTargetDock) {
- if (pTargetWnd->parentWidget()) {
- pTargetDock = mdiMainFrm->dockManager->findWidgetParentDock( pTargetWnd->parentWidget());
- }
- }
- }
- /* if (!pTargetDock || pTargetWnd == mdiMainFrm->getMainDockWidget()) {
- if (mdiMainFrm->m_managedDockPositionMode && (mdiMainFrm->m_pMdi || mdiMainFrm->m_documentTabWidget)) {
- KDockWidget *dw1=pTargetDock->findNearestDockWidget(pos);
- if (dw1)
- pCover->manualDock(dw1,KDockWidget::DockCenter,percent);
- else
- pCover->manualDock ( pTargetDock, pos, 20 );
- return;
- }
- }*/ //TODO
- pCover->manualDock( pTargetDock, pos, percent);
-//check pCover->show();
- }
-}
-
-void ToolViewAccessor::hide() {
- Q_ASSERT(d->widgetContainer);
- if (!d->widgetContainer) return;
- d->widgetContainer->undock();
-}
-
-void ToolViewAccessor::show() {
- Q_ASSERT(d->widgetContainer);
- if (!d->widgetContainer) return;
- d->widgetContainer->makeDockVisible();
-}
-
-}
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/toolviewaccessor.h b/kmdi/kmdi/toolviewaccessor.h
deleted file mode 100644
index 75d9a863e..000000000
--- a/kmdi/kmdi/toolviewaccessor.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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 _KMDI_TOOLVIEWACCESSOR_H_
-#define _KMDI_TOOLVIEWACCESSOR_H_
-
-#include <tqwidget.h>
-#include <tqpixmap.h>
-#include <tqrect.h>
-#include <tqapplication.h>
-#include <tqdatetime.h>
-
-#include <kdockwidget.h>
-
-namespace KMDIPrivate {
- class GUIClient;
- class ToolViewAccessorPrivate;
-}
-
-namespace KMDI {
-
-class MainWindow;
-
-class ToolViewAccessor : public TQObject
-{
- Q_OBJECT
-
- friend class KMDI::MainWindow;
- friend class KMDIPrivate::GUIClient;
-
-private:
- /**
- * Internally used by KMDI::MainWindow to store a temporary information that the method
- * activate() is unnecessary and that it can by escaped.
- * This saves from unnecessary calls when activate is called directly.
- */
- bool m_bInterruptActivation;
- /**
- * Internally used to prevent cycles between KMDI::MainWindow::activateView() and KMdiChildView::activate().
- */
- bool m_bMainframesActivateViewIsPending;
- /**
- *
- */
- bool m_bFocusInEventIsPending;
-
-private:
- ToolViewAccessor( KMDI::MainWindow *parent , TQWidget *widgetToWrap, const TQString& tabToolTip = 0, const TQString& tabCaption = 0);
- ToolViewAccessor( KMDI::MainWindow *parent);
-public:
- ~ToolViewAccessor();
- TQWidget *wrapperWidget();
- TQWidget *wrappedWidget();
- void place(KDockWidget::DockPosition pos = KDockWidget::DockNone, TQWidget* pTargetWnd = 0L,int percent = 50);
- void placeAndShow(KDockWidget::DockPosition pos = KDockWidget::DockNone, TQWidget* pTargetWnd = 0L,int percent = 50);
- void show();
-public slots:
- void setWidgetToWrap(TQWidget* widgetToWrap, const TQString& tabToolTip = 0, const TQString& tabCaption = 0);
- void hide();
-private:
- KMDIPrivate::ToolViewAccessorPrivate *d;
- KMDI::MainWindow *mdiMainFrm;
-
-protected:
- bool eventFilter(TQObject *o, TQEvent *e);
-};
-
-}
-
-#endif //_KMDITOOLVIEWACCESSOR_H_
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
diff --git a/kmdi/kmdi/toolviewaccessor_p.h b/kmdi/kmdi/toolviewaccessor_p.h
deleted file mode 100644
index 71ffb286a..000000000
--- a/kmdi/kmdi/toolviewaccessor_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger <jowenn@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 as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- 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 KMDI_TOOLVIEW_ACCESSOR_PRIVATE_H_
-#define KMDI_TOOLVIEW_ACCESSOR_PRIVATE_H_
-
-#include <kdockwidget.h>
-#include <tqguardedptr.h>
-#include <kaction.h>
-
-namespace KMDIPrivate
-{
-
-class ToolViewAccessorPrivate
-{
- public:
- ToolViewAccessorPrivate()
- : widgetContainer (0)
- , widget (0)
- {
- }
-
- ~ToolViewAccessorPrivate()
- {
- delete action;
-
- if (!widgetContainer.isNull())
- widgetContainer->undock();
-
- delete (KDockWidget*)widgetContainer;
- }
-
- TQGuardedPtr<KDockWidget> widgetContainer;
- TQWidget *widget;
- TQGuardedPtr<KAction> action;
-};
-
-}
-
-#endif
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
-
-
diff --git a/kmdi/kmdichildarea.cpp b/kmdi/kmdichildarea.cpp
deleted file mode 100644
index 342fbdd9c..000000000
--- a/kmdi/kmdichildarea.cpp
+++ /dev/null
@@ -1,793 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildarea.cpp
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#include "kmdichildarea.h"
-#include "kmdichildarea.moc"
-
-#include "kmdidefines.h"
-
-#include <kconfig.h>
-#include <kdebug.h>
-#include <kglobal.h>
-#include <kglobalsettings.h>
-
-#include <math.h>
-#include <tqpopupmenu.h>
-
-
-///////////////////////////////////////////////////////////////////////////////
-// KMdiChildArea
-///////////////////////////////////////////////////////////////////////////////
-
-//============ KMdiChildArea ============//
-
-KMdiChildArea::KMdiChildArea( TQWidget *parent )
- : TQFrame( parent, "kmdi_childarea" )
-{
- setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
- m_captionFont = TQFont();
- TQFontMetrics fm( m_captionFont );
- m_captionFontLineSpacing = fm.lineSpacing();
- m_captionActiveBackColor = TDEGlobalSettings::activeTitleColor();
- m_captionActiveForeColor = TDEGlobalSettings::activeTextColor();
- m_captionInactiveBackColor = TDEGlobalSettings::inactiveTitleColor();
- m_captionInactiveForeColor = TDEGlobalSettings::inactiveTextColor();
- m_pZ = new TQPtrList<KMdiChildFrm>;
- m_pZ->setAutoDelete( true );
- setFocusPolicy( TQ_ClickFocus );
- m_defaultChildFrmSize = TQSize( 400, 300 );
-}
-
-
-KMdiChildArea::~KMdiChildArea()
-{
- delete m_pZ; //This will destroy all the widgets inside.
-}
-
-
-void KMdiChildArea::manageChild( KMdiChildFrm* child, bool show, bool cascade )
-{
- kdDebug( 760 ) << k_funcinfo << "Adding child " << child << " to be managed" << endl;
- KMdiChildFrm* top = topChild();
-
- //remove old references. There can be more than one so we remove them all
- if ( m_pZ->findRef( child ) != -1 )
- {
- //TQPtrList::find* moves current() to the found item
- m_pZ->take();
- while ( m_pZ->findNextRef( child ) != -1 )
- m_pZ->take();
- }
-
- if ( show )
- m_pZ->append( child ); //visible -> first in the Z order
- else
- m_pZ->insert( 0, child ); //hidden -> last in the Z order
-
- if ( cascade )
- child->move( getCascadePoint( m_pZ->count() - 1 ) );
-
- if ( show )
- {
- if ( top && top->state() == KMdiChildFrm::Maximized )
- {
- kdDebug( 760 ) << k_funcinfo << "Maximizing the new child" << endl;
- emit sysButtonConnectionsMustChange( top, child );
- top->setState( KMdiChildFrm::Normal, false /*animate*/ );
- child->setState( KMdiChildFrm::Maximized, false /*animate*/ );
- }
- child->show();
- focusTopChild();
- }
-}
-
-
-void KMdiChildArea::destroyChild( KMdiChildFrm *child, bool focusTop )
-{
- kdDebug( 760 ) << k_funcinfo << "Removing child " << child->caption() << endl;
- bool wasMaximized = ( child->state() == KMdiChildFrm::Maximized );
-
- // destroy the old one
- disconnect( child );
- child->blockSignals( true );
- m_pZ->setAutoDelete( false );
- m_pZ->removeRef( child );
-
- // focus the next new childframe
- KMdiChildFrm* newTopChild = topChild();
- if ( wasMaximized )
- {
- if ( newTopChild )
- {
- newTopChild->setState( KMdiChildFrm::Maximized, false );
- emit sysButtonConnectionsMustChange( child, newTopChild );
- }
- else
- emit noMaximizedChildFrmLeft( child ); // last childframe removed
- }
-
- delete child;
- m_pZ->setAutoDelete( true );
-
- if ( focusTop )
- focusTopChild();
-}
-
-
-void KMdiChildArea::destroyChildButNotItsView( KMdiChildFrm* child, bool focusTop )
-{
- kdDebug( 760 ) << k_funcinfo << "Removing child " << child->caption() << endl;
- bool wasMaximized = ( child->state() == KMdiChildFrm::Maximized );
-
- // destroy the old one
- disconnect( child );
- child->unsetClient();
- m_pZ->setAutoDelete( false );
- m_pZ->removeRef( child );
-
- // focus the next new childframe
- KMdiChildFrm* newTopChild = topChild();
- if ( wasMaximized )
- {
- if ( newTopChild )
- {
- newTopChild->setState( KMdiChildFrm::Maximized, false );
- emit sysButtonConnectionsMustChange( child, newTopChild );
- }
- else
- emit noMaximizedChildFrmLeft( child ); // last childframe removed
- }
- delete child;
- m_pZ->setAutoDelete( true );
-
- if ( focusTop )
- focusTopChild();
-}
-
-void KMdiChildArea::setTopChild( KMdiChildFrm* child, bool /* bSetFocus */ )
-{
- if ( !child )
- return;
-
- if ( topChild() != child )
- {
- kdDebug( 760 ) << k_funcinfo << "Setting " << child->caption() << " as the new top child" << endl;
- m_pZ->setAutoDelete( false );
- if ( child )
- m_pZ->removeRef( child );
- m_pZ->setAutoDelete( true );
-
- //disable the labels of all the other children
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- ( *it )->m_pCaption->setActive( false );
-
- KMdiChildFrm* maximizedChild = topChild();
- bool topChildMaximized = false;
- if ( maximizedChild && maximizedChild->state() == KMdiChildFrm::Maximized )
- topChildMaximized = true;
-
- m_pZ->append( child );
-
- int nChildAreaMinW = 0, nChildAreaMinH = 0;
- int nChildAreaMaxW = TQWIDGETSIZE_MAX, nChildAreaMaxH = TQWIDGETSIZE_MAX;
- if ( topChildMaximized && child->m_pClient )
- {
- //the former top child is maximized, so maximize the new one
- nChildAreaMinW = child->m_pClient->minimumWidth();
- nChildAreaMinH = child->m_pClient->minimumHeight();
- /// @todo: setting the maximum size doesn't work properly - fix this later
- // nChildAreaMaxW = child->m_pClient->maximumWidth();
- // nChildAreaMaxH = child->m_pClient->maximumHeight();
- }
-
- //set the min and max sizes of this child area to the new top child
- setMinimumSize( nChildAreaMinW, nChildAreaMinH );
- setMaximumSize( nChildAreaMaxW, nChildAreaMaxH );
-
- if ( topChildMaximized )
- { //maximize the new view and restore the old
- child->setState( KMdiChildFrm::Maximized, false /*animate*/);
- maximizedChild->setState( KMdiChildFrm::Normal, false /*animate*/ );
- emit sysButtonConnectionsMustChange( maximizedChild, child );
- }
- else
- child->raise();
-
-#ifdef USE_QT4
- child->m_pClient->setFocus();
-#else // USE_QT4
- TQFocusEvent::setReason( TQFocusEvent::Other );
- child->m_pClient->setFocus();
-#endif // USE_QT4
- }
-}
-
-
-void KMdiChildArea::resizeEvent( TQResizeEvent* e )
-{
- //If we have a maximized children at the top , adjust its size
- KMdiChildFrm* child = topChild();
- if ( child && child->state() == KMdiChildFrm::Maximized )
- {
- int clientw = 0, clienth = 0;
- if ( child->m_pClient != 0L )
- {
- clientw = child->m_pClient->width();
- clienth = child->m_pClient->height();
- }
- child->resize( width() + KMDI_CHILDFRM_DOUBLE_BORDER,
- height() + child->m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_DOUBLE_BORDER );
-
- }
- layoutMinimizedChildren();
- TQWidget::resizeEvent( e );
-}
-
-//=============== mousePressEvent =============//
-
-void KMdiChildArea::mousePressEvent( TQMouseEvent *e )
-{
- //Popup the window menu
- if ( e->button() & Qt::RightButton )
- emit popupWindowMenu( mapToGlobal( e->pos() ) );
-}
-
-//=============== getCascadePoint ============//
-
-TQPoint KMdiChildArea::getCascadePoint( int indexOfWindow )
-{
- if ( indexOfWindow < 0 )
- {
- indexOfWindow = m_pZ->count(); //use the window count
- kdDebug( 760 ) << k_funcinfo << "indexOfWindow was less than zero, using "
- << indexOfWindow << " as new index" << endl;
- }
-
- TQPoint pnt( 0, 0 );
- if ( indexOfWindow == 0 )
- {
- kdDebug( 760 ) << k_funcinfo << "No windows. Returning TQPoint( 0, 0 ) as the cascade point" << endl;
- return pnt;
- }
-
- bool topLevelMode = false;
- if ( height() == 1 ) // hacky?!
- topLevelMode = true;
-
- kdDebug( 760 ) << k_funcinfo << "Getting the cascade point for window index " << indexOfWindow << endl;
- kdDebug( 760 ) << k_funcinfo << "Do we think we're in top level mode? " << topLevelMode << endl;
-
- KMdiChildFrm* child = m_pZ->first();
-
- //default values
- int step = 20;
- int h = ( topLevelMode ? TQApplication::desktop()->height() : height() );
- int w = ( topLevelMode ? TQApplication::desktop()->width() : width() );
-
- int availableHeight = h - m_defaultChildFrmSize.height();
- int availableWidth = w - m_defaultChildFrmSize.width();
- int ax = 0;
- int ay = 0;
-
- if ( child )
- {
- kdDebug( 760 ) << k_funcinfo << "child frame exists. resetting height and width values" << endl;
- step = child->m_pCaption->heightHint() + KMDI_CHILDFRM_BORDER;
- availableHeight = h - child->minimumHeight();
- availableWidth = w - child->minimumWidth();
- }
-
- for ( int i = 0; i < indexOfWindow; i++ )
- {
- ax += step;
- ay += step;
-
- //do some bounds checking, because to not do it would be bad.
- if ( ax > availableWidth )
- ax = 0;
-
- if ( ay > availableHeight )
- ay = 0;
- }
- pnt.setX( ax );
- pnt.setY( ay );
- return pnt;
-}
-
-
-void KMdiChildArea::childMinimized( KMdiChildFrm *minimizedChild, bool wasMaximized )
-{
- //can't find the child in our list, so we don't care.
- if ( m_pZ->findRef( minimizedChild ) == -1 )
- {
- kdDebug( 760 ) << k_funcinfo << "child was minimized but wasn't in our list!" << endl;
- return;
- }
-
- kdDebug( 760 ) << k_funcinfo << endl;
- if ( m_pZ->count() > 1 )
- {
- //move the minimized child to the bottom
- m_pZ->setAutoDelete( false );
- m_pZ->removeRef( minimizedChild );
- m_pZ->setAutoDelete( true );
- m_pZ->insert( 0, minimizedChild );
-
- if ( wasMaximized )
- { // Need to maximize the new top child
- kdDebug( 760 ) << k_funcinfo << "child just minimized from maximized state. maximize new top child" << endl;
- minimizedChild = topChild();
- if ( !minimizedChild )
- return; //??
-
- if ( minimizedChild->state() == KMdiChildFrm::Maximized )
- return; //it's already maximized
-
- minimizedChild->setState( KMdiChildFrm::Maximized, false ); //do not animate the change
- }
- focusTopChild();
- }
- else
- setFocus(); //Remove focus from the child. We only have one window
-}
-
-void KMdiChildArea::focusTopChild()
-{
- KMdiChildFrm* lastChild = topChild();
- if ( !lastChild )
- {
- kdDebug( 760 ) << k_funcinfo << "No more child windows left" << endl;
- emit lastChildFrmClosed();
- return;
- }
-
- if ( !lastChild->m_pClient->hasFocus() )
- {
- //disable the labels of all the other children
- TQPtrListIterator<KMdiChildFrm> it ( *m_pZ );
- for ( ; ( *it ); ++it )
- {
- if ( ( *it ) != lastChild )
- ( *it )->m_pCaption->setActive( false );
- }
-
- kdDebug( 760 ) << k_funcinfo << "Giving focus to " << lastChild->caption() << endl;
- lastChild->raise();
- lastChild->m_pClient->activate();
- }
-
-}
-
-void KMdiChildArea::cascadeWindows()
-{
- kdDebug( 760 ) << k_funcinfo << "cascading windows but not changing their size" << endl;
- int idx = 0;
- TQPtrList<KMdiChildFrm> list( *m_pZ );
- list.setAutoDelete( false );
- while ( !list.isEmpty() )
- {
- KMdiChildFrm* childFrm = list.first();
- if ( childFrm->state() != KMdiChildFrm::Minimized )
- {
- if ( childFrm->state() == KMdiChildFrm::Maximized )
- childFrm->restorePressed();
-
- childFrm->move( getCascadePoint( idx ) );
- idx++;
- }
- list.removeFirst();
- }
- focusTopChild();
-}
-
-void KMdiChildArea::cascadeMaximized()
-{
- kdDebug( 760 ) << k_funcinfo << "cascading windows. will make sure they are minimum sized" << endl;
- int idx = 0;
- TQPtrList<KMdiChildFrm> list( *m_pZ );
-
- list.setAutoDelete( false );
- while ( !list.isEmpty() )
- {
- KMdiChildFrm* childFrm = list.first();
- if (childFrm->state() != KMdiChildFrm::Minimized )
- {
- if (childFrm->state() == KMdiChildFrm::Maximized )
- childFrm->restorePressed();
-
- TQPoint pnt( getCascadePoint( idx ) );
- childFrm->move( pnt );
- TQSize curSize( width() - pnt.x(), height() - pnt.y() );
-
- if ( ( childFrm->minimumSize().width() > curSize.width() ) ||
- ( childFrm->minimumSize().height() > curSize.height() ) )
- {
- childFrm->resize( childFrm->minimumSize() );
- }
- else
- childFrm->resize( curSize );
-
- idx++;
- }
- list.removeFirst();
- }
- focusTopChild();
-}
-
-void KMdiChildArea::expandVertical()
-{
- kdDebug( 760 ) << k_funcinfo << "expanding all child frames vertically" << endl;
- int idx = 0;
- TQPtrList<KMdiChildFrm> list( *m_pZ );
- list.setAutoDelete( false );
- while ( !list.isEmpty() )
- {
- KMdiChildFrm* childFrm = list.first();
- if ( childFrm->state() != KMdiChildFrm::Minimized )
- {
- if ( childFrm->state() == KMdiChildFrm::Maximized )
- childFrm->restorePressed();
-
- childFrm->setGeometry( childFrm->x(), 0, childFrm->width(), height() );
- idx++;
- }
- list.removeFirst();
- }
- focusTopChild();
-}
-
-void KMdiChildArea::expandHorizontal()
-{
- kdDebug( 760 ) << k_funcinfo << "expanding all child frames horizontally" << endl;
- int idx = 0;
- TQPtrList<KMdiChildFrm> list( *m_pZ );
- list.setAutoDelete( false );
- while ( !list.isEmpty() )
- {
- KMdiChildFrm* childFrm = list.first();
- if ( childFrm->state() != KMdiChildFrm::Minimized )
- {
- if ( childFrm->state() == KMdiChildFrm::Maximized )
- childFrm->restorePressed();
-
- childFrm->setGeometry( 0, childFrm->y(), width(), childFrm->height() );
- idx++;
- }
- list.removeFirst();
- }
- focusTopChild();
-}
-
-int KMdiChildArea::getVisibleChildCount() const
-{
- int visibleChildCount = 0;
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- {
- if ( ( *it )->state() != KMdiChildFrm::Minimized && ( *it )->isVisible() )
- visibleChildCount++;
- }
- return visibleChildCount;
-}
-
-void KMdiChildArea::tilePragma()
-{
- kdDebug( 760 ) << k_funcinfo << endl;
- tileAllInternal( 9 );
-}
-
-void KMdiChildArea::tileAllInternal( int maxWnds )
-{
- kdDebug( 760 ) << k_funcinfo << endl;
- //NUM WINDOWS = 1,2,3,4,5,6,7,8,9
- static int colstable[ 9 ] = { 1, 1, 1, 2, 2, 2, 3, 3, 3 }; //num columns
- static int rowstable[ 9 ] = { 1, 2, 3, 2, 3, 3, 3, 3, 3 }; //num rows
- static int lastwindw[ 9 ] = { 1, 1, 1, 1, 2, 1, 3, 2, 1 }; //last window multiplier
- static int colrecall[ 9 ] = { 0, 0, 0, 3, 3, 3, 6, 6, 6 }; //adjust self
- static int rowrecall[ 9 ] = { 0, 0, 0, 0, 4, 4, 4, 4, 4 }; //adjust self
-
- int numVisible = getVisibleChildCount();
- if ( numVisible < 1 )
- {
- kdDebug( 760 ) << k_funcinfo << "No visible child windows to tile" << endl;
- return;
- }
-
- KMdiChildFrm *tcw = topChild();
- int numToHandle = ( ( numVisible > maxWnds ) ? maxWnds : numVisible );
-
- int xQuantum = width() / colstable[ numToHandle - 1 ];
- int widthToCompare;
-
- if ( tcw->minimumWidth() > m_defaultChildFrmSize.width() )
- widthToCompare = tcw->minimumWidth();
- else
- widthToCompare = m_defaultChildFrmSize.width();
-
- if ( xQuantum < widthToCompare )
- {
- if ( colrecall[ numToHandle - 1 ] != 0 )
- {
- tileAllInternal( colrecall[ numToHandle - 1 ] );
- return ;
- }
- }
-
- int yQuantum = height() / rowstable[ numToHandle - 1 ];
- int heightToCompare;
- if ( tcw->minimumHeight() > m_defaultChildFrmSize.height() )
- heightToCompare = tcw->minimumHeight();
- else
- heightToCompare = m_defaultChildFrmSize.height();
-
- if ( yQuantum < heightToCompare )
- {
- if ( rowrecall[ numToHandle - 1 ] != 0 )
- {
- tileAllInternal( rowrecall[ numToHandle - 1 ] );
- return ;
- }
- }
- int curX = 0;
- int curY = 0;
- int curRow = 1;
- int curCol = 1;
- int curWin = 1;
-
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- {
- KMdiChildFrm* child = ( *it );
- if ( child->state() != KMdiChildFrm::Minimized )
- {
- //restore the window
- if ( child->state() == KMdiChildFrm::Maximized )
- child->restorePressed();
-
- if ( ( curWin % numToHandle ) == 0 )
- child->setGeometry( curX, curY, xQuantum * lastwindw[ numToHandle - 1 ], yQuantum );
- else
- child->setGeometry( curX, curY, xQuantum, yQuantum );
-
- //example : 12 windows : 3 cols 3 rows
- if ( curCol < colstable[ numToHandle - 1 ] )
- { //curCol<3
- curX += xQuantum; //add a column in the same row
- curCol++; //increase current column
- }
- else
- {
- curX = 0; //new row
- curCol = 1; //column 1
- if ( curRow < rowstable[ numToHandle - 1 ] )
- { //curRow<3
- curY += yQuantum; //add a row
- curRow++; //increase current row
- }
- else
- {
- curY = 0; //restart from beginning
- curRow = 1; //reset current row
- }
- }
- curWin++;
- }
- }
-
- if ( tcw )
- tcw->m_pClient->activate();
-}
-
-void KMdiChildArea::tileAnodine()
-{
- KMdiChildFrm * topChildWindow = topChild();
- int numVisible = getVisibleChildCount(); // count visible windows
- if ( numVisible < 1 )
- return ;
-
- int numCols = int( sqrt( ( double ) numVisible ) ); // set columns to square root of visible count
- // create an array to form grid layout
- int *numRows = new int[ numCols ];
- int numCurCol = 0;
-
- while ( numCurCol < numCols )
- {
- numRows[numCurCol] = numCols; // create primary grid values
- numCurCol++;
- }
-
- int numDiff = numVisible - ( numCols * numCols ); // count extra rows
- int numCurDiffCol = numCols; // set column limiting for grid updates
-
- while ( numDiff > 0 )
- {
- numCurDiffCol--;
- numRows[numCurDiffCol]++; // add extra rows to column grid
-
- if ( numCurDiffCol < 1 )
- numCurDiffCol = numCols; // rotate through the grid
-
- numDiff--;
- }
-
- numCurCol = 0;
- int numCurRow = 0;
- int curX = 0;
- int curY = 0;
-
- // the following code will size everything based on my grid above
- // there is no limit to the number of windows it will handle
- // it's great when a kick-ass theory works!!! // Pragma :)
- int xQuantum = width() / numCols;
- int yQuantum = height() / numRows[numCurCol];
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- {
- KMdiChildFrm* child = ( *it );
- if ( child->state() != KMdiChildFrm::Minimized )
- {
- if ( child->state() == KMdiChildFrm::Maximized )
- child->restorePressed();
-
- child->setGeometry( curX, curY, xQuantum, yQuantum );
- numCurRow++;
- curY += yQuantum;
-
- if ( numCurRow == numRows[numCurCol] )
- {
- numCurRow = 0;
- numCurCol++;
- curY = 0;
- curX += xQuantum;
- if ( numCurCol != numCols )
- yQuantum = height() / numRows[ numCurCol ];
- }
- }
- }
-
- delete[] numRows;
-
- if ( topChildWindow )
- topChildWindow->m_pClient->activate();
-}
-
-
-void KMdiChildArea::tileVertically()
-{
- KMdiChildFrm * topChildWindow = topChild();
- int numVisible = getVisibleChildCount(); // count visible windows
- if ( numVisible < 1 )
- return ;
-
- int w = width() / numVisible;
- int lastWidth = 0;
-
- if ( numVisible > 1 )
- lastWidth = width() - ( w * ( numVisible - 1 ) );
- else
- lastWidth = w;
-
- int h = height();
- int posX = 0;
- int countVisible = 0;
-
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- {
- KMdiChildFrm* child = ( *it );
- if ( child->state() != KMdiChildFrm::Minimized )
- {
- if ( child->state() == KMdiChildFrm::Maximized )
- child->restorePressed();
-
- countVisible++;
-
- if ( countVisible < numVisible )
- {
- child->setGeometry( posX, 0, w, h );
- posX += w;
- }
- else
- { // last visible childframe
- child->setGeometry( posX, 0, lastWidth, h );
- }
- }
- }
-
- if ( topChildWindow )
- topChildWindow->m_pClient->activate();
-}
-
-
-void KMdiChildArea::layoutMinimizedChildren()
-{
- int posX = 0;
- int posY = height();
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- {
- KMdiChildFrm* child = *( it );
- if ( child->state() == KMdiChildFrm::Minimized )
- {
-
- if ( ( posX > 0 ) && ( posX + child->width() > width() ) )
- {
- posX = 0;
- posY -= child->height();
- }
-
- child->move( posX, posY - child->height() );
- posX = child->geometry().right();
- }
- }
-}
-
-
-void KMdiChildArea::setMdiCaptionFont( const TQFont& fnt )
-{
- m_captionFont = fnt;
- TQFontMetrics fm( m_captionFont );
- m_captionFontLineSpacing = fm.lineSpacing();
-
- TQPtrListIterator<KMdiChildFrm> it( *m_pZ );
- for ( ; ( *it ); ++it )
- ( *it )->doResize();
-
-}
-
-void KMdiChildArea::setMdiCaptionActiveForeColor( const TQColor& clr )
-{
- m_captionActiveForeColor = clr;
-}
-
-void KMdiChildArea::setMdiCaptionActiveBackColor( const TQColor& clr )
-{
- m_captionActiveBackColor = clr;
-}
-
-void KMdiChildArea::setMdiCaptionInactiveForeColor( const TQColor& clr )
-{
- m_captionInactiveForeColor = clr;
-}
-
-void KMdiChildArea::setMdiCaptionInactiveBackColor( const TQColor& clr )
-{
- m_captionInactiveBackColor = clr;
-}
-
-//KDE4: remove
-void KMdiChildArea::getCaptionColors( const TQPalette& /*pal*/, TQColor& activeBG,
- TQColor& activeFG, TQColor& inactiveBG, TQColor& inactiveFG )
-{
- activeBG = TDEGlobalSettings::activeTitleColor();
- activeFG = TDEGlobalSettings::activeTextColor();
- inactiveBG = TDEGlobalSettings::inactiveTitleColor();
- inactiveFG = TDEGlobalSettings::inactiveTextColor();
-}
-
-// kate: space-indent off; replace-tabs off; tab-width 4; indent-mode csands;
diff --git a/kmdi/kmdichildarea.h b/kmdi/kmdichildarea.h
deleted file mode 100644
index 0a6076076..000000000
--- a/kmdi/kmdichildarea.h
+++ /dev/null
@@ -1,304 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildarea.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDI_CHILD_AREA_H_
-#define _KMDI_CHILD_AREA_H_
-
-#include <tqframe.h>
-#include <tqptrlist.h>
-
-#include "kmdichildfrm.h"
-#include "kmdichildview.h"
-
-class KMdiChildAreaPrivate;
-
-/**
- * @short Internal class.
- *
- * The main frame widget KMdiMainFrm consists of 2 child widgets. One is this class.
- * It's the widget where the child frames (emulated toplevel MDI views) live in.
- * This class is the manager for the child frame widgets because it controls the
- * Z-order widget stack of KMdiChildFrm's.
- * It provides all placing and positioning algorithms for docked (attached) MDI views.
- *
- * KMdiChildArea doesn't know anything about the actual MDI views. It only knows
- * and manages the frame widgets of attached MDI views.
- * All actions and stuff concerning only to childframes are handled here.
- */
-class KMDI_EXPORT KMdiChildArea : public TQFrame
-{
- friend class KMdiChildFrmCaption;
- friend class KMdiChildFrm;
-
-Q_OBJECT
-
- // attributes
-public:
- /**
- * Z Order stack of KMdiChildFrm childframe windows (top=last)
- */
- TQPtrList<KMdiChildFrm> *m_pZ; //Auto delete enabled
-
- /**
- * the default size of an newly created childframe
- */
- TQSize m_defaultChildFrmSize;
-protected:
- /**
- * The MDI childframe window caption font
- */
- TQFont m_captionFont;
-
- /**
- * The foreground color of the active MDI childframe window caption
- */
- TQColor m_captionActiveBackColor;
-
- /**
- * The background color of the active MDI childframe window captions
- */
- TQColor m_captionActiveForeColor;
-
- /**
- * The foreground color of inactive MDI childframe window captions
- */
- TQColor m_captionInactiveBackColor;
-
- /**
- * The background color of inactive MDI childframe window captions
- */
- TQColor m_captionInactiveForeColor;
-
- int m_captionFontLineSpacing;
-
- // methods
-public:
-
- /**
- * Consruction. Note: This class needn't to know about KMdiMainFrm .
- */
- KMdiChildArea( TQWidget *parent );
-
- /**
- * Destructor : THERE should be no child windows anymore...
- * Howewer it simply deletes all the child widgets :)
- */
- ~KMdiChildArea();
-
- /**
- * Appends a new KMdiChildFrm to this manager.
- * The child is shown,raised and gets focus if this window has it.
- */
- void manageChild( KMdiChildFrm *lpC, bool bShow = true, bool bCascade = true );
-
- /**
- * Destroys a managed KMdiChildFrm
- * Also deletes the client attached to this child.
- */
- void destroyChild( KMdiChildFrm* child, bool focusTopChild = true );
-
- /**
- * Destroys a managed KMdiChildFrm
- * Clients attached to the KMdiChildFrm are not deleted.
- */
- void destroyChildButNotItsView( KMdiChildFrm *lpC, bool bFocusTopChild = true );
-
- /**
- * Brings the child to the top of the stack
- * The child is focused if setFocus is true. If setFocus is false, the
- * child is just raised.
- */
- void setTopChild( KMdiChildFrm* child, bool setFocus = false );
-
- /**
- * Returns the topmost child (the active one) or 0 if there are no children.
- * Note that the topmost child may be also hidded , if ALL the windows are minimized.
- */
- inline KMdiChildFrm * topChild() const { return m_pZ->last(); }
-
- /**
- * Returns the number of visible children
- */
- int getVisibleChildCount() const;
-
- /**
- * Calculates the cascade point for the given index. If index is -1
- * the cascade point is calculated for the window following the last window
- * @param indexOfWindow the index of the window in relation the z-ordered window list
- */
- TQPoint getCascadePoint( int indexOfWindow = -1 );
-
- /**
- * Sets the MDI childframe window caption font
- * A relayout does not occur when using this function
- */
- void setMdiCaptionFont( const TQFont &fnt );
-
- /**
- * Sets the foreground color of the active MDI childframe window caption
- * A relayout does not occur when using this function
- */
- void setMdiCaptionActiveForeColor( const TQColor &clr );
-
- /**
- * Sets the background color of the active MDI childframe window captions
- * A relayout does not occur when using this function
- */
- void setMdiCaptionActiveBackColor( const TQColor &clr );
-
- /**
- * Sets the foreground color of inactive MDI childframe window captions
- * A relayout does not occur when using this function
- */
- void setMdiCaptionInactiveForeColor( const TQColor &clr );
-
- /**
- * Sets the background color of inactive MDI childframe window captions
- * A relayout does not occur when using this function
- */
- void setMdiCaptionInactiveBackColor( const TQColor &clr );
-
- /**
- * Gets all caption colors, consistent with current WM settings
- * (or other Desktop settings e.g. system settings for win32)
- * This method is useful not only for KMDI child windows.
- * Colors are returned via activeBG, activeFG, inactiveBG, inactiveFG references.
- *
- * @deprecated Use TDEGlobalSettings::activeTitleColor(), TDEGlobalSettings::activeTextColor(),
- * TDEGlobalSettings::inactiveTitleColor() and TDEGlobalSettings::inactiveTextColor() instead.
- */
- static void getCaptionColors( const TQPalette &pal, TQColor &activeBG, TQColor &activeFG,
- TQColor &inactiveBG, TQColor &inactiveFG ) KDE_DEPRECATED;
-
-public slots:
- /**
- * Cascades all windows resizing them to the minimum size.
- */
- void cascadeWindows();
-
- /**
- * Cascades all windows resizing them to the maximum available size.
- */
- void cascadeMaximized();
-
- /**
- * Maximize all windows but only in vertical direction
- */
- void expandVertical();
-
- /**
- * Maximize all windows but only in horizontal direction
- */
- void expandHorizontal();
-
- /**
- * Gives focus to the topmost child if it doesn't get focus
- * automatically or you want to wait to give it focus
- */
- void focusTopChild();
-
- /**
- * Tile Pragma
- */
- void tilePragma();
-
- /**
- * Tile Anodine
- */
- void tileAnodine();
-
- /**
- * Tile all the windows in the child area vertically
- */
- void tileVertically();
-
- /**
- * Position and layout the minimized child frames
- */
- void layoutMinimizedChildren();
-
-protected:
-
- /**
- * Internally used for the tile algorithm
- */
- void tileAllInternal( int maxWnds );
-
- /**
- * Automatically resizes a maximized MDI view and layouts the positions of minimized MDI views.
- */
- virtual void resizeEvent( TQResizeEvent * );
-
- /**
- * Shows the 'Window' popup menu on right mouse button click
- */
- void mousePressEvent( TQMouseEvent *e );
-
- /**
- * Internally used. Actions that are necessary when an MDI view gets minimized
- */
- void childMinimized( KMdiChildFrm *lpC, bool bWasMaximized );
-
-signals:
- /**
- * Signals that there aren't maximized child frames any more
- */
- void noMaximizedChildFrmLeft( KMdiChildFrm* );
-
- /**
- * Signals that the child frames are maximized now
- */
- void nowMaximized( bool );
-
- /**
- * Signals a KMdiMainFrm that the signal/slot connections of the system buttons in the
- * menubar (only in Maximize mode) must be updated to another MDI view because the focused
- * MDI view has changed
- * @internal
- */
- void sysButtonConnectionsMustChange( KMdiChildFrm*, KMdiChildFrm* );
-
- /**
- * Signals a KMdiMainFrm that the 'Window' popup menu must be shown
- * @internal
- */
- void popupWindowMenu( TQPoint );
-
- /**
- * Signals that the last attached (docked) MDI view has been closed.
- * Note: Detached MDI views can remain.
- */
- void lastChildFrmClosed();
-
-private:
-
- KMdiChildAreaPrivate *d;
-};
-
-#endif // _KMDICHILDAREA_H_
-
-// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on;
diff --git a/kmdi/kmdichildfrm.cpp b/kmdi/kmdichildfrm.cpp
deleted file mode 100644
index 449c8befe..000000000
--- a/kmdi/kmdichildfrm.cpp
+++ /dev/null
@@ -1,1409 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildfrm.cpp
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// : 01/2003 by Jens Zurheide to allow switching
-// between views based on timestamps
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#include "kmdichildfrm.h"
-#include "kmdichildfrm.moc"
-
-#include "kmdidefines.h"
-#include "kmdichildfrmcaption.h"
-#include "kmdichildarea.h"
-#include "kmdimainfrm.h"
-
-#include <tqpainter.h>
-#include <tqapplication.h>
-#include <tqcursor.h>
-#include <tqobjectlist.h>
-#include <tqframe.h>
-#include <tqpopupmenu.h>
-#include <tqtoolbutton.h>
-#include <tqnamespace.h>
-#include <tqimage.h>
-
-#include <klocale.h>
-#include <kiconloader.h>
-
-//////////////////////////////////////////////////////////////////////////////
-// KMdiChildFrm
-//////////////////////////////////////////////////////////////////////////////
-
-#define KMDI_NORESIZE 0
-#define KMDI_RESIZE_TOP 1
-#define KMDI_RESIZE_LEFT 2
-#define KMDI_RESIZE_RIGHT 4
-#define KMDI_RESIZE_BOTTOM 8
-#define KMDI_RESIZE_TOPLEFT (1|2)
-#define KMDI_RESIZE_TOPRIGHT (1|4)
-#define KMDI_RESIZE_BOTTOMLEFT (8|2)
-#define KMDI_RESIZE_BOTTOMRIGHT (8|4)
-
-#include "filenew.xpm"
-#include "win_closebutton.xpm"
-#include "win_minbutton.xpm"
-#include "win_maxbutton.xpm"
-#include "win_restorebutton.xpm"
-#include "win_undockbutton.xpm"
-#include "kde_closebutton.xpm"
-#include "kde_minbutton.xpm"
-#include "kde_maxbutton.xpm"
-#include "kde_restorebutton.xpm"
-#include "kde_undockbutton.xpm"
-#include "kde2_closebutton.xpm"
-#include "kde2_minbutton.xpm"
-#include "kde2_maxbutton.xpm"
-#include "kde2_restorebutton.xpm"
-#include "kde2_undockbutton.xpm"
-#include "kde2laptop_closebutton.xpm"
-#include "kde2laptop_minbutton.xpm"
-#include "kde2laptop_maxbutton.xpm"
-#include "kde2laptop_restorebutton.xpm"
-#include "kde2laptop_undockbutton.xpm"
-
-
-KMdiWin32IconButton::KMdiWin32IconButton( TQWidget* parent, const char* name )
- : TQLabel( parent, name )
-{}
-
-//============ mousePressEvent ============//
-
-void KMdiWin32IconButton::mousePressEvent( TQMouseEvent* )
-{
- //emit pressed();
-}
-
-//============ KMdiChildFrm ============//
-
-KMdiChildFrm::KMdiChildFrm( KMdiChildArea *parent )
- : TQFrame( parent, "kmdi_childfrm" )
- , m_pClient( 0L )
- , m_pManager( 0L )
- , m_pCaption( 0L )
- , m_pWinIcon( 0L )
- , m_pUnixIcon( 0L )
- , m_pMinimize( 0L )
- , m_pMaximize( 0L )
- , m_pClose( 0L )
- , m_pUndock( 0L )
- , m_state( Normal )
- , m_restoredRect()
- , m_iResizeCorner( KMDI_NORESIZE )
- , m_iLastCursorCorner( KMDI_NORESIZE )
- , m_bResizing( false )
- , m_bDragging( false )
- , m_pIconButtonPixmap( 0L )
- , m_pMinButtonPixmap( 0L )
- , m_pMaxButtonPixmap( 0L )
- , m_pRestoreButtonPixmap( 0L )
- , m_pCloseButtonPixmap( 0L )
- , m_pUndockButtonPixmap( 0L )
- , m_windowMenuID( 0 )
- , m_pSystemMenu( 0L )
- , m_oldClientMinSize()
- , m_oldClientMaxSize()
- , m_oldLayoutResizeMode( TQLayout::Minimum )
-{
- m_pCaption = new KMdiChildFrmCaption( this );
-
- m_pManager = parent;
-
- m_pWinIcon = new KMdiWin32IconButton( m_pCaption, "kmdi_iconbutton_icon" );
- m_pUnixIcon = new TQToolButton( m_pCaption, "kmdi_toolbutton_icon" );
- m_pMinimize = new TQToolButton( m_pCaption, "kmdi_toolbutton_min" );
- m_pMaximize = new TQToolButton( m_pCaption, "kmdi_toolbutton_max" );
- m_pClose = new TQToolButton( m_pCaption, "kmdi_toolbutton_close" );
- m_pUndock = new TQToolButton( m_pCaption, "kmdi_toolbutton_undock" );
-
- TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
- TQObject::connect( m_pMaximize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( maximizePressed() ) );
- TQObject::connect( m_pClose, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closePressed() ) );
- TQObject::connect( m_pUndock, TQT_SIGNAL( clicked() ), this, TQT_SLOT( undockPressed() ) );
-
- m_pIconButtonPixmap = new TQPixmap( SmallIcon( "filenew" ) );
- if ( m_pIconButtonPixmap->isNull() )
- * m_pIconButtonPixmap = TQPixmap( filenew );
-
- redecorateButtons();
-
- m_pWinIcon->setFocusPolicy( TQ_NoFocus );
- m_pUnixIcon->setFocusPolicy( TQ_NoFocus );
- m_pClose->setFocusPolicy( TQ_NoFocus );
- m_pMinimize->setFocusPolicy( TQ_NoFocus );
- m_pMaximize->setFocusPolicy( TQ_NoFocus );
- m_pUndock->setFocusPolicy( TQ_NoFocus );
-
- setFrameStyle( TQFrame::WinPanel | TQFrame::Raised );
- setFocusPolicy( TQ_NoFocus );
-
- setMouseTracking( true );
-
- setMinimumSize( KMDI_CHILDFRM_MIN_WIDTH, m_pCaption->heightHint() );
-
- m_pSystemMenu = new TQPopupMenu();
-}
-
-//============ ~KMdiChildFrm ============//
-
-KMdiChildFrm::~KMdiChildFrm()
-{
- delete m_pMinButtonPixmap;
- delete m_pMaxButtonPixmap;
- delete m_pRestoreButtonPixmap;
- delete m_pCloseButtonPixmap;
- delete m_pUndockButtonPixmap;
- delete m_pSystemMenu;
- delete m_pIconButtonPixmap;
-}
-
-//============ mousePressEvent =============//
-void KMdiChildFrm::mousePressEvent( TQMouseEvent *e )
-{
- if ( m_bResizing )
- {
- if ( TQApplication::overrideCursor() )
- TQApplication::restoreOverrideCursor();
-
- m_bResizing = false;
- releaseMouse();
- }
-
- m_pCaption->setActive( true );
- m_pManager->setTopChild( this, false );
-
- m_iResizeCorner = getResizeCorner( e->pos().x(), e->pos().y() );
- if ( m_iResizeCorner != KMDI_NORESIZE )
- {
- m_bResizing = true;
- //notify child view
- KMdiChildFrmResizeBeginEvent ue( e );
- if ( m_pClient != 0L )
- TQApplication::sendEvent( m_pClient, &ue );
- }
-}
-
-//============ mouseReleaseEvent ==============//
-
-void KMdiChildFrm::mouseReleaseEvent( TQMouseEvent *e )
-{
- if ( m_bResizing )
- {
- if ( TQApplication::overrideCursor() )
- TQApplication::restoreOverrideCursor();
-
- m_bResizing = false;
- //notify child view
- KMdiChildFrmResizeEndEvent ue( e );
- if ( m_pClient != 0L )
- TQApplication::sendEvent( m_pClient, &ue );
- }
-}
-
-//============= setResizeCursor ===============//
-
-void KMdiChildFrm::setResizeCursor( int resizeCorner )
-{
- if ( resizeCorner == m_iLastCursorCorner )
- return ; //Don't do it twice
-
- m_iLastCursorCorner = resizeCorner;
- switch ( resizeCorner )
- {
- case KMDI_NORESIZE:
- if ( TQApplication::overrideCursor() )
- TQApplication::restoreOverrideCursor();
- break;
- case KMDI_RESIZE_LEFT:
- case KMDI_RESIZE_RIGHT:
- TQApplication::setOverrideCursor( tqsizeHorCursor, true );
- break;
- case KMDI_RESIZE_TOP:
- case KMDI_RESIZE_BOTTOM:
- TQApplication::setOverrideCursor( tqsizeVerCursor, true );
- break;
- case KMDI_RESIZE_TOPLEFT:
- case KMDI_RESIZE_BOTTOMRIGHT:
- TQApplication::setOverrideCursor( tqsizeFDiagCursor, true );
- break;
- case KMDI_RESIZE_BOTTOMLEFT:
- case KMDI_RESIZE_TOPRIGHT:
- TQApplication::setOverrideCursor( tqsizeBDiagCursor, true );
- break;
- }
-}
-
-//============= unsetResizeCursor ===============//
-
-void KMdiChildFrm::unsetResizeCursor()
-{
- if ( !m_bResizing && m_iResizeCorner != KMDI_NORESIZE )
- {
- m_iResizeCorner = KMDI_NORESIZE;
- m_iLastCursorCorner = KMDI_NORESIZE;
- if ( TQApplication::overrideCursor() )
- TQApplication::restoreOverrideCursor();
- }
-}
-
-//============= mouseMoveEvent ===============//
-
-void KMdiChildFrm::mouseMoveEvent( TQMouseEvent *e )
-{
- if ( m_state != Normal )
- return;
-
- if ( !m_pClient )
- return;
-
- if ( m_pClient->minimumSize() == m_pClient->maximumSize() )
- return;
-
- if ( m_bResizing )
- {
- if ( !( e->state() & Qt::RightButton ) && !( e->state() & Qt::MidButton ) )
- {
- // same as: if no button or left button pressed
- TQPoint p = parentWidget()->mapFromGlobal( e->globalPos() );
- resizeWindow( m_iResizeCorner, p.x(), p.y() );
- }
- else
- m_bResizing = false;
- }
- else
- {
- m_iResizeCorner = getResizeCorner( e->pos().x(), e->pos().y() );
- setResizeCursor( m_iResizeCorner );
- }
-}
-
-//============= moveEvent ===============//
-
-void KMdiChildFrm::moveEvent( TQMoveEvent* me )
-{
- // give its child view the chance to notify a childframe move
- KMdiChildFrmMoveEvent cfme( me );
- if ( m_pClient != 0L )
- TQApplication::sendEvent( m_pClient, &cfme );
-}
-
-//=============== leaveEvent ===============//
-
-void KMdiChildFrm::leaveEvent( TQEvent * )
-{
- unsetResizeCursor();
-}
-
-void KMdiChildFrm::resizeWindow( int resizeCorner, int xPos, int yPos )
-{
- TQRect resizeRect( x(), y(), width(), height() );
-
- // Calculate the minimum width & height
- int minWidth = 0;
- int minHeight = 0;
- int maxWidth = TQWIDGETSIZE_MAX;
- int maxHeight = TQWIDGETSIZE_MAX;
-
- // it could be the client forces the childframe to enlarge its minimum size
- if ( m_pClient )
- {
- minWidth = m_pClient->minimumSize().width() + KMDI_CHILDFRM_DOUBLE_BORDER;
- minHeight = m_pClient->minimumSize().height() + KMDI_CHILDFRM_DOUBLE_BORDER +
- m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR;
- maxWidth = m_pClient->maximumSize().width() + KMDI_CHILDFRM_DOUBLE_BORDER;
- maxHeight = m_pClient->maximumSize().height() + KMDI_CHILDFRM_DOUBLE_BORDER +
- m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR;
- }
-
- if ( minWidth < minimumWidth() )
- minWidth = minimumWidth();
-
- if ( minHeight < minimumHeight() )
- minHeight = minimumHeight();
-
- if ( maxWidth > maximumWidth() )
- maxWidth = maximumWidth();
-
- if ( maxHeight > maximumHeight() )
- maxHeight = maximumHeight();
-
- TQPoint mousePos( xPos, yPos );
-
- // manipulate width
- switch ( resizeCorner )
- {
- //left sides
- case KMDI_RESIZE_TOPLEFT:
- case KMDI_RESIZE_LEFT:
- case KMDI_RESIZE_BOTTOMLEFT:
- resizeRect.setLeft( mousePos.x() );
- if ( resizeRect.width() < minWidth )
- resizeRect.setLeft( resizeRect.right() - minWidth + 1 );
- if ( resizeRect.width() > maxWidth )
- resizeRect.setLeft( resizeRect.right() - maxWidth + 1 );
- break;
- //right sides
- case KMDI_RESIZE_TOPRIGHT:
- case KMDI_RESIZE_RIGHT:
- case KMDI_RESIZE_BOTTOMRIGHT:
- resizeRect.setRight( mousePos.x() );
- if ( resizeRect.width() < minWidth )
- resizeRect.setRight( resizeRect.left() + minWidth - 1 );
- if ( resizeRect.width() > maxWidth )
- resizeRect.setRight( resizeRect.left() + maxWidth - 1 );
- break;
- default:
- break;
- }
-
- // manipulate height
- switch ( resizeCorner )
- {
- case KMDI_RESIZE_TOPLEFT:
- case KMDI_RESIZE_TOP:
- case KMDI_RESIZE_TOPRIGHT:
- resizeRect.setTop( mousePos.y() );
- if ( resizeRect.height() < minHeight )
- resizeRect.setTop( resizeRect.bottom() - minHeight + 1 );
- if ( resizeRect.height() > maxHeight )
- resizeRect.setTop( resizeRect.bottom() - maxHeight + 1 );
- break;
- case KMDI_RESIZE_BOTTOMLEFT:
- case KMDI_RESIZE_BOTTOM:
- case KMDI_RESIZE_BOTTOMRIGHT:
- resizeRect.setBottom( mousePos.y() );
- if ( resizeRect.height() < minHeight )
- resizeRect.setBottom( resizeRect.top() + minHeight - 1 );
- if ( resizeRect.height() > maxHeight )
- resizeRect.setBottom( resizeRect.top() + maxHeight - 1 );
- break;
- default:
- // nothing to do
- break;
- }
- // actually resize
- setGeometry( resizeRect );
-
- if ( m_state == Maximized )
- {
- m_state = Normal;
- m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
- }
-}
-
-//================= getResizeCorner =============//
-
-int KMdiChildFrm::getResizeCorner( int ax, int ay )
-{
- int ret = KMDI_NORESIZE;
- if ( m_pClient->minimumWidth() != m_pClient->maximumWidth() )
- {
- if ( ( ax > 0 ) && ( ax < ( KMDI_CHILDFRM_BORDER + 2 ) ) )
- ret |= KMDI_RESIZE_LEFT;
-
- if ( ( ax < width() ) && ( ax > ( width() - ( KMDI_CHILDFRM_BORDER + 2 ) ) ) )
- ret |= KMDI_RESIZE_RIGHT;
- }
- if ( m_pClient->minimumHeight() != m_pClient->maximumHeight() )
- {
- if ( ( ay > 0 ) && ( ay < ( KMDI_CHILDFRM_BORDER + 2 ) ) )
- ret |= KMDI_RESIZE_TOP;
-
- if ( ( ay < ( height() ) ) && ( ay > ( height() - ( KMDI_CHILDFRM_BORDER + 2 ) ) ) )
- ret |= KMDI_RESIZE_BOTTOM;
- }
- return ret;
-}
-
-//============= maximizePressed ============//
-
-void KMdiChildFrm::maximizePressed()
-{
- switch ( m_state )
- {
- case Maximized:
- emit m_pManager->nowMaximized( false );
- setState( Normal );
- break;
- case Normal:
- case Minimized:
- setState( Maximized );
- emit m_pManager->nowMaximized( true );
- break;
- }
-}
-
-void KMdiChildFrm::restorePressed()
-{
- if ( m_state == Normal )
- return ;
-
- if ( m_state == Maximized )
- emit m_pManager->nowMaximized( false );
-
- setState( Normal );
-}
-
-//============= minimizePressed ============//
-
-void KMdiChildFrm::minimizePressed()
-{
- switch ( m_state )
- {
- case Minimized:
- setState( Normal );
- break;
- case Normal:
- setState( Minimized );
- break;
- case Maximized:
- emit m_pManager->nowMaximized( false );
- setState( Normal );
- setState( Minimized );
- break;
- }
-}
-
-//============= closePressed ============//
-
-void KMdiChildFrm::closePressed()
-{
- if ( m_pClient )
- m_pClient->close();
-}
-
-//============= undockPressed ============//
-
-void KMdiChildFrm::undockPressed()
-{
- if ( m_pClient )
- {
- if ( m_state == Minimized )
- setState( Normal );
- m_pClient->detach();
- }
-}
-
-//============ setState =================//
-
-void KMdiChildFrm::setState( MdiWindowState state, bool /*bAnimate*/ )
-{
- if ( m_state == Normal ) //save the current rect
- m_restoredRect = TQRect( x(), y(), width(), height() );
-
- switch ( state )
- {
- case Normal:
- switch ( m_state )
- {
- case Maximized:
- m_pClient->m_stateChanged = true;
- m_state = state;
- // client min / max size / layout behavior don't change
- // set frame max size indirectly by setting the clients max size to
- // it's current value (calls setMaxSize() of frame)
- m_pClient->setMaximumSize( m_pClient->maximumSize().width(), m_pClient->maximumSize().height() );
- m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
- setGeometry( m_restoredRect );
- break;
- case Minimized:
- m_pClient->m_stateChanged = true;
- m_state = state;
- // restore client min / max size / layout behavior
- m_pClient->setMinimumSize( m_oldClientMinSize.width(), m_oldClientMinSize.height() );
- m_pClient->setMaximumSize( m_oldClientMaxSize.width(), m_oldClientMaxSize.height() );
- if ( m_pClient->layout() != 0L )
- {
- m_pClient->layout() ->setResizeMode( m_oldLayoutResizeMode );
- }
- m_pMinimize->setPixmap( *m_pMinButtonPixmap );
- m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
- TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( restorePressed() ) );
- TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
- setGeometry( m_restoredRect );
- break;
- case Normal:
- break;
- }
- break;
- case Maximized:
- switch ( m_state )
- {
- case Minimized:
- {
- m_pClient->m_stateChanged = true;
- m_state = state;
- // restore client min / max size / layout behavior
- m_pClient->setMinimumSize( m_oldClientMinSize.width(), m_oldClientMinSize.height() );
- m_pClient->setMaximumSize( m_oldClientMaxSize.width(), m_oldClientMaxSize.height() );
- if ( m_pClient->layout() != 0L )
- {
- m_pClient->layout() ->setResizeMode( m_oldLayoutResizeMode );
- }
- setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
- // reset to maximize-captionbar
- m_pMaximize->setPixmap( *m_pRestoreButtonPixmap );
- m_pMinimize->setPixmap( *m_pMinButtonPixmap );
- TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( restorePressed() ) );
- TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
- int nFrameWidth = KMDI_CHILDFRM_DOUBLE_BORDER;
- int nFrameHeight = KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR +
- m_pCaption->heightHint();
- setGeometry( -m_pClient->x(), -m_pClient->y(),
- m_pManager->width() + nFrameWidth,
- m_pManager->height() + nFrameHeight );
- raise();
- }
- break;
- case Normal:
- {
- m_pClient->m_stateChanged = true;
- m_state = state;
- // client min / max size / layout behavior don't change
- setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
- m_pMaximize->setPixmap( *m_pRestoreButtonPixmap );
- int nFrameWidth = KMDI_CHILDFRM_DOUBLE_BORDER;
- int nFrameHeight = KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR +
- m_pCaption->heightHint();
- TQRect maximizedFrmRect( -m_pClient->x(), -m_pClient->y(),
- m_pManager->width() + nFrameWidth,
- m_pManager->height() + nFrameHeight );
- if ( geometry() != maximizedFrmRect )
- {
- setGeometry( maximizedFrmRect );
- }
- raise();
- }
- break;
- case Maximized:
- break;
- }
- break;
- case Minimized:
- switch ( m_state )
- {
- case Maximized:
- m_pClient->m_stateChanged = true;
- m_state = state;
- // save client min / max size / layout behavior
- m_oldClientMinSize = m_pClient->minimumSize();
- m_oldClientMaxSize = m_pClient->maximumSize();
- if ( m_pClient->layout() != 0L )
- {
- m_oldLayoutResizeMode = m_pClient->layout() ->resizeMode();
- }
- m_pClient->setMinimumSize( 0, 0 );
- m_pClient->setMaximumSize( 0, 0 );
- if ( m_pClient->layout() != 0L )
- {
- m_pClient->layout() ->setResizeMode( TQLayout::FreeResize );
- }
- switchToMinimizeLayout();
- m_pManager->childMinimized( this, true );
- break;
- case Normal:
- m_pClient->m_stateChanged = true;
- m_state = state;
- // save client min / max size / layout behavior
- m_oldClientMinSize = m_pClient->minimumSize();
- m_oldClientMaxSize = m_pClient->maximumSize();
- if ( m_pClient->layout() != 0L )
- {
- m_oldLayoutResizeMode = m_pClient->layout() ->resizeMode();
- }
- m_restoredRect = geometry();
- m_pClient->setMinimumSize( 0, 0 );
- m_pClient->setMaximumSize( 0, 0 );
- if ( m_pClient->layout() != 0L )
- {
- m_pClient->layout() ->setResizeMode( TQLayout::FreeResize );
- }
- switchToMinimizeLayout();
- m_pManager->childMinimized( this, false );
- break;
- case Minimized:
- break;
- }
- break;
- }
-
- KMdiChildFrm* pTopFrame = m_pManager->topChild();
- KMdiChildView* pTopChild = 0L;
- if ( pTopFrame != 0L )
- {
- pTopChild = pTopFrame->m_pClient;
- }
- if ( ( pTopChild != 0L ) && pTopChild->isMaximized() )
- {
- m_pManager->setMinimumSize( pTopChild->minimumWidth(), pTopChild->minimumHeight() );
- /// @todo: setting the maximum size doesn't work properly - fix this later
- /// m_pManager->setMaximumSize(pTopChild->maximumWidth(), pTopChild->maximumHeight());
- }
- else
- {
- m_pManager->setMinimumSize( 0, 0 );
- m_pManager->setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
- }
-}
-
-//============== restoreGeometry ================//
-
-TQRect KMdiChildFrm::restoreGeometry() const
-{
- return m_restoredRect;
-}
-
-//============== setRestoreGeometry ================//
-
-void KMdiChildFrm::setRestoreGeometry( const TQRect& newRestGeo )
-{
- m_restoredRect = newRestGeo;
-}
-
-//============ setCaption ===============//
-
-void KMdiChildFrm::setCaption( const TQString& text )
-{
- m_pCaption->setCaption( text );
-}
-
-//============ enableClose ==============//
-
-void KMdiChildFrm::enableClose( bool bEnable )
-{
- m_pClose->setEnabled( bEnable );
- m_pClose->repaint( false );
-}
-
-//============ setIcon ==================//
-
-void KMdiChildFrm::setIcon( const TQPixmap& pxm )
-{
- TQPixmap p = pxm;
- if ( p.width() != 18 || p.height() != 18 )
- {
- TQImage img = p.convertToImage();
- p = img.smoothScale( 18, 18, TQ_ScaleMin );
- }
- const bool do_resize = m_pIconButtonPixmap->size() != p.size();
- *m_pIconButtonPixmap = p;
- m_pWinIcon->setPixmap( p );
- m_pUnixIcon->setPixmap( p );
- if ( do_resize )
- doResize( true );
-}
-
-//============ icon =================//
-
-TQPixmap* KMdiChildFrm::icon() const
-{
- return m_pIconButtonPixmap;
-}
-
-//============ setClient ============//
-void KMdiChildFrm::setClient( KMdiChildView *w, bool bAutomaticResize )
-{
- m_pClient = w;
-
- if ( w->icon() )
- setIcon( *( w->icon() ) );
-
- //resize to match the client
- int clientYPos = m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_BORDER;
- if ( bAutomaticResize || w->size().isEmpty() || ( w->size() == TQSize( 1, 1 ) ) )
- {
- if ( m_pManager->topChild() )
- {
- resize( m_pManager->topChild() ->size() );
- }
- else
- {
- resize( m_pManager->m_defaultChildFrmSize.width() + KMDI_CHILDFRM_DOUBLE_BORDER,
- m_pManager->m_defaultChildFrmSize.height() + KMDI_CHILDFRM_BORDER + clientYPos );
- }
- }
- else
- {
- resize( w->width() + KMDI_CHILDFRM_DOUBLE_BORDER, w->height() + KMDI_CHILDFRM_BORDER + clientYPos );
- }
-
- // memorize the focuses in a dictionary because they will get lost during reparenting
- TQDict<TQ_FocusPolicy>* pFocPolDict = new TQDict<TQ_FocusPolicy>;
- pFocPolDict->setAutoDelete( true );
- TQObjectList *list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
- TQObjectListIt it( *list ); // iterate over the buttons
- TQObject * obj;
- int i = 1;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- ++it;
- TQWidget* widg = ( TQWidget* ) obj;
- if ( widg->name( 0 ) == 0 )
- {
- TQString tmpStr;
- tmpStr.setNum( i );
- tmpStr = "unnamed" + tmpStr;
- widg->setName( tmpStr.latin1() );
- i++;
- }
- TQ_FocusPolicy* pFocPol = new TQ_FocusPolicy;
- *pFocPol = widg->focusPolicy();
- pFocPolDict->insert( widg->name(), pFocPol );
- }
- delete list; // delete the list, not the objects
-
- //Reparent if needed
- if ( TQT_BASE_OBJECT(w->parent()) != TQT_BASE_OBJECT(this) )
- {
- //reparent to this widget , no flags , point , show it
- TQPoint pnt2( KMDI_CHILDFRM_BORDER, clientYPos );
- TQSize mincs = w->minimumSize();
- TQSize maxcs = w->maximumSize();
- w->setMinimumSize( 0, 0 );
- w->setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
-
- // min/max sizes, flags, DND get lost. :-(
- w->reparent( this, 0, pnt2, w->isVisible() );
-
- w->setMinimumSize( mincs.width(), mincs.height() );
- w->setMaximumSize( maxcs.width(), maxcs.height() );
- }
- else
- w->move( KMDI_CHILDFRM_BORDER, clientYPos );
-
- linkChildren( pFocPolDict );
-
- TQObject::connect( m_pClient, TQT_SIGNAL( mdiParentNowMaximized( bool ) ), m_pManager, TQT_SIGNAL( nowMaximized( bool ) ) );
-
- if ( m_pClient->minimumWidth() > m_pManager->m_defaultChildFrmSize.width() )
- setMinimumWidth( m_pClient->minimumSize().width() + KMDI_CHILDFRM_DOUBLE_BORDER );
-
- if ( m_pClient->minimumHeight() > m_pManager->m_defaultChildFrmSize.height() )
- {
- setMinimumHeight( m_pClient->minimumSize().height() + KMDI_CHILDFRM_DOUBLE_BORDER +
- m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR );
- }
-}
-
-//============ unsetClient ============//
-
-void KMdiChildFrm::unsetClient( TQPoint positionOffset )
-{
- if ( !m_pClient )
- return ;
-
- TQObject::disconnect( m_pClient, TQT_SIGNAL( mdiParentNowMaximized( bool ) ), m_pManager, TQT_SIGNAL( nowMaximized( bool ) ) );
-
- //reparent to desktop widget , no flags , point , show it
- TQDict<TQ_FocusPolicy>* pFocPolDict;
- pFocPolDict = unlinkChildren();
-
- // get name of focused child widget
- TQWidget* focusedChildWidget = m_pClient->focusedChildWidget();
- const char* nameOfFocusedWidget = "";
- if ( focusedChildWidget != 0 )
- nameOfFocusedWidget = focusedChildWidget->name();
-
- TQSize mins = m_pClient->minimumSize();
- TQSize maxs = m_pClient->maximumSize();
- m_pClient->reparent( 0, 0, mapToGlobal( pos() ) - pos() + positionOffset, isVisible() );
- m_pClient->setMinimumSize( mins.width(), mins.height() );
- m_pClient->setMaximumSize( maxs.width(), maxs.height() );
-
- // remember the focus policies using the dictionary and reset them
- TQObjectList *list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
- TQObjectListIt it( *list ); // iterate over all child widgets of child frame
- TQObject * obj;
- TQWidget* firstFocusableChildWidget = 0;
- TQWidget* lastFocusableChildWidget = 0;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- TQWidget * widg = ( TQWidget* ) obj;
- ++it;
- TQ_FocusPolicy* pFocPol = pFocPolDict->find( widg->name() ); // remember the focus policy from before the reparent
- if ( pFocPol )
- widg->setFocusPolicy( *pFocPol );
-
- // reset focus to old position (doesn't work :-( for its own unexplicable reasons)
- if ( widg->name() == nameOfFocusedWidget )
- widg->setFocus();
-
- // get first and last focusable widget
- if ( ( widg->focusPolicy() == TQ_StrongFocus ) || ( widg->focusPolicy() == TQ_TabFocus ) )
- {
- if ( firstFocusableChildWidget == 0 )
- firstFocusableChildWidget = widg; // first widget
- lastFocusableChildWidget = widg; // last widget
-
- }
- else
- {
- if ( widg->focusPolicy() == TQ_WheelFocus )
- {
- if ( firstFocusableChildWidget == 0 )
- firstFocusableChildWidget = widg; // first widget
- lastFocusableChildWidget = widg; // last widget
- //tqDebug("*** %s (%s)",widg->name(),widg->className());
- }
- }
- }
- delete list; // delete the list, not the objects
- delete pFocPolDict;
-
- // reset first and last focusable widget
- m_pClient->setFirstFocusableChildWidget( firstFocusableChildWidget );
- m_pClient->setLastFocusableChildWidget( lastFocusableChildWidget );
-
- // reset the focus policy of the view
- m_pClient->setFocusPolicy( TQ_ClickFocus );
-
- // lose information about the view (because it's undocked now)
- m_pClient = 0;
-}
-
-//============== linkChildren =============//
-void KMdiChildFrm::linkChildren( TQDict<TQ_FocusPolicy>* pFocPolDict )
-{
- // reset the focus policies for all widgets in the view (take them from the dictionary)
- TQObjectList* list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
- TQObjectListIt it( *list ); // iterate over all child widgets of child frame
- TQObject* obj;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- TQWidget* widg = ( TQWidget* ) obj;
- ++it;
- TQ_FocusPolicy* pFocPol = pFocPolDict->find( widg->name() ); // remember the focus policy from before the reparent
-
- if ( pFocPol != 0 )
- widg->setFocusPolicy( *pFocPol );
-
- if ( !( widg->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) ) )
- widg->installEventFilter( this );
-
- }
- delete list; // delete the list, not the objects
- delete pFocPolDict;
-
- // reset the focus policies for the rest
- m_pWinIcon->setFocusPolicy( TQ_NoFocus );
- m_pUnixIcon->setFocusPolicy( TQ_NoFocus );
- m_pClient->setFocusPolicy( TQ_ClickFocus );
- m_pCaption->setFocusPolicy( TQ_NoFocus );
- m_pUndock->setFocusPolicy( TQ_NoFocus );
- m_pMinimize->setFocusPolicy( TQ_NoFocus );
- m_pMaximize->setFocusPolicy( TQ_NoFocus );
- m_pClose->setFocusPolicy( TQ_NoFocus );
-
- // install the event filter (catch mouse clicks) for the rest
- m_pWinIcon->installEventFilter( this );
- m_pUnixIcon->installEventFilter( this );
- m_pCaption->installEventFilter( this );
- m_pUndock->installEventFilter( this );
- m_pMinimize->installEventFilter( this );
- m_pMaximize->installEventFilter( this );
- m_pClose->installEventFilter( this );
- m_pClient->installEventFilter( this );
- // m_pClient->installEventFilterForAllChildren();
-}
-
-//============== unlinkChildren =============//
-
-TQDict<TQ_FocusPolicy>* KMdiChildFrm::unlinkChildren()
-{
- // memorize the focuses in a dictionary because they will get lost during reparenting
- TQDict<TQ_FocusPolicy>* pFocPolDict = new TQDict<TQ_FocusPolicy>;
- pFocPolDict->setAutoDelete( true );
-
- TQObjectList *list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
- TQObjectListIt it( *list ); // iterate over all child widgets of child frame
- TQObject * obj;
- int i = 1;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- ++it;
- TQWidget* w = ( TQWidget* ) obj;
- // get current widget object name
- if ( w->name( 0 ) == 0 )
- {
- TQString tmpStr;
- tmpStr.setNum( i );
- tmpStr = "unnamed" + tmpStr;
- w->setName( tmpStr.latin1() );
- i++;
- }
- TQ_FocusPolicy* pFocPol = new TQ_FocusPolicy;
- *pFocPol = w->focusPolicy();
- // memorize focus policy
- pFocPolDict->insert( w->name(), pFocPol );
- // remove event filter
- ( ( TQWidget* ) obj ) ->removeEventFilter( this );
- }
- delete list; // delete the list, not the objects
-
- // remove the event filter (catch mouse clicks) for the rest
- m_pWinIcon->removeEventFilter( this );
- m_pUnixIcon->removeEventFilter( this );
- m_pCaption->removeEventFilter( this );
- m_pUndock->removeEventFilter( this );
- m_pMinimize->removeEventFilter( this );
- m_pMaximize->removeEventFilter( this );
- m_pClose->removeEventFilter( this );
- m_pClient->removeEventFilter( this );
-
- //SCHEDULED_FOR_REMOVE m_pClient->removeEventFilterForAllChildren();
-
- return pFocPolDict;
-}
-
-//============== resizeEvent ===============//
-
-void KMdiChildFrm::resizeEvent( TQResizeEvent * )
-{
- doResize(); // an extra method because it can also called directly
-}
-
-void KMdiChildFrm::doResize()
-{
- doResize( false );
-}
-
-void KMdiChildFrm::doResize( bool captionOnly )
-{
- //Resize the caption
- int captionHeight = m_pCaption->heightHint();
- int captionWidth = width() - KMDI_CHILDFRM_DOUBLE_BORDER;
- int buttonHeight = m_pClose->pixmap() ->height();
- int buttonWidth = m_pClose->pixmap() ->width();
- int heightOffset = captionHeight / 2 - buttonHeight / 2;
- int rightOffset1 = 1;
- int rightOffset2 = 1;
- int frmIconHeight = m_pWinIcon->pixmap() ->height();
- int frmIconWidth = m_pWinIcon->pixmap() ->width();
- int frmIconOffset = 1;
- TQWidget* pIconWidget = m_pWinIcon;
- m_pCaption->setGeometry( KMDI_CHILDFRM_BORDER, KMDI_CHILDFRM_BORDER, captionWidth, captionHeight );
-
- //The buttons are caption children
- if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
- {
- rightOffset2 += 2;
- m_pUnixIcon->hide();
- }
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
- {
- buttonWidth += 4;
- buttonHeight += 4;
- heightOffset -= 2;
- rightOffset1 = 0;
- rightOffset2 = 0;
- m_pWinIcon->hide();
- frmIconHeight = buttonHeight;
- frmIconWidth = buttonWidth;
- frmIconOffset = 0;
- pIconWidget = m_pUnixIcon;
- }
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDELook )
- {
- buttonWidth += 3;
- buttonHeight += 3;
- heightOffset -= 1;
- m_pUnixIcon->hide();
- }
- if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::KDELaptopLook )
- {
- pIconWidget->setGeometry( frmIconOffset, captionHeight / 2 - frmIconHeight / 2, frmIconWidth, frmIconHeight );
- m_pClose->setGeometry( ( captionWidth - buttonWidth ) - rightOffset1, heightOffset, buttonWidth, buttonHeight );
- m_pMaximize->setGeometry( ( captionWidth - ( buttonWidth * 2 ) ) - rightOffset2, heightOffset, buttonWidth, buttonHeight );
- m_pMinimize->setGeometry( ( captionWidth - ( buttonWidth * 3 ) ) - rightOffset2, heightOffset, buttonWidth, buttonHeight );
- m_pUndock->setGeometry( ( captionWidth - ( buttonWidth * 4 ) ) - rightOffset2, heightOffset, buttonWidth, buttonHeight );
- }
- else
- { // KDELaptopLook
- m_pWinIcon->hide();
- m_pUnixIcon->hide();
- buttonHeight += 5;
- heightOffset -= 2;
- m_pClose->setGeometry ( 0, heightOffset, 27, buttonHeight );
- m_pMaximize->setGeometry( captionWidth - 27, heightOffset, 27, buttonHeight );
- m_pMinimize->setGeometry( captionWidth - 27 * 2, heightOffset, 27, buttonHeight );
- m_pUndock->setGeometry ( captionWidth - 27 * 3, heightOffset, 27, buttonHeight );
- }
-
- //Resize the client
- if ( !captionOnly && m_pClient )
- {
- TQSize newClientSize( captionWidth,
- height() - ( KMDI_CHILDFRM_DOUBLE_BORDER + captionHeight + KMDI_CHILDFRM_SEPARATOR ) );
- if ( newClientSize != m_pClient->size() )
- {
- m_pClient->setGeometry( KMDI_CHILDFRM_BORDER,
- m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_BORDER,
- newClientSize.width(), newClientSize.height() );
- }
- }
-}
-
-static bool hasParent( TQObject* par, TQObject* o )
-{
- while ( o && o != par )
- o = o->parent();
- return o == par;
-}
-
-//============= eventFilter ===============//
-
-bool KMdiChildFrm::eventFilter( TQObject *obj, TQEvent *e )
-{
- switch ( e->type() )
- {
- case TQEvent::Enter:
- {
- // check if the receiver is really a child of this frame
- bool bIsChild = false;
- TQObject* pObj = obj;
- while ( ( pObj != 0L ) && !bIsChild )
- {
- bIsChild = ( TQT_BASE_OBJECT(pObj) == TQT_BASE_OBJECT(this) );
- pObj = pObj->parent();
- }
- // unset the resize cursor if the cursor moved from the frame into a inner widget
- if ( bIsChild )
- unsetResizeCursor();
- }
- break;
- case TQEvent::MouseButtonPress:
- {
- if ( !hasParent( TQT_TQOBJECT(m_pClient), obj ) )
- {
- bool bIsSecondClick = false;
- if ( m_timeMeasure.elapsed() <= TQApplication::doubleClickInterval() )
- bIsSecondClick = true; // of a possible double click
-
- if ( !( ( ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pWinIcon) ) || ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pUnixIcon) ) ) && bIsSecondClick ) )
- {
- // in case we didn't click on the icon button
- TQFocusEvent focusEvent( TQFocusEvent::FocusIn );
- TQApplication::sendEvent( tqApp->mainWidget(), &focusEvent );
- if ( m_pClient )
- {
- m_pClient->updateTimeStamp();
- m_pClient->activate();
- }
-
- if ( ( TQT_BASE_OBJECT(obj->parent()) != TQT_BASE_OBJECT(m_pCaption) ) && ( TQT_BASE_OBJECT(obj) != TQT_BASE_OBJECT(m_pCaption) ) )
- {
- TQWidget* w = ( TQWidget* ) obj;
- if ( ( w->focusPolicy() == TQ_ClickFocus ) || ( w->focusPolicy() == TQ_StrongFocus ) )
- {
- w->setFocus();
- }
- }
- }
- if ( ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pWinIcon) ) || ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pUnixIcon) ) )
- {
- // in case we clicked on the icon button
- if ( m_timeMeasure.elapsed() > TQApplication::doubleClickInterval() )
- {
- showSystemMenu();
- m_timeMeasure.start();
- }
- else
- closePressed(); // double click on icon button closes the view
-
- return true;
- }
- }
- }
- break;
- case TQEvent::Resize:
- {
- if ( ( ( TQWidget* ) obj == m_pClient ) && ( m_state == Normal ) )
- {
- TQResizeEvent* re = ( TQResizeEvent* ) e;
- int captionHeight = m_pCaption->heightHint();
- TQSize newChildFrmSize( re->size().width() + KMDI_CHILDFRM_DOUBLE_BORDER,
- re->size().height() + captionHeight + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_DOUBLE_BORDER );
- if ( newChildFrmSize != size() )
- resize( newChildFrmSize );
- }
- }
- break;
- case TQEvent::ChildRemoved:
- {
- // if we lost a child we uninstall ourself as event filter for the lost
- // child and its children
- TQObject* pLostChild = TQT_TQOBJECT(( ( TQChildEvent* ) e )->child());
- if ( ( pLostChild != 0L ) /*&& (pLostChild->inherits(TQWIDGET_OBJECT_NAME_STRING))*/ )
- {
- TQObjectList* list = pLostChild->queryList();
- list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all lost child widgets
- TQObject* obj;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- TQWidget* widg = ( TQWidget* ) obj;
- ++it;
- widg->removeEventFilter( this );
- }
- delete list; // delete the list, not the objects
- }
- }
- break;
- case TQEvent::ChildInserted:
- {
- // if we got a new child we install ourself as event filter for the new
- // child and its children (as we did when we got our client).
- // XXX see linkChildren() and focus policy stuff
- TQObject* pNewChild = TQT_TQOBJECT(( ( TQChildEvent* ) e ) ->child());
- if ( ( pNewChild != 0L ) && ::tqqt_cast<TQWidget*>( pNewChild ) )
- {
- TQWidget * pNewWidget = TQT_TQWIDGET( pNewChild );
- TQObjectList *list = pNewWidget->queryList( TQWIDGET_OBJECT_NAME_STRING );
- list->insert( 0, pNewChild ); // add the new child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all new child widgets
- TQObject * obj;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- TQWidget * widg = ( TQWidget* ) obj;
- ++it;
- if ( !::tqqt_cast<TQPopupMenu*>( widg ) )
- {
- widg->installEventFilter( this );
- }
- }
- delete list; // delete the list, not the objects
- }
- }
- break;
- default:
- break;
- }
-
- return false; // standard event processing (see Qt documentation)
-}
-
-//============= raiseAndActivate ===============//
-
-void KMdiChildFrm::raiseAndActivate()
-{
- m_pCaption->setActive( true );
- m_pManager->setTopChild( this, false ); //Do not focus by now...
-}
-
-//============= setMinimumSize ===============//
-
-void KMdiChildFrm::setMinimumSize ( int minw, int minh )
-{
- TQWidget::setMinimumSize( minw, minh );
- if ( m_state == Maximized )
- {
- m_pManager->setMinimumSize( minw, minh );
- }
-}
-
-//============= systemMenu ===============//
-
-TQPopupMenu* KMdiChildFrm::systemMenu() const
-{
- if ( m_pSystemMenu == 0 )
- return 0;
-
- m_pSystemMenu->clear();
-
- if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
- {
- m_pSystemMenu->insertItem( i18n( "&Restore" ), this, TQT_SLOT( restorePressed() ) );
- m_pSystemMenu->insertItem( i18n( "&Move" ), m_pCaption, TQT_SLOT( slot_moveViaSystemMenu() ) );
- m_pSystemMenu->insertItem( i18n( "R&esize" ), this, TQT_SLOT( slot_resizeViaSystemMenu() ) );
- m_pSystemMenu->insertItem( i18n( "M&inimize" ), this, TQT_SLOT( minimizePressed() ) );
- m_pSystemMenu->insertItem( i18n( "M&aximize" ), this, TQT_SLOT( maximizePressed() ) );
- if ( state() == Normal )
- m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 0 ), false );
- else if ( state() == Maximized )
- {
- m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 1 ), false );
- m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 2 ), false );
- m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 4 ), false );
- }
- else if ( state() == Minimized )
- {
- m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 2 ), false );
- m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 3 ), false );
- }
- }
- else
- {
- if ( state() != Normal )
- m_pSystemMenu->insertItem( i18n( "&Restore" ), this, TQT_SLOT( restorePressed() ) );
- if ( state() != Maximized )
- m_pSystemMenu->insertItem( i18n( "&Maximize" ), this, TQT_SLOT( maximizePressed() ) );
- if ( state() != Minimized )
- m_pSystemMenu->insertItem( i18n( "&Minimize" ), this, TQT_SLOT( minimizePressed() ) );
- if ( state() != Maximized )
- m_pSystemMenu->insertItem( i18n( "M&ove" ), m_pCaption, TQT_SLOT( slot_moveViaSystemMenu() ) );
- if ( state() == Normal )
- m_pSystemMenu->insertItem( i18n( "&Resize" ), this, TQT_SLOT( slot_resizeViaSystemMenu() ) );
- }
-
- m_pSystemMenu->insertItem( i18n( "&Undock" ), this, TQT_SLOT( undockPressed() ) );
- m_pSystemMenu->insertSeparator();
- m_pSystemMenu->insertItem( i18n( "&Close" ), this, TQT_SLOT( closePressed() ) );
-
- return m_pSystemMenu;
-}
-
-/** Shows a system menu for child frame windows. */
-void KMdiChildFrm::showSystemMenu()
-{
- if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
- m_pUnixIcon->setDown( false );
-
- TQPoint popupmenuPosition;
-
- TQRect iconGeom;
- if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
- iconGeom = m_pWinIcon->geometry();
- else
- iconGeom = m_pUnixIcon->geometry();
-
- popupmenuPosition = TQPoint( iconGeom.x(), iconGeom.y() + captionHeight() + KMDI_CHILDFRM_BORDER );
- systemMenu() ->popup( mapToGlobal( popupmenuPosition ) );
-}
-
-void KMdiChildFrm::switchToMinimizeLayout()
-{
- setMinimumWidth( KMDI_CHILDFRM_MIN_WIDTH );
- setFixedHeight( m_pCaption->height() + KMDI_CHILDFRM_DOUBLE_BORDER );
-
- m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
-
- // temporary use of minimize button for restore function
- m_pMinimize->setPixmap( *m_pRestoreButtonPixmap );
- TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
- TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( restorePressed() ) );
-
- // resizing
- resize( 300, minimumHeight() );
-
- // positioning
- m_pManager->layoutMinimizedChildren();
-}
-
-void KMdiChildFrm::slot_resizeViaSystemMenu()
-{
- grabMouse();
- m_bResizing = true;
- m_iResizeCorner = KMDI_RESIZE_BOTTOMLEFT;
- setResizeCursor( m_iResizeCorner );
-}
-
-void KMdiChildFrm::redecorateButtons()
-{
- delete m_pMinButtonPixmap;
- delete m_pMaxButtonPixmap;
- delete m_pRestoreButtonPixmap;
- delete m_pCloseButtonPixmap;
- delete m_pUndockButtonPixmap;
-
- if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
- {
- m_pMinButtonPixmap = new TQPixmap( win_minbutton );
- m_pMaxButtonPixmap = new TQPixmap( win_maxbutton );
- m_pRestoreButtonPixmap = new TQPixmap( win_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( win_closebutton );
- m_pUndockButtonPixmap = new TQPixmap( win_undockbutton );
- }
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
- {
- m_pMinButtonPixmap = new TQPixmap( kde_minbutton );
- m_pMaxButtonPixmap = new TQPixmap( kde_maxbutton );
- m_pRestoreButtonPixmap = new TQPixmap( kde_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( kde_closebutton );
- m_pUndockButtonPixmap = new TQPixmap( kde_undockbutton );
- }
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDELook )
- {
- m_pMinButtonPixmap = new TQPixmap( kde2_minbutton );
- m_pMaxButtonPixmap = new TQPixmap( kde2_maxbutton );
- m_pRestoreButtonPixmap = new TQPixmap( kde2_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( kde2_closebutton );
- m_pUndockButtonPixmap = new TQPixmap( kde2_undockbutton );
- }
- else
- { // kde2laptop look
- m_pMinButtonPixmap = new TQPixmap( kde2laptop_minbutton );
- m_pMaxButtonPixmap = new TQPixmap( kde2laptop_maxbutton );
- m_pRestoreButtonPixmap = new TQPixmap( kde2laptop_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( kde2laptop_closebutton );
- m_pUndockButtonPixmap = new TQPixmap( kde2laptop_undockbutton );
- }
-
- m_pUnixIcon->setAutoRaise( true );
- if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
- {
- m_pMinimize->setAutoRaise( true );
- m_pMaximize->setAutoRaise( true );
- m_pClose->setAutoRaise( true );
- m_pUndock->setAutoRaise( true );
- }
- else
- {
- m_pMinimize->setAutoRaise( false );
- m_pMaximize->setAutoRaise( false );
- m_pClose->setAutoRaise( false );
- m_pUndock->setAutoRaise( false );
- }
-
- if ( m_pClient && m_pClient->icon() )
- {
- m_pWinIcon->setPixmap( *( m_pClient )->icon() );
- m_pUnixIcon->setPixmap( *( m_pClient )->icon() );
- }
- else
- {
- m_pWinIcon->setPixmap( *m_pIconButtonPixmap );
- m_pUnixIcon->setPixmap( *m_pIconButtonPixmap );
- }
- m_pClose->setPixmap( *m_pCloseButtonPixmap );
- m_pMinimize->setPixmap( *m_pMinButtonPixmap );
- m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
- m_pUndock->setPixmap( *m_pUndockButtonPixmap );
-}
-
-TQRect KMdiChildFrm::mdiAreaContentsRect() const
-{
- TQFrame * p = ( TQFrame* ) parentWidget();
- if ( p )
- {
- return p->contentsRect();
- }
- else
- {
- TQRect empty;
- return empty;
- }
-}
-
-// kate: indent-mode csands; tab-width 4; space-indent off; replace-tabs off;
diff --git a/kmdi/kmdichildfrm.h b/kmdi/kmdichildfrm.h
deleted file mode 100644
index 0fe2cd2b2..000000000
--- a/kmdi/kmdichildfrm.h
+++ /dev/null
@@ -1,446 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildfrm.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-// patches : */2000 Lars Beikirch (Lars.Beikirch@gmx.net)
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//------------------------------------------------------------------------------
-#ifndef _KMDI_CHILD_FRM_H_
-#define _KMDI_CHILD_FRM_H_
-
-#include <tqptrlist.h>
-#include <tqpixmap.h>
-#include <tqpushbutton.h>
-#include <tqlabel.h>
-#include <tqdatetime.h>
-#include <tqlayout.h>
-
-#include <tqdict.h>
-
-#include "kmdichildfrmcaption.h"
-
-class KMdiChildArea;
-class KMdiChildView;
-class TQPopupMenu;
-class TQToolButton;
-
-//==============================================================================
-/**
- * @short Internal class, only used on Win32.
- * This class provides a label widget that can process mouse click events.
- */
-class KMDI_EXPORT KMdiWin32IconButton : public TQLabel
-{
- Q_OBJECT
-public:
- KMdiWin32IconButton( TQWidget* parent, const char* name = 0 );
- virtual void mousePressEvent( TQMouseEvent* );
-
-signals:
- void pressed();
-};
-
-//==============================================================================
-/* some special events, see kmdidefines.h
-*/
-//------------------------------------------------------------------------------
-/**
- * @short a TQCustomEvent for move
- * This special event will be useful, to inform view about child frame event.
- */
-class KMDI_EXPORT KMdiChildFrmMoveEvent : public TQCustomEvent
-{
-public:
- KMdiChildFrmMoveEvent( TQMoveEvent *e ) : TQCustomEvent( TQEvent::Type( TQEvent::User + int( KMdi::EV_Move ) ), e ) {}
-
-};
-
-//------------------------------------------------------------------------------
-/**
- * @short a TQCustomEvent for begin of dragging
- * This special event will be useful, to inform view about child frame event.
- */
-class KMDI_EXPORT KMdiChildFrmDragBeginEvent : public TQCustomEvent
-{
-public:
- KMdiChildFrmDragBeginEvent( TQMouseEvent *e ) : TQCustomEvent( TQEvent::Type( TQEvent::User + int( KMdi::EV_DragBegin ) ), e ) {}
-};
-
-//------------------------------------------------------------------------------
-/**
- * @short a TQCustomEvent for end of dragging
- * This special event will be useful, to inform view about child frame event.
- */
-class KMDI_EXPORT KMdiChildFrmDragEndEvent : public TQCustomEvent
-{
-public:
- KMdiChildFrmDragEndEvent( TQMouseEvent *e ) : TQCustomEvent( TQEvent::Type( TQEvent::User + int( KMdi::EV_DragEnd ) ), e ) {}
-};
-
-//------------------------------------------------------------------------------
-/**
- * @short a TQCustomEvent for begin of resizing
- * This special event will be useful, to inform view about child frame event.
- */
-class KMDI_EXPORT KMdiChildFrmResizeBeginEvent : public TQCustomEvent
-{
-public:
- KMdiChildFrmResizeBeginEvent( TQMouseEvent *e ) : TQCustomEvent( TQEvent::Type( TQEvent::User + int( KMdi::EV_ResizeBegin ) ), e ) {}
-};
-
-//------------------------------------------------------------------------------
-/**
- * @short a TQCustomEvent for end of resizing
- * This special event will be useful, to inform view about child frame event.
- */
-class KMDI_EXPORT KMdiChildFrmResizeEndEvent : public TQCustomEvent
-{
-public:
- KMdiChildFrmResizeEndEvent( TQMouseEvent *e ) : TQCustomEvent( TQEvent::Type( TQEvent::User + int( KMdi::EV_ResizeEnd ) ), e ) {}
-};
-
-
-class KMdiChildFrmPrivate;
-//==============================================================================
-/**
- * @short Internal class.
- * It's an MDI child frame widget. It contains a view widget and a frame caption. Usually you derive from its view.
- */
-//------------------------------------------------------------------------------
-class KMDI_EXPORT KMdiChildFrm : public TQFrame
-{
- friend class KMdiChildArea;
- friend class KMdiChildFrmCaption;
-
- Q_OBJECT
-
- // attributes
-public:
- enum MdiWindowState { Normal, Maximized, Minimized };
- //positions same in h and cpp for fast order check
- KMdiChildView* m_pClient;
-
-protected:
- KMdiChildArea* m_pManager;
- KMdiChildFrmCaption* m_pCaption;
- KMdiWin32IconButton* m_pWinIcon;
- TQToolButton* m_pUnixIcon;
- TQToolButton* m_pMinimize;
- TQToolButton* m_pMaximize;
- TQToolButton* m_pClose;
- TQToolButton* m_pUndock;
- MdiWindowState m_state;
- TQRect m_restoredRect;
- int m_iResizeCorner;
- int m_iLastCursorCorner;
- bool m_bResizing;
- bool m_bDragging;
- TQPixmap* m_pIconButtonPixmap;
- TQPixmap* m_pMinButtonPixmap;
- TQPixmap* m_pMaxButtonPixmap;
- TQPixmap* m_pRestoreButtonPixmap;
- TQPixmap* m_pCloseButtonPixmap;
- TQPixmap* m_pUndockButtonPixmap;
-
- /**
- * Every child frame window has an temporary ID in the Window menu of the child area.
- */
- int m_windowMenuID;
-
- /**
- * Imitates a system menu for child frame windows
- */
- TQPopupMenu* m_pSystemMenu;
-
- TQSize m_oldClientMinSize;
- TQSize m_oldClientMaxSize;
- TQLayout::ResizeMode m_oldLayoutResizeMode;
- TQTime m_timeMeasure;
-
- // methods
-public:
-
- /**
- * Creates a new KMdiChildFrm class.
- */
- KMdiChildFrm( KMdiChildArea *parent );
-
- /**
- * Destroys this KMdiChildFrm
- * If a child is still here managed (no recreation was made) it is destroyed too.
- */
- ~KMdiChildFrm();
-
- /**
- * Reparents the widget w to this KMdiChildFrm (if this is not already done)
- * Installs an event filter to catch focus events.
- * Resizes this mdi child in a way that the child fits perfectly in.
- */
- void setClient( KMdiChildView *w, bool bAutomaticResize = false );
-
- /**
- * Reparents the client widget to 0 (desktop), moves with an offset from the original position
- * Removes the event filter.
- */
- void unsetClient( TQPoint positionOffset = TQPoint( 0, 0 ) );
-
- /**
- * Sets the window icon pointer.
- */
- void setIcon( const TQPixmap &pxm );
-
- /**
- * Returns the child frame icon.
- */
- TQPixmap* icon() const;
-
- /**
- * Enables or disables the close button
- */
- void enableClose( bool bEnable );
-
- /**
- * Sets the caption of this window
- */
- void setCaption( const TQString& text );
-
- /**
- * Gets the caption of this mdi child.
- */
- const TQString& caption() { return m_pCaption->m_szCaption; }
-
- /**
- * Minimizes, Maximizes, or restores the window.
- */
- void setState( MdiWindowState state, bool bAnimate = true );
-
- /**
- * Returns the current state of the window
- */
- inline MdiWindowState state() const { return m_state; }
-
- /**
- * Returns the inner client area of the parent of this (which is KMdiChildArea).
- */
- TQRect mdiAreaContentsRect() const;
-
- /**
- * Returns the geometry that will be restored by calling restore().
- */
- TQRect restoreGeometry() const;
-
- /**
- * Sets the geometry that will be restored by calling restore().
- */
- void setRestoreGeometry( const TQRect& newRestGeo );
-
- /**
- * Forces updating the rects of the caption and so...
- * It may be useful when setting the mdiCaptionFont of the MdiManager
- */
- void updateRects() { resizeEvent( 0 ); }
-
- /**
- * Returns the system menu.
- */
- TQPopupMenu* systemMenu() const;
-
- /**
- * Returns the caption bar height
- */
- inline int captionHeight() const { return m_pCaption->height(); }
-
- /**
- * sets new raise behavior and pixmaps of the buttons depending on the current decoration style
- */
- void redecorateButtons();
-
- /**
- * returns the mouse state "In Drag"
- */
- bool isInDrag() const { return m_bDragging; }
-
- /**
- * returns the mouse state "In Resize"
- */
- bool isInResize() const { return m_bResizing; }
-
- /**
- * Internally called from the signal focusInEventOccurs.
- * It raises the MDI childframe to the top of all other MDI child frames and sets the focus on it.
- */
- void raiseAndActivate();
-
- /**
- * Sets the minimum size of the widget to w by h pixels.
- * It extends it's base clase method in a way that the minimum size of
- * the child area will be set additionally if the view is maximized.
- */
- virtual void setMinimumSize ( int minw, int minh );
-
-public slots:
-
- void slot_resizeViaSystemMenu();
-
-protected:
-
- /**
- * Reimplemented from the base class.
- * Resizes the captionbar, relayouts the position of the system buttons,
- * and calls resize for its embedded KMdiChildView with the proper size
- */
- virtual void resizeEvent( TQResizeEvent * );
-
- /**
- * Reimplemented from the base class.
- * Detects if the mouse is on the edge of window and what resize cursor must be set.
- * Calls KMdiChildFrm::resizeWindow if it is in m_bResizing.
- */
- virtual void mouseMoveEvent( TQMouseEvent *e );
-
- /**
- * Reimplemented from the base class.
- * Colours the caption, raises the childfrm widget and
- * turns to resize mode if it is on the edge (resize-sensitive area)
- */
- virtual void mousePressEvent( TQMouseEvent *e );
-
- /**
- * Reimplemented from the base class.
- * Sets a normal cursor and leaves the resize mode.
- */
- virtual void mouseReleaseEvent( TQMouseEvent * );
-
- /**
- * Reimplemented from the base class.
- * give its child view the chance to notify a childframe move... that's why it sends
- * a KMdiChildMovedEvent to the embedded KMdiChildView .
- */
- virtual void moveEvent( TQMoveEvent* me );
-
- /**
- * Reimplemented from the base class. If not in resize mode, it sets the mouse cursor to normal appearance.
- */
- virtual void leaveEvent( TQEvent * );
-
- /**
- * Reimplemented from the base class.
- * In addition, the following are caught
- * -the client's mousebutton press events which raises and activates the childframe
- * -the client's resize event which resizes this widget as well
- */
- virtual bool eventFilter( TQObject*, TQEvent* );
-
- /**
- * Calculates the new geometry from the new mouse position given as parameters
- * and calls KMdiChildFrm::setGeometry
- */
- void resizeWindow( int resizeCorner, int x, int y );
-
- /**
- * Override the cursor appearance depending on the widget corner given as parameter
- */
- void setResizeCursor( int resizeCorner );
-
- /**
- * Changes from the resize cursor to the normal (previous) cursor
- */
- void unsetResizeCursor();
-
- /**
- * That means to show a mini window showing the childframe's caption bar, only.
- * It cannot be resized.
- */
- virtual void switchToMinimizeLayout();
-
- /**
- * Does the actual resize. Called from various places but from resizeEvent in general.
- */
- void doResize();
-
- /**
- * Does the actual resize, like doResize() but skips resize of the client if \a captionOnly is true.
- * @todo: merge with doResize()
- */
- void doResize( bool captionOnly );
-
-protected slots:
-
- /**
- * Handles a click on the Maximize button
- */
- void maximizePressed();
-
- /**
- * Handles a click on the Restore (Normalize) button
- */
- void restorePressed();
-
- /**
- * Handles a click on the Minimize button.
- */
- void minimizePressed();
-
- /**
- * Handles a click on the Close button.
- */
- void closePressed();
-
- /**
- * Handles a click on the Undock (Detach) button
- */
- void undockPressed();
-
- /**
- * Shows a system menu for child frame windows.
- */
- void showSystemMenu();
-
-protected:
-
- /**
- * Restore the focus policies for _all_ widgets in the view using the list given as parameter.
- * Install the event filter for all direct child widgets of this. (See KMdiChildFrm::eventFilter)
- */
- void linkChildren( TQDict<TQ_FocusPolicy>* pFocPolDict );
-
- /**
- * Backups all focus policies of _all_ child widgets in the MDI childview since they get lost during a reparent.
- * Remove all event filters for all direct child widgets of this. (See KMdiChildFrm::eventFilter)
- */
- TQDict<TQ_FocusPolicy>* unlinkChildren();
-
- /**
- * Calculates the corner id for the resize cursor. The return value can be tested for:
- * KMDI_RESIZE_LEFT, KMDI_RESIZE_RIGHT, KMDI_RESIZE_TOP, KMDI_RESIZE_BOTTOM
- * or an OR'd variant of them for the corners.
- */
- int getResizeCorner( int ax, int ay );
-
-private:
- KMdiChildFrmPrivate *d;
-};
-
-#endif //_KMDICHILDFRM_H_
-
-// kate: space-indent off; replace-tabs off; tab-width 4; indent-mode csands;
diff --git a/kmdi/kmdichildfrmcaption.cpp b/kmdi/kmdichildfrmcaption.cpp
deleted file mode 100644
index 9ebbefb34..000000000
--- a/kmdi/kmdichildfrmcaption.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildfrmcaption.cpp
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#include "kmdichildfrmcaption.h"
-#include "kmdichildfrmcaption.moc"
-
-#include <tqpainter.h>
-#include <tqapplication.h>
-#include <tqcursor.h>
-#include <tqtoolbutton.h>
-#include <tqpopupmenu.h>
-
-#include "kmdidefines.h"
-#include "kmdichildfrm.h"
-#include "kmdichildarea.h"
-#include "kmdimainfrm.h"
-#include <klocale.h>
-#include <iostream>
-
-#ifdef Q_WS_WIN
-//TODO: one day gradient can be added for win98/winnt5+
-// ask system properties on windows
-#ifndef SPI_GETGRADIENTCAPTIONS
-# define SPI_GETGRADIENTCAPTIONS 0x1008
-#endif
-#ifndef COLOR_GRADIENTACTIVECAPTION
-# define COLOR_GRADIENTACTIVECAPTION 27
-#endif
-#ifndef COLOR_GRADIENTINACTIVECAPTION
-# define COLOR_GRADIENTINACTIVECAPTION 28
-#endif
-#endif
-//#endif
-
-//////////////////////////////////////////////////////////////////////////////
-// Class : KMdiChildFrmCaption
-// Purpose : An MDI label that draws the title
-//
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//============== KMdiChildFrmCaption =============//
-
-KMdiChildFrmCaption::KMdiChildFrmCaption( KMdiChildFrm *parent )
- : TQWidget( parent, "kmdi_childfrmcaption" )
-{
- m_szCaption = i18n( "Unnamed" );
- m_bActive = false;
- m_pParent = parent;
- setBackgroundMode( NoBackground );
- setFocusPolicy( TQ_NoFocus );
- m_bChildInDrag = false;
-}
-
-//============== ~KMdiChildFrmCaption =============//
-
-KMdiChildFrmCaption::~KMdiChildFrmCaption()
-{}
-
-//============= mousePressEvent ==============//
-
-void KMdiChildFrmCaption::mousePressEvent( TQMouseEvent *e )
-{
- if ( e->button() == Qt::LeftButton )
- {
- setMouseTracking( false );
- if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
- {
- TQApplication::setOverrideCursor( tqsizeAllCursor, true );
- }
- m_pParent->m_bDragging = true;
- m_offset = mapToParent( e->pos() );
- }
- else if ( e->button() == Qt::RightButton )
- {
- m_pParent->systemMenu()->popup( mapToGlobal( e->pos() ) );
- }
-}
-
-//============= mouseReleaseEvent ============//
-
-void KMdiChildFrmCaption::mouseReleaseEvent( TQMouseEvent *e )
-{
- if ( e->button() == Qt::LeftButton )
- {
- if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
- TQApplication::restoreOverrideCursor();
-
- releaseMouse();
- if ( m_pParent->m_bDragging )
- {
- m_pParent->m_bDragging = false;
- if ( m_bChildInDrag )
- {
- //notify child view
- KMdiChildFrmDragEndEvent ue( e );
- if ( m_pParent->m_pClient != 0L )
- TQApplication::sendEvent( m_pParent->m_pClient, &ue );
-
- m_bChildInDrag = false;
- }
- }
- }
-}
-
-//============== mouseMoveEvent =============//
-void KMdiChildFrmCaption::mouseMoveEvent( TQMouseEvent *e )
-{
- if ( !m_pParent->m_bDragging )
- return ;
-
- if ( !m_bChildInDrag )
- {
- //notify child view
- KMdiChildFrmDragBeginEvent ue( e );
- if ( m_pParent->m_pClient != 0L )
- TQApplication::sendEvent( m_pParent->m_pClient, &ue );
-
- m_bChildInDrag = true;
- }
-
- TQPoint relMousePosInChildArea = m_pParent->m_pManager->mapFromGlobal( e->globalPos() );
-
- // mouse out of child area? stop child frame dragging
- if ( !m_pParent->m_pManager->rect().contains( relMousePosInChildArea ) )
- {
- if ( relMousePosInChildArea.x() < 0 )
- relMousePosInChildArea.rx() = 0;
-
- if ( relMousePosInChildArea.y() < 0 )
- relMousePosInChildArea.ry() = 0;
-
- if ( relMousePosInChildArea.x() > m_pParent->m_pManager->width() )
- relMousePosInChildArea.rx() = m_pParent->m_pManager->width();
-
- if ( relMousePosInChildArea.y() > m_pParent->m_pManager->height() )
- relMousePosInChildArea.ry() = m_pParent->m_pManager->height();
- }
- TQPoint mousePosInChildArea = relMousePosInChildArea - m_offset;
-
- // set new child frame position
- parentWidget() ->move( mousePosInChildArea );
-}
-
-//=============== setActive ===============//
-
-void KMdiChildFrmCaption::setActive( bool bActive )
-{
- if ( m_bActive == bActive )
- return ;
-
- // Ensure the icon's pixmap has the correct bg color
- m_pParent->m_pWinIcon->setBackgroundColor( bActive ?
- m_pParent->m_pManager->m_captionActiveBackColor :
- m_pParent->m_pManager->m_captionInactiveBackColor );
- m_pParent->m_pUnixIcon->setBackgroundColor( bActive ?
- m_pParent->m_pManager->m_captionActiveBackColor :
- m_pParent->m_pManager->m_captionInactiveBackColor );
-
- m_bActive = bActive;
- repaint( false );
-}
-
-//=============== setCaption ===============//
-
-void KMdiChildFrmCaption::setCaption( const TQString& text )
-{
- m_szCaption = text;
- repaint( false );
-}
-
-//============== heightHint ===============//
-
-int KMdiChildFrmCaption::heightHint()
-{
- int hint = m_pParent->m_pManager->m_captionFontLineSpacing + 3;
- if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
- {
- if ( hint < 18 )
- hint = 18;
- }
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
- {
- if ( hint < 20 )
- hint = 20;
- }
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDELook )
- {
- if ( hint < 16 )
- hint = 16;
- }
- else
- { // kde2laptop look
- hint -= 4;
- if ( hint < 14 )
- hint = 14;
- }
- return hint;
-}
-
-//=============== paintEvent ==============//
-
-void KMdiChildFrmCaption::paintEvent( TQPaintEvent * )
-{
- TQPainter p( this );
- TQRect r = rect();
- p.setFont( m_pParent->m_pManager->m_captionFont );
-
- if ( m_bActive )
- {
- p.fillRect( r, m_pParent->m_pManager->m_captionActiveBackColor );
- p.setPen( m_pParent->m_pManager->m_captionActiveForeColor );
- }
- else
- {
- p.fillRect( r, m_pParent->m_pManager->m_captionInactiveBackColor );
- p.setPen( m_pParent->m_pManager->m_captionInactiveForeColor );
- }
-
- //Shift the text after the icon
- if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
- r.setLeft( r.left() + m_pParent->icon() ->width() + 3 );
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
- r.setLeft( r.left() + 22 );
- else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDELook )
- r.setLeft( r.left() + m_pParent->icon() ->width() + 3 );
- else // kde2laptop look
- r.setLeft( r.left() + 30 );
-
- int captionWidthForText = width() - 4 * m_pParent->m_pClose->width() - m_pParent->icon() ->width() - 5;
- TQString text = abbreviateText( m_szCaption, captionWidthForText );
- p.drawText( r, AlignVCenter | AlignLeft | SingleLine, text );
-
-}
-
-
-TQString KMdiChildFrmCaption::abbreviateText( TQString origStr, int maxWidth )
-{
- TQFontMetrics fm = fontMetrics();
- int actualWidth = fm.width( origStr );
-
- int realLetterCount = origStr.length();
- int newLetterCount;
-
- if ( actualWidth != 0 )
- newLetterCount = ( maxWidth * realLetterCount ) / actualWidth;
- else
- newLetterCount = realLetterCount; // should be 0 anyway
-
- int w = maxWidth + 1;
- TQString s = origStr;
-
- if ( newLetterCount <= 0 )
- s = "";
-
- while ( ( w > maxWidth ) && ( newLetterCount >= 1 ) )
- {
- if ( newLetterCount < realLetterCount )
- {
- if ( newLetterCount > 3 )
- s = origStr.left( newLetterCount / 2 ) + "..." + origStr.right( newLetterCount / 2 );
- else
- {
- if ( newLetterCount > 1 )
- s = origStr.left( newLetterCount ) + "..";
- else
- s = origStr.left( 1 );
- }
- }
- TQFontMetrics fm = fontMetrics();
- w = fm.width( s );
- newLetterCount--;
- }
- return s;
-}
-
-//============= mouseDoubleClickEvent ===========//
-
-void KMdiChildFrmCaption::mouseDoubleClickEvent( TQMouseEvent * )
-{
- m_pParent->maximizePressed();
-}
-
-//============= slot_moveViaSystemMenu ===========//
-
-void KMdiChildFrmCaption::slot_moveViaSystemMenu()
-{
- setMouseTracking( true );
- grabMouse();
-
- if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
- TQApplication::setOverrideCursor( tqsizeAllCursor, true );
-
- m_pParent->m_bDragging = true;
- m_offset = mapFromGlobal( TQCursor::pos() );
-}
-
-// kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;
diff --git a/kmdi/kmdichildfrmcaption.h b/kmdi/kmdichildfrmcaption.h
deleted file mode 100644
index 0a209bcd9..000000000
--- a/kmdi/kmdichildfrmcaption.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildfrmcaption.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-#ifndef _KMDI_CHILD_FRM_CAPTION_H_
-#define _KMDI_CHILD_FRM_CAPTION_H_
-
-#include <tqwidget.h>
-
-#include "kmdidefines.h"
-
-class KMdiChildFrm;
-
-
-class KMdiChildFrmCaptionPrivate;
-
-/**
-* @short Internal class.
-*
-* It's the caption bar of a child frame widget.
-*/
-class KMDI_EXPORT KMdiChildFrmCaption : public TQWidget
-{
- Q_OBJECT
-public:
- /**
- * Constructor
- */
- KMdiChildFrmCaption( KMdiChildFrm *parent );
-
- /**
- * Destructor
- */
- ~KMdiChildFrmCaption();
-
- /**
- * Repaint the caption bar in active background colors
- */
- void setActive( bool bActive );
-
- /**
- * Repaint with a new caption bar title
- */
- void setCaption( const TQString& text );
-
- /**
- * Returns the caption bar height depending on the used font
- */
- int heightHint();
-
-public slots:
- /**
- * Grabs the mouse, a move cursor, sets a move indicator variable to true and keeps the global mouse position in mind
- */
- void slot_moveViaSystemMenu();
-
-protected:
- /**
- * Draws the caption bar and its title using the settings
- */
- virtual void paintEvent( TQPaintEvent *e );
-
- /**
- * The same as KMdiChildFrmCaption::slot_moveViaSystemMenu
- */
- virtual void mousePressEvent( TQMouseEvent * );
-
- /**
- * Calls maximizePressed of the parent widget ( KMdiChildFrm )
- */
- virtual void mouseDoubleClickEvent( TQMouseEvent * );
-
- /**
- * Restore the normal mouse cursor, set the state variable back to 'not moving'
- */
- virtual void mouseReleaseEvent( TQMouseEvent * );
-
- /**
- * Checks if out of move range of the KMdiChildArea and calls KMdiChildFrm::move
- */
- virtual void mouseMoveEvent( TQMouseEvent *e );
-
- /**
- * Computes a new abbreviated string from a given string depending on a given maximum width
- * @todo Replace with a call to a KStringHandler function instead of rolling our own
- */
- TQString abbreviateText( TQString origStr, int maxWidth );
-
- // attributes
-public:
- /**
- * the title string shown in the caption bar
- */
- TQString m_szCaption;
-
-protected: // Protected attributes
- /**
- * parent widget
- */
- KMdiChildFrm *m_pParent;
-
- /**
- * state variable indicating whether activated or not activated
- */
- bool m_bActive;
-
- /**
- * the position offset related to its parent widget (internally used for translating mouse move positions
- */
- TQPoint m_offset;
-
- /**
- * True if the child knows that it is currently being dragged.
- */
- bool m_bChildInDrag;
-
-private:
- KMdiChildFrmCaptionPrivate *d;
-};
-
-#endif //_KMDICAPTION_H_
-
-// kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;
diff --git a/kmdi/kmdichildview.cpp b/kmdi/kmdichildview.cpp
deleted file mode 100644
index ad5328cc9..000000000
--- a/kmdi/kmdichildview.cpp
+++ /dev/null
@@ -1,774 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildview.cpp
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create a
-// -06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-// patches : 02/2000 by Massimo Morin (mmorin@schedsys.com)
-// */2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
-// 02/2001 by Eva Brucherseifer (eva@rt.e-technik.tu-darmstadt.de)
-// 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
-//
-// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#include "kmdichildview.h"
-#include "kmdichildview.moc"
-
-#include <tqdatetime.h>
-#include <tqobjectlist.h>
-
-#include "kmdimainfrm.h"
-#include "kmdichildfrm.h"
-#include "kmdidefines.h"
-#include <kdebug.h>
-#include <klocale.h>
-#include <tqiconset.h>
-
-//============ KMdiChildView ============//
-
-KMdiChildView::KMdiChildView( const TQString& caption, TQWidget* parentWidget, const char* name, WFlags f )
- : TQWidget( parentWidget, name, f )
- , m_focusedChildWidget( 0L )
- , m_firstFocusableChildWidget( 0L )
- , m_lastFocusableChildWidget( 0L )
- , m_stateChanged( true )
- , m_bToolView( false )
- , m_bInterruptActivation( false )
- , m_bMainframesActivateViewIsPending( false )
- , m_bFocusInEventIsPending( false )
- , m_trackChanges( 0 )
-{
- setGeometry( 0, 0, 0, 0 ); // reset
- if ( caption != 0L )
- m_szCaption = caption;
- else
- m_szCaption = i18n( "Unnamed" );
-
- m_sTabCaption = m_szCaption;
- setFocusPolicy( TQ_ClickFocus );
- installEventFilter( this );
-
- // store the current time
- updateTimeStamp();
-}
-
-
-//============ KMdiChildView ============//
-
-KMdiChildView::KMdiChildView( TQWidget* parentWidget, const char* name, WFlags f )
- : TQWidget( parentWidget, name, f )
- , m_focusedChildWidget( 0L )
- , m_firstFocusableChildWidget( 0L )
- , m_lastFocusableChildWidget( 0L )
- , m_stateChanged( true )
- , m_bToolView( false )
- , m_bInterruptActivation( false )
- , m_bMainframesActivateViewIsPending( false )
- , m_bFocusInEventIsPending( false )
- , m_trackChanges( 0 )
-{
- setGeometry( 0, 0, 0, 0 ); // reset
- m_szCaption = i18n( "Unnamed" );
- m_sTabCaption = m_szCaption;
- setFocusPolicy( TQ_ClickFocus );
- installEventFilter( this );
-
- // store the current time
- updateTimeStamp();
-}
-
-//============ ~KMdiChildView ============//
-
-KMdiChildView::~KMdiChildView()
-{
- kdDebug( 760 ) << k_funcinfo << endl;
-}
-
-void KMdiChildView::trackIconAndCaptionChanges( TQWidget *view )
-{
- m_trackChanges = view;
-}
-
-
-//============== internal geometry ==============//
-
-TQRect KMdiChildView::internalGeometry() const
-{
- if ( mdiParent() )
- { // is attached
- // get the client area coordinates inside the MDI child frame
- TQRect posInFrame = geometry();
- // map these values to the parent of the MDI child frame
- // (this usually is the MDI child area) and return
- TQPoint ptTopLeft = mdiParent() ->mapToParent( posInFrame.topLeft() );
- TQSize sz = size();
- return TQRect( ptTopLeft, sz );
- }
- else
- {
- TQRect geo = geometry();
- TQRect frameGeo = externalGeometry();
- return TQRect( frameGeo.x(), frameGeo.y(), geo.width(), geo.height() );
- // return geometry();
- }
-}
-
-//============== set internal geometry ==============//
-
-void KMdiChildView::setInternalGeometry( const TQRect& newGeometry )
-{
- if ( mdiParent() )
- { // is attached
- // retrieve the frame size
- TQRect geo = internalGeometry();
- TQRect frameGeo = externalGeometry();
- int nFrameSizeTop = geo.y() - frameGeo.y();
- int nFrameSizeLeft = geo.x() - frameGeo.x();
-
- // create the new geometry that is accepted by the TQWidget::setGeometry() method
- TQRect newGeoQt;
- newGeoQt.setX( newGeometry.x() - nFrameSizeLeft );
- newGeoQt.setY( newGeometry.y() - nFrameSizeTop );
-
- newGeoQt.setWidth( newGeometry.width() + nFrameSizeLeft + KMDI_CHILDFRM_DOUBLE_BORDER / 2 );
- newGeoQt.setHeight( newGeometry.height() + nFrameSizeTop + KMDI_CHILDFRM_DOUBLE_BORDER / 2 );
- // newGeoQt.setWidth(newGeometry.width()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER);
- // newGeoQt.setHeight(newGeometry.height()+mdiParent()->captionHeight()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER);
-
- // set the geometry
- mdiParent()->setGeometry( newGeoQt );
- }
- else
- {
- // retrieve the frame size
- TQRect geo = internalGeometry();
- TQRect frameGeo = externalGeometry();
- int nFrameSizeTop = geo.y() - frameGeo.y();
- int nFrameSizeLeft = geo.x() - frameGeo.x();
-
- // create the new geometry that is accepted by the TQWidget::setGeometry() method
- TQRect newGeoQt;
-
- newGeoQt.setX( newGeometry.x() - nFrameSizeLeft );
- newGeoQt.setY( newGeometry.y() - nFrameSizeTop );
-
- newGeoQt.setWidth( newGeometry.width() );
- newGeoQt.setHeight( newGeometry.height() );
-
- // set the geometry
- setGeometry( newGeoQt );
- }
-}
-
-//============== external geometry ==============//
-
-TQRect KMdiChildView::externalGeometry() const
-{
- return mdiParent() ? mdiParent()->frameGeometry() : frameGeometry();
-}
-
-//============== set external geometry ==============//
-
-void KMdiChildView::setExternalGeometry( const TQRect& newGeometry )
-{
- if ( mdiParent() )
- { // is attached
- mdiParent() ->setGeometry( newGeometry );
- }
- else
- {
- // retrieve the frame size
- TQRect geo = internalGeometry();
- TQRect frameGeo = externalGeometry();
- int nTotalFrameWidth = frameGeo.width() - geo.width();
- int nTotalFrameHeight = frameGeo.height() - geo.height();
- int nFrameSizeTop = geo.y() - frameGeo.y();
- int nFrameSizeLeft = geo.x() - frameGeo.x();
-
- // create the new geometry that is accepted by the TQWidget::setGeometry() method
- // not attached => the window system makes the frame
- TQRect newGeoQt;
- newGeoQt.setX( newGeometry.x() + nFrameSizeLeft );
- newGeoQt.setY( newGeometry.y() + nFrameSizeTop );
- newGeoQt.setWidth( newGeometry.width() - nTotalFrameWidth );
- newGeoQt.setHeight( newGeometry.height() - nTotalFrameHeight );
-
- // set the geometry
- setGeometry( newGeoQt );
- }
-}
-
-//============== minimize ==============//
-
-void KMdiChildView::minimize( bool bAnimate )
-{
- if ( mdiParent() )
- {
- if ( !isMinimized() )
- {
- mdiParent() ->setState( KMdiChildFrm::Minimized, bAnimate );
- }
- }
- else
- showMinimized();
-}
-
-void KMdiChildView::showMinimized()
-{
- emit isMinimizedNow();
- TQWidget::showMinimized();
-}
-
-//slot:
-void KMdiChildView::minimize()
-{
- minimize( true );
-}
-
-//============= maximize ==============//
-
-void KMdiChildView::maximize( bool bAnimate )
-{
- if ( mdiParent() )
- {
- if ( !isMaximized() )
- {
- mdiParent() ->setState( KMdiChildFrm::Maximized, bAnimate );
- emit mdiParentNowMaximized( true );
- }
- }
- else
- showMaximized();
-}
-
-void KMdiChildView::showMaximized()
-{
- emit isMaximizedNow();
- TQWidget::showMaximized();
-}
-
-//slot:
-void KMdiChildView::maximize()
-{
- maximize( true );
-}
-
-//============== restoreGeometry ================//
-
-TQRect KMdiChildView::restoreGeometry()
-{
- if ( mdiParent() )
- return mdiParent() ->restoreGeometry();
- else //FIXME not really supported, may be we must use Windows or X11 funtions
- return geometry();
-}
-
-//============== setRestoreGeometry ================//
-
-void KMdiChildView::setRestoreGeometry( const TQRect& newRestGeo )
-{
- if ( mdiParent() )
- mdiParent()->setRestoreGeometry( newRestGeo );
-}
-
-//============== attach ================//
-
-void KMdiChildView::attach()
-{
- emit attachWindow( this, true );
-}
-
-//============== detach =================//
-
-void KMdiChildView::detach()
-{
- emit detachWindow( this, true );
-}
-
-//=============== isMinimized ? =================//
-
-bool KMdiChildView::isMinimized() const
-{
- if ( mdiParent() )
- return ( mdiParent()->state() == KMdiChildFrm::Minimized );
- else
- return TQWidget::isMinimized();
-}
-
-//============== isMaximized ? ==================//
-
-bool KMdiChildView::isMaximized() const
-{
- if ( mdiParent() )
- return ( mdiParent()->state() == KMdiChildFrm::Maximized );
- else
- return TQWidget::isMaximized();
-}
-
-//============== restore ================//
-
-void KMdiChildView::restore()
-{
- if ( mdiParent() )
- {
- if ( isMaximized() )
- emit mdiParentNowMaximized( false );
-
- if ( isMinimized() || isMaximized() )
- mdiParent()->setState( KMdiChildFrm::Normal );
- }
- else
- showNormal();
-}
-
-void KMdiChildView::showNormal()
-{
- emit isRestoredNow();
- TQWidget::showNormal();
-}
-
-//=============== youAreAttached ============//
-
-void KMdiChildView::youAreAttached( KMdiChildFrm *lpC )
-{
- lpC->setCaption( m_szCaption );
- emit isAttachedNow();
-}
-
-//================ youAreDetached =============//
-
-void KMdiChildView::youAreDetached()
-{
- setCaption( m_szCaption );
-
- setTabCaption( m_sTabCaption );
- if ( myIconPtr() )
- setIcon( *( myIconPtr() ) );
-
- setFocusPolicy( TQ_StrongFocus );
-
- emit isDetachedNow();
-}
-
-//================ setCaption ================//
-// this set the caption of only the window
-void KMdiChildView::setCaption( const TQString& szCaption )
-{
- // this will work only for window
- m_szCaption = szCaption;
- if ( mdiParent() )
- mdiParent() ->setCaption( m_szCaption );
- else //have to call the parent one
- TQWidget::setCaption( m_szCaption );
-
- emit windowCaptionChanged( m_szCaption );
-}
-
-//============== closeEvent ================//
-
-void KMdiChildView::closeEvent( TQCloseEvent *e )
-{
- e->ignore(); //we ignore the event , and then close later if needed.
- emit childWindowCloseRequest( this );
-}
-
-//================ myIconPtr =================//
-
-TQPixmap* KMdiChildView::myIconPtr()
-{
- return 0;
-}
-
-//============= focusInEvent ===============//
-
-void KMdiChildView::focusInEvent( TQFocusEvent *e )
-{
- TQWidget::focusInEvent( e );
-
- // every widget get a focusInEvent when a popup menu is opened!?! -> maybe bug of QT
- if ( e && ( ( e->reason() ) == TQFocusEvent::Popup ) )
- return ;
-
-
- m_bFocusInEventIsPending = true;
- activate();
- m_bFocusInEventIsPending = false;
-
- emit gotFocus( this );
-}
-
-//============= activate ===============//
-
-void KMdiChildView::activate()
-{
- // avoid circularity
- static bool s_bActivateIsPending = false;
- if ( s_bActivateIsPending )
- return ;
-
- s_bActivateIsPending = true;
-
- // raise the view and push the taskbar button
- if ( !m_bMainframesActivateViewIsPending )
- emit focusInEventOccurs( this );
-
- // if this method was called directly, check if the mainframe wants that we interrupt
- if ( m_bInterruptActivation )
- m_bInterruptActivation = false;
- else
- {
- if ( !m_bFocusInEventIsPending )
- setFocus();
-
- kdDebug( 760 ) << k_funcinfo << endl;
- emit activated( this );
- }
-
- if ( m_focusedChildWidget != 0L )
- m_focusedChildWidget->setFocus();
- else
- {
- if ( m_firstFocusableChildWidget != 0L )
- {
- m_firstFocusableChildWidget->setFocus();
- m_focusedChildWidget = m_firstFocusableChildWidget;
- }
- }
- s_bActivateIsPending = false;
-}
-
-//============= focusOutEvent ===============//
-
-void KMdiChildView::focusOutEvent( TQFocusEvent* e )
-{
- TQWidget::focusOutEvent( e );
- emit lostFocus( this );
-}
-
-//============= resizeEvent ===============//
-
-void KMdiChildView::resizeEvent( TQResizeEvent* e )
-{
- TQWidget::resizeEvent( e );
-
- if ( m_stateChanged )
- {
- m_stateChanged = false;
- if ( isMaximized() )
- { //maximized
- emit isMaximizedNow();
- }
- else if ( isMinimized() )
- { //minimized
- emit isMinimizedNow();
- }
- else
- { //is restored
- emit isRestoredNow();
- }
- }
-}
-
-void KMdiChildView::slot_childDestroyed()
-{
- // do what we do if a child is removed
-
- // if we lost a child we uninstall ourself as event filter for the lost
- // child and its children
- const TQObject * pLostChild = TQT_TQOBJECT_CONST(sender());
- if ( pLostChild && ( pLostChild->isWidgetType() ) )
- {
- TQObjectList* list = ( ( TQObject* ) ( pLostChild ) ) ->queryList( TQWIDGET_OBJECT_NAME_STRING );
- list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all lost child widgets
- TQObject* obj;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- TQWidget * widg = ( TQWidget* ) obj;
- ++it;
- widg->removeEventFilter( this );
- if ( m_firstFocusableChildWidget == widg )
- m_firstFocusableChildWidget = 0L; // reset first widget
-
- if ( m_lastFocusableChildWidget == widg )
- m_lastFocusableChildWidget = 0L; // reset last widget
-
- if ( m_focusedChildWidget == widg )
- m_focusedChildWidget = 0L; // reset focused widget
- }
- delete list; // delete the list, not the objects
- }
-}
-
-//============= eventFilter ===============//
-bool KMdiChildView::eventFilter( TQObject *obj, TQEvent *e )
-{
- if ( e->type() == TQEvent::KeyPress && isAttached() )
- {
- TQKeyEvent* ke = ( TQKeyEvent* ) e;
- if ( ke->key() == Qt::Key_Tab )
- {
- TQWidget* w = ( TQWidget* ) obj;
- TQ_FocusPolicy wfp = w->focusPolicy();
- if ( wfp == TQ_StrongFocus || wfp == TQ_TabFocus || w->focusPolicy() == TQ_WheelFocus )
- {
- if ( m_lastFocusableChildWidget != 0 )
- {
- if ( w == m_lastFocusableChildWidget )
- {
- if ( w != m_firstFocusableChildWidget )
- m_firstFocusableChildWidget->setFocus();
- }
- }
- }
- }
- }
- else if ( e->type() == TQEvent::FocusIn )
- {
- if ( obj->isWidgetType() )
- {
- TQObjectList * list = queryList( TQWIDGET_OBJECT_NAME_STRING );
- if ( list->find( obj ) != -1 )
- m_focusedChildWidget = ( TQWidget* ) obj;
-
- delete list; // delete the list, not the objects
- }
- if ( !isAttached() )
- { // is toplevel, for attached views activation is done by main frame event filter
- static bool m_bActivationIsPending = false;
- if ( !m_bActivationIsPending )
- {
- m_bActivationIsPending = true;
- activate(); // sets the focus
- m_bActivationIsPending = false;
- }
- }
- }
- else if ( e->type() == TQEvent::ChildRemoved )
- {
- // if we lost a child we uninstall ourself as event filter for the lost
- // child and its children
- TQObject * pLostChild = TQT_TQOBJECT(( ( TQChildEvent* ) e ) ->child());
- if ( ( pLostChild != 0L ) && ( pLostChild->isWidgetType() ) )
- {
- TQObjectList * list = pLostChild->queryList( TQWIDGET_OBJECT_NAME_STRING );
- list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all lost child widgets
- TQObject * o;
- while ( ( o = it.current() ) != 0 )
- { // for each found object...
- TQWidget * widg = ( TQWidget* ) o;
- ++it;
- widg->removeEventFilter( this );
- TQ_FocusPolicy wfp = widg->focusPolicy();
- if ( wfp == TQ_StrongFocus || wfp == TQ_TabFocus || widg->focusPolicy() == TQ_WheelFocus )
- {
- if ( m_firstFocusableChildWidget == widg )
- m_firstFocusableChildWidget = 0L; // reset first widget
-
- if ( m_lastFocusableChildWidget == widg )
- m_lastFocusableChildWidget = 0L; // reset last widget
- }
- }
- delete list; // delete the list, not the objects
- }
- }
- else if ( e->type() == TQEvent::ChildInserted )
- {
- // if we got a new child and we are attached to the MDI system we
- // install ourself as event filter for the new child and its children
- // (as we did when we were added to the MDI system).
- TQObject * pNewChild = TQT_TQOBJECT(( ( TQChildEvent* ) e ) ->child());
- if ( ( pNewChild != 0L ) && ( pNewChild->isWidgetType() ) )
- {
- TQWidget * pNewWidget = ( TQWidget* ) pNewChild;
- if ( pNewWidget->testWFlags( (WFlags)(WType_Dialog | WShowModal) ) )
- return false;
- TQObjectList *list = pNewWidget->queryList( TQWIDGET_OBJECT_NAME_STRING );
- list->insert( 0, pNewChild ); // add the new child to the list too, just to save code
- TQObjectListIt it( *list ); // iterate over all new child widgets
- TQObject * o;
- while ( ( o = it.current() ) != 0 )
- { // for each found object...
- TQWidget * widg = ( TQWidget* ) o;
- ++it;
- widg->installEventFilter( this );
- connect( widg, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( slot_childDestroyed() ) );
- TQ_FocusPolicy wfp = widg->focusPolicy();
- if ( wfp == TQ_StrongFocus || wfp == TQ_TabFocus || widg->focusPolicy() == TQ_WheelFocus )
- {
- if ( m_firstFocusableChildWidget == 0 )
- m_firstFocusableChildWidget = widg; // first widge
-
- m_lastFocusableChildWidget = widg; // last widget
- }
- }
- delete list; // delete the list, not the objects
- }
- }
- else
- {
- if ( e->type() == TQEvent::IconChange )
- {
- // tqDebug("KMDiChildView:: TQEvent:IconChange intercepted\n");
- if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(this) )
- iconUpdated( this, icon() ? ( *icon() ) : TQPixmap() );
- else if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_trackChanges) )
- setIcon( m_trackChanges->icon() ? ( *( m_trackChanges->icon() ) ) : TQPixmap() );
- }
- if ( e->type() == TQEvent::CaptionChange )
- {
- if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(this) )
- captionUpdated( this, caption() );
- }
- }
-
- return false; // standard event processing
-}
-
-/** Switches interposing in event loop of all current child widgets off. */
-void KMdiChildView::removeEventFilterForAllChildren()
-{
- TQObjectList* list = queryList( TQWIDGET_OBJECT_NAME_STRING );
- TQObjectListIt it( *list ); // iterate over all child widgets
- TQObject* obj;
- while ( ( obj = it.current() ) != 0 )
- { // for each found object...
- TQWidget* widg = ( TQWidget* ) obj;
- ++it;
- widg->removeEventFilter( this );
- }
- delete list; // delete the list, not the objects
-}
-
-TQWidget* KMdiChildView::focusedChildWidget()
-{
- return m_focusedChildWidget;
-}
-
-void KMdiChildView::setFirstFocusableChildWidget( TQWidget* firstFocusableChildWidget )
-{
- m_firstFocusableChildWidget = firstFocusableChildWidget;
-}
-
-void KMdiChildView::setLastFocusableChildWidget( TQWidget* lastFocusableChildWidget )
-{
- m_lastFocusableChildWidget = lastFocusableChildWidget;
-}
-
-/** Set a new value of the task bar button caption */
-void KMdiChildView::setTabCaption ( const TQString& stbCaption )
-{
- m_sTabCaption = stbCaption;
- emit tabCaptionChanged( m_sTabCaption );
-}
-
-void KMdiChildView::setMDICaption ( const TQString& caption )
-{
- setCaption( caption );
- setTabCaption( caption );
-}
-
-/** sets an ID */
-void KMdiChildView::setWindowMenuID( int id )
-{
- m_windowMenuID = id;
-}
-
-//============= slot_clickedInWindowMenu ===============//
-
-/** called if someone click on the "Window" menu item for this child frame window */
-void KMdiChildView::slot_clickedInWindowMenu()
-{
- updateTimeStamp();
- emit clickedInWindowMenu( m_windowMenuID );
-}
-
-//============= slot_clickedInDockMenu ===============//
-
-/** called if someone click on the "Dock/Undock..." menu item for this child frame window */
-void KMdiChildView::slot_clickedInDockMenu()
-{
- emit clickedInDockMenu( m_windowMenuID );
-}
-
-//============= setMinimumSize ===============//
-
-void KMdiChildView::setMinimumSize( int minw, int minh )
-{
- TQWidget::setMinimumSize( minw, minh );
- if ( mdiParent() && mdiParent()->state() != KMdiChildFrm::Minimized )
- {
- mdiParent() ->setMinimumSize( minw + KMDI_CHILDFRM_DOUBLE_BORDER,
- minh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent() ->captionHeight() );
- }
-}
-
-//============= setMaximumSize ===============//
-
-void KMdiChildView::setMaximumSize( int maxw, int maxh )
-{
- if ( mdiParent() && mdiParent()->state() == KMdiChildFrm::Normal )
- {
- int w = maxw + KMDI_CHILDFRM_DOUBLE_BORDER;
- if ( w > TQWIDGETSIZE_MAX )
- w = TQWIDGETSIZE_MAX;
-
- int h = maxh + KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR + mdiParent() ->captionHeight();
- if ( h > TQWIDGETSIZE_MAX )
- h = TQWIDGETSIZE_MAX;
-
- mdiParent()->setMaximumSize( w, h );
- }
- TQWidget::setMaximumSize( maxw, maxh );
-}
-
-//============= show ===============//
-
-void KMdiChildView::show()
-{
- if ( mdiParent() )
- mdiParent()->show();
-
- TQWidget::show();
-}
-
-//============= hide ===============//
-
-void KMdiChildView::hide()
-{
- if ( mdiParent() )
- mdiParent()->hide();
-
- TQWidget::hide();
-}
-
-//============= raise ===============//
-
-void KMdiChildView::raise()
-{
- if ( mdiParent() ) //TODO Check Z-order
- mdiParent()->raise();
-
- TQWidget::raise();
-}
-
-// kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;
diff --git a/kmdi/kmdichildview.h b/kmdi/kmdichildview.h
deleted file mode 100644
index 11e74259e..000000000
--- a/kmdi/kmdichildview.h
+++ /dev/null
@@ -1,615 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdichildview.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-// patches : 02/2000 by Massimo Morin (mmorin@schedsys.com)
-// */2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
-// 02/2001 by Eva Brucherseifer (eva@rt.e-technik.tu-darmstadt.de)
-// 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-#ifndef _KMDI_CHILD_VIEW_H_
-#define _KMDI_CHILD_VIEW_H_
-
-#include <tqwidget.h>
-#include <tqpixmap.h>
-#include <tqrect.h>
-#include <tqapplication.h>
-#include <tqdatetime.h>
-
-#include "kmdichildfrm.h"
-
-class KMdiChildViewPrivate;
-
-/**
- * @short Base class for all your special view windows.
- *
- * Base class for all MDI view widgets. KMdi stores additional information in this class
- * to handle the attach/detach mechanism and such things.
- *
- * All such windows 'lives' attached to a KMdiChildFrm widget
- * managed by KMdiChildArea, or detached (managed by the window manager.)
- * So remember that the KMdiChildView::parent pointer may change, and may be 0L, too.
- *
- * There are 2 possibilities for you to put your widgets under MDI control:
- *
- * Either you inherit all the views from KMdiChildView:
- * \code
- * class MyMdiWidget : public KMdiChildView
- * { .... };
- * ...
- * MyMdiWidget w;
- * mainframe->addWindow(w, flags);
- * \endcode
- *
- * or you wrap them by a KMdiChildView somehow like this:
- *
- * \code
- * void DocViewMan::addKMdiFrame(TQWidget* pNewView, bool bShow, const TQPixmap& icon)
- * {
- * // cover it by a KMdi childview and add that MDI system
- * KMdiChildView* pMDICover = new KMdiChildView( pNewView->caption());
- * pMDICover->setIcon(icon);
- * m_MDICoverList.append( pMDICover);
- * TQBoxLayout* pLayout = new TQHBoxLayout( pMDICover, 0, -1, "layout");
- * pNewView->reparent( pMDICover, TQPoint(0,0));
- * pLayout->addWidget( pNewView);
- * pMDICover->setName( pNewView->name());
- * // captions
- * TQString shortName = pNewView->caption();
- * int length = shortName.length();
- * shortName = shortName.right(length - (shortName.findRev('/') +1));
- * pMDICover->setTabCaption( shortName);
- * pMDICover->setCaption(pNewView->caption());
- *
- * // fake a viewActivated to update the currentEditView/currentBrowserView pointers _before_ adding to MDI control
- * slot_viewActivated( pMDICover);
- *
- * // take it under MDI mainframe control (note: this triggers also a setFocus())
- * int flags;
- * if (bShow) {
- * flags = KMdi::StandardAdd;
- * }
- * else {
- * flags = KMdi::Hide;
- * }
- * // set the accelerators for Toplevel MDI mode (each toplevel window needs its own accels
- * connect( m_pParent, TQT_SIGNAL(childViewIsDetachedNow(TQWidget*)), this, TQT_SLOT(initKeyAccel(TQWidget*)) );
- *
- * m_pParent->addWindow( pMDICover, flags);
- * // correct the default settings of KMdi ('cause we haven't a tab order for subwidget focuses)
- * pMDICover->setFirstFocusableChildWidget(0L);
- * pMDICover->setLastFocusableChildWidget(0L);
- * }
- * \endcode
- *
- */
-
-class KMDI_EXPORT KMdiChildView : public TQWidget
-{
- friend class KMdiMainFrm;
- friend class KMdiChildFrm;
- Q_OBJECT
-
- // attributes
-protected:
- /**
- * See KMdiChildView::caption
- */
- TQString m_szCaption;
-
- /**
- * See KMdiChildView::tabCaption
- */
- TQString m_sTabCaption;
-
- /**
- * See KMdiChildView::focusedChildWidget
- */
- TQWidget* m_focusedChildWidget;
-
- /**
- * See KMdiChildView::setFirstFocusableChildWidget
- */
- TQWidget* m_firstFocusableChildWidget;
-
- /**
- * See KMdiChildView::setLastFocusableChildWidget
- */
- TQWidget* m_lastFocusableChildWidget;
-
- /**
- * Every child view window has an temporary ID in the Window menu of the main frame.
- */
- int m_windowMenuID;
-
- /**
- * Holds a temporary information about if the MDI view state has changed but is not processed yet (pending state).
- * For example it could be that a 'maximize' is pending, if this variable is true.
- */
- bool m_stateChanged;
-
- /**
- * Holds the time when this view was activated (not only displayed) for the last time.
- */
- TQDateTime m_time;
-
-private:
- /**
- * Internally used as indicator whether this KMdiChildView is treated as document view or as tool view.
- */
- bool m_bToolView;
-
- /**
- * Internally used by KMdiMainFrm to store a temporary information that the method
- * activate() is unnecessary and that it can by escaped.
- * This saves from unnecessary calls when activate is called directly.
- */
- bool m_bInterruptActivation;
-
- /**
- * Internally used to prevent cycles between KMdiMainFrm::activateView() and KMdiChildView::activate().
- */
- bool m_bMainframesActivateViewIsPending;
-
- /**
- * Internally used to check if there is a focus in event pending
- */
- bool m_bFocusInEventIsPending;
-
- // methods
-public:
- /**
- * Constructor
- */
- KMdiChildView( const TQString& caption, TQWidget* parentWidget = 0L, const char* name = 0L, WFlags f = 0 );
-
- /**
- * Constructor
- * sets "Unnamed" as default caption
- */
- KMdiChildView( TQWidget* parentWidget = 0L, const char* name = 0L, WFlags f = 0 );
-
- /**
- * Destructor
- */
- ~KMdiChildView();
-
- /**
- * This method does the same as focusInEvent(). That's why it is a replacement for the setFocus() call. It makes
- * sense if you for instance want to focus (I mean raise and activate) this view although the real focus is
- * in another toplevel widget. focusInEvent() will never get called in that case and your setFocus() call for this
- * widget would fail without any effect.
- * Use this method with caution, it always raises the view and pushes the taskbar button. Also when the focus is
- * still on another MDI view in the same toplevel window where this is located!
- */
- void activate();
-
- /**
- * Memorizes the first focusable child widget of this widget
- */
- void setFirstFocusableChildWidget( TQWidget* );
-
- /**
- * Memorizes the last focusable child widget of this widget
- */
- void setLastFocusableChildWidget( TQWidget* );
-
- /**
- * Returns the current focused child widget of this widget
- */
- TQWidget* focusedChildWidget();
-
- /**
- * Returns true if the MDI view is a child window within the MDI mainframe widget
- * or false if the MDI view is in toplevel mode
- */
- bool isAttached() const { return ( mdiParent() != 0L ); }
-
- /**
- * Returns the caption of the child window (different from the caption on the button in the taskbar)
- */
- const TQString& caption() const { return m_szCaption; }
-
- /**
- * Returns the caption of the button on the taskbar
- */
- const TQString& tabCaption() const { return m_sTabCaption; }
-
- /**
- * Sets the window caption string...
- * Calls updateButton on the taskbar button if it has been set.
- */
- virtual void setCaption( const TQString& szCaption );
-
- /**
- * Sets the caption of the button referring to this window
- */
- virtual void setTabCaption( const TQString& caption );
-
- /**
- * Sets the caption of both the window and the button on the taskbar
- */
- virtual void setMDICaption( const TQString &caption );
-
- /**
- * Returns the KMdiChildFrm parent widget (or 0 if the window is not attached)
- */
- KMdiChildFrm *mdiParent() const;
-
- /**
- * Tells if the window is minimized when attached to the Mdi manager,
- * or if it is VISIBLE when 'floating'.
- */
- bool isMinimized() const;
-
- /**
- * Tells if the window is minimized when attached to the Mdi manager,
- * otherwise returns false.
- */
- bool isMaximized() const;
-
- /**
- * Returns the geometry of this MDI child window as TQWidget::geometry() does.
- */
- TQRect internalGeometry() const;
-
- /**
- * Sets the geometry of the client area of this MDI child window. The
- * top left position of the argument is the position of the top left point
- * of the client area in its parent coordinates and the arguments width
- * and height is the width and height of the client area. Please note: This
- * differs from the behavior of TQWidget::setGeometry()!
- */
- void setInternalGeometry( const TQRect& newGeomety );
-
- /**
- * Returns the frame geometry of this window or of the parent if there is any...
- */
- TQRect externalGeometry() const;
-
- /**
- * Sets the geometry of the frame of this MDI child window. The top left
- * position of the argument is the position of the top left point of the
- * frame in its parent coordinates and the arguments width and height is
- * the width and height of the widget frame. Please note: This differs
- * from the behavior of TQWidget::setGeometry()!
- */
- void setExternalGeometry( const TQRect& newGeomety );
-
- /**
- * You should override this function in the derived class.
- */
- virtual TQPixmap* myIconPtr();
-
- /**
- * Minimizes this window when it is attached to the Mdi manager.
- * Otherwise has no effect
- */
- virtual void minimize( bool bAnimate );
-
- /**
- * Maximizes this window when it is attached to the Mdi manager.
- * Otherwise has no effect
- */
- virtual void maximize( bool bAnimate );
-
- /**
- * Returns the geometry that will be restored by calling restore().
- */
- TQRect restoreGeometry();
-
- /**
- * Sets the geometry that will be restored by calling restore().
- */
- void setRestoreGeometry( const TQRect& newRestGeo );
-
- /**
- * Switches interposing in event loop of all current child widgets off.
- */
- void removeEventFilterForAllChildren();
-
- /**
- * Internally used for setting an ID for the 'Window' menu entry
- */
- void setWindowMenuID( int id );
-
- /**
- * Sets the minimum size of the widget to w by h pixels.
- * It extends it base clase method in a way that the minimum size of
- * its childframe (if there is one) will be set, additionally.
- */
- virtual void setMinimumSize ( int minw, int minh );
-
- /**
- * Sets the maximum size of the widget to w by h pixels.
- * It extends it base clase method in a way that the maximum size of
- * its childframe (if there is one) will be set, additionally.
- */
- virtual void setMaximumSize ( int maxw, int maxh );
-
- /**
- * Returns if this is added as MDI tool-view
- */
- inline bool isToolView() const { return m_bToolView; }
-
- /**
- * Remember the current time
- */
- inline void updateTimeStamp()
- {
- m_time.setDate( TQDate::currentDate() );
- m_time.setTime( TQTime::currentTime() );
- }
-
- /**
- * Recall a previously remembered time, i.e. the value of m_time
- */
- inline const TQDateTime& getTimeStamp() const { return m_time; }
-
-public slots:
- /**
- * Attaches this window to the Mdi manager.
- * It calls the KMdiMainFrm attachWindow function , so if you have a pointer
- * to this KMdiMainFrm you'll be faster calling that function.
- */
- virtual void attach();
-
- /**
- * Detaches this window from the Mdi manager.
- * It calls the KMdiMainFrm detachWindow function , so if you have a pointer
- * to this KMdiMainFrm you'll be faster calling that function.
- */
- virtual void detach();
-
- /**
- * Mimimizes the MDI view. If attached, the covering childframe widget is minimized (only a mini widget
- * showing the caption bar and the system buttons will remain visible). If detached, it will use the
- * minimize of the underlying system ( TQWidget::showMinimized ).
- */
- virtual void minimize();
-
- /**
- * Maximizes the MDI view. If attached, this widget will fill the whole MDI view area widget. The system buttons
- * move to the main menubar (if set by KMdiMainFrm::setMenuForSDIModeSysButtons ).
- * If detached, it will use the minimize of the underlying system ( TQWidget::showMaximized ).
- */
- virtual void maximize();
-
- /**
- * Restores this window to its normal size. Also known as 'normalize'.
- */
- virtual void restore();
-
- /**
- * Internally called, if KMdiMainFrm::attach is called.
- * Actually, only the caption of the covering childframe is set.
- */
- virtual void youAreAttached( KMdiChildFrm *lpC );
-
- /**
- * Internally called, if KMdiMainFrm::detach is called.
- * Some things for going toplevel will be done here.
- */
- virtual void youAreDetached();
-
- /**
- * Called if someone click on the "Window" menu item for this child frame window
- */
- virtual void slot_clickedInWindowMenu();
-
- /**
- * Called if someone click on the "Dock/Undock..." menu item for this child frame window
- */
- virtual void slot_clickedInDockMenu();
-
- /**
- * Calls TQWidget::show but also for it's parent widget if attached
- */
- virtual void show();
-
- /**
- * Calls TQWidget::hide() or it's parent widget hide() if attached
- */
- virtual void hide();
-
- /**
- * Calls TQWidget::raise() or it's parent widget raise() if attached
- */
- virtual void raise();
-
- /**
- * Overridden from its base class method. Emits a signal KMdiChildView::isMinimizedNow , additionally.
- * Note that this method is not used by an external windows manager call on system minimizing.
- */
- virtual void showMinimized();
-
- /**
- * Overridden from its base class method. Emits a signal KMdiChildView::isMaximizedNow , additionally.
- * Note that this method is not used by an external windows manager call on system maximizing.
- */
- virtual void showMaximized();
-
- /**
- * Overridden from its base class method. Emits a signal KMdiChildView::isRestoredNow , additionally.
- * Note that this method is not used by an external windows manager call on system normalizing.
- */
- virtual void showNormal();
-
-
-protected:
- /**
- * Ignores the event and calls KMdiMainFrm::childWindowCloseRequest instead. This is because the
- * mainframe has control over the views. Therefore the MDI view has to request the mainframe for a close.
- */
- virtual void closeEvent( TQCloseEvent *e );
-
- /**
- * It only catches TQEvent::KeyPress events there. If a Qt::Key_Tab is pressed, the internal MDI focus
- * handling is called. That means if the last focusable child widget of this is called, it will jump to the
- * first focusable child widget of this.
- * See KMdiChildView::setFirstFocusableChildWidget and KMdiChildView::lastFirstFocusableChildWidget
- */
- virtual bool eventFilter( TQObject *obj, TQEvent *e );
-
- /**
- * If attached, the childframe will be activated and the MDI taskbar button will be pressed. Additionally, the
- * memorized old focused child widget of this is focused again.
- * Sends the focusInEventOccurs signal before changing the focus and the
- * gotFocus signal after changing the focus.
- */
- virtual void focusInEvent( TQFocusEvent *e );
-
- /**
- * Send the lostFocus signal
- */
- virtual void focusOutEvent( TQFocusEvent *e );
-
- /**
- * Internally used for the minimize/maximize/restore mechanism when in attach mode.
- */
- virtual void resizeEvent( TQResizeEvent *e );
-
- void trackIconAndCaptionChanges( TQWidget *view );
-
-protected slots:
- void slot_childDestroyed();
-
-signals:
- /**
- * Internally used by KMdiChildView::attach to send it as command to the mainframe.
- */
- void attachWindow( KMdiChildView*, bool );
-
- /**
- * Internally used by KMdiChildView::detach to send it as command to the mainframe.
- */
- void detachWindow( KMdiChildView*, bool );
-
- /**
- * Is sent when this MDI child view is going to receive focus (before actually changing the focus).
- * Internally used to send information to the mainframe that this MDI child view is focused.
- * See KMdiChildView::focusInEvent
- */
- void focusInEventOccurs( KMdiChildView* );
-
- /**
- * Is sent when this MDI child has received the focus (after actually changing the focus).
- * See KMdiChildView::focusInEvent
- */
- void gotFocus( KMdiChildView* );
-
- /**
- * Is sent when this MDI child was set to the activate view of all MDI views (after actually changing the focus).
- * See KMdiChildView::activate
- */
- void activated( KMdiChildView* );
-
- /** Is sent when this MDI child view has lost the focus (after actually changing the focus).
- * See KMdiChildView::focusOutEvent
- */
- void lostFocus( KMdiChildView* );
-
- /** Is sent when this MDI child view was deactivated (after actually changing the focus).
- * See KMdiChildView::focusOutEvent
- */
- void deactivated( KMdiChildView* );
-
- /**
- * Internally used to send information to the mainframe that this MDI child view wants to be closed.
- * See KMdiChildView::closeEvent and KMdiMainFrm::closeWindow
- */
- void childWindowCloseRequest( KMdiChildView* );
-
- /**
- * Emitted when the window caption is changed via KMdiChildView::setCaption or KMdiChildView::setMDICaption
- */
- void windowCaptionChanged( const TQString& );
-
- /**
- * Emitted when the window caption is changed via KMdiChildView::setTabCaption or KMdiChildView::setMDICaption
- */
- void tabCaptionChanged( const TQString& );
-
- /**
- * Internally used to send information to the mainframe that this MDI view is maximized now.
- * Usually, the mainframe switches system buttons.
- */
- void mdiParentNowMaximized( bool );
-
- /**
- * Is automatically emitted when slot_clickedInWindowMenu is called
- */
- void clickedInWindowMenu( int );
-
- /**
- * Is automatically emitted when slot_clickedInDockMenu is called
- */
- void clickedInDockMenu( int );
-
- /**
- * Signals this has been maximized
- */
- void isMaximizedNow();
-
- /**
- * Signals this has been minimized
- */
- void isMinimizedNow();
-
- /**
- * Signals this has been restored (normalized)
- */
- void isRestoredNow();
-
- /**
- * Signals this has been attached
- */
- void isAttachedNow();
-
- /**
- * Signals this has been detached
- */
- void isDetachedNow();
-
- void iconUpdated( TQWidget*, TQPixmap );
- void captionUpdated( TQWidget*, const TQString& );
-
-
-private:
- KMdiChildViewPrivate *d;
- TQWidget *m_trackChanges;
-};
-
-inline KMdiChildFrm *KMdiChildView::mdiParent() const
-{
- TQWidget * pw = parentWidget();
- if ( pw != 0L )
- if ( pw->inherits( "KMdiChildFrm" ) )
- return ( KMdiChildFrm * ) pw;
- return 0L;
-}
-
-#endif //_KMDICHILDVIEW_H_
-
-// kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;
diff --git a/kmdi/kmdidefines.h b/kmdi/kmdidefines.h
deleted file mode 100644
index 8673876a5..000000000
--- a/kmdi/kmdidefines.h
+++ /dev/null
@@ -1,117 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdidefines.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-#ifndef _KMDI_DEFINES_H_
-#define _KMDI_DEFINES_H_
-
-#include <tdelibs_export.h>
-
-#define KMDI_CHILDFRM_SEPARATOR 2
-#define KMDI_CHILDFRM_BORDER 4
-#define KMDI_CHILDFRM_DOUBLE_BORDER 8
-#define KMDI_CHILDFRM_MIN_WIDTH 130
-
-//----------------------------------------------------------------------------
-/**
-* @short A namespace for the KMDI library
-*/
-namespace KMdi
-{
- /** extent Qt events
- @see TQCustomEvent, TQEvent::User
- \code
- bool B_MyWidget::event( TQEvent* e) {
- if( e->type() == TQEvent::Type(TQEvent::User + int(KMdi::EV_Move))) {
- ...
- }
- ...
- }
- \endcode
- */
- enum EventType {
- EV_Move=1,
- EV_DragBegin,
- EV_DragEnd,
- EV_ResizeBegin,
- EV_ResizeEnd
- };
-
- /**
- * During KMdiMainFrm::addWindow the enum AddWindowFlags is used to determine how the view is initialy being added to the MDI system
- */
- enum AddWindowFlags {
- /**
- * standard is: show normal, attached, visible, document view (not toolview). Maximize, Minimize, Hide adds
- * appropriately. Detach adds a view that appears toplevel, ToolWindow adds the view as tool view.
- * That means it is stay-on-top and toplevel. UseKMdiSizeHint should use the restore geometry of the
- * latest current top childframe but is not supported yet.
- */
- StandardAdd = 0,
- Maximize = 1,
- Minimize = 2,
- Hide = 4,
- Detach = 8,
- ToolWindow = 16,
- UseKMdiSizeHint = 32,
- AddWindowFlags = 0xff
- };
-
- enum FrameDecor {
- Win95Look = 0,
- KDE1Look = 1,
- KDELook = 2,
- KDELaptopLook = 3
- };
-
- enum MdiMode {
- UndefinedMode = 0,
- ToplevelMode = 1,
- ChildframeMode = 2,
- TabPageMode = 3,
- IDEAlMode = 4
- };
-
- enum TabWidgetVisibility {
- AlwaysShowTabs = 0,
- ShowWhenMoreThanOneTab = 1,
- NeverShowTabs = 2
- };
-
- /**
- * The style of the toolview tabs
- * \since 3.3
- */
- enum ToolviewStyle {
- /** Show only icons on the toolview tabs. The visible toolviews contain both the icon and text. */
- IconOnly = 0,
- /** Show only the text description on the toolview tabs. */
- TextOnly = 1,
- /** Show both the icon and description on the toolview tabs. */
- TextAndIcon = 3
- };
-} //namespace
-
-#endif //_KMDIDEFINES_H_
diff --git a/kmdi/kmdidockcontainer.cpp b/kmdi/kmdidockcontainer.cpp
deleted file mode 100644
index af086ee51..000000000
--- a/kmdi/kmdidockcontainer.cpp
+++ /dev/null
@@ -1,858 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2002 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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.
-*/
-
-#include "kmdimainfrm.h"
-#include "kmdidockcontainer.h"
-#include "kmdidockcontainer.moc"
-
-#include "kdockwidget_private.h"
-
-#include <tqwidgetstack.h>
-#include <tqlayout.h>
-#include <tqtimer.h>
-#include <tqtooltip.h>
-#include <kmultitabbar.h>
-#include <kglobalsettings.h>
-
-#include <kdebug.h>
-#include <kiconloader.h>
-#include <kapplication.h>
-#include <kconfig.h>
-#include <klocale.h>
-
-//TODO: Well, this is already defined in tdeui/kdockwidget.cpp
-static const char* const kmdi_not_close_xpm[] =
- {
- "5 5 2 1",
- "# c black",
- ". c None",
- "#####",
- "#...#",
- "#...#",
- "#...#",
- "#####"
- };
-
-KMdiDockContainer::KMdiDockContainer( TQWidget *parent, TQWidget *win, int position, int flags )
- : TQWidget( parent ), KDockContainer()
-{
- m_tabSwitching = false;
- m_block = false;
- m_inserted = -1;
- m_mainWin = win;
- oldtab = -1;
- mTabCnt = 0;
- m_position = position;
- m_previousTab = -1;
- m_separatorPos = 18000;
- m_movingState = NotMoving;
- m_startEvent = 0;
- kdDebug( 760 ) << k_funcinfo << endl;
-
- TQBoxLayout *l;
- m_horizontal = ( ( position == KDockWidget::DockTop ) || ( position == KDockWidget::DockBottom ) );
-
-
- if ( m_horizontal )
- l = new TQVBoxLayout( this ); //vertical layout for top and bottom docks
- else
- l = new TQHBoxLayout( this ); //horizontal layout for left and right docks
-
- l->setAutoAdd( false );
-
- m_tb = new KMultiTabBar( m_horizontal ? KMultiTabBar::Horizontal : KMultiTabBar::Vertical, this );
-
- m_tb->setStyle( KMultiTabBar::KMultiTabBarStyle( flags ) );
- m_tb->showActiveTabTexts( true );
-
- KMultiTabBar::KMultiTabBarPosition kmtbPos;
- switch( position )
- {
- case KDockWidget::DockLeft:
- kmtbPos = KMultiTabBar::Left;
- break;
- case KDockWidget::DockRight:
- kmtbPos = KMultiTabBar::Right;
- break;
- case KDockWidget::DockTop:
- kmtbPos = KMultiTabBar::Top;
- break;
- case KDockWidget::DockBottom:
- kmtbPos = KMultiTabBar::Bottom;
- break;
- default:
- kmtbPos = KMultiTabBar::Right;
- break;
- }
- m_tb->setPosition( kmtbPos );
-
- m_ws = new TQWidgetStack( this );
-
- m_ws->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
-
- //layout the tabbar
- if ( position == KDockWidget::DockLeft || position == KDockWidget::DockTop )
- {
- //add the tabbar then the widget stack
- l->add( m_tb );
- l->add( m_ws );
- }
- else
- {
- //add the widget stack then the tabbar
- l->add( m_ws );
- l->add( m_tb );
- }
-
- l->activate();
- m_ws->hide();
-
-}
-
-void KMdiDockContainer::setStyle( int style )
-{
- if ( m_tb )
- m_tb->setStyle( KMultiTabBar::KMultiTabBarStyle( style ) );
-}
-
-KMdiDockContainer::~KMdiDockContainer()
-{
- TQMap<KDockWidget*, int>::iterator it;
- while ( m_map.count() )
- {
- it = m_map.begin();
- KDockWidget *w = it.key();
- if ( m_overlapButtons.contains( w ) )
- {
- ( ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() ) )->removeButton( m_overlapButtons[w] );
- m_overlapButtons.remove( w );
- }
- m_map.remove( w );
- w->undock();
- }
- deactivated( this );
-}
-
-
-void KMdiDockContainer::init()
-{
- bool overlap = isOverlapMode();
- kdDebug( 760 ) << k_funcinfo << endl;
- if ( !m_horizontal )
- {
- kdDebug( 760 ) << k_funcinfo << "Horizontal tabbar. Setting forced fixed width." << endl;
- parentDockWidget()->setForcedFixedWidth( m_tb->width() );
- activateOverlapMode( m_tb->width() );
- }
- else
- {
- kdDebug( 760 ) << k_funcinfo << "Vertical tabbar. Setting forced fixed height." << endl;
- parentDockWidget()->setForcedFixedHeight( m_tb->height() );
- activateOverlapMode( m_tb->height() );
- }
-
- if (!overlap) deactivateOverlapMode();
-
- // try to restore splitter size
- if ( parentDockWidget() && parentDockWidget()->parent() )
- {
- KDockSplitter * sp = ::tqqt_cast<KDockSplitter*>( parentDockWidget()->parent() );
- if ( sp )
- sp->setSeparatorPosX( m_separatorPos );
- }
-}
-
-KDockWidget* KMdiDockContainer::parentDockWidget()
-{
- return ( ( KDockWidget* ) parent() );
-}
-
-void KMdiDockContainer::insertWidget ( KDockWidget *dwdg, TQPixmap pixmap, const TQString &text, int & )
-{
- kdDebug( 760 ) << k_funcinfo << "Adding a dockwidget to the dock container" << endl;
- KDockWidget* w = dwdg;
- int tab;
- bool alreadyThere = m_map.contains( w );
-
- if ( alreadyThere )
- {
- tab = m_map[ w ];
- if ( m_ws->addWidget( w, tab ) != tab )
- kdDebug( 760 ) << "ERROR COULDN'T READD WIDGET" << endl;
-
- kdDebug( 760 ) << k_funcinfo << "Readded widget " << dwdg << endl;
- }
- else
- {
- tab = m_ws->addWidget( w );
- m_map.insert( w, tab );
- m_revMap.insert( tab, w );
-
- if ( ( ( KDockWidget* ) parentWidget() ) ->mayBeShow() )
- ( ( KDockWidget* ) parentWidget() ) ->dockBack();
-
- if ( ::tqqt_cast<KDockWidgetHeader*>(w->getHeader()) )
- {
- kdDebug( 760 ) << k_funcinfo << "The dockwidget we're adding has a header" << endl;
- kdDebug( 760 ) << k_funcinfo << "Adding our overlap mode button to it" << endl;
-
- KDockWidgetHeader *hdr = ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() );
- KDockButton_Private *btn = new KDockButton_Private( hdr, "OverlapButton" );
-
- TQToolTip::add( btn, i18n( "Switch between overlap and side by side mode", "Overlap" ) );
-
- btn->setToggleButton( true );
- btn->setPixmap( const_cast< const char** >( kmdi_not_close_xpm ) );
- hdr->addButton( btn );
- m_overlapButtons.insert( w, btn );
- btn->setOn( !isOverlapMode() );
-
- connect( btn, TQT_SIGNAL( clicked() ), this, TQT_SLOT( changeOverlapMode() ) );
- }
-
- m_tb->appendTab( pixmap.isNull() ? SmallIcon( "misc" ) : pixmap, tab, w->tabPageLabel() );
- m_tb->tab( tab )->installEventFilter( this );
- kdDebug( 760 ) << k_funcinfo << "Added tab with label " << w->tabPageLabel() <<
- " to the tabbar" << endl;
-
- connect( m_tb->tab( tab ), TQT_SIGNAL( clicked( int ) ), this, TQT_SLOT( tabClicked( int ) ) );
-
- mTabCnt++;
- m_inserted = tab;
- int dummy = 0;
- KDockContainer::insertWidget( w, pixmap, text, dummy );
- itemNames.append( w->name() );
- tabCaptions.insert( w->name(), w->tabPageLabel() );
- tabTooltips.insert( w->name(), w->toolTipString() );
- }
-
- //FB m_ws->raiseWidget(tab);
-}
-
-
-bool KMdiDockContainer::eventFilter( TQObject *obj, TQEvent *event )
-{
- switch ( event->type() )
- {
- case TQEvent::MouseButtonPress:
- {
- KMultiTabBarTab* kmtbTab = tqt_dynamic_cast<KMultiTabBarTab*>( obj );
- if ( !kmtbTab )
- {
- kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no tab" << endl;
- break;
- }
-
- KDockWidget* w = m_revMap[ kmtbTab->id() ];
- if ( !w )
- {
- kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no widget" << endl;
- break;
- }
-
- if ( !w->getHeader() )
- {
- kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no header" << endl;
- break;
- }
-
- KDockWidgetHeader *hdr = ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() );
- if ( !hdr )
- {
- kdDebug(760) << "Wrong header type in KMdiDockContainer::eventFilter" << endl;
- break;
- }
-
- m_dockManager = w->dockManager();
- m_dragPanel = TQT_TQOBJECT(hdr->dragPanel());
-
- if ( m_dragPanel )
- m_movingState = WaitingForMoveStart;
-
- delete m_startEvent;
- m_startEvent = new TQMouseEvent( * ( ( TQMouseEvent* ) event ) );
- }
- break;
- case TQEvent::MouseButtonRelease:
- if ( m_movingState == Moving )
- {
- m_movingState = NotMoving;
- TQApplication::postEvent( m_dragPanel, new TQMouseEvent( * ( ( TQMouseEvent* ) event ) ) );
- delete m_startEvent;
- m_startEvent = 0;
- }
- case TQEvent::MouseMove:
- if ( m_movingState == WaitingForMoveStart )
- {
- TQPoint p( ( ( TQMouseEvent* ) event )->pos() - m_startEvent->pos() );
- if ( p.manhattanLength() > TDEGlobalSettings::dndEventDelay() )
- {
- m_dockManager->eventFilter( m_dragPanel, TQT_TQEVENT(m_startEvent) );
- m_dockManager->eventFilter( m_dragPanel, event );
- m_movingState = Moving;
- }
- }
- else if ( m_movingState == Moving )
- m_dockManager->eventFilter( m_dragPanel, event );
-
- break;
- default:
- break;
-
- }
- return false;
-
-}
-
-void KMdiDockContainer::showWidget( KDockWidget *w )
-{
- if ( !m_map.contains( w ) )
- return ;
-
- int id = m_map[ w ];
- m_tb->setTab( id, true );
- tabClicked( id );
-}
-
-void KMdiDockContainer::changeOverlapMode()
-{
- const KDockButton_Private * btn = tqt_dynamic_cast<const KDockButton_Private*>( sender() );
-
- if ( !btn )
- return ;
-
- if ( !btn->isOn() )
- {
- kdDebug( 760 ) << k_funcinfo << "Activating overlap mode" << endl;
- if ( !m_horizontal )
- activateOverlapMode( m_tb->width() );
- else
- activateOverlapMode( m_tb->height() );
-
- }
- else
- {
- kdDebug( 760 ) << k_funcinfo << "Deactivating overlap mode" << endl;
- deactivateOverlapMode();
- }
-
- TQMap<KDockWidget*, KDockButton_Private*>::iterator it;
- for ( it = m_overlapButtons.begin(); it != m_overlapButtons.end(); ++it )
- it.data()->setOn( !isOverlapMode() );
-}
-
-void KMdiDockContainer::hideIfNeeded()
-{
- if ( itemNames.count() == 0 )
- {
- kdDebug( 760 ) << k_funcinfo << "Hiding the dock container" << endl;
- ( ( KDockWidget* ) parentWidget() )->undock();
- }
-}
-
-void KMdiDockContainer::removeWidget( KDockWidget* dwdg )
-{
- KDockWidget * w = dwdg;
- if ( !m_map.contains( w ) )
- return; //we don't have this widget in our container
-
- kdDebug( 760 ) << k_funcinfo << endl;
- //lower the tab. ( TODO: needed? )
- int id = m_map[ w ];
- if ( m_tb->isTabRaised( id ) )
- {
- m_tb->setTab( id, false );
- tabClicked( id );
- }
-
- m_tb->removeTab( id );
- m_ws->removeWidget( w );
- m_map.remove( w );
- m_revMap.remove( id );
- if ( m_overlapButtons.contains( w ) )
- {
- ( ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() ) )->removeButton( m_overlapButtons[ w ] );
- m_overlapButtons.remove( w );
- }
- KDockContainer::removeWidget( w );
- itemNames.remove( w->name() );
- tabCaptions.remove( w->name() );
- tabTooltips.remove( w->name() );
- hideIfNeeded();
-}
-
-void KMdiDockContainer::undockWidget( KDockWidget *dwdg )
-{
- KDockWidget * w = dwdg;
-
- if ( !m_map.contains( w ) )
- return ;
-
- int id = m_map[ w ];
- if ( m_tb->isTabRaised( id ) )
- {
- kdDebug( 760 ) << k_funcinfo << "Widget has been undocked, setting tab down" << endl;
- m_tb->setTab( id, false );
- tabClicked( id );
- }
-}
-
-void KMdiDockContainer::tabClicked( int t )
-{
- bool call_makeVisible = !m_tabSwitching;
- m_tabSwitching = true;
- if ( m_tb->isTabRaised( t ) )
- {
- kdDebug( 760 ) << k_funcinfo << "Tab " << t << " was just activated" << endl;
- if ( m_ws->isHidden() )
- {
- kdDebug( 760 ) << k_funcinfo << "Showing widgetstack for tab just clicked" << endl;
- m_ws->show();
- parentDockWidget()->restoreFromForcedFixedSize();
- }
-
- if ( !m_ws->widget( t ) )
- {
- kdDebug( 760 ) << k_funcinfo << "Widget tab was clicked for is not in our stack" << endl;
- kdDebug( 760 ) << k_funcinfo << "Docking it back in" << endl;
- m_revMap[t]->manualDock( parentDockWidget(), KDockWidget::DockCenter, 20 );
- if ( call_makeVisible )
- m_revMap[t]->makeDockVisible();
- m_tabSwitching = false;
- emit activated( this );
- return ;
- }
-
- if ( m_ws->widget( t ) )
- {
- m_ws->raiseWidget( t );
- KDockWidget * tmpDw = ::tqqt_cast<KDockWidget*>( m_ws->widget( t ) );
- if ( tmpDw )
- {
- if ( tmpDw->getWidget() )
- tmpDw->getWidget()->setFocus();
- }
- else
- kdDebug( 760 ) << k_funcinfo << "Something really weird is going on" << endl;
- }
- else
- kdDebug( 760 ) << k_funcinfo << "We have no widget to handle in our stack." << endl;
-
- if ( oldtab != t )
- m_tb->setTab( oldtab, false );
-
- m_tabSwitching = true;
- oldtab = t;
- emit activated( this );
- }
- else
- {
- kdDebug( 760 ) << k_funcinfo << "Tab " << t << " was just deactiviated" << endl;
- // try save splitter position
- if ( parentDockWidget() && parentDockWidget()->parent() )
- {
- KDockSplitter * sp = ::tqqt_cast<KDockSplitter*>( parentDockWidget()->parent() );
- if ( sp )
- m_separatorPos = sp->separatorPos();
- }
- m_previousTab = t;
- // oldtab=-1;
- if ( m_block )
- return ;
- emit deactivated( this );
- m_block = true;
- if ( m_ws->widget( t ) )
- {
- // ((KDockWidget*)m_ws->widget(t))->undock();
- }
- m_block = false;
- m_ws->hide ();
-
-
- kdDebug( 760 ) << k_funcinfo << "Fixed Width:" << m_tb->width() << endl;
- if ( !m_horizontal )
- parentDockWidget()->setForcedFixedWidth( m_tb->width() ); // strange why it worked before at all
- else
- parentDockWidget()->setForcedFixedHeight( m_tb->height() ); // strange why it worked before at all
- }
- m_tabSwitching = false;
-}
-
-void KMdiDockContainer::setToolTip ( KDockWidget* w, TQString &s )
-{
- kdDebug( 760 ) << k_funcinfo << "Setting tooltip '" << s << "' for widget " << w << endl;
- int tabId = m_map[w];
- KMultiTabBarTab *mbTab = m_tb->tab( tabId );
- TQToolTip::remove( mbTab );
- TQToolTip::add( mbTab, s );
-}
-
-void KMdiDockContainer::setPixmap( KDockWidget* widget , const TQPixmap& pixmap )
-{
- int id = m_ws->id( widget );
- if ( id == -1 )
- return ;
- KMultiTabBarTab *tab = m_tb->tab( id );
- tab->setIcon( pixmap.isNull() ? SmallIcon( "misc" ) : pixmap );
-}
-
-void KMdiDockContainer::save( TQDomElement& dockEl )
-{
- TQDomDocument doc = dockEl.ownerDocument();
- TQDomElement el;
- el = doc.createElement( "name" );
- el.appendChild( doc.createTextNode( TQString( "%1" ).arg( parent() ->name() ) ) );
- dockEl.appendChild( el );
- el = doc.createElement( "overlapMode" );
- el.appendChild( doc.createTextNode( isOverlapMode() ? "true" : "false" ) );
- dockEl.appendChild( el );
- TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it( *tl );
- TQStringList::Iterator it2 = itemNames.begin();
- int i = 0;
- for ( ;it.current() != 0;++it, ++it2 )
- {
- el = doc.createElement( "child" );
- el.setAttribute( "pos", TQString( "%1" ).arg( i ) );
- TQString s = tabCaptions[ *it2 ];
- if ( !s.isEmpty() )
- {
- el.setAttribute( "tabCaption", s );
- }
- s = tabTooltips[ *it2 ];
- if ( !s.isEmpty() )
- {
- el.setAttribute( "tabTooltip", s );
- }
- el.appendChild( doc.createTextNode( *it2 ) );
- dockEl.appendChild( el );
- if ( m_tb->isTabRaised( it.current() ->id() ) )
- {
- TQDomElement el2 = doc.createElement( "raised" );
- el2.appendChild( doc.createTextNode( m_ws->widget( it.current() ->id() ) ->name() ) );
- el.appendChild( el2 );
- }
- ++i;
- }
-
-
-}
-
-void KMdiDockContainer::load( TQDomElement& dockEl )
-{
- TQString raise;
-
- for ( TQDomNode n = dockEl.firstChild();!n.isNull();n = n.nextSibling() )
- {
- TQDomElement el = n.toElement();
- if ( el.isNull() )
- continue;
- if ( el.tagName() == "overlapMode" )
- {
- if ( el.attribute( "overlapMode" ) != "false" )
- activateOverlapMode( m_horizontal?m_tb->height():m_tb->width() );
- else
- deactivateOverlapMode();
- }
- else if ( el.tagName() == "child" )
- {
- KDockWidget * dw = ( ( KDockWidget* ) parent() ) ->dockManager() ->getDockWidgetFromName( el.text() );
- if ( dw )
- {
- if ( el.hasAttribute( "tabCaption" ) )
- {
- dw->setTabPageLabel( el.attribute( "tabCaption" ) );
- }
- if ( el.hasAttribute( "tabTooltip" ) )
- {
- dw->setToolTipString( el.attribute( "tabTooltip" ) );
- }
- dw->manualDock( ( KDockWidget* ) parent(), KDockWidget::DockCenter );
- }
- }
- }
-
- TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it1( *tl );
- m_ws->hide();
- if ( !m_horizontal )
- parentDockWidget()->setForcedFixedWidth( m_tb->width() );
- else
- parentDockWidget()->setForcedFixedHeight( m_tb->height() );
-
- for ( ;it1.current() != 0;++it1 )
- m_tb->setTab( it1.current() ->id(), false );
-
- kapp->syncX();
- m_delayedRaise = -1;
-
- for ( TQMap<KDockWidget*, KDockButton_Private*>::iterator it = m_overlapButtons.begin();
- it != m_overlapButtons.end();++it )
- it.data() ->setOn( !isOverlapMode() );
-
- if ( !raise.isEmpty() )
- {
- for ( TQMap<KDockWidget*, int>::iterator it = m_map.begin();it != m_map.end();++it )
- {
- if ( it.key() ->name() == raise )
- {
- m_delayedRaise = it.data();
- TQTimer::singleShot( 0, this, TQT_SLOT( delayedRaise() ) );
- kdDebug( 760 ) << k_funcinfo << "raising " << it.key()->name() << endl;
- break;
- }
- }
-
- }
- if ( m_delayedRaise == -1 )
- TQTimer::singleShot( 0, this, TQT_SLOT( init() ) );
-}
-
-void KMdiDockContainer::save( TDEConfig* cfg, const TQString& group_or_prefix )
-{
- TQString grp = cfg->group();
- cfg->deleteGroup( group_or_prefix + TQString( "::%1" ).arg( parent() ->name() ) );
- cfg->setGroup( group_or_prefix + TQString( "::%1" ).arg( parent() ->name() ) );
-
- if ( isOverlapMode() )
- cfg->writeEntry( "overlapMode", "true" );
- else
- cfg->writeEntry( "overlapMode", "false" );
-
- // try to save the splitter position
- if ( parentDockWidget() && parentDockWidget() ->parent() )
- {
- KDockSplitter * sp = ::tqqt_cast<KDockSplitter*>( parentDockWidget() -> parent() );
- if ( sp )
- cfg->writeEntry( "separatorPosition", m_separatorPos );
- }
-
- TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it( *tl );
- TQStringList::Iterator it2 = itemNames.begin();
- int i = 0;
- for ( ;it.current() != 0;++it, ++it2 )
- {
- // cfg->writeEntry(TQString("widget%1").arg(i),m_ws->widget(it.current()->id())->name());
- cfg->writeEntry( TQString( "widget%1" ).arg( i ), ( *it2 ) );
- TQString s = tabCaptions[ *it2 ];
- if ( !s.isEmpty() )
- {
- cfg->writeEntry( TQString( "widget%1-tabCaption" ).arg( i ), s );
- }
- s = tabTooltips[ *it2 ];
- if ( !s.isEmpty() )
- {
- cfg->writeEntry( TQString( "widget%1-tabTooltip" ).arg( i ), s );
- }
- // kdDebug(760)<<"****************************************Saving: "<<m_ws->widget(it.current()->id())->name()<<endl;
- if ( m_tb->isTabRaised( it.current() ->id() ) )
- cfg->writeEntry( m_ws->widget( it.current() ->id() ) ->name(), true );
- ++i;
- }
- cfg->sync();
- cfg->setGroup( grp );
-
-}
-
-void KMdiDockContainer::load( TDEConfig* cfg, const TQString& group_or_prefix )
-{
- TQString grp = cfg->group();
- cfg->setGroup( group_or_prefix + TQString( "::%1" ).arg( parent() ->name() ) );
-
- if ( cfg->readEntry( "overlapMode" ) != "false" )
- activateOverlapMode( m_horizontal?m_tb->height():m_tb->width() );
- else
- deactivateOverlapMode();
-
- m_separatorPos = cfg->readNumEntry( "separatorPosition", 18000 );
-
- int i = 0;
- TQString raise;
- while ( true )
- {
- TQString dwn = cfg->readEntry( TQString( "widget%1" ).arg( i ) );
- if ( dwn.isEmpty() )
- break;
- kdDebug( 760 ) << k_funcinfo << "configuring dockwidget :" << dwn << endl;
- KDockWidget *dw = ( ( KDockWidget* ) parent() ) ->dockManager() ->getDockWidgetFromName( dwn );
- if ( dw )
- {
- TQString s = cfg->readEntry( TQString( "widget%1-tabCaption" ).arg( i ) );
- if ( !s.isEmpty() )
- {
- dw->setTabPageLabel( s );
- }
- s = cfg->readEntry( TQString( "widget%1-tabTooltip" ).arg( i ) );
- if ( !s.isEmpty() )
- {
- dw->setToolTipString( s );
- }
- dw->manualDock( ( KDockWidget* ) parent(), KDockWidget::DockCenter );
- }
- if ( cfg->readBoolEntry( dwn, false ) )
- raise = dwn;
- i++;
-
- }
-
- TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it1( *tl );
- m_ws->hide();
- if ( !m_horizontal )
- parentDockWidget() ->setForcedFixedWidth( m_tb->width() );
- else
- parentDockWidget() ->setForcedFixedHeight( m_tb->height() );
- for ( ;it1.current() != 0;++it1 )
- {
- m_tb->setTab( it1.current() ->id(), false );
- }
- kapp->syncX();
- m_delayedRaise = -1;
-
- for ( TQMap<KDockWidget*, KDockButton_Private*>::iterator it = m_overlapButtons.begin();
- it != m_overlapButtons.end();++it )
- it.data() ->setOn( !isOverlapMode() );
-
- if ( !raise.isEmpty() )
- {
- for ( TQMap<KDockWidget*, int>::iterator it = m_map.begin();it != m_map.end();++it )
- {
- if ( it.key() ->name() == raise )
- {
- /* tabClicked(it.data());
- m_tb->setTab(it.data(),true);
- tabClicked(it.data());
- m_ws->raiseWidget(it.key());
- kapp->sendPostedEvents();
- kapp->syncX();*/
-
- m_delayedRaise = it.data();
- TQTimer::singleShot( 0, this, TQT_SLOT( delayedRaise() ) );
- kdDebug( 760 ) << k_funcinfo << "raising" << it.key() ->name() << endl;
- break;
- }
- }
-
- }
- if ( m_delayedRaise == -1 )
- TQTimer::singleShot( 0, this, TQT_SLOT( init() ) );
- cfg->setGroup( grp );
-
-}
-
-void KMdiDockContainer::delayedRaise()
-{
- m_tb->setTab( m_delayedRaise, true );
- tabClicked( m_delayedRaise );
-}
-
-void KMdiDockContainer::collapseOverlapped()
-{
- //don't collapse if we're switching tabs
- if ( m_tabSwitching )
- return;
-
- if ( isOverlapMode() )
- {
- TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
- TQPtrListIterator<KMultiTabBarTab> it( *tl );
- for ( ;it.current();++it )
- {
- if ( it.current()->isOn() )
- {
- kdDebug( 760 ) << k_funcinfo << "lowering tab with id " << ( *it )->id() << endl;
- it.current()->setState( false );
- tabClicked( ( *it )->id() );
- }
- }
- }
-}
-
-void KMdiDockContainer::toggle()
-{
- kdDebug( 760 ) << k_funcinfo << endl;
-
- if ( m_tb->isTabRaised( oldtab ) )
- {
- kdDebug( 760 ) << k_funcinfo << "lowering tab" << endl;
- m_tb->setTab( oldtab, false );
- tabClicked( oldtab );
- KMdiMainFrm *mainFrm = tqt_dynamic_cast<KMdiMainFrm*>( m_mainWin );
- if ( mainFrm && mainFrm->activeWindow() )
- mainFrm->activeWindow()->setFocus();
- }
- else
- {
- kdDebug( 760 ) << k_funcinfo << "raising tab" << endl;
- if ( m_tb->tab( m_previousTab ) == 0 )
- {
- if ( m_tb->tabs() ->count() == 0 )
- return ;
-
- m_previousTab = m_tb->tabs() ->getFirst() ->id();
- }
- m_tb->setTab( m_previousTab, true );
- tabClicked( m_previousTab );
- }
-}
-
-void KMdiDockContainer::prevToolView()
-{
- kdDebug( 760 ) << k_funcinfo << endl;
- TQPtrList<KMultiTabBarTab>* tabs = m_tb->tabs();
- int pos = tabs->findRef( m_tb->tab( oldtab ) );
-
- if ( pos == -1 )
- return ;
-
- pos--;
- if ( pos < 0 )
- pos = tabs->count() - 1;
-
- KMultiTabBarTab *tab = tabs->at( pos );
- if ( !tab )
- return ; //can never happen here, but who knows
-
- m_tb->setTab( tab->id(), true );
- tabClicked( tab->id() );
-}
-
-void KMdiDockContainer::nextToolView()
-{
- kdDebug( 760 ) << k_funcinfo << endl;
- TQPtrList<KMultiTabBarTab>* tabs = m_tb->tabs();
- int pos = tabs->findRef( m_tb->tab( oldtab ) );
-
- if ( pos == -1 )
- return ;
-
- pos++;
- if ( pos >= ( int ) tabs->count() )
- pos = 0;
-
- KMultiTabBarTab *tab = tabs->at( pos );
- if ( !tab )
- return ; //can never happen here, but who knows
-
- m_tb->setTab( tab->id(), true );
- tabClicked( tab->id() );
-}
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdidockcontainer.h b/kmdi/kmdidockcontainer.h
deleted file mode 100644
index 8dfe6664b..000000000
--- a/kmdi/kmdidockcontainer.h
+++ /dev/null
@@ -1,167 +0,0 @@
- /* This file is part of the KDE project
- Copyright (C) 2002 Christoph Cullmann <cullmann@kde.org>
- Copyright (C) 2002,2003 Joseph Wenninger <jowenn@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 _KMDI_DOCK_CONTAINER_
-#define _KMDI_DOCK_CONTAINER_
-
-#include <tqwidget.h>
-#include <tqstringlist.h>
-#include <kdockwidget.h>
-#include <tqmap.h>
-#include <tqdom.h>
-
-# include <kdockwidget_p.h>
-
-#include <tqpushbutton.h>
-
-class TQWidgetStack;
-class KMultiTabBar;
-class KDockButton_Private;
-
-class KMDI_EXPORT KMdiDockContainer: public TQWidget, public KDockContainer
-{
- Q_OBJECT
-
-public:
- KMdiDockContainer( TQWidget *parent, TQWidget *win, int position, int flags );
- virtual ~KMdiDockContainer();
-
- /** Get the KDockWidget that is our parent */
- KDockWidget *parentDockWidget();
-
- /**
- * Add a widget to this container
- * \param w the KDockWidget we are adding
- */
- virtual void insertWidget ( KDockWidget *w, TQPixmap, const TQString &, int & );
-
- /**
- * Show a widget.
- *
- * The widget has to belong to this container otherwise
- * it will not be shown
- * \param w the KDockWidget to show
- */
- virtual void showWidget ( KDockWidget *w );
-
- /**
- * Set the tooltip for the widget.
- * Currently, this method does nothing
- */
- virtual void setToolTip ( KDockWidget *, TQString & );
-
- /**
- * Set the pixmap for the widget.
- */
- virtual void setPixmap( KDockWidget* widget, const TQPixmap& pixmap );
-
- /**
- * Undock the widget from the container.
- */
- virtual void undockWidget( KDockWidget* dwdg );
-
- /**
- * Remove a widget from the container. The caller of this function
- * is responsible for deleting the widget
- */
- virtual void removeWidget( KDockWidget* );
-
- /**
- * Hide the the dock container if the number of items is 0
- */
- void hideIfNeeded();
-
- /**
- * Save the config using a TDEConfig object
- *
- * The combination of the group_or_prefix variable and the parent
- * dockwidget's name will be the group the configuration is saved in
- * \param group_or_prefix the prefix to append to the parent dockwidget's name
- */
- virtual void save( TDEConfig *, const TQString& group_or_prefix );
-
- /**
- * Load the config using a TDEConfig object
- *
- * The combination of the group_or_prefix variable and the parent
- * dockwidget's name will be the group the configuration is loaded from
- * \param group_or_prefix the prefix to append to the parent dockwidget's name
- */
- virtual void load( TDEConfig *, const TQString& group_or_prefix );
-
- /**
- * Save the config to a QDomElement
- */
- virtual void save( TQDomElement& );
-
- /**
- * Load the config from a QDomElement
- */
- virtual void load( TQDomElement& );
-
- /**
- * Set the style for the tabbar
- */
- void setStyle( int );
-
-protected:
- bool eventFilter( TQObject*, TQEvent* );
-
-public slots:
- void init();
- void collapseOverlapped();
- void toggle();
- void nextToolView();
- void prevToolView();
-protected slots:
- void tabClicked( int );
- void delayedRaise();
- void changeOverlapMode();
-private:
- TQWidget *m_mainWin;
- TQWidgetStack *m_ws;
- KMultiTabBar *m_tb;
- int mTabCnt;
- int oldtab;
- int m_previousTab;
- int m_position;
- int m_separatorPos;
- TQMap<KDockWidget*, int> m_map;
- TQMap<int, KDockWidget*> m_revMap;
- TQMap<KDockWidget*, KDockButton_Private*> m_overlapButtons;
- TQStringList itemNames;
- TQMap<TQString, TQString> tabCaptions;
- TQMap<TQString, TQString> tabTooltips;
- int m_inserted;
- int m_delayedRaise;
- bool m_horizontal;
- bool m_block;
- bool m_tabSwitching;
- TQObject *m_dragPanel;
- KDockManager *m_dockManager;
- TQMouseEvent *m_startEvent;
- enum MovingState {NotMoving = 0, WaitingForMoveStart, Moving} m_movingState;
-signals:
- void activated( KMdiDockContainer* );
- void deactivated( KMdiDockContainer* );
-};
-
-#endif
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdidocumentviewtabwidget.cpp b/kmdi/kmdidocumentviewtabwidget.cpp
deleted file mode 100644
index 90b618e47..000000000
--- a/kmdi/kmdidocumentviewtabwidget.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#include <tqtimer.h>
-
-#include <ktabbar.h>
-#include <kpopupmenu.h>
-#include "kmdidocumentviewtabwidget.h"
-
-KMdiDocumentViewTabWidget::KMdiDocumentViewTabWidget( TQWidget* parent, const char* name ) : KTabWidget( parent, name )
-{
- m_visibility = KMdi::ShowWhenMoreThanOneTab;
- tabBar() ->hide();
- setHoverCloseButton( true );
- connect( this, TQT_SIGNAL( closeRequest( TQWidget* ) ), this, TQT_SLOT( closeTab( TQWidget* ) ) );
-}
-
-KMdiDocumentViewTabWidget::~KMdiDocumentViewTabWidget()
-{}
-
-void KMdiDocumentViewTabWidget::closeTab( TQWidget* w )
-{
- w->close();
-}
-void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, const TQString & label )
-{
- KTabWidget::addTab( child, label );
- showPage( child );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
-}
-
-void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label )
-{
- KTabWidget::addTab( child, iconset, label );
- showPage( child );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
-}
-
-void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, TQTab * tab )
-{
- KTabWidget::addTab( child, tab );
- showPage( child );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
-}
-
-void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, const TQString & label, int index )
-{
- KTabWidget::insertTab( child, label, index );
- showPage( child );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
- tabBar() ->repaint();
-}
-
-void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index )
-{
- KTabWidget::insertTab( child, iconset, label, index );
- showPage( child );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
- tabBar() ->repaint();
-}
-
-void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, TQTab * tab, int index )
-{
- KTabWidget::insertTab( child, tab, index );
- showPage( child );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
- tabBar() ->repaint();
-}
-
-void KMdiDocumentViewTabWidget::removePage ( TQWidget * w )
-{
- KTabWidget::removePage( w );
- TQTimer::singleShot(0, this, TQT_SLOT(maybeShow()));
-}
-
-void KMdiDocumentViewTabWidget::updateIconInView( TQWidget *w, TQPixmap icon )
-{
- changeTab( w, icon, tabLabel( w ) );
-}
-
-void KMdiDocumentViewTabWidget::updateCaptionInView( TQWidget *w, const TQString &caption )
-{
- changeTab( w, caption );
-}
-
-void KMdiDocumentViewTabWidget::maybeShow()
-{
- switch (m_visibility)
- {
- case KMdi::AlwaysShowTabs:
- tabBar() ->show();
- if ( cornerWidget() )
- {
- if ( count() == 0 )
- cornerWidget() ->hide();
- else
- cornerWidget() ->show();
- }
- break;
-
- case KMdi::ShowWhenMoreThanOneTab:
- if ( count() < 2 )
- tabBar() ->hide();
- else tabBar() ->show();
- if ( cornerWidget() )
- {
- if ( count() < 2 )
- cornerWidget() ->hide();
- else
- cornerWidget() ->show();
- }
- break;
- case KMdi::NeverShowTabs:
- tabBar() ->hide();
- break;
- }
-}
-
-void KMdiDocumentViewTabWidget::setTabWidgetVisibility( KMdi::TabWidgetVisibility visibility )
-{
- m_visibility = visibility;
- maybeShow();
-}
-
-void KMdiDocumentViewTabWidget::moveTab( int from, int to )
-{
- emit initiateTabMove( from, to );
- KTabWidget::moveTab( from, to );
-}
-
-KMdi::TabWidgetVisibility KMdiDocumentViewTabWidget::tabWidgetVisibility( )
-{
- return m_visibility;
-}
-
-
-#ifndef NO_INCLUDE_MOCFILES
-#include "kmdidocumentviewtabwidget.moc"
-#endif
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmdidocumentviewtabwidget.h b/kmdi/kmdidocumentviewtabwidget.h
deleted file mode 100644
index d731a9a03..000000000
--- a/kmdi/kmdidocumentviewtabwidget.h
+++ /dev/null
@@ -1,125 +0,0 @@
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDI_DOCUMENT_VIEW_TAB_WIDGET_H_
-#define _KMDI_DOCUMENT_VIEW_TAB_WIDGET_H_
-
-#include <ktabwidget.h>
-#include <kmdidefines.h>
-
-class KPopupMenu;
-
-//KDE4: Add a d pointer
-/**
- * A reimplementation of KTabWidget for KMDI
- */
-class KMDI_EXPORT KMdiDocumentViewTabWidget:
- public KTabWidget
-{
- Q_OBJECT
-public:
- KMdiDocumentViewTabWidget( TQWidget* parent, const char* name = 0 );
- ~KMdiDocumentViewTabWidget();
-
- /**
- * Add a tab into the tabwidget
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void addTab ( TQWidget * child, const TQString & label );
-
- /**
- * Add a tab into the tabwidget
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label );
-
- /**
- * Add a tab into the tabwidget
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void addTab ( TQWidget * child, TQTab * tab );
-
- /**
- * Insert a tab into the tabwidget with a label
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void insertTab ( TQWidget * child, const TQString & label, int index = -1 );
-
- /**
- * Inserts a tab into the tabwidget with an icon and label
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index = -1 );
-
- /**
- * Inserts a tab into the tabwidget
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void insertTab ( TQWidget * child, TQTab * tab, int index = -1 );
-
- /**
- * Removes the tab from the tabwidget
- * \sa QTabWidget
- * \sa KTabWidget
- */
- virtual void removePage ( TQWidget * w );
-
- /**
- * Set the tab widget's visibility and then make the change
- * to match the new setting
- */
- KMdi::TabWidgetVisibility tabWidgetVisibility();
-
- /** Get the tab widget's visibility */
- void setTabWidgetVisibility( KMdi::TabWidgetVisibility );
-
-private slots:
-
- /** Close the tab specified by w */
- void closeTab( TQWidget* w );
-
- /** Moves a tab. Reimplemented for internal reasons. */
- void moveTab( int from, int to );
-
-public slots:
-
- /** Change the icon for the tab */
- void updateIconInView( TQWidget*, TQPixmap );
-
- /** Change the caption for the tab */
- void updateCaptionInView( TQWidget*, const TQString& );
-
-private slots:
-
- /**
- * Determine whether or not we should show the tab bar
- * The tab bar is hidden if it's determined that it should be hidden
- * and shown if it's determined that it should be shown
- */
- void maybeShow();
-
-private:
-
- KMdi::TabWidgetVisibility m_visibility;
-
-signals:
- void initiateTabMove(int, int);
-};
-
-
-
-#endif
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmdifocuslist.cpp b/kmdi/kmdifocuslist.cpp
deleted file mode 100644
index e8f71ff25..000000000
--- a/kmdi/kmdifocuslist.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2003 Joseph Wenninger <jowenn@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.
-*/
-
-#include "kmdifocuslist.h"
-#include "kmdifocuslist.moc"
-#include <tqobjectlist.h>
-#include <kdebug.h>
-
-KMdiFocusList::KMdiFocusList( TQObject *parent ) : TQObject( parent )
-{}
-
-KMdiFocusList::~KMdiFocusList()
-{}
-
-void KMdiFocusList::addWidgetTree( TQWidget* w )
-{
- //this method should never be called twice on the same hierarchy
- m_list.insert( w, w->focusPolicy() );
- w->setFocusPolicy( TQ_ClickFocus );
- kdDebug( 760 ) << "KMdiFocusList::addWidgetTree: adding toplevel" << endl;
- connect( w, TQT_SIGNAL( destroyed( TQObject * ) ), this, TQT_SLOT( objectHasBeenDestroyed( TQObject* ) ) );
- TQObjectList *l = w->queryList( TQWIDGET_OBJECT_NAME_STRING );
- TQObjectListIt it( *l );
- TQObject *obj;
- while ( ( obj = it.current() ) != 0 )
- {
- TQWidget * wid = ( TQWidget* ) obj;
- m_list.insert( wid, wid->focusPolicy() );
- wid->setFocusPolicy( TQ_ClickFocus );
- kdDebug( 760 ) << "KMdiFocusList::addWidgetTree: adding widget" << endl;
- connect( wid, TQT_SIGNAL( destroyed( TQObject * ) ), this, TQT_SLOT( objectHasBeenDestroyed( TQObject* ) ) );
- ++it;
- }
- delete l;
-}
-
-void KMdiFocusList::restore()
-{
- for ( TQMap<TQWidget*, TQ_FocusPolicy>::const_iterator it = m_list.constBegin();it != m_list.constEnd();++it )
- {
- it.key() ->setFocusPolicy( it.data() );
- }
- m_list.clear();
-}
-
-
-void KMdiFocusList::objectHasBeenDestroyed( TQObject * o )
-{
- if ( !o || !o->isWidgetType() )
- return ;
- TQWidget *w = ( TQWidget* ) o;
- m_list.remove( w );
-}
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdifocuslist.h b/kmdi/kmdifocuslist.h
deleted file mode 100644
index 8de19bf33..000000000
--- a/kmdi/kmdifocuslist.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2003 Joseph Wenninger <jowenn@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 KMDI_FOCUS_LIST
-#define KMDI_FOCUS_LIST
-
-#include <tqobject.h>
-#include <tqmap.h>
-#include <tqwidget.h>
-#include <tdelibs_export.h>
-
-class KMDI_EXPORT KMdiFocusList: public TQObject
-{
- Q_OBJECT
-public:
- KMdiFocusList( TQObject *parent );
- ~KMdiFocusList();
- void addWidgetTree( TQWidget* );
- void restore();
-protected slots:
- void objectHasBeenDestroyed( TQObject* );
-private:
- TQMap<TQWidget*, TQ_FocusPolicy> m_list;
-
-};
-
-#endif
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdiguiclient.cpp b/kmdi/kmdiguiclient.cpp
deleted file mode 100644
index c2c34c55f..000000000
--- a/kmdi/kmdiguiclient.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
- based on ktoolbarhandler.cpp: Copyright (C) 2002 Simon Hausmann <hausmann@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.
-*/
-
-#include "kmdiguiclient.h"
-#include "kmdiguiclient.moc"
-
-#include <tqpopupmenu.h>
-#include <kapplication.h>
-#include <kconfig.h>
-#include <ktoolbar.h>
-#include <kmainwindow.h>
-#include <klocale.h>
-#include <kaction.h>
-#include <tqstring.h>
-#include <assert.h>
-#include <kdebug.h>
-#include <kdockwidget.h>
-#include <tdeversion.h>
-#include "kmdimainfrm.h"
-#include "kmditoolviewaccessor.h"
-#include "kmditoolviewaccessor_p.h"
-namespace
-{
-const char *actionListName = "show_kmdi_document_tool_view_actions";
-
-const char *guiDescription = ""
- "<!DOCTYPE kpartgui><kpartgui name=\"KMDIViewActions\">"
- "<MenuBar>"
- " <Menu name=\"view\">"
- " <ActionList name=\"%1\" />"
- " </Menu>"
- "</MenuBar>"
- "</kpartgui>";
-
-const char *resourceFileName = "kmdiviewactions.rc";
-
-}
-
-
-using namespace KMDIPrivate;
-
-
-
-ToggleToolViewAction::ToggleToolViewAction( const TQString& text, const KShortcut& cut, KDockWidget *dw, KMdiMainFrm *mdiMainFrm,
- TQObject* parent, const char* name )
- : KToggleAction( text, cut, parent, name ), m_dw( dw ), m_mdiMainFrm( mdiMainFrm )
-{
- if ( m_dw )
- {
- connect( this, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotToggled( bool ) ) );
- connect( m_dw->dockManager(), TQT_SIGNAL( change() ), this, TQT_SLOT( anDWChanged() ) );
- connect( m_dw, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( slotWidgetDestroyed() ) );
- setChecked( m_dw->mayBeHide() );
- }
-}
-
-
-ToggleToolViewAction::~ToggleToolViewAction()
-{
- unplugAll();
-}
-
-void ToggleToolViewAction::anDWChanged()
-{
- if ( isChecked() && m_dw->mayBeShow() )
- setChecked( false );
- else if ( ( !isChecked() ) && m_dw->mayBeHide() )
- setChecked( true );
- else if ( isChecked() && ( m_dw->parentDockTabGroup() &&
- ( ( ::tqqt_cast<KDockWidget*>( m_dw->parentDockTabGroup() ->
- parent() ) ) ->mayBeShow() ) ) )
- setChecked( false );
-}
-
-
-void ToggleToolViewAction::slotToggled( bool t )
-{
- // m_mw->mainDock->setDockSite( KDockWidget::DockCorner );
-
- if ( ( !t ) && m_dw->mayBeHide() )
- m_dw->undock();
- else
- if ( t && m_dw->mayBeShow() )
- m_mdiMainFrm->makeDockVisible( m_dw );
-
- // m_mw->mainDock->setDockSite( KDockWidget::DockNone );
-}
-
-void ToggleToolViewAction::slotWidgetDestroyed()
-{
- disconnect( m_dw->dockManager(), TQT_SIGNAL( change() ), this, TQT_SLOT( anDWChanged() ) );
- disconnect( this, TQT_SIGNAL( toggled( bool ) ), 0, 0 );
- unplugAll();
- deleteLater();
-}
-
-
-KMDIGUIClient::KMDIGUIClient( KMdiMainFrm* mdiMainFrm, bool showMDIModeAction, const char* name ) : TQObject( mdiMainFrm, name ),
- KXMLGUIClient( mdiMainFrm )
-{
- m_mdiMode = KMdi::ChildframeMode;
- m_mdiMainFrm = mdiMainFrm;
- connect( mdiMainFrm->guiFactory(), TQT_SIGNAL( clientAdded( KXMLGUIClient * ) ),
- this, TQT_SLOT( clientAdded( KXMLGUIClient * ) ) );
-
- /* re-use an existing resource file if it exists. can happen if the user launches the
- * toolbar editor */
- /*
- setXMLFile( resourceFileName );
- */
-
- if ( domDocument().documentElement().isNull() )
- {
-
- TQString completeDescription = TQString::fromLatin1( guiDescription )
- .arg( actionListName );
-
- setXML( completeDescription, false /*merge*/ );
- }
-
- if ( actionCollection() ->kaccel() == 0 )
- actionCollection() ->setWidget( mdiMainFrm );
- m_toolMenu = new KActionMenu( i18n( "Tool &Views" ), actionCollection(), "kmdi_toolview_menu" );
- if ( showMDIModeAction )
- {
- m_mdiModeAction = new KSelectAction( i18n( "MDI Mode" ), 0, actionCollection() );
- TQStringList modes;
- modes << i18n( "&Toplevel Mode" ) << i18n( "C&hildframe Mode" ) << i18n( "Ta&b Page Mode" ) << i18n( "I&DEAl Mode" );
- m_mdiModeAction->setItems( modes );
- connect( m_mdiModeAction, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( changeViewMode( int ) ) );
- }
- else
- m_mdiModeAction = 0;
-
- connect( m_mdiMainFrm, TQT_SIGNAL( mdiModeHasBeenChangedTo( KMdi::MdiMode ) ),
- this, TQT_SLOT( mdiModeHasBeenChangedTo( KMdi::MdiMode ) ) );
-
- m_gotoToolDockMenu = new KActionMenu( i18n( "Tool &Docks" ), actionCollection(), "kmdi_tooldock_menu" );
- m_gotoToolDockMenu->insert( new KAction( i18n( "Switch Top Dock" ), ALT + CTRL + SHIFT + Key_T, this, TQT_SIGNAL( toggleTop() ),
- actionCollection(), "kmdi_activate_top" ) );
- m_gotoToolDockMenu->insert( new KAction( i18n( "Switch Left Dock" ), ALT + CTRL + SHIFT + Key_L, this, TQT_SIGNAL( toggleLeft() ),
- actionCollection(), "kmdi_activate_left" ) );
- m_gotoToolDockMenu->insert( new KAction( i18n( "Switch Right Dock" ), ALT + CTRL + SHIFT + Key_R, this, TQT_SIGNAL( toggleRight() ),
- actionCollection(), "kmdi_activate_right" ) );
- m_gotoToolDockMenu->insert( new KAction( i18n( "Switch Bottom Dock" ), ALT + CTRL + SHIFT + Key_B, this, TQT_SIGNAL( toggleBottom() ),
- actionCollection(), "kmdi_activate_bottom" ) );
- m_gotoToolDockMenu->insert( new KActionSeparator( actionCollection(), "kmdi_goto_menu_separator" ) );
- m_gotoToolDockMenu->insert( new KAction( i18n( "Previous Tool View" ), ALT + CTRL + Key_Left, TQT_TQOBJECT(m_mdiMainFrm), TQT_SLOT( prevToolViewInDock() ),
- actionCollection(), "kmdi_prev_toolview" ) );
- m_gotoToolDockMenu->insert( new KAction( i18n( "Next Tool View" ), ALT + CTRL + Key_Right, TQT_TQOBJECT(m_mdiMainFrm), TQT_SLOT( nextToolViewInDock() ),
- actionCollection(), "kmdi_next_toolview" ) );
-
- actionCollection() ->readShortcutSettings( "Shortcuts", kapp->config() );
-}
-
-KMDIGUIClient::~KMDIGUIClient()
-{
-
- // actionCollection()->writeShortcutSettings( "KMDI Shortcuts", kapp->config() );
- for ( uint i = 0;i < m_toolViewActions.count();i++ )
- disconnect( m_toolViewActions.at( i ), 0, this, 0 );
-
- m_toolViewActions.setAutoDelete( false );
- m_toolViewActions.clear();
- m_documentViewActions.setAutoDelete( false );
- m_documentViewActions.clear();
-}
-
-void KMDIGUIClient::changeViewMode( int id )
-{
- switch ( id )
- {
- case 0:
- m_mdiMainFrm->switchToToplevelMode();
- break;
- case 1:
- m_mdiMainFrm->switchToChildframeMode();
- break;
- case 2:
- m_mdiMainFrm->switchToTabPageMode();
- break;
- case 3:
- m_mdiMainFrm->switchToIDEAlMode();
- break;
- default:
- Q_ASSERT( 0 );
- }
-}
-
-void KMDIGUIClient::setupActions()
-{
- if ( !factory() || !m_mdiMainFrm )
- return ;
-
- // BarActionBuilder builder( actionCollection(), m_mainWindow, m_toolBars );
-
- // if ( !builder.needsRebuild() )
- // return;
-
-
- unplugActionList( actionListName );
-
- // m_actions.setAutoDelete( true );
- // m_actions.clear();
- // m_actions.setAutoDelete( false );
-
- // m_actions = builder.create();
-
- // m_toolBars = builder.toolBars();
-
- // m_toolViewActions.append(new KAction( "TESTKMDIGUICLIENT", TQString::null, 0,
- // this, TQT_SLOT(blah()),actionCollection(),"nothing"));
-
- TQPtrList<KAction> addList;
- if ( m_toolViewActions.count() < 3 )
- for ( uint i = 0;i < m_toolViewActions.count();i++ )
- addList.append( m_toolViewActions.at( i ) );
- else
- addList.append( m_toolMenu );
- if ( m_mdiMode == KMdi::IDEAlMode )
- addList.append( m_gotoToolDockMenu );
- if ( m_mdiModeAction )
- addList.append( m_mdiModeAction );
- kdDebug( 760 ) << "KMDIGUIClient::setupActions: plugActionList" << endl;
- plugActionList( actionListName, addList );
-
- // connectToActionContainers();
-}
-
-void KMDIGUIClient::addToolView( KMdiToolViewAccessor* mtva )
-{
- kdDebug( 760 ) << "*****void KMDIGUIClient::addToolView(KMdiToolViewAccessor* mtva)*****" << endl;
- // kdDebug()<<"name: "<<mtva->wrappedWidget()->name()<<endl;
- TQString aname = TQString( "kmdi_toolview_" ) + mtva->wrappedWidget() ->name();
-
- // try to read the action shortcut
- KShortcut sc;
- TDEConfig *cfg = kapp->config();
- TQString _grp = cfg->group();
- cfg->setGroup( "Shortcuts" );
- // if ( cfg->hasKey( aname ) )
- sc = KShortcut( cfg->readEntry( aname, "" ) );
- cfg->setGroup( _grp );
- KAction *a = new ToggleToolViewAction( i18n( "Show %1" ).arg( mtva->wrappedWidget() ->caption() ),
- /*TQString::null*/sc, tqt_dynamic_cast<KDockWidget*>( mtva->wrapperWidget() ),
- m_mdiMainFrm, actionCollection(), aname.latin1() );
-#if KDE_IS_VERSION(3,2,90)
-
- ( ( ToggleToolViewAction* ) a ) ->setCheckedState( TQString(i18n( "Hide %1" ).arg( mtva->wrappedWidget() ->caption() )) );
-#endif
-
- connect( a, TQT_SIGNAL( destroyed( TQObject* ) ), this, TQT_SLOT( actionDeleted( TQObject* ) ) );
- m_toolViewActions.append( a );
- m_toolMenu->insert( a );
- mtva->d->action = a;
-
- setupActions();
-}
-
-void KMDIGUIClient::actionDeleted( TQObject* a )
-{
- m_toolViewActions.remove( static_cast<KAction*>( a ) );
- /* if (!m_toolMenu.isNull()) m_toolMenu->remove(static_cast<KAction*>(a));*/
- setupActions();
-}
-
-
-void KMDIGUIClient::clientAdded( KXMLGUIClient *client )
-{
- if ( client == this )
- setupActions();
-}
-
-
-void KMDIGUIClient::mdiModeHasBeenChangedTo( KMdi::MdiMode mode )
-{
- kdDebug( 760 ) << "KMDIGUIClient::mdiModeHasBennChangeTo" << endl;
- m_mdiMode = mode;
- if ( m_mdiModeAction )
- {
- switch ( mode )
- {
- case KMdi::ToplevelMode:
- m_mdiModeAction->setCurrentItem( 0 );
- break;
- case KMdi::ChildframeMode:
- m_mdiModeAction->setCurrentItem( 1 );
- break;
- case KMdi::TabPageMode:
- m_mdiModeAction->setCurrentItem( 2 );
- break;
- case KMdi::IDEAlMode:
- m_mdiModeAction->setCurrentItem( 3 );
- break;
- default:
- Q_ASSERT( 0 );
- }
- }
- setupActions();
-
-}
-
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdiguiclient.h b/kmdi/kmdiguiclient.h
deleted file mode 100644
index 9c9634314..000000000
--- a/kmdi/kmdiguiclient.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2003 Joseph Wenninger
-
- 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 KMDIGUICLIENT_H
-#define KMDIGUICLIENT_H
-
-#include <tqobject.h>
-#include <tqguardedptr.h>
-#include <kxmlguiclient.h>
-#include <kaction.h>
-#include "kmdidefines.h"
-
-class KMainWindow;
-class KToolBar;
-class KMdiToolViewAccessor;
-class KMdiMainFrm;
-class KDockWidget;
-
-namespace KMDIPrivate
-{
-
-/**
- * A class derived from KXMLGUIClient that handles the various
- * KMDI modes
- */
-class KMDI_EXPORT KMDIGUIClient : public TQObject,
- public KXMLGUIClient
-{
- Q_OBJECT
-public:
-
- KMDIGUIClient( KMdiMainFrm *mdiMainFrm, bool showMDIModeAction, const char *name = 0 );
- virtual ~KMDIGUIClient();
-
- /**
- * Add a new tool view to this KMDIGUIClient. Reads the shortcut
- * for the tool view from the KMDI application's config file and also
- * adds a ToggleToolViewAction so that the visibility of the toolviews
- * can be turned on and off
- */
- void addToolView( KMdiToolViewAccessor* );
-
-private slots:
-
- /**
- * The XMLGUIClient factory has added an XMLGUI client. Plug our actions
- * in if we're the client that's been added.
- */
- void clientAdded( KXMLGUIClient *client );
- /**
- * Plug in the various toggle actions we have into the tool views menu
- */
- void setupActions();
-
- /**
- * Change the view mode. This will automatically change the view mode
- * of the KMdiMainFrm associated with this KMDIGUIClient
- */
- void changeViewMode( int id );
-
- /**
- * One of our tool view toggle actions has been deleted. Redo the
- * tool views menu
- */
- void actionDeleted( TQObject* );
-
- /**
- * Updates the action that lets the user change the MDI mode to the
- * correct value based on the current mode
- */
- void mdiModeHasBeenChangedTo( KMdi::MdiMode );
-
-signals:
- /** Toggle the top tool dock */
- void toggleTop();
-
- /** Toggle the left tool dock */
- void toggleLeft();
-
- /** Toggle the right tool dock */
- void toggleRight();
-
- /** Toggle the bottom tool dock */
- void toggleBottom();
-
-private:
- class KMDIGUIClientPrivate;
- KMDIGUIClientPrivate *d;
- KMdi::MdiMode m_mdiMode;
-
- TQGuardedPtr<KMdiMainFrm> m_mdiMainFrm;
- TQPtrList<KAction> m_toolViewActions;
- TQPtrList<KAction> m_documentViewActions;
-
- KActionMenu *m_docMenu;
- KActionMenu *m_toolMenu;
- KSelectAction *m_mdiModeAction;
-
- KActionMenu *m_gotoToolDockMenu;
-};
-
-/**
- * A KToggleAction specifically for toggling the showing
- * or the hiding of a KMDI tool view
- */
-class KMDI_EXPORT ToggleToolViewAction: public KToggleAction
-{
- Q_OBJECT
-public:
-
- ToggleToolViewAction( const TQString& text, const KShortcut& cut = KShortcut(), KDockWidget *dw = 0, KMdiMainFrm *mdiMainFrm = 0,
- TQObject* parent = 0, const char* name = 0 );
-
- virtual ~ToggleToolViewAction();
-
-private:
-
- KDockWidget *m_dw;
- KMdiMainFrm *m_mdiMainFrm;
-protected slots:
-
- void slotToggled( bool );
- void anDWChanged();
- void slotWidgetDestroyed();
-};
-
-
-}
-
-#endif
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdiiterator.h b/kmdi/kmdiiterator.h
deleted file mode 100644
index 0b0ec235a..000000000
--- a/kmdi/kmdiiterator.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdiiterator.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 02/2000 by Massimo Morin
-// changes : 02/2000 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Massimo Morin (mmorin@schedsys.com)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDIITERATOR_H_
-#define _KMDIITERATOR_H_
-
-
-template <class Item>
-class KMdiIterator
-{
-public:
- virtual ~KMdiIterator() {}
-
- virtual void first() = 0;
- virtual void last() = 0;
- virtual void next() = 0;
- virtual void prev() = 0;
- virtual bool isDone() const = 0;
- virtual Item currentItem() const = 0;
-
-protected:
- KMdiIterator() {}
-}
-;
-
-#endif // _KMDIITERATOR_H_
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmdilistiterator.h b/kmdi/kmdilistiterator.h
deleted file mode 100644
index 2bc5d6bc0..000000000
--- a/kmdi/kmdilistiterator.h
+++ /dev/null
@@ -1,61 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdilistiterator.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 02/2000 by Massimo Morin
-// changes : 02/2000 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Massimo Morin (mmorin@schedsys.com)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDILISTITERATOR_H_
-#define _KMDILISTITERATOR_H_
-
-#include <kmdiiterator.h>
-
-template <class I>
-class TQPtrList;
-template <class I>
-class TQPtrListIterator;
-
-template <class Item>
-class KMdiListIterator : public KMdiIterator<Item*>
-{
-public:
- KMdiListIterator( TQPtrList<Item>& list )
- {
- m_iterator = new TQPtrListIterator<Item>( list );
- }
-
- virtual void first() { m_iterator->toFirst(); }
- virtual void last() { m_iterator->toLast(); }
- virtual void next() { ++( *m_iterator ); }
- virtual void prev() { --( *m_iterator ); }
- virtual bool isDone() const { return m_iterator->current() == 0; }
- virtual Item* currentItem() const { return m_iterator->current(); }
-
- virtual ~KMdiListIterator() { delete m_iterator; }
-
-private:
- TQPtrListIterator<Item> *m_iterator;
-};
-
-#endif // _KMDILISTITERATOR_H_
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmdimainfrm.cpp b/kmdi/kmdimainfrm.cpp
deleted file mode 100644
index f101ff700..000000000
--- a/kmdi/kmdimainfrm.cpp
+++ /dev/null
@@ -1,2937 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdimainfrm.cpp
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-// patches : 02/2000 by Massimo Morin (mmorin@schedsys.com)
-// */2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
-// 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
-//
-// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-
-/*
- * ATTENTION: please do you part to try to make this file legible. It's
- * extremely hard to read already. Especially follow the indenting rules.
- */
-#include "config.h"
-
-#include <assert.h>
-
-#include <tqcursor.h>
-#include <tqclipboard.h>
-#include <tqobjectlist.h>
-#include <tqpopupmenu.h>
-#include <tqmenubar.h>
-
-#include <kmenubar.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <tdeversion.h>
-#include <tqtabwidget.h>
-#include <klocale.h>
-#include <kstdaccel.h>
-
-#include <kiconloader.h>
-#include <kmdidockcontainer.h>
-
-
-#include <tqtoolbutton.h>
-#include <tqdockarea.h>
-#include <tqlayout.h>
-#include <tqtimer.h>
-#include <tqtextstream.h>
-#include <tqstring.h>
-#include <tqmap.h>
-#include <tqvaluelist.h>
-
-#include "kmdimainfrm.h"
-#include "kmditaskbar.h"
-#include "kmdichildfrm.h"
-#include "kmdichildarea.h"
-#include "kmdichildview.h"
-#include "kmdidockcontainer.h"
-#include "kmditoolviewaccessor_p.h"
-#include "kmdifocuslist.h"
-#include "kmdidocumentviewtabwidget.h"
-#include "kmdiguiclient.h"
-
-#include "win_undockbutton.xpm"
-#include "win_minbutton.xpm"
-#include "win_restorebutton.xpm"
-#include "win_closebutton.xpm"
-#include "kde_undockbutton.xpm"
-#include "kde_minbutton.xpm"
-#include "kde_restorebutton.xpm"
-#include "kde_closebutton.xpm"
-#include "kde2_undockbutton.xpm"
-#include "kde2_minbutton.xpm"
-#include "kde2_restorebutton.xpm"
-#include "kde2_closebutton.xpm"
-#include "kde2laptop_undockbutton.xpm"
-#include "kde2laptop_minbutton.xpm"
-#include "kde2laptop_restorebutton.xpm"
-#include "kde2laptop_closebutton.xpm"
-#include "kde2laptop_closebutton_menu.xpm"
-
-#ifdef Q_WS_X11
-#ifndef NO_KDE
-#include <X11/X.h> // schroder
-#include <X11/Xlib.h> // schroder
-#endif
-
-#ifdef KeyRelease
-/* I hate the defines in the X11 header files. Get rid of one of them */
-#undef KeyRelease
-#endif
-
-#ifdef KeyPress
-/* I hate the defines in the X11 header files. Get rid of one of them */
-#undef KeyPress
-#endif
-#endif // Q_WS_X11 && ! K_WS_QTONLY
-
-using namespace KParts;
-
-KMdi::FrameDecor KMdiMainFrm::m_frameDecoration = KMdi::KDELook;
-
-class KMdiMainFrmPrivate
-{
-public:
- KMdiMainFrmPrivate() : focusList( 0 )
- {
- for ( int i = 0;i < 4;i++ )
- {
- activeDockPriority[ i ] = 0;
- m_styleIDEAlMode = 0;
- m_toolviewStyle = 0;
- }
- }
- ~KMdiMainFrmPrivate()
- {}
- KMdiDockContainer* activeDockPriority[ 4 ];
- KMdiFocusList *focusList;
- int m_styleIDEAlMode;
- int m_toolviewStyle;
- KAction *closeWindowAction;
-};
-
-//============ constructor ============//
-KMdiMainFrm::KMdiMainFrm( TQWidget* parentWidget, const char* name, KMdi::MdiMode mdiMode, WFlags flags )
- : KParts::DockMainWindow( parentWidget, name, flags )
- , m_mdiMode( KMdi::UndefinedMode )
- , m_pMdi( 0L )
- , m_pTaskBar( 0L )
- , m_pDocumentViews( 0L )
- , m_pCurrentWindow( 0L )
- , m_pWindowPopup( 0L )
- , m_pTaskBarPopup( 0L )
- , m_pWindowMenu( 0L )
- , m_pDockMenu( 0L )
- , m_pMdiModeMenu( 0L )
- , m_pPlacingMenu( 0L )
- , m_pMainMenuBar( 0L )
- , m_pUndockButtonPixmap( 0L )
- , m_pMinButtonPixmap( 0L )
- , m_pRestoreButtonPixmap( 0L )
- , m_pCloseButtonPixmap( 0L )
- , m_pUndock( 0L )
- , m_pMinimize( 0L )
- , m_pRestore( 0L )
- , m_pClose( 0L )
- , m_bMaximizedChildFrmMode( false )
- , m_oldMainFrmHeight( 0 )
- , m_oldMainFrmMinHeight( 0 )
- , m_oldMainFrmMaxHeight( 0 )
- , m_bSDIApplication( false )
- , m_pDockbaseAreaOfDocumentViews( 0L )
- , m_pTempDockSession( 0L )
- , m_bClearingOfWindowMenuBlocked( false )
- , m_pDragEndTimer( 0L )
- , m_bSwitching( false )
- , m_leftContainer( 0 )
- , m_rightContainer( 0 )
- , m_topContainer( 0 )
- , m_bottomContainer( 0 )
- , d( new KMdiMainFrmPrivate() )
- , m_mdiGUIClient( 0 )
- , m_managedDockPositionMode( false )
- , m_documentTabWidget( 0 )
-{
- kdDebug(760) << k_funcinfo << endl;
- // Create the local lists of windows
- m_pDocumentViews = new TQPtrList<KMdiChildView>;
- m_pDocumentViews->setAutoDelete( false );
- m_pToolViews = new TQMap<TQWidget*, KMdiToolViewAccessor*>;
-
- // This seems to be needed (re-check it after Qt2.0 comed out)
- setFocusPolicy( TQ_ClickFocus );
-
- // create the central widget
- createMdiManager();
-
- // cover KMdi's childarea by a dockwidget
- m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", TQPixmap(), 0L, "mdi_area_cover" );
- m_pDockbaseAreaOfDocumentViews->setDockWindowTransient( this, true );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockNone );
- m_pDockbaseAreaOfDocumentViews->setDockSite( KDockWidget::DockCorner );
- m_pDockbaseAreaOfDocumentViews->setWidget( m_pMdi );
- // set this dock to main view
- setView( m_pDockbaseAreaOfDocumentViews );
- setMainDockWidget( m_pDockbaseAreaOfDocumentViews );
-
- // Apply options for the MDI manager
- applyOptions();
-
- m_pTaskBarPopup = new TQPopupMenu( this, "taskbar_popup_menu" );
- m_pWindowPopup = new TQPopupMenu( this, "window_popup_menu" );
-
- m_pWindowMenu = new TQPopupMenu( this, "window_menu" );
- m_pWindowMenu->setCheckable( true );
- TQObject::connect( m_pWindowMenu, TQT_SIGNAL( aboutToShow() ), this, TQT_SLOT( fillWindowMenu() ) );
-
- m_pDockMenu = new TQPopupMenu( this, "dock_menu" );
- m_pDockMenu->setCheckable( true );
-
- m_pMdiModeMenu = new TQPopupMenu( this, "mdimode_menu" );
- m_pMdiModeMenu->setCheckable( true );
-
- m_pPlacingMenu = new TQPopupMenu( this, "placing_menu" );
-
- d->closeWindowAction = new KAction(i18n("&Close"), KStdAccel::close(),
- TQT_TQOBJECT(this), TQT_SLOT(closeActiveView()), actionCollection(), "window_close");
-
- // the MDI view taskbar
- createTaskBar();
-
- // this is only a hack, but prevents us from crash because the buttons are otherwise
- // not created before we switch the modes where we need them !!!
- setMenuForSDIModeSysButtons( menuBar() );
-
- switch ( mdiMode )
- {
- case KMdi::IDEAlMode:
- kdDebug(760) << k_funcinfo << "Switching to IDEAl mode" << endl;
- switchToIDEAlMode();
- break;
- case KMdi::TabPageMode:
- kdDebug(760) << k_funcinfo << "Switching to tab page mode" << endl;
- switchToTabPageMode();
- break;
- case KMdi::ToplevelMode:
- kdDebug(760) << k_funcinfo << "Switching to top level mode" << endl;
- switchToToplevelMode();
- break;
- default:
- m_mdiMode = KMdi::ChildframeMode;
- kdDebug(760) << k_funcinfo << "Switching to child frame mode" << endl;
- break;
- }
-
- // drag end timer
- m_pDragEndTimer = new TQTimer();
- connect( m_pDragEndTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( dragEndTimeOut() ) );
- connect( guiFactory(), TQT_SIGNAL( clientAdded( KXMLGUIClient* ) ),
- this, TQT_SLOT( verifyToplevelHeight() ) );
- connect( guiFactory(), TQT_SIGNAL( clientRemoved( KXMLGUIClient* ) ),
- this, TQT_SLOT( verifyToplevelHeight() ) );
-}
-
-void KMdiMainFrm::verifyToplevelHeight()
-{
- if ( m_mdiMode != KMdi::ToplevelMode )
- return;
-
- //kdDebug(760) << k_funcinfo << endl;
- int topDockHeight = topDock() ? topDock()->height() : 0;
- int menuBarHeight = hasMenuBar() ? menuBar()->height() : 0;
- setFixedHeight( topDockHeight + menuBarHeight );
- resize( width(), height() );
-}
-
-void KMdiMainFrm::setStandardMDIMenuEnabled( bool showModeMenu )
-{
- m_mdiGUIClient = new KMDIPrivate::KMDIGUIClient( this, showModeMenu );
- connect( m_mdiGUIClient, TQT_SIGNAL( toggleTop() ), this, TQT_SIGNAL( toggleTop() ) );
- connect( m_mdiGUIClient, TQT_SIGNAL( toggleLeft() ), this, TQT_SIGNAL( toggleLeft() ) );
- connect( m_mdiGUIClient, TQT_SIGNAL( toggleRight() ), this, TQT_SIGNAL( toggleRight() ) );
- connect( m_mdiGUIClient, TQT_SIGNAL( toggleBottom() ), this, TQT_SIGNAL( toggleBottom() ) );
-
- if ( m_mdiMode == KMdi::IDEAlMode )
- {
- if ( m_topContainer )
- connect( this, TQT_SIGNAL( toggleTop() ), m_topContainer->getWidget(), TQT_SLOT( toggle() ) );
- if ( m_leftContainer )
- connect( this, TQT_SIGNAL( toggleLeft() ), m_leftContainer->getWidget(), TQT_SLOT( toggle() ) );
- if ( m_rightContainer )
- connect( this, TQT_SIGNAL( toggleRight() ), m_rightContainer->getWidget(), TQT_SLOT( toggle() ) );
- if ( m_bottomContainer )
- connect( this, TQT_SIGNAL( toggleBottom() ), m_bottomContainer->getWidget(), TQT_SLOT( toggle() ) );
- }
-
- emit mdiModeHasBeenChangedTo( m_mdiMode );
-}
-
-//============ ~KMdiMainFrm ============//
-KMdiMainFrm::~KMdiMainFrm()
-{
- //save the children first to a list, as removing invalidates our iterator
- TQValueList<KMdiChildView*> children;
- for ( KMdiChildView * w = m_pDocumentViews->first();w;w = m_pDocumentViews->next() )
- children.append( w );
-
- // safely close the windows so properties are saved...
- TQValueListIterator<KMdiChildView*> childIt;
- for ( childIt = children.begin(); childIt != children.end(); ++childIt )
- {
- closeWindow( *childIt, false ); // without re-layout taskbar!
- }
-
- emit lastChildViewClosed();
- delete m_pDocumentViews;
- delete m_pToolViews;
- m_pToolViews = 0;
- delete m_pDragEndTimer;
-
- delete m_pUndockButtonPixmap;
- delete m_pMinButtonPixmap;
- delete m_pRestoreButtonPixmap;
- delete m_pCloseButtonPixmap;
-
- //deletes added for Release-Version-Pop-Up-WinMenu-And-Go-Out-Problem
- delete m_pDockMenu;
- delete m_pMdiModeMenu;
- delete m_pPlacingMenu;
- delete m_pTaskBarPopup;
- delete m_pWindowPopup;
- delete m_pWindowMenu;
- delete m_mdiGUIClient;
- delete m_pTempDockSession;
- m_mdiGUIClient = 0;
- delete d;
- d = 0;
-}
-
-//============ applyOptions ============//
-//FIXME something wrong with this function. dunno what though
-void KMdiMainFrm::applyOptions()
-{
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; ( *it ); ++it )
- {
- TQWidget* childFrame = 0L;
- if ( ( *it )->mdiParent() )
- {
- kdDebug(760) << k_funcinfo << "using child view's mdi parent for resize hack" << endl;
- childFrame = ( *it )->mdiParent();
- }
- else
- {
- kdDebug(760) << k_funcinfo << "using child view for resize hack" << endl;
- childFrame = ( *it );
- }
-
- int w = childFrame->width();
- int h = childFrame->height();
- childFrame->resize( w + 1, h + 1 );
- childFrame->resize( w - 1, h - 1 );
- }
-}
-
-//============ createMdiManager ============//
-void KMdiMainFrm::createMdiManager()
-{
- kdDebug(760) << k_funcinfo << "creating MDI manager" << endl;
- m_pMdi = new KMdiChildArea( this );
- setCentralWidget( m_pMdi );
- TQObject::connect( m_pMdi, TQT_SIGNAL( nowMaximized( bool ) ),
- this, TQT_SLOT( setEnableMaximizedChildFrmMode( bool ) ) );
- TQObject::connect( m_pMdi, TQT_SIGNAL( noMaximizedChildFrmLeft( KMdiChildFrm* ) ),
- this, TQT_SLOT( switchOffMaximizeModeForMenu( KMdiChildFrm* ) ) );
- TQObject::connect( m_pMdi, TQT_SIGNAL( sysButtonConnectionsMustChange( KMdiChildFrm*, KMdiChildFrm* ) ),
- this, TQT_SLOT( updateSysButtonConnections( KMdiChildFrm*, KMdiChildFrm* ) ) );
- TQObject::connect( m_pMdi, TQT_SIGNAL( popupWindowMenu( TQPoint ) ),
- this, TQT_SLOT( popupWindowMenu( TQPoint ) ) );
- TQObject::connect( m_pMdi, TQT_SIGNAL( lastChildFrmClosed() ),
- this, TQT_SIGNAL( lastChildFrmClosed() ) );
-}
-
-//============ createTaskBar ==============//
-void KMdiMainFrm::createTaskBar()
-{
- m_pTaskBar = new KMdiTaskBar( this, TQMainWindow::DockBottom );
- m_pTaskBar->installEventFilter( this );
-}
-
-void KMdiMainFrm::slot_toggleTaskBar()
-{
- if ( !m_pTaskBar )
- return;
- m_pTaskBar->switchOn( !m_pTaskBar->isSwitchedOn() );
-}
-
-void KMdiMainFrm::resizeEvent( TQResizeEvent *e )
-{
- if ( ( m_mdiMode == KMdi::ToplevelMode ) && !parentWidget() )
- {
- if ( e->oldSize().height() != e->size().height() )
- return ;
- }
- KParts::DockMainWindow::resizeEvent( e );
- if ( !m_mdiGUIClient )
- return ;
- setSysButtonsAtMenuPosition();
-}
-
-//================ setMinimumSize ===============//
-
-void KMdiMainFrm::setMinimumSize( int minw, int minh )
-{
- if ( ( m_mdiMode == KMdi::ToplevelMode ) && !parentWidget() )
- return ;
- DockMainWindow::setMinimumSize( minw, minh );
-}
-
-//================ wrapper ===============//
-
-KMdiChildView* KMdiMainFrm::createWrapper( TQWidget *view, const TQString& name, const TQString& shortName )
-{
- Q_ASSERT( view ); // if this assert fails, then some part didn't return a widget. Fix the part ;)
-
- KMdiChildView* pMDICover = new KMdiChildView( name /*caption*/, 0L /*parent*/,
- name.latin1() );
- TQBoxLayout* pLayout = new TQHBoxLayout( pMDICover, 0, -1, "layout" );
- view->reparent( pMDICover, TQPoint( 0, 0 ) );
- pLayout->addWidget( view );
- // pMDICover->setName(name);
- pMDICover->setTabCaption( shortName );
- pMDICover->setCaption( name );
-
- const TQPixmap* wndIcon = view->icon();
- if ( wndIcon )
- pMDICover->setIcon( *wndIcon );
-
- pMDICover->trackIconAndCaptionChanges( view );
- return pMDICover;
-}
-
-//================ addWindow ===============//
-
-void KMdiMainFrm::addWindow( KMdiChildView* pWnd, int flags )
-{
- addWindow( pWnd, flags, -1 );
-}
-
-void KMdiMainFrm::addWindow( KMdiChildView* pWnd, int flags, int index )
-{
- if ( windowExists( pWnd, AnyView ) ) //already added
- return;
-
- if ( flags & KMdi::ToolWindow )
- {
- addToolWindow( pWnd );
- // some kind of cascading
- pWnd->move( m_pMdi->mapToGlobal( m_pMdi->getCascadePoint() ) );
-
- return ;
- }
-
- d->closeWindowAction->setEnabled(true);
-
- // common connections used when under MDI control
- TQObject::connect( pWnd, TQT_SIGNAL( clickedInWindowMenu( int ) ), this, TQT_SLOT( windowMenuItemActivated( int ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( focusInEventOccurs( KMdiChildView* ) ), this, TQT_SLOT( activateView( KMdiChildView* ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( childWindowCloseRequest( KMdiChildView* ) ), this, TQT_SLOT( childWindowCloseRequest( KMdiChildView* ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( attachWindow( KMdiChildView*, bool ) ), this, TQT_SLOT( attachWindow( KMdiChildView*, bool ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( detachWindow( KMdiChildView*, bool ) ), this, TQT_SLOT( detachWindow( KMdiChildView*, bool ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( clickedInDockMenu( int ) ), this, TQT_SLOT( dockMenuItemActivated( int ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( activated( KMdiChildView* ) ), this, TQT_SIGNAL( viewActivated( KMdiChildView* ) ) );
- TQObject::connect( pWnd, TQT_SIGNAL( deactivated( KMdiChildView* ) ), this, TQT_SIGNAL( viewDeactivated( KMdiChildView* ) ) );
-
- if ( index == -1 )
- m_pDocumentViews->append( pWnd );
- else
- m_pDocumentViews->insert( index, pWnd );
-
- if ( m_pTaskBar )
- {
- KMdiTaskBarButton* but = m_pTaskBar->addWinButton( pWnd );
- TQObject::connect( pWnd, TQT_SIGNAL( tabCaptionChanged( const TQString& ) ), but, TQT_SLOT( setNewText( const TQString& ) ) );
- }
-
- // embed the view depending on the current MDI mode
- if ( m_mdiMode == KMdi::TabPageMode || m_mdiMode == KMdi::IDEAlMode )
- {
- TQPixmap pixmap;
- if ( pWnd->icon() )
- pixmap = *( pWnd->icon() );
-
- m_documentTabWidget->insertTab( pWnd, pixmap, pWnd->tabCaption(), index );
-
- connect( pWnd, TQT_SIGNAL( iconUpdated( TQWidget*, TQPixmap ) ), m_documentTabWidget, TQT_SLOT( updateIconInView( TQWidget*, TQPixmap ) ) );
- connect( pWnd, TQT_SIGNAL( captionUpdated( TQWidget*, const TQString& ) ), m_documentTabWidget, TQT_SLOT( updateCaptionInView( TQWidget*, const TQString& ) ) );
- }
- else
- {
- if ( ( flags & KMdi::Detach ) || ( m_mdiMode == KMdi::ToplevelMode ) )
- {
- detachWindow( pWnd, !( flags & KMdi::Hide ) );
- emit childViewIsDetachedNow( pWnd ); // fake it because detach won't call it in this case of addWindow-to-MDI
- }
- else
- attachWindow( pWnd, !( flags & KMdi::Hide ), flags & KMdi::UseKMdiSizeHint );
-
- if ( ( m_bMaximizedChildFrmMode && ( !m_bSDIApplication && ( flags & KMdi::Detach ) )
- && m_mdiMode != KMdi::ToplevelMode ) || ( flags & KMdi::Maximize ) )
- {
- if ( !pWnd->isMaximized() )
- pWnd->maximize();
- }
-
- if ( !m_bSDIApplication || ( flags & KMdi::Detach ) )
- {
- if ( flags & KMdi::Minimize )
- pWnd->minimize();
-
- if ( !( flags & KMdi::Hide ) )
- {
- if ( pWnd->isAttached() )
- pWnd->mdiParent()->show();
- else
- pWnd->show();
- }
- }
- }
-}
-
-//============ addWindow ============//
-void KMdiMainFrm::addWindow( KMdiChildView* pWnd, TQRect rectNormal, int flags )
-{
- addWindow( pWnd, flags );
- if ( m_bMaximizedChildFrmMode && pWnd->isAttached() )
- pWnd->setRestoreGeometry( rectNormal );
- else
- pWnd->setGeometry( rectNormal );
-}
-
-//============ addWindow ============//
-void KMdiMainFrm::addWindow( KMdiChildView* pWnd, TQPoint pos, int flags )
-{
- addWindow( pWnd, flags );
- if ( m_bMaximizedChildFrmMode && pWnd->isAttached() )
- pWnd->setRestoreGeometry( TQRect( pos, pWnd->restoreGeometry().size() ) );
- else
- pWnd->move( pos );
-}
-
-
-
-KMdiToolViewAccessor *KMdiMainFrm::createToolWindow()
-{
- return new KMdiToolViewAccessor( this );
-}
-
-
-void KMdiMainFrm::deleteToolWindow( TQWidget* pWnd )
-{
- if ( m_pToolViews->contains( pWnd ) )
- deleteToolWindow( ( *m_pToolViews ) [ pWnd ] );
-}
-
-void KMdiMainFrm::deleteToolWindow( KMdiToolViewAccessor *accessor )
-{
- delete accessor;
-}
-
-//============ addWindow ============//
-KMdiToolViewAccessor *KMdiMainFrm::addToolWindow( TQWidget* pWnd, KDockWidget::DockPosition pos, TQWidget* pTargetWnd,
- int percent, const TQString& tabToolTip, const TQString& tabCaption )
-{
- TQWidget* tvta = pWnd;
- KDockWidget* pDW = dockManager->getDockWidgetFromName( pWnd->name() );
- if ( pDW )
- {
- // probably readDockConfig already created the widgetContainer, use that
- pDW->setWidget( pWnd );
-
- if ( pWnd->icon() )
- pDW->setPixmap( *pWnd->icon() );
-
- pDW->setTabPageLabel( ( tabCaption == 0 ) ? pWnd->caption() : tabCaption );
- pDW->setToolTipString( tabToolTip );
- dockManager->removeFromAutoCreateList( pDW );
- pWnd = pDW;
- }
-
- TQRect r = pWnd->geometry();
-
- KMdiToolViewAccessor *mtva = new KMdiToolViewAccessor( this, pWnd, tabToolTip, ( tabCaption == 0 ) ? pWnd->caption() : tabCaption );
- m_pToolViews->insert( tvta, mtva );
-
- if ( pos == KDockWidget::DockNone )
- {
- mtva->d->widgetContainer->setEnableDocking( KDockWidget::DockNone );
- mtva->d->widgetContainer->reparent( this, (WFlags)(WType_TopLevel | WType_Dialog), r.topLeft(), true ); //pToolView->isVisible());
- }
- else //add and dock the toolview as a dockwidget view
- mtva->place( pos, pTargetWnd, percent );
-
-
- return mtva;
-}
-
-//============ attachWindow ============//
-void KMdiMainFrm::attachWindow( KMdiChildView *pWnd, bool bShow, bool bAutomaticResize )
-{
- pWnd->installEventFilter( this );
-
- // decide whether window shall be cascaded
- bool bCascade = false;
- TQApplication::sendPostedEvents();
- TQRect frameGeo = pWnd->frameGeometry();
- TQPoint topLeftScreen = pWnd->mapToGlobal( TQPoint( 0, 0 ) );
- TQPoint topLeftMdiChildArea = m_pMdi->mapFromGlobal( topLeftScreen );
- TQRect childAreaGeo = m_pMdi->geometry();
- if ( topLeftMdiChildArea.x() < 0 || topLeftMdiChildArea.y() < 0 ||
- ( topLeftMdiChildArea.x() + frameGeo.width() > childAreaGeo.width() ) ||
- ( topLeftMdiChildArea.y() + frameGeo.height() > childAreaGeo.height() ) )
- {
- bCascade = true;
- }
-
- // create frame and insert child view
- KMdiChildFrm *lpC = new KMdiChildFrm( m_pMdi );
- pWnd->hide();
- if ( !bCascade )
- lpC->move( topLeftMdiChildArea );
-
- lpC->setClient( pWnd, bAutomaticResize );
- lpC->setFocus();
- pWnd->youAreAttached( lpC );
- if ( ( m_mdiMode == KMdi::ToplevelMode ) && !parentWidget() )
- {
- setMinimumHeight( m_oldMainFrmMinHeight );
- setMaximumHeight( m_oldMainFrmMaxHeight );
- resize( width(), m_oldMainFrmHeight );
- m_oldMainFrmHeight = 0;
- switchToChildframeMode();
- }
-
- m_pMdi->manageChild( lpC, false, bCascade );
- if ( m_pMdi->topChild() && m_pMdi->topChild() ->isMaximized() )
- {
- TQRect r = lpC->geometry();
- lpC->setGeometry( -lpC->m_pClient->x(), -lpC->m_pClient->y(),
- m_pMdi->width() + KMDI_CHILDFRM_DOUBLE_BORDER,
- m_pMdi->height() + lpC->captionHeight() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_DOUBLE_BORDER );
- lpC->setRestoreGeometry( r );
- }
-
- if ( bShow )
- {
- lpC->show();
- }
-
-#undef FocusIn
- TQFocusEvent fe( TQEvent::FocusIn );
- TQApplication::sendEvent( pWnd, &fe );
-
- m_pCurrentWindow = pWnd; // required for checking the active item
-}
-
-//============= detachWindow ==============//
-void KMdiMainFrm::detachWindow( KMdiChildView *pWnd, bool bShow )
-{
- if ( pWnd->isAttached() )
- {
- pWnd->removeEventFilter( this );
- pWnd->youAreDetached();
- // this is only if it was attached and you want to detach it
- if ( pWnd->parent() )
- {
- KMdiChildFrm * lpC = pWnd->mdiParent();
- if ( lpC )
- {
- if ( lpC->icon() )
- {
- TQPixmap pixm( *( lpC->icon() ) );
- pWnd->setIcon( pixm );
- }
- TQString capt( lpC->caption() );
- if ( !bShow )
- lpC->hide();
- lpC->unsetClient( m_undockPositioningOffset );
- m_pMdi->destroyChildButNotItsView( lpC, false ); //Do not focus the new top child , we loose focus...
- pWnd->setCaption( capt );
- }
- }
- }
- else
- {
- if ( pWnd->size().isEmpty() || ( pWnd->size() == TQSize( 1, 1 ) ) )
- {
- if ( m_pCurrentWindow )
- {
- pWnd->setGeometry( TQRect( m_pMdi->getCascadePoint( m_pDocumentViews->count() - 1 ), m_pCurrentWindow->size() ) );
- }
- else
- {
- pWnd->setGeometry( TQRect( m_pMdi->getCascadePoint( m_pDocumentViews->count() - 1 ), defaultChildFrmSize() ) );
- }
- }
-#ifdef Q_WS_X11
- if ( mdiMode() == KMdi::ToplevelMode )
- {
- XSetTransientForHint( tqt_xdisplay(), pWnd->winId(), topLevelWidget() ->winId() );
- }
-#endif
-
- return ;
- }
-
-#ifdef Q_WS_X11
- if ( mdiMode() == KMdi::ToplevelMode )
- {
- XSetTransientForHint( tqt_xdisplay(), pWnd->winId(), topLevelWidget() ->winId() );
- }
-#endif
-
- // this will show it...
- if ( bShow )
- {
- activateView( pWnd );
- }
-
- emit childViewIsDetachedNow( pWnd );
-}
-
-//============== removeWindowFromMdi ==============//
-void KMdiMainFrm::removeWindowFromMdi( KMdiChildView *pWnd )
-{
- Q_UNUSED( pWnd );
- //Closes a child window. sends no close event : simply deletes it
- //FIXME something wrong with this, but nobody knows whatcart
-#if 0
- if ( !( m_pWinList->removeRef( pWnd ) ) )
- return ;
- if ( m_pWinList->count() == 0 )
- m_pCurrentWindow = 0L;
-
- TQObject::disconnect( pWnd, TQT_SIGNAL( attachWindow( KMdiChildView*, bool ) ), this, TQT_SLOT( attachWindow( KMdiChildView*, bool ) ) );
- TQObject::disconnect( pWnd, TQT_SIGNAL( detachWindow( KMdiChildView*, bool ) ), this, TQT_SLOT( detachWindow( KMdiChildView*, bool ) ) );
- TQObject::disconnect( pWnd, TQT_SIGNAL( focusInEventOccurs( KMdiChildView* ) ), this, TQT_SLOT( activateView( KMdiChildView* ) ) );
- TQObject::disconnect( pWnd, TQT_SIGNAL( childWindowCloseRequest( KMdiChildView* ) ), this, TQT_SLOT( childWindowCloseRequest( KMdiChildView* ) ) );
- TQObject::disconnect( pWnd, TQT_SIGNAL( clickedInWindowMenu( int ) ), this, TQT_SLOT( windowMenuItemActivated( int ) ) );
- TQObject::disconnect( pWnd, TQT_SIGNAL( clickedInDockMenu( int ) ), this, TQT_SLOT( dockMenuItemActivated( int ) ) );
-
- if ( m_pTaskBar )
- {
- KMdiTaskBarButton * but = m_pTaskBar->getButton( pWnd );
- if ( but != 0L )
- {
- TQObject::disconnect( pWnd, TQT_SIGNAL( tabCaptionChanged( const TQString& ) ), but, TQT_SLOT( setNewText( const TQString& ) ) );
- }
- m_pTaskBar->removeWinButton( pWnd );
- }
-
- if ( m_mdiMode == KMdi::TabPageMode )
- {
- if ( m_pWinList->count() == 0 )
- {
- if ( !m_pDockbaseAreaOfDocumentViews )
- {
- m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", TQPixmap(), 0L, "mdi_area_cover" );
- m_pDockbaseAreaOfDocumentViews->setDockWindowTransient( this, true );
-
- m_pDockbaseAreaOfDocumentViews->setWidget( m_pMdi );
- setMainDockWidget( m_pDockbaseAreaOfDocumentViews );
- }
- m_pDockbaseOfTabPage->setDockSite( KDockWidget::DockFullSite );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockCenter );
- m_pDockbaseAreaOfDocumentViews->manualDock( m_pDockbaseOfTabPage, KDockWidget::DockCenter );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockNone );
- m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
- m_pClose->hide();
- }
- KDockWidget* pDockW = ( KDockWidget* ) pWnd->parentWidget();
- pWnd->reparent( 0L, TQPoint( 0, 0 ) );
- pDockW->setWidget( 0L );
- if ( pDockW == m_pDockbaseOfTabPage )
- {
- TQTabWidget * pTab = ( TQTabWidget* ) pDockW->parentWidget() ->parentWidget();
- int cnt = pTab->count();
- m_pDockbaseOfTabPage = ( KDockWidget* ) pTab->page( cnt - 2 );
- if ( pDockW == m_pDockbaseOfTabPage )
- {
- m_pDockbaseOfTabPage = ( KDockWidget* ) pTab->page( cnt - 1 ); // different to the one deleted next
- }
- }
- delete pDockW;
- if ( m_pWinList->count() == 1 )
- {
- m_pWinList->last() ->activate(); // all other views are activated by tab switch
- }
- }
- else if ( pWnd->isAttached() )
- {
- pWnd->mdiParent() ->hide();
- m_pMdi->destroyChildButNotItsView( pWnd->mdiParent() );
- }
- else
- {
- // is not attached
- if ( m_pMdi->getVisibleChildCount() > 0 )
- {
- setActiveWindow();
- m_pCurrentWindow = 0L;
- KMdiChildView* pView = m_pMdi->topChild() ->m_pClient;
- if ( pView )
- {
- pView->activate();
- }
- }
- else if ( m_pWinList->count() > 0 )
- {
- //crash? m_pWinList->last()->activate();
- //crash? m_pWinList->last()->setFocus();
- }
- }
-
- if ( pWnd->isToolView() )
- pWnd->m_bToolView = false;
-
- if ( !m_pCurrentWindow )
- emit lastChildViewClosed();
-#endif
-}
-
-//============== closeWindow ==============//
-void KMdiMainFrm::closeWindow( KMdiChildView *pWnd, bool layoutTaskBar )
-{
- if ( !pWnd )
- return ;
- //Closes a child window. sends no close event : simply deletes it
- m_pDocumentViews->removeRef( pWnd );
- if ( m_pDocumentViews->count() == 0 )
- m_pCurrentWindow = 0L;
-
- if ( m_pTaskBar )
- {
- m_pTaskBar->removeWinButton( pWnd, layoutTaskBar );
- }
-
- if ( ( m_mdiMode == KMdi::TabPageMode ) || ( m_mdiMode == KMdi::IDEAlMode ) )
- {
- if ( !m_documentTabWidget )
- return ; //oops
- if ( m_pDocumentViews->count() == 0 )
- m_pClose->hide();
- pWnd->reparent( 0L, TQPoint( 0, 0 ) );
- kdDebug(760) << "-------- 1" << endl;
- if ( m_pDocumentViews->count() == 1 )
- {
- m_pDocumentViews->last() ->activate(); // all other views are activated by tab switch
- }
- }
- if ( ( m_mdiMode == KMdi::TabPageMode ) || ( m_mdiMode == KMdi::IDEAlMode ) )
- {
- if ( m_pDocumentViews->count() == 0 )
- {
- if ( !m_pDockbaseAreaOfDocumentViews )
- {
- m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", TQPixmap(), 0L, "mdi_area_cover" );
- m_pDockbaseAreaOfDocumentViews->setDockWindowTransient( this, true );
- m_pDockbaseAreaOfDocumentViews->setWidget( m_pMdi );
- setMainDockWidget( m_pDockbaseAreaOfDocumentViews );
- }
-#if 0
- m_pDockbaseOfTabPage->setDockSite( KDockWidget::DockFullSite );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockCenter );
- m_pDockbaseAreaOfDocumentViews->manualDock( m_pDockbaseOfTabPage, KDockWidget::DockCenter );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockNone );
- m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
-#endif
-
- m_pClose->hide();
- }
-#if 0
- KDockWidget* pDockW = ( KDockWidget* ) pWnd->parentWidget();
- pWnd->reparent( 0L, TQPoint( 0, 0 ) );
- pDockW->setWidget( 0L );
- if ( pDockW == m_pDockbaseOfTabPage )
- {
- TQTabWidget * pTab = ( TQTabWidget* ) pDockW->parentWidget() ->parentWidget();
- int cnt = pTab->count();
- m_pDockbaseOfTabPage = ( KDockWidget* ) pTab->page( cnt - 2 );
- if ( pDockW == m_pDockbaseOfTabPage )
- {
- m_pDockbaseOfTabPage = ( KDockWidget* ) pTab->page( cnt - 1 ); // different to the one deleted next
- }
- }
- delete pDockW;
-#endif
-
- delete pWnd;
- if ( m_pDocumentViews->count() == 1 )
- {
- m_pDocumentViews->last() ->activate(); // all other views are activated by tab switch
- }
- }
- else if ( pWnd->isAttached() )
- {
- m_pMdi->destroyChild( pWnd->mdiParent() );
- }
- else
- {
- delete pWnd;
- // is not attached
- if ( m_pMdi->getVisibleChildCount() > 0 )
- {
- setActiveWindow();
- m_pCurrentWindow = 0L;
- KMdiChildView* pView = m_pMdi->topChild() ->m_pClient;
- if ( pView )
- {
- pView->activate();
- }
- }
- else if ( m_pDocumentViews->count() > 0 )
- {
- if ( m_pDocumentViews->current() )
- {
- m_pDocumentViews->current() ->activate();
- m_pDocumentViews->current() ->setFocus();
- }
- else
- {
- m_pDocumentViews->last() ->activate();
- m_pDocumentViews->last() ->setFocus();
- }
- }
- }
-
- if ( !m_pCurrentWindow )
- {
- d->closeWindowAction->setEnabled(false);
- emit lastChildViewClosed();
- }
-}
-
-//================== findWindow =================//
-KMdiChildView* KMdiMainFrm::findWindow( const TQString& caption )
-{
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; ( *it ); ++it )
- {
- if ( ( *it )->caption() == caption )
- return ( *it );
- }
- return 0L;
-}
-
-//================== activeWindow ===================//
-KMdiChildView* KMdiMainFrm::activeWindow()
-{
- return m_pCurrentWindow;
-}
-
-//================== windowExists ? =================//
-bool KMdiMainFrm::windowExists( KMdiChildView *pWnd, ExistsAs as )
-{
- if ( ( as == ToolView ) || ( as == AnyView ) )
- {
- if ( m_pToolViews->contains( pWnd ) )
- return true;
- if ( as == ToolView )
- return false;
- }
-
- if ( m_pDocumentViews->findRef( pWnd ) != -1 )
- return true;
-
- return false;
-}
-
-TQPopupMenu * KMdiMainFrm::windowPopup( KMdiChildView * pWnd, bool bIncludeTaskbarPopup )
-{
- m_pWindowPopup->clear();
- if ( bIncludeTaskbarPopup )
- {
- m_pWindowPopup->insertItem( i18n( "Window" ), taskBarPopup( pWnd, false ) );
- m_pWindowPopup->insertSeparator();
- }
- return m_pWindowPopup;
-}
-
-//================ taskBarPopup =================//
-TQPopupMenu* KMdiMainFrm::taskBarPopup( KMdiChildView *pWnd, bool /*bIncludeWindowPopup*/ )
-{
- //returns the g_pTaskBarPopup filled according to the KMdiChildView state
- m_pTaskBarPopup->clear();
- if ( pWnd->isAttached() )
- {
- m_pTaskBarPopup->insertItem( i18n( "Undock" ), pWnd, TQT_SLOT( detach() ) );
- m_pTaskBarPopup->insertSeparator();
- if ( pWnd->isMinimized() || pWnd->isMaximized() )
- m_pTaskBarPopup->insertItem( i18n( "Restore" ), pWnd, TQT_SLOT( restore() ) );
- if ( !pWnd->isMaximized() )
- m_pTaskBarPopup->insertItem( i18n( "Maximize" ), pWnd, TQT_SLOT( maximize() ) );
- if ( !pWnd->isMinimized() )
- m_pTaskBarPopup->insertItem( i18n( "Minimize" ), pWnd, TQT_SLOT( minimize() ) );
- }
- else
- m_pTaskBarPopup->insertItem( i18n( "Dock" ), pWnd, TQT_SLOT( attach() ) );
- m_pTaskBarPopup->insertSeparator();
- m_pTaskBarPopup->insertItem( i18n( "Close" ), pWnd, TQT_SLOT( close() ) );
- // the window has a view...get the window popup
- m_pTaskBarPopup->insertSeparator();
- m_pTaskBarPopup->insertItem( i18n( "Operations" ), windowPopup( pWnd, false ) ); //alvoid recursion
- return m_pTaskBarPopup;
-}
-
-void KMdiMainFrm::slotDocCurrentChanged( TQWidget* pWidget )
-{
- KMdiChildView * pWnd = static_cast<KMdiChildView*>( pWidget );
- pWnd->m_bMainframesActivateViewIsPending = true;
-
- bool bActivateNecessary = true;
- if ( m_pCurrentWindow != pWnd )
- m_pCurrentWindow = pWnd;
-
- if ( m_pTaskBar )
- m_pTaskBar->setActiveButton( pWnd );
-
- if ( m_documentTabWidget && ( m_mdiMode == KMdi::TabPageMode || m_mdiMode == KMdi::IDEAlMode ) )
- {
- m_documentTabWidget->showPage( pWnd );
- pWnd->activate();
- }
- else
- {
- if ( pWnd->isAttached() )
- {
- if ( bActivateNecessary && ( m_pMdi->topChild() == pWnd->mdiParent() ) )
- pWnd->activate();
-
- pWnd->mdiParent()->raiseAndActivate();
- }
- if ( !pWnd->isAttached() )
- {
- if ( bActivateNecessary )
- pWnd->activate();
-
- m_pMdi->setTopChild( 0L ); // lose focus in the mainframe window
- if ( !pWnd->isActiveWindow() )
- pWnd->setActiveWindow();
-
- pWnd->raise();
- }
- }
- if ( !switching() )
- activeWindow()->updateTimeStamp();
- emit collapseOverlapContainers();
- pWnd->m_bMainframesActivateViewIsPending = false;
-}
-
-
-void KMdiMainFrm::activateView( KMdiChildView* pWnd )
-{
- pWnd->m_bMainframesActivateViewIsPending = true;
-
- bool bActivateNecessary = true;
- if ( m_pCurrentWindow != pWnd )
- m_pCurrentWindow = pWnd;
- else
- {
- bActivateNecessary = false;
- // if this method is called as answer to view->activate(),
- // interrupt it because it's not necessary
- pWnd->m_bInterruptActivation = true;
- }
-
- if ( m_pTaskBar )
- m_pTaskBar->setActiveButton( pWnd );
-
- if ( m_documentTabWidget && m_mdiMode == KMdi::TabPageMode || m_mdiMode == KMdi::IDEAlMode )
- {
- m_documentTabWidget->showPage( pWnd );
- pWnd->activate();
- }
- else
- {
- if ( pWnd->isAttached() )
- {
- if ( bActivateNecessary && ( m_pMdi->topChild() == pWnd->mdiParent() ) )
- pWnd->activate();
-
- pWnd->mdiParent() ->raiseAndActivate();
- }
- if ( !pWnd->isAttached() )
- {
- if ( bActivateNecessary )
- pWnd->activate();
-
- m_pMdi->setTopChild( 0L ); // lose focus in the mainframe window
- if ( !pWnd->isActiveWindow() )
- pWnd->setActiveWindow();
-
- pWnd->raise();
- }
- }
-
- emit collapseOverlapContainers();
-
- pWnd->m_bMainframesActivateViewIsPending = false;
-}
-
-void KMdiMainFrm::taskbarButtonRightClicked( KMdiChildView *pWnd )
-{
- activateView( pWnd ); // set focus
- //TQApplication::sendPostedEvents();
- taskBarPopup( pWnd, true ) ->popup( TQCursor::pos() );
-}
-
-void KMdiMainFrm::childWindowCloseRequest( KMdiChildView *pWnd )
-{
- KMdiViewCloseEvent * ce = new KMdiViewCloseEvent( pWnd );
- TQApplication::postEvent( this, ce );
-}
-
-bool KMdiMainFrm::event( TQEvent* e )
-{
- if ( e->type() == TQEvent::User )
- {
- KMdiChildView * pWnd = ( KMdiChildView* ) ( ( KMdiViewCloseEvent* ) e )->data();
- if ( pWnd != 0L )
- closeWindow( pWnd );
- return true;
- // A little hack: If MDI child views are moved implicietly by moving
- // the main widget they should know this too. Unfortunately there seems to
- // be no way to catch the move start / move stop situations for the main
- // widget in a clean way. (There is no MouseButtonPress/Release or
- // something like that.) Therefore we do the following: When we get the
- // "first" move event we start a timer and interprete it as "drag begin".
- // If we get the next move event and the timer is running we restart the
- // timer and don't do anything else. If the timer elapses (this meens we
- // haven't had any move event for a while) we interprete this as "drag
- // end". If the moving didn't stop actually, we will later get another
- // "drag begin", so we get a drag end too much, but this would be the same
- // as if the user would stop moving for a little while.
- // Actually we seem to be lucky that the timer does not elapse while we
- // are moving -> so we have no obsolete drag end / begin
- }
- else if ( isVisible() && e->type() == TQEvent::Move )
- {
- if ( m_pDragEndTimer->isActive() )
- {
- // this is not the first move -> stop old timer
- m_pDragEndTimer->stop();
- }
- else
- {
- // this is the first move -> send the drag begin to all concerned views
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; ( *it ); ++it )
- {
- KMdiChildFrmDragBeginEvent dragBeginEvent( 0L );
- TQApplication::sendEvent( ( *it ), &dragBeginEvent );
- }
- }
- m_pDragEndTimer->start( 200, true ); // single shot after 200 ms
- }
-
- return DockMainWindow::event( e );
-}
-
-bool KMdiMainFrm::eventFilter( TQObject * /*obj*/, TQEvent *e )
-{
- if ( e->type() == TQEvent::Resize && m_mdiMode == KMdi::ToplevelMode )
- {
- verifyToplevelHeight();
- return false; //let the rest of the resize magic do its work
- }
-
- if ( e->type() == TQEvent::FocusIn )
- {
- TQFocusEvent * pFE = ( TQFocusEvent* ) e;
- if ( pFE->reason() == TQFocusEvent::ActiveWindow )
- {
- if ( m_pCurrentWindow && !m_pCurrentWindow->isHidden() &&
- !m_pCurrentWindow->isAttached() && m_pMdi->topChild() )
- {
- return true; // eat the event
- }
- }
- if ( m_pMdi )
- {
- static bool focusTCIsPending = false;
- if ( !focusTCIsPending && m_mdiMode == KMdi::ChildframeMode )
- {
- focusTCIsPending = true;
- m_pMdi->focusTopChild();
- focusTCIsPending = false;
- }
- }
- }
- else if ( e->type() == TQEvent::KeyRelease )
- {
- if ( switching() )
- {
- KAction * a = actionCollection() ->action( "view_last_window" ) ;
- if ( a )
- {
- const KShortcut cut( a->shortcut() );
- const KKeySequence& seq = cut.seq( 0 );
- const KKey& key = seq.key( 0 );
- int modFlags = key.modFlags();
- int state = ( ( TQKeyEvent * ) e ) ->state();
- KKey key2( ( TQKeyEvent * ) e );
-
- /** these are quite some assumptions:
- * The key combination uses exactly one modifier key
- * The WIN button in KDE is the meta button in Qt
- **/
- if ( state != ( ( TQKeyEvent * ) e ) ->stateAfter() &&
- ( ( modFlags & KKey::CTRL ) > 0 ) == ( ( state & TQt::ControlButton ) > 0 ) &&
- ( ( modFlags & KKey::ALT ) > 0 ) == ( ( state & TQt::AltButton ) > 0 ) &&
- ( ( modFlags & KKey::WIN ) > 0 ) == ( ( state & TQt::MetaButton ) > 0 ) )
- {
- activeWindow() ->updateTimeStamp();
- setSwitching( false );
- }
- return true;
- }
- else
- {
- kdDebug(760) << "KAction( \"view_last_window\") not found." << endl;
- }
- }
- }
- return false; // standard event processing
-}
-
-/**
- * close all views
- */
-void KMdiMainFrm::closeAllViews()
-{
- //save the children first to a list, as removing invalidates our iterator
- TQValueList<KMdiChildView*> children;
- for ( KMdiChildView * w = m_pDocumentViews->first();w;w = m_pDocumentViews->next() )
- {
- children.append( w );
- }
- TQValueListIterator<KMdiChildView *> childIt;
- for ( childIt = children.begin(); childIt != children.end(); ++childIt )
- {
- ( *childIt )->close();
- }
-}
-
-
-/**
- * iconify all views
- */
-void KMdiMainFrm::iconifyAllViews()
-{
- kdDebug(760) << k_funcinfo << "minimizing all the views" << endl;
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; ( *it ); ++it )
- ( *it )->minimize();
-}
-
-/**
- * closes the view of the active (topchild) window
- */
-void KMdiMainFrm::closeActiveView()
-{
- kdDebug(760) << k_funcinfo << "closing the active view" << endl;
- if ( m_pCurrentWindow )
- m_pCurrentWindow->close();
-}
-
-/** find the root dockwidgets and store their geometry */
-void KMdiMainFrm::findRootDockWidgets( TQPtrList<KDockWidget>* rootDockWidgetList, TQValueList<TQRect>* positionList )
-{
- //nothing is valid
- if ( !rootDockWidgetList && !positionList )
- return ;
-
- // since we set some windows to toplevel, we must consider the window manager's window frame
- const int frameBorderWidth = 7; // @todo: Can we / do we need to ask the window manager?
- const int windowTitleHeight = 10; // @todo: -"-
-
- TQObjectList* pObjList = queryList( "KDockWidget" );
- if ( pObjList->isEmpty() )
- pObjList = queryList( "KDockWidget_Compat::KDockWidget" );
-
- TQObjectListIt it( *pObjList );
- // for all dockwidgets (which are children of this mainwindow)
- while ( ( *it ) )
- {
- KDockWidget* dockWindow = 0L; /* pDockW */
- KDockWidget* rootDockWindow = 0L; /* pRootDockWindow */
- KDockWidget* undockCandidate = 0L; /* pUndockCandidate */
- TQWidget* pW = TQT_TQWIDGET( ( *it ) );
-
- // find the oldest ancestor of the current dockwidget that can be undocked
- while ( !pW->isTopLevel() )
- {
- if ( ::tqqt_cast<KDockWidget*>( pW ) || pW->inherits( "KDockWidget_Compat::KDockWidget" ) )
- {
- undockCandidate = static_cast<KDockWidget*>( pW );
- if ( undockCandidate->enableDocking() != KDockWidget::DockNone )
- rootDockWindow = undockCandidate;
- }
- pW = pW->parentWidget();
- }
-
- if ( rootDockWindow )
- {
- // if that oldest ancestor is not already in the list, append it
- bool found = false;
- if ( !rootDockWidgetList->isEmpty() )
- {
- TQPtrListIterator<KDockWidget> it2( *rootDockWidgetList );
- for ( ; it2.current() && !found; ++it2 )
- {
- dockWindow = it2.current();
- if ( dockWindow == rootDockWindow )
- found = true;
- }
- }
-
- if ( !found || rootDockWidgetList->isEmpty() )
- {
- rootDockWidgetList->append( dockWindow );
- kdDebug(760) << k_funcinfo << "Appending " << rootDockWindow << " to our list of " <<
- "root dock windows" << endl;
- TQPoint p = rootDockWindow->mapToGlobal( rootDockWindow->pos() ) - rootDockWindow->pos();
- TQRect r( p.x(), p.y() + m_undockPositioningOffset.y(),
- rootDockWindow->width() - windowTitleHeight - frameBorderWidth * 2,
- rootDockWindow->height() - windowTitleHeight - frameBorderWidth * 2 );
- positionList->append( r );
- }
- }
- ++it;
- }
- delete pObjList;
-}
-
-/**
- * undocks all view windows (unix-like)
- */
-void KMdiMainFrm::switchToToplevelMode()
-{
- if ( m_mdiMode == KMdi::ToplevelMode )
- {
- emit mdiModeHasBeenChangedTo( KMdi::ToplevelMode );
- return ;
- }
-
- KMdi::MdiMode oldMdiMode = m_mdiMode;
-
- const int frameBorderWidth = 7; // @todo: Can we / do we need to ask the window manager?
- setUndockPositioningOffset( TQPoint( 0, ( m_pTaskBar ? m_pTaskBar->height() : 0 ) + frameBorderWidth ) );
-
- // 1.) select the dockwidgets to be undocked and store their geometry
- TQPtrList<KDockWidget> rootDockWidgetList;
- TQValueList<TQRect> positionList;
-
- // 2.) undock the MDI views of KMDI
- switch( oldMdiMode )
- {
- case KMdi::ChildframeMode:
- finishChildframeMode();
- break;
- case KMdi::TabPageMode:
- finishTabPageMode();
- break;
- case KMdi::IDEAlMode:
- finishIDEAlMode();
- findRootDockWidgets( &rootDockWidgetList, &positionList );
- break;
- default:
- break; //do nothing
- }
-
- // 3.) undock all these found oldest ancestors (being KDockWidgets)
- TQPtrListIterator<KDockWidget> kdwit( rootDockWidgetList );
- for ( ; ( *kdwit ); ++kdwit )
- ( *kdwit )->undock();
-
- // 4.) recreate the MDI childframe area and hide it
- if ( oldMdiMode == KMdi::TabPageMode || oldMdiMode == KMdi::IDEAlMode )
- {
- if ( !m_pDockbaseAreaOfDocumentViews )
- {
- m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", TQPixmap(), 0L, "mdi_area_cover" );
- m_pDockbaseAreaOfDocumentViews->setDockWindowTransient( this, true );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockNone );
- m_pDockbaseAreaOfDocumentViews->setDockSite( KDockWidget::DockCorner );
- m_pDockbaseAreaOfDocumentViews->setWidget( m_pMdi );
- }
- // set this dock to main view
- setView( m_pDockbaseAreaOfDocumentViews );
- setMainDockWidget( m_pDockbaseAreaOfDocumentViews );
- }
- // TQApplication::sendPostedEvents(); //why do we need to empty the event queue?
- if ( !parentWidget() )
- {
- //if we don't have a parent widget ( which i expect we wouldn't )
- //make sure we take into account the size of the docks provided by
- //QMainWindow
- int topDockHeight = topDock() ? topDock()->height() : 0;
- int bottomDockHeight = bottomDock() ? bottomDock()->height() : 0;
- int menuBarHeight = hasMenuBar() ? menuBar()->height() : 0;
- if ( m_pDocumentViews->count() != 0 )
- setFixedHeight( height() - m_pDockbaseAreaOfDocumentViews->height() );
- else
- {
- kdDebug(760) << k_funcinfo << "height is: " << height() << endl;
- kdDebug(760) << k_funcinfo << "top dock height: " << topDockHeight << endl;
- kdDebug(760) << k_funcinfo << "bottom dock height: " << bottomDockHeight << endl;
- kdDebug(760) << k_funcinfo << "menu bar height: " << menuBarHeight << endl;
- kdDebug(760) << k_funcinfo << "dock base area height: " << m_pDockbaseAreaOfDocumentViews->height() << endl;
- setFixedHeight( topDockHeight + menuBarHeight );
- }
- }
-
- //FIXME although i don't know what to fix
- // 5. show the child views again
- TQPtrListIterator<KMdiChildView> kmdicvit( *m_pDocumentViews );
- for ( kmdicvit.toFirst(); ( *kmdicvit ); ++kmdicvit )
- {
-#ifdef Q_WS_X11
- XSetTransientForHint( tqt_xdisplay(), ( *kmdicvit )->winId(), winId() );
-#endif
- ( *kmdicvit )->show();
- }
-
- // 6.) reset all memorized positions of the undocked ones and show them again
- TQValueList<TQRect>::Iterator qvlqrit;
- TQValueList<TQRect>::Iterator qvlEnd = positionList.end();
- for ( kmdicvit.toFirst(), qvlqrit = positionList.begin() ; ( *kmdicvit ) && qvlqrit != qvlEnd; ++kmdicvit, ++qvlqrit )
- {
- ( *kmdicvit )->setGeometry( ( *qvlqrit ) );
- ( *kmdicvit )->show();
- }
-
- m_pDockbaseAreaOfDocumentViews->setDockSite( KDockWidget::DockNone );
- m_mdiMode = KMdi::ToplevelMode;
-
- kdDebug(760) << k_funcinfo << "Switch to toplevel mode completed" << endl;
- emit mdiModeHasBeenChangedTo( KMdi::ToplevelMode );
-
-}
-
-void KMdiMainFrm::finishToplevelMode()
-{
- m_pDockbaseAreaOfDocumentViews->setDockSite( KDockWidget::DockCorner );
-}
-
-/**
- * docks all view windows (Windows-like)
- */
-void KMdiMainFrm::switchToChildframeMode()
-{
- if ( m_mdiMode == KMdi::ChildframeMode )
- {
- emit mdiModeHasBeenChangedTo( KMdi::ChildframeMode );
- return ;
- }
-
- TQPtrList<KDockWidget> rootDockWidgetList;
- TQValueList<TQRect> positionList;
-
- if ( m_mdiMode == KMdi::TabPageMode )
- {
- kdDebug(760) << k_funcinfo << "finishing tab page mode" << endl;
- // select the dockwidgets to be undocked and store their geometry
- findRootDockWidgets( &rootDockWidgetList, &positionList );
- kdDebug(760) << k_funcinfo << "Found " << rootDockWidgetList.count() << " widgets to undock" << endl;
-
- // undock all these found oldest ancestors (being KDockWidgets)
- TQPtrListIterator<KDockWidget> it( rootDockWidgetList );
- for ( ; ( *it ) ; ++it )
- ( *it )->undock();
-
- finishTabPageMode();
- }
- else if ( m_mdiMode == KMdi::ToplevelMode )
- {
- finishToplevelMode();
- }
- else if ( m_mdiMode == KMdi::IDEAlMode )
- {
- kdDebug(760) << k_funcinfo << "finishing ideal mode" << endl;
- finishIDEAlMode( false );
-
- // select the dockwidgets to be undocked and store their geometry
- findRootDockWidgets( &rootDockWidgetList, &positionList );
- kdDebug(760) << k_funcinfo << "Found " << rootDockWidgetList.count() << " widgets to undock" << endl;
-
- // undock all these found oldest ancestors (being KDockWidgets)
- TQPtrListIterator<KDockWidget> it( rootDockWidgetList );
- for ( ; ( *it ) ; ++it )
- ( *it )->undock();
-
- m_mdiMode = KMdi::TabPageMode;
- finishTabPageMode();
- m_mdiMode = KMdi::IDEAlMode;
- }
-
- if ( !m_pDockbaseAreaOfDocumentViews )
- {
- // cover KMdi's childarea by a dockwidget
- m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", TQPixmap(), 0L, "mdi_area_cover" );
- m_pDockbaseAreaOfDocumentViews->setDockWindowTransient( this, true );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockNone );
- m_pDockbaseAreaOfDocumentViews->setDockSite( KDockWidget::DockCorner );
- m_pDockbaseAreaOfDocumentViews->setWidget( m_pMdi );
- kdDebug(760) << k_funcinfo << "childarea is now covered by a dockwidget" << endl;
- }
-
- if ( m_pDockbaseAreaOfDocumentViews->isTopLevel() )
- {
- // set this dock to main view
- setView( m_pDockbaseAreaOfDocumentViews );
- setMainDockWidget( m_pDockbaseAreaOfDocumentViews );
- m_pDockbaseAreaOfDocumentViews->setEnableDocking( KDockWidget::DockNone );
- m_pDockbaseAreaOfDocumentViews->setDockSite( KDockWidget::DockCorner );
- kdDebug(760) << k_funcinfo << "Dock base area has been set to the main view" << endl;
- }
- m_pDockbaseAreaOfDocumentViews->setWidget( m_pMdi ); //JW
- m_pDockbaseAreaOfDocumentViews->show();
-
- if ( ( m_mdiMode == KMdi::TabPageMode ) || ( m_mdiMode == KMdi::IDEAlMode ) )
- {
- kdDebug(760) << k_funcinfo << "trying to dock back the undock toolviews" << endl;
- TQPtrListIterator<KDockWidget> it( rootDockWidgetList );
- for ( ; ( *it ); ++it )
- ( *it )->dockBack();
- }
-
- if ( m_mdiMode == KMdi::ToplevelMode && m_pTempDockSession )
- {
- // restore the old dock scenario which we memorized at the time we switched to toplevel mode
- kdDebug(760) << k_funcinfo << "Restoring old dock scenario memorized from toplevel mode" << endl;
- TQDomElement oldDockState = m_pTempDockSession->namedItem( "cur_dock_state" ).toElement();
- readDockConfig( oldDockState );
- }
-
- KMdi::MdiMode oldMdiMode = m_mdiMode;
- m_mdiMode = KMdi::ChildframeMode;
-
- //FIXME although i don't know what to fix.
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; ( *it ); ++it )
- {
- KMdiChildView* pView = ( *it );
- if ( !pView->isToolView() && pView->isAttached() )
- attachWindow( pView, true );
- }
- for ( it.toFirst(); ( *it ); ++it )
- {
- KMdiChildView* pView = ( *it );
- if ( !pView->isToolView() )
- pView->show();
- }
- if ( ( oldMdiMode == KMdi::ToplevelMode ) && !parentWidget() )
- {
- setMinimumHeight( m_oldMainFrmMinHeight );
- setMaximumHeight( m_oldMainFrmMaxHeight );
- resize( width(), m_oldMainFrmHeight );
- m_oldMainFrmHeight = 0;
- kdDebug(760) << k_funcinfo << "left top level mode completely" << endl;
- emit leftTopLevelMode();
- }
- emit mdiModeHasBeenChangedTo( KMdi::ChildframeMode );
-}
-
-void KMdiMainFrm::finishChildframeMode()
-{
- // save the old dock scenario of the dockwidget-like tool views to a DOM tree
- kdDebug(760) << k_funcinfo << "saving the current dock scenario" << endl;
- delete m_pTempDockSession;
- m_pTempDockSession = new TQDomDocument( "docksession" );
- TQDomElement curDockState = m_pTempDockSession->createElement( "cur_dock_state" );
- m_pTempDockSession->appendChild( curDockState );
- writeDockConfig( curDockState );
-
- // detach all non-tool-views to toplevel
- kdDebug(760) << k_funcinfo << "detaching all document views and moving them to toplevel" << endl;
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; ( *it ); ++it )
- {
- KMdiChildView* pView = ( *it );
- if ( pView->isToolView() )
- continue;
- if ( pView->isAttached() )
- {
- if ( pView->isMaximized() )
- pView->mdiParent()->setGeometry( 0, 0, m_pMdi->width(), m_pMdi->height() );
- detachWindow( pView, false );
- }
- }
-}
-
-/**
- * Docks all view windows (Windows-like)
- */
-void KMdiMainFrm::switchToTabPageMode()
-{
- if ( m_mdiMode == KMdi::TabPageMode )
- {
- emit mdiModeHasBeenChangedTo( KMdi::TabPageMode );
- return ; // nothing need to be done
- }
-
- switch( m_mdiMode )
- {
- case KMdi::ChildframeMode:
- finishChildframeMode();
- break;
- case KMdi::ToplevelMode:
- finishToplevelMode();
- break;
- case KMdi::IDEAlMode:
- finishIDEAlMode( false );
- emit mdiModeHasBeenChangedTo( KMdi::TabPageMode );
- m_mdiMode = KMdi::TabPageMode;
- return;
- break;
- default:
- break;
- }
-
- setupTabbedDocumentViewSpace();
- m_mdiMode = KMdi::TabPageMode;
- if ( m_pCurrentWindow )
- m_pCurrentWindow->setFocus();
-
- m_pTaskBar->switchOn( false );
-
- if ( m_pClose )
- {
- TQObject::connect( m_pClose, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closeViewButtonPressed() ) );
- if ( m_pDocumentViews->count() > 0 )
- m_pClose->show();
- }
- else
- kdDebug(760) << "close button nonexistant. strange things might happen" << endl;
-
- kdDebug(760) << "Switch to tab page mode complete" << endl;
- emit mdiModeHasBeenChangedTo( KMdi::TabPageMode );
-}
-
-void KMdiMainFrm::finishTabPageMode()
-{
- // if tabified, release all views from their docking covers
- if ( m_mdiMode == KMdi::TabPageMode )
- {
- m_pClose->hide();
- TQObject::disconnect( m_pClose, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closeViewButtonPressed() ) );
-
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; it.current(); ++it )
- {
- KMdiChildView* pView = it.current();
- if ( pView->isToolView() )
- continue;
- kdDebug(760) << "KMdiMainFrm::finishTabPageMode: in loop" << endl;
- TQSize mins = pView->minimumSize();
- TQSize maxs = pView->maximumSize();
- TQSize sz = pView->size();
- TQWidget* pParent = pView->parentWidget();
- TQPoint p( pParent->mapToGlobal( pParent->pos() ) - pParent->pos() + m_undockPositioningOffset );
- m_documentTabWidget->removePage( pView );
- pView->reparent( 0, 0, p );
- // pView->reparent(0,0,p);
- pView->resize( sz );
- pView->setMinimumSize( mins.width(), mins.height() );
- pView->setMaximumSize( maxs.width(), maxs.height() );
- // ((KDockWidget*)pParent)->undock(); // this destroys the dockwiget cover, too
- // pParent->close();
- // delete pParent;
- // if (centralWidget() == pParent) {
- // setCentralWidget(0L); // avoid dangling pointer
- // }
- }
- delete m_documentTabWidget;
- m_documentTabWidget = 0;
- m_pTaskBar->switchOn( true );
- }
-}
-
-
-
-void KMdiMainFrm::setupTabbedDocumentViewSpace()
-{
- // resize to childframe mode size of the mainwindow if we were in toplevel mode
- if ( ( m_mdiMode == KMdi::ToplevelMode ) && !parentWidget() )
- {
- setMinimumHeight( m_oldMainFrmMinHeight );
- setMaximumHeight( m_oldMainFrmMaxHeight );
- resize( width(), m_oldMainFrmHeight );
- m_oldMainFrmHeight = 0;
- //tqDebug("TopLevelMode off");
- emit leftTopLevelMode();
- TQApplication::sendPostedEvents();
-
- // restore the old dock szenario which we memorized at the time we switched to toplevel mode
- if ( m_pTempDockSession )
- {
- TQDomElement oldDockState = m_pTempDockSession->namedItem( "cur_dock_state" ).toElement();
- readDockConfig( oldDockState );
- }
- }
-
-#if 0
- if ( m_pDockbaseOfTabPage != m_pDockbaseAreaOfDocumentViews )
- {
- delete m_pDockbaseOfTabPage;
- m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
- }
-#endif
- delete m_documentTabWidget;
- m_documentTabWidget = new KMdiDocumentViewTabWidget( m_pDockbaseAreaOfDocumentViews );
- connect( m_documentTabWidget, TQT_SIGNAL( currentChanged( TQWidget* ) ), this, TQT_SLOT( slotDocCurrentChanged( TQWidget* ) ) );
- m_pDockbaseAreaOfDocumentViews->setWidget( m_documentTabWidget );
- m_documentTabWidget->show();
- TQPtrListIterator<KMdiChildView> it4( *m_pDocumentViews );
- for ( ; it4.current(); ++it4 )
- {
- KMdiChildView* pView = it4.current();
- m_documentTabWidget->addTab( pView, pView->icon() ? *( pView->icon() ) : TQPixmap(), pView->tabCaption() );
- /*
- connect(pView,TQT_SIGNAL(iconOrCaptionUdpated(TQWidget*,TQPixmap,const TQString&)),
- m_documentTabWidget,TQT_SLOT(updateView(TQWidget*,TQPixmap,const TQString&)));
- */
- connect( pView, TQT_SIGNAL( iconUpdated( TQWidget*, TQPixmap ) ), m_documentTabWidget, TQT_SLOT( updateIconInView( TQWidget*, TQPixmap ) ) );
- connect( pView, TQT_SIGNAL( captionUpdated( TQWidget*, const TQString& ) ), m_documentTabWidget, TQT_SLOT( updateCaptionInView( TQWidget*, const TQString& ) ) );
-
- }
-}
-
-
-void KMdiMainFrm::setIDEAlModeStyle( int flags )
-{
- d->m_styleIDEAlMode = flags; // see KMultiTabBar for the first 3 bits
- if ( m_leftContainer )
- {
- KMdiDockContainer * tmpL = ::tqqt_cast<KMdiDockContainer*>( m_leftContainer->getWidget() );
- if ( tmpL )
- tmpL->setStyle( flags );
- }
-
- if ( m_rightContainer )
- {
- KMdiDockContainer * tmpR = ::tqqt_cast<KMdiDockContainer*>( m_rightContainer->getWidget() );
- if ( tmpR )
- tmpR->setStyle( flags );
- }
-
- if ( m_topContainer )
- {
- KMdiDockContainer * tmpT = ::tqqt_cast<KMdiDockContainer*>( m_topContainer->getWidget() );
- if ( tmpT )
- tmpT->setStyle( flags );
- }
-
- if ( m_bottomContainer )
- {
- KMdiDockContainer * tmpB = ::tqqt_cast<KMdiDockContainer*>( m_bottomContainer->getWidget() );
- if ( tmpB )
- tmpB->setStyle( flags );
- }
-}
-
-void KMdiMainFrm::setToolviewStyle( int flag )
-{
- if ( m_mdiMode == KMdi::IDEAlMode )
- {
- setIDEAlModeStyle( flag );
- }
- d->m_toolviewStyle = flag;
- bool toolviewExists = false;
- TQMap<TQWidget*, KMdiToolViewAccessor*>::Iterator it;
- for ( it = m_pToolViews->begin(); it != m_pToolViews->end(); ++it )
- {
- KDockWidget *dockWidget = tqt_dynamic_cast<KDockWidget*>( it.data()->wrapperWidget() );
- if ( dockWidget )
- {
- switch ( flag )
- {
- case KMdi::IconOnly:
- dockWidget->setTabPageLabel( TQString::null );
- dockWidget->setPixmap( *( it.data()->wrappedWidget()->icon() ) );
- break;
- case KMdi::TextOnly:
- dockWidget->setPixmap(); //FIXME: Does not hide the icon in the IDEAl mode.
- dockWidget->setTabPageLabel( it.data()->wrappedWidget()->caption() );
- break;
- case KMdi::TextAndIcon:
- dockWidget->setPixmap( *( it.data()->wrappedWidget()->icon() ) );
- dockWidget->setTabPageLabel( it.data()->wrappedWidget()->caption() );
- default:
- break;
- }
- toolviewExists = true;
- }
- }
-
- if ( toolviewExists )
- {
- //workaround for the above FIXME to make switching to TextOnly mode work in IDEAl as well. Be sure that this version of switch* is called.
- if ( m_mdiMode == KMdi::IDEAlMode && flag == KMdi::TextOnly )
- {
- KMdiMainFrm::switchToTabPageMode();
- KMdiMainFrm::switchToIDEAlMode();
- }
- else
- {
- writeDockConfig();
- readDockConfig();
- }
- }
-}
-
-/**
- * Docks all view windows (Windows-like)
- */
-void KMdiMainFrm::switchToIDEAlMode()
-{
- kdDebug(760) << k_funcinfo << "switching to IDEAl mode" << endl;
-
- if ( m_mdiMode == KMdi::IDEAlMode )
- {
- emit mdiModeHasBeenChangedTo( KMdi::IDEAlMode );
- return ; // nothing need to be done
- }
-
- switch( m_mdiMode )
- {
- case KMdi::ChildframeMode:
- finishChildframeMode();
- break;
- case KMdi::ToplevelMode:
- finishToplevelMode();
- break;
- case KMdi::TabPageMode:
- m_mdiMode = KMdi::IDEAlMode;
- setupToolViewsForIDEALMode();
- emit mdiModeHasBeenChangedTo( KMdi::IDEAlMode );
- return;
- break;
- default:
- break;
- }
-
- setupTabbedDocumentViewSpace();
- m_mdiMode = KMdi::IDEAlMode;
- setupToolViewsForIDEALMode();
-
- if ( m_pCurrentWindow )
- m_pCurrentWindow->setFocus();
-
- m_pTaskBar->switchOn( false );
-
- if ( m_pClose )
- {
- TQObject::connect( m_pClose, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closeViewButtonPressed() ) );
- if ( m_pDocumentViews->count() > 0 )
- m_pClose->show();
- }
- else
- kdWarning(760) << k_funcinfo << "close button pointer does not exist!" << endl;
-
- kdDebug(760) << k_funcinfo << "switch to IDEAl mode complete" << endl;
-
- emit mdiModeHasBeenChangedTo( KMdi::IDEAlMode );
-}
-
-
-void KMdiMainFrm::dockToolViewsIntoContainers( TQPtrList<KDockWidget>& widgetsToReparent, KDockWidget *container )
-{
- TQPtrListIterator<KDockWidget> it( widgetsToReparent );
- for ( ; ( *it ); ++it )
- {
- ( *it )->manualDock( container, KDockWidget::DockCenter, 20 );
- ( *it )->loseFormerBrotherDockWidget();
- }
-}
-
-void KMdiMainFrm::findToolViewsDockedToMain( TQPtrList<KDockWidget>* list, KDockWidget::DockPosition dprtmw )
-{
- KDockWidget* mainDock = getMainDockWidget();
- if ( mainDock->parentDockTabGroup() )
- {
- mainDock = tqt_dynamic_cast<KDockWidget*>( mainDock->parentDockTabGroup()->parent() );
- // FIXME: will likely crash below due to unchecked cast
- }
-
- if ( !mainDock )
- {
- kdDebug(760) << k_funcinfo << "mainDock invalid. No main dock widget found." << endl;
- return;
- }
-
- KDockWidget* widget = mainDock->findNearestDockWidget( dprtmw );
- if ( widget && widget->parentDockTabGroup() )
- {
- widget = static_cast<KDockWidget*>( TQT_TQWIDGET(widget->parentDockTabGroup() ->parent()) );
-
- if ( widget )
- {
- KDockTabGroup* tg = tqt_dynamic_cast<KDockTabGroup*>( widget->getWidget() );
- if ( tg )
- {
- kdDebug(760) << k_funcinfo << "KDockTabGroup found" << endl;
- for ( int i = 0;i < tg->count();i++ )
- list->append( static_cast<KDockWidget*>( tg->page( i ) ) );
- }
- else
- list->append( widget );
- }
- else
- kdDebug(760) << k_funcinfo << "no widget found" << endl;
- }
- else
- kdDebug(760) << "No main dock widget found" << endl;
-}
-
-
-void KMdiMainFrm::setupToolViewsForIDEALMode()
-{
- m_leftContainer = createDockWidget( "KMdiDock::leftDock", SmallIcon( "misc" ), 0L, "Left Dock" );
- m_rightContainer = createDockWidget( "KMdiDock::rightDock", SmallIcon( "misc" ), 0L, "Right Dock" );
- m_topContainer = createDockWidget( "KMdiDock::topDock", SmallIcon( "misc" ), 0L, "Top Dock" );
- m_bottomContainer = createDockWidget( "KMdiDock::bottomDock", SmallIcon( "misc" ), 0L, "Bottom Dock" );
-
- KDockWidget *mainDock = getMainDockWidget();
- KDockWidget *w = mainDock;
- if ( mainDock->parentDockTabGroup() )
- w = static_cast<KDockWidget*>( TQT_TQWIDGET(mainDock->parentDockTabGroup()->parent()) );
-
- TQPtrList<KDockWidget> leftReparentWidgets;
- TQPtrList<KDockWidget> rightReparentWidgets;
- TQPtrList<KDockWidget> bottomReparentWidgets;
- TQPtrList<KDockWidget> topReparentWidgets;
-
- if ( mainDock->parentDockTabGroup() )
- mainDock = static_cast<KDockWidget*>( TQT_TQWIDGET(mainDock->parentDockTabGroup() ->parent()) );
-
- findToolViewsDockedToMain( &leftReparentWidgets, KDockWidget::DockLeft );
- findToolViewsDockedToMain( &rightReparentWidgets, KDockWidget::DockRight );
- findToolViewsDockedToMain( &bottomReparentWidgets, KDockWidget::DockBottom );
- findToolViewsDockedToMain( &topReparentWidgets, KDockWidget::DockTop );
-
- mainDock->setEnableDocking( KDockWidget::DockNone ); //::DockCorner);
- mainDock->setDockSite( KDockWidget::DockCorner );
-
-
- KMdiDockContainer *tmpDC;
- m_leftContainer->setWidget( tmpDC = new KMdiDockContainer( m_leftContainer, this, KDockWidget::DockLeft, d->m_styleIDEAlMode ) );
- m_leftContainer->setEnableDocking( KDockWidget::DockLeft );
- m_leftContainer->manualDock( mainDock, KDockWidget::DockLeft, 20 );
- tmpDC->init();
- if ( m_mdiGUIClient )
- connect ( this, TQT_SIGNAL( toggleLeft() ), tmpDC, TQT_SLOT( toggle() ) );
- connect( this, TQT_SIGNAL( collapseOverlapContainers() ), tmpDC, TQT_SLOT( collapseOverlapped() ) );
- connect( tmpDC, TQT_SIGNAL( activated( KMdiDockContainer* ) ), this, TQT_SLOT( setActiveToolDock( KMdiDockContainer* ) ) );
- connect( tmpDC, TQT_SIGNAL( deactivated( KMdiDockContainer* ) ), this, TQT_SLOT( removeFromActiveDockList( KMdiDockContainer* ) ) );
-
- m_rightContainer->setWidget( tmpDC = new KMdiDockContainer( m_rightContainer, this, KDockWidget::DockRight, d->m_styleIDEAlMode ) );
- m_rightContainer->setEnableDocking( KDockWidget::DockRight );
- m_rightContainer->manualDock( mainDock, KDockWidget::DockRight, 80 );
- tmpDC->init();
- if ( m_mdiGUIClient )
- connect ( this, TQT_SIGNAL( toggleRight() ), tmpDC, TQT_SLOT( toggle() ) );
- connect( this, TQT_SIGNAL( collapseOverlapContainers() ), tmpDC, TQT_SLOT( collapseOverlapped() ) );
- connect( tmpDC, TQT_SIGNAL( activated( KMdiDockContainer* ) ), this, TQT_SLOT( setActiveToolDock( KMdiDockContainer* ) ) );
- connect( tmpDC, TQT_SIGNAL( deactivated( KMdiDockContainer* ) ), this, TQT_SLOT( removeFromActiveDockList( KMdiDockContainer* ) ) );
-
- m_topContainer->setWidget( tmpDC = new KMdiDockContainer( m_topContainer, this, KDockWidget::DockTop, d->m_styleIDEAlMode ) );
- m_topContainer->setEnableDocking( KDockWidget::DockTop );
- m_topContainer->manualDock( mainDock, KDockWidget::DockTop, 20 );
- tmpDC->init();
- if ( m_mdiGUIClient )
- connect ( this, TQT_SIGNAL( toggleTop() ), tmpDC, TQT_SLOT( toggle() ) );
- connect( this, TQT_SIGNAL( collapseOverlapContainers() ), tmpDC, TQT_SLOT( collapseOverlapped() ) );
- connect( tmpDC, TQT_SIGNAL( activated( KMdiDockContainer* ) ), this, TQT_SLOT( setActiveToolDock( KMdiDockContainer* ) ) );
- connect( tmpDC, TQT_SIGNAL( deactivated( KMdiDockContainer* ) ), this, TQT_SLOT( removeFromActiveDockList( KMdiDockContainer* ) ) );
-
- m_bottomContainer->setWidget( tmpDC = new KMdiDockContainer( m_bottomContainer, this, KDockWidget::DockBottom, d->m_styleIDEAlMode ) );
- m_bottomContainer->setEnableDocking( KDockWidget::DockBottom );
- m_bottomContainer->manualDock( mainDock, KDockWidget::DockBottom, 80 );
- tmpDC->init();
- if ( m_mdiGUIClient )
- connect ( this, TQT_SIGNAL( toggleBottom() ), tmpDC, TQT_SLOT( toggle() ) );
- connect( this, TQT_SIGNAL( collapseOverlapContainers() ), tmpDC, TQT_SLOT( collapseOverlapped() ) );
- connect( tmpDC, TQT_SIGNAL( activated( KMdiDockContainer* ) ), this, TQT_SLOT( setActiveToolDock( KMdiDockContainer* ) ) );
- connect( tmpDC, TQT_SIGNAL( deactivated( KMdiDockContainer* ) ), this, TQT_SLOT( removeFromActiveDockList( KMdiDockContainer* ) ) );
-
- m_leftContainer->setDockSite( KDockWidget::DockCenter );
- m_rightContainer->setDockSite( KDockWidget::DockCenter );
- m_topContainer->setDockSite( KDockWidget::DockCenter );
- m_bottomContainer->setDockSite( KDockWidget::DockCenter );
-
- dockToolViewsIntoContainers( leftReparentWidgets, m_leftContainer );
- dockToolViewsIntoContainers( rightReparentWidgets, m_rightContainer );
- dockToolViewsIntoContainers( bottomReparentWidgets, m_bottomContainer );
- dockToolViewsIntoContainers( topReparentWidgets, m_topContainer );
-
-
- dockManager->setSpecialLeftDockContainer( m_leftContainer );
- dockManager->setSpecialRightDockContainer( m_rightContainer );
- dockManager->setSpecialTopDockContainer( m_topContainer );
- dockManager->setSpecialBottomDockContainer( m_bottomContainer );
-
-
- ( ( KMdiDockContainer* ) ( m_leftContainer->getWidget() ) ) ->hideIfNeeded();
- ( ( KMdiDockContainer* ) ( m_rightContainer->getWidget() ) ) ->hideIfNeeded();
- ( ( KMdiDockContainer* ) ( m_topContainer->getWidget() ) ) ->hideIfNeeded();
- ( ( KMdiDockContainer* ) ( m_bottomContainer->getWidget() ) ) ->hideIfNeeded();
-
-}
-
-
-
-void KMdiMainFrm::finishIDEAlMode( bool full )
-{
- // if tabified, release all views from their docking covers
- if ( m_mdiMode == KMdi::IDEAlMode )
- {
- assert( m_pClose );
- m_pClose->hide();
- TQObject::disconnect( m_pClose, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closeViewButtonPressed() ) );
-
-
- TQStringList leftNames;
- leftNames = prepareIdealToTabs( m_leftContainer );
- int leftWidth = m_leftContainer->width();
-
- TQStringList rightNames;
- rightNames = prepareIdealToTabs( m_rightContainer );
- int rightWidth = m_rightContainer->width();
-
- TQStringList topNames;
- topNames = prepareIdealToTabs( m_topContainer );
- int topHeight = m_topContainer->height();
-
- TQStringList bottomNames;
- bottomNames = prepareIdealToTabs( m_bottomContainer );
- int bottomHeight = m_bottomContainer->height();
-
-
- kdDebug(760) << "leftNames" << leftNames << endl;
- kdDebug(760) << "rightNames" << rightNames << endl;
- kdDebug(760) << "topNames" << topNames << endl;
- kdDebug(760) << "bottomNames" << bottomNames << endl;
-
- delete m_leftContainer;
- m_leftContainer = 0;
- delete m_rightContainer;
- m_rightContainer = 0;
- delete m_bottomContainer;
- m_bottomContainer = 0;
- delete m_topContainer;
- m_topContainer = 0;
-
-
- idealToolViewsToStandardTabs( bottomNames, KDockWidget::DockBottom, bottomHeight );
- idealToolViewsToStandardTabs( leftNames, KDockWidget::DockLeft, leftWidth );
- idealToolViewsToStandardTabs( rightNames, KDockWidget::DockRight, rightWidth );
- idealToolViewsToStandardTabs( topNames, KDockWidget::DockTop, topHeight );
-
- TQApplication::sendPostedEvents();
-
- if ( !full )
- return ;
-
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; it.current(); ++it )
- {
- KMdiChildView* pView = it.current();
- if ( pView->isToolView() )
- continue;
- TQSize mins = pView->minimumSize();
- TQSize maxs = pView->maximumSize();
- TQSize sz = pView->size();
- TQWidget* pParent = pView->parentWidget();
- TQPoint p( pParent->mapToGlobal( pParent->pos() ) - pParent->pos() + m_undockPositioningOffset );
- pView->reparent( 0, 0, p );
- pView->reparent( 0, 0, p );
- pView->resize( sz );
- pView->setMinimumSize( mins.width(), mins.height() );
- pView->setMaximumSize( maxs.width(), maxs.height() );
- KDockWidget* pDockW = 0L;
- // find the oldest ancestor of the current dockwidget that can be undocked
- do
- {
- if ( pParent->inherits( "KDockWidget" ) || pParent->inherits( "KDockWidget_Compat::KDockWidget" ) )
- {
- pDockW = ( KDockWidget* ) pParent;
- pDockW->undock(); // this destroys the dockwiget cover, too
- if ( pParent != m_pDockbaseAreaOfDocumentViews )
- {
- pParent->close();
- delete pParent;
- }
- }
- else
- {
- pParent = pParent->parentWidget();
- }
- }
- while ( pParent && !pDockW );
- if ( centralWidget() == pParent )
- {
- setCentralWidget( 0L ); // avoid dangling pointer
- }
- }
- m_pTaskBar->switchOn( true );
-
- }
-
-}
-
-TQStringList KMdiMainFrm::prepareIdealToTabs( KDockWidget* container )
-{
- KDockContainer * pDW = tqt_dynamic_cast<KDockContainer*>( container->getWidget() );
- TQStringList widgetNames = ( ( KMdiDockContainer* ) pDW ) ->containedWidgets();
- for ( TQStringList::iterator it = widgetNames.begin();it != widgetNames.end();++it )
- {
- KDockWidget* dw = ( KDockWidget* ) manager() ->getDockWidgetFromName( *it );
- dw->undock();
- dw->setLatestKDockContainer( 0 );
- dw->loseFormerBrotherDockWidget();
- }
- return widgetNames;
-}
-
-void KMdiMainFrm::idealToolViewsToStandardTabs( TQStringList widgetNames, KDockWidget::DockPosition pos, int size )
-{
- Q_UNUSED( size )
-
- KDockWidget * mainDock = getMainDockWidget();
- if ( mainDock->parentDockTabGroup() )
- {
- mainDock = static_cast<KDockWidget*>( TQT_TQWIDGET(mainDock->parentDockTabGroup() ->parent()) );
- }
-
- if ( widgetNames.count() > 0 )
- {
- TQStringList::iterator it = widgetNames.begin();
- KDockWidget *dwpd = manager() ->getDockWidgetFromName( *it );
- if ( !dwpd )
- {
- kdDebug(760) << "Fatal error in finishIDEAlMode" << endl;
- return ;
- }
- dwpd->manualDock( mainDock, pos, 20 );
- ++it;
- for ( ;it != widgetNames.end();++it )
- {
- KDockWidget *tmpdw = manager() ->getDockWidgetFromName( *it );
- if ( !tmpdw )
- {
- kdDebug(760) << "Fatal error in finishIDEAlMode" << endl;
- return ;
- }
- tmpdw->manualDock( dwpd, KDockWidget::DockCenter, 20 );
- }
-
-#if 0
- TQWidget *wid = dwpd->parentDockTabGroup();
- if ( !wid )
- wid = dwpd;
- wid->setGeometry( 0, 0, 20, 20 );
- /* wid->resize(
- ((pos==KDockWidget::DockLeft) || (pos==KDockWidget::DockRight))?size:wid->width(),
- ((pos==KDockWidget::DockLeft) || (pos==KDockWidget::DockRight))?wid->height():size);
- */
-#endif
-
- }
-
-}
-
-
-/**
- * redirect the signal for insertion of buttons to an own slot
- * that means: If the menubar (where the buttons should be inserted) is given,
- * QextMDI can insert them automatically.
- * Otherwise only signals can be emitted to tell the outside that
- * someone must do this job itself.
- */
-void KMdiMainFrm::setMenuForSDIModeSysButtons( KMenuBar* pMenuBar )
-{
- if ( m_bSDIApplication ) // there are no buttons in the menubar in this mode (although the view is always maximized)
- return ;
-
- m_pMainMenuBar = pMenuBar;
- if ( m_pMainMenuBar == 0L )
- return ; // use setMenuForSDIModeSysButtons( 0L) for unsetting the external main menu!
-
- if ( !m_pUndock )
- m_pUndock = new TQToolButton( pMenuBar );
- if ( !m_pRestore )
- m_pRestore = new TQToolButton( pMenuBar );
- if ( !m_pMinimize )
- m_pMinimize = new TQToolButton( pMenuBar );
- if ( !m_pClose )
- m_pClose = new TQToolButton( pMenuBar );
- m_pUndock->setAutoRaise( false );
- m_pMinimize->setAutoRaise( false );
- m_pRestore->setAutoRaise( false );
- m_pClose->setAutoRaise( false );
-
- setSysButtonsAtMenuPosition();
-
- delete m_pUndockButtonPixmap;
- delete m_pMinButtonPixmap;
- delete m_pRestoreButtonPixmap;
- delete m_pCloseButtonPixmap;
- // create the decoration pixmaps
- if ( frameDecorOfAttachedViews() == KMdi::Win95Look )
- {
- m_pUndockButtonPixmap = new TQPixmap( win_undockbutton );
- m_pMinButtonPixmap = new TQPixmap( win_minbutton );
- m_pRestoreButtonPixmap = new TQPixmap( win_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( win_closebutton );
- }
- else if ( frameDecorOfAttachedViews() == KMdi::KDE1Look )
- {
- m_pUndockButtonPixmap = new TQPixmap( kde_undockbutton );
- m_pMinButtonPixmap = new TQPixmap( kde_minbutton );
- m_pRestoreButtonPixmap = new TQPixmap( kde_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( kde_closebutton );
- m_pUndock->setAutoRaise( true );
- m_pMinimize->setAutoRaise( true );
- m_pRestore->setAutoRaise( true );
- m_pClose->setAutoRaise( true );
- }
- else if ( frameDecorOfAttachedViews() == KMdi::KDELook )
- {
- m_pUndockButtonPixmap = new TQPixmap( kde2_undockbutton );
- m_pMinButtonPixmap = new TQPixmap( kde2_minbutton );
- m_pRestoreButtonPixmap = new TQPixmap( kde2_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( kde2_closebutton );
- }
- else
- { // kde2laptop look
- m_pUndockButtonPixmap = new TQPixmap( kde2laptop_undockbutton );
- m_pMinButtonPixmap = new TQPixmap( kde2laptop_minbutton );
- m_pRestoreButtonPixmap = new TQPixmap( kde2laptop_restorebutton );
- m_pCloseButtonPixmap = new TQPixmap( kde2laptop_closebutton );
- }
-
- m_pUndock->hide();
- m_pMinimize->hide();
- m_pRestore->hide();
- m_pClose->hide();
-
- m_pUndock->setPixmap( *m_pUndockButtonPixmap );
- m_pMinimize->setPixmap( *m_pMinButtonPixmap );
- m_pRestore->setPixmap( *m_pRestoreButtonPixmap );
- m_pClose->setPixmap( *m_pCloseButtonPixmap );
-}
-
-void KMdiMainFrm::setSysButtonsAtMenuPosition()
-{
- if ( m_pMainMenuBar == 0L )
- return ;
- if ( m_pMainMenuBar->parentWidget() == 0L )
- return ;
-
- int menuW = m_pMainMenuBar->parentWidget() ->width();
- int h;
- int y;
- if ( frameDecorOfAttachedViews() == KMdi::Win95Look )
- h = 16;
- else if ( frameDecorOfAttachedViews() == KMdi::KDE1Look )
- h = 20;
- else if ( frameDecorOfAttachedViews() == KMdi::KDELook )
- h = 16;
- else
- h = 14;
- y = m_pMainMenuBar->height() / 2 - h / 2;
-
- if ( frameDecorOfAttachedViews() == KMdi::KDELaptopLook )
- {
- int w = 27;
- m_pUndock->setGeometry( ( menuW - ( w * 3 ) - 5 ), y, w, h );
- m_pMinimize->setGeometry( ( menuW - ( w * 2 ) - 5 ), y, w, h );
- m_pRestore->setGeometry( ( menuW - w - 5 ), y, w, h );
- }
- else
- {
- m_pUndock->setGeometry( ( menuW - ( h * 4 ) - 5 ), y, h, h );
- m_pMinimize->setGeometry( ( menuW - ( h * 3 ) - 5 ), y, h, h );
- m_pRestore->setGeometry( ( menuW - ( h * 2 ) - 5 ), y, h, h );
- m_pClose->setGeometry( ( menuW - h - 5 ), y, h, h );
- }
-}
-
-/** Activates the next open view */
-void KMdiMainFrm::activateNextWin()
-{
- KMdiIterator<KMdiChildView*>* it = createIterator();
- KMdiChildView* aWin = activeWindow();
- for ( it->first(); !it->isDone(); it->next() )
- {
- if ( it->currentItem() == aWin )
- {
- it->next();
- if ( !it->currentItem() )
- {
- it->first();
- }
- if ( it->currentItem() )
- {
- activateView( it->currentItem() );
- }
- break;
- }
- }
- delete it;
-}
-
-/** Activates the previous open view */
-void KMdiMainFrm::activatePrevWin()
-{
- KMdiIterator<KMdiChildView*>* it = createIterator();
- KMdiChildView* aWin = activeWindow();
- for ( it->first(); !it->isDone(); it->next() )
- {
- if ( it->currentItem() == aWin )
- {
- it->prev();
- if ( !it->currentItem() )
- {
- it->last();
- }
- if ( it->currentItem() )
- {
- activateView( it->currentItem() );
- }
- break;
- }
- }
- delete it;
-}
-
-/** Activates the view we accessed the most time ago */
-void KMdiMainFrm::activateFirstWin()
-{
- m_bSwitching= true; // flag that we are currently switching between windows
- KMdiIterator<KMdiChildView*>* it = createIterator();
- TQMap<TQDateTime, KMdiChildView*> m;
- for ( it->first(); !it->isDone(); it->next() )
- {
- m.insert( it->currentItem() ->getTimeStamp(), it->currentItem() );
- }
-
- if ( !activeWindow() )
- return ;
-
- TQDateTime current = activeWindow() ->getTimeStamp();
- TQMap<TQDateTime, KMdiChildView*>::iterator pos( m.find( current ) );
- TQMap<TQDateTime, KMdiChildView*>::iterator newPos = pos;
- if ( pos != m.end() )
- {
- ++newPos;
- }
- if ( newPos != m.end() )
- { // look ahead
- ++pos;
- }
- else
- {
- pos = m.begin();
- }
- activateView( pos.data() );
- delete it;
-}
-
-/** Activates the previously accessed view before this one was activated */
-void KMdiMainFrm::activateLastWin()
-{
- m_bSwitching= true; // flag that we are currently switching between windows
- KMdiIterator<KMdiChildView*>* it = createIterator();
- TQMap<TQDateTime, KMdiChildView*> m;
- for ( it->first(); !it->isDone(); it->next() )
- {
- m.insert( it->currentItem() ->getTimeStamp(), it->currentItem() );
- }
-
- if ( !activeWindow() )
- return ;
-
- TQDateTime current = activeWindow() ->getTimeStamp();
- TQMap<TQDateTime, KMdiChildView*>::iterator pos( m.find( current ) );
- if ( pos != m.begin() )
- {
- --pos;
- }
- else
- {
- pos = m.end();
- --pos;
- }
- activateView( pos.data() );
- delete it;
-}
-
-/** Activates the view with a certain index (TabPage mode only) */
-void KMdiMainFrm::activateView( int index )
-{
- KMdiChildView * pView = m_pDocumentViews->first();
- for ( int i = 0; pView && ( i < index ); i++ )
- {
- pView = m_pDocumentViews->next();
- }
- if ( pView )
- {
- pView->activate();
- }
-}
-
-/** turns the system buttons for maximize mode (SDI mode) on, and connects them with the current child frame */
-void KMdiMainFrm::setEnableMaximizedChildFrmMode( bool enableMaxChildFrameMode )
-{
- if ( enableMaxChildFrameMode )
- {
- kdDebug(760) << k_funcinfo << "Turning on maximized child frame mode" << endl;
- m_bMaximizedChildFrmMode = true;
-
- KMdiChildFrm* pCurrentChild = m_pMdi->topChild();
-
- //If we have no child or there is no menubar, we do nothing
- if ( !pCurrentChild || !m_pMainMenuBar )
- return ;
-
- TQObject::connect( m_pUndock, TQT_SIGNAL( clicked() ), pCurrentChild, TQT_SLOT( undockPressed() ) );
- TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), pCurrentChild, TQT_SLOT( minimizePressed() ) );
- TQObject::connect( m_pRestore, TQT_SIGNAL( clicked() ), pCurrentChild, TQT_SLOT( maximizePressed() ) );
- m_pMinimize->show();
- m_pUndock->show();
- m_pRestore->show();
-
- if ( frameDecorOfAttachedViews() == KMdi::KDELaptopLook )
- {
- m_pMainMenuBar->insertItem( TQPixmap( kde2laptop_closebutton_menu ), m_pMdi->topChild(), TQT_SLOT( closePressed() ), 0, -1, 0 );
- }
- else
- {
- m_pMainMenuBar->insertItem( *pCurrentChild->icon(), pCurrentChild->systemMenu(), -1, 0 );
- if ( m_pClose )
- {
- TQObject::connect( m_pClose, TQT_SIGNAL( clicked() ), pCurrentChild, TQT_SLOT( closePressed() ) );
- m_pClose->show();
- }
- else
- kdDebug(760) << k_funcinfo << "no close button. things won't behave correctly" << endl;
- }
- }
- else
- {
- if ( !m_bMaximizedChildFrmMode )
- return ; // already set, nothing to do
-
- kdDebug(760) << k_funcinfo << "Turning off maximized child frame mode" << endl;
- m_bMaximizedChildFrmMode = false;
-
- KMdiChildFrm* pFrmChild = m_pMdi->topChild();
- if ( pFrmChild && pFrmChild->m_pClient && pFrmChild->state() == KMdiChildFrm::Maximized )
- {
- pFrmChild->m_pClient->restore();
- switchOffMaximizeModeForMenu( pFrmChild );
- }
- }
-}
-
-/** turns the system buttons for maximize mode (SDI mode) off, and disconnects them */
-void KMdiMainFrm::switchOffMaximizeModeForMenu( KMdiChildFrm* oldChild )
-{
- // if there is no menubar given, those system buttons aren't possible
- if ( !m_pMainMenuBar )
- return ;
-
- m_pMainMenuBar->removeItem( m_pMainMenuBar->idAt( 0 ) );
-
- if ( oldChild )
- {
- Q_ASSERT( m_pClose );
- TQObject::disconnect( m_pUndock, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( undockPressed() ) );
- TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( minimizePressed() ) );
- TQObject::disconnect( m_pRestore, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( maximizePressed() ) );
- TQObject::disconnect( m_pClose, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( closePressed() ) );
- }
- m_pUndock->hide();
- m_pMinimize->hide();
- m_pRestore->hide();
- m_pClose->hide();
-}
-
-/** reconnects the system buttons form maximize mode (SDI mode) with the new child frame */
-void KMdiMainFrm::updateSysButtonConnections( KMdiChildFrm* oldChild, KMdiChildFrm* newChild )
-{
- //tqDebug("updateSysButtonConnections");
- // if there is no menubar given, those system buttons aren't possible
- if ( !m_pMainMenuBar )
- return ;
-
- if ( newChild )
- {
- if ( frameDecorOfAttachedViews() == KMdi::KDELaptopLook )
- m_pMainMenuBar->insertItem( TQPixmap( kde2laptop_closebutton_menu ), newChild, TQT_SLOT( closePressed() ), 0, -1, 0 );
- else
- m_pMainMenuBar->insertItem( *newChild->icon(), newChild->systemMenu(), -1, 0 );
- }
-
- if ( oldChild )
- {
- m_pMainMenuBar->removeItem( m_pMainMenuBar->idAt( 1 ) );
- Q_ASSERT( m_pClose );
- TQObject::disconnect( m_pUndock, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( undockPressed() ) );
- TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( minimizePressed() ) );
- TQObject::disconnect( m_pRestore, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( maximizePressed() ) );
- TQObject::disconnect( m_pClose, TQT_SIGNAL( clicked() ), oldChild, TQT_SLOT( closePressed() ) );
- }
- if ( newChild )
- {
- Q_ASSERT( m_pClose );
- TQObject::connect( m_pUndock, TQT_SIGNAL( clicked() ), newChild, TQT_SLOT( undockPressed() ) );
- TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), newChild, TQT_SLOT( minimizePressed() ) );
- TQObject::connect( m_pRestore, TQT_SIGNAL( clicked() ), newChild, TQT_SLOT( maximizePressed() ) );
- TQObject::connect( m_pClose, TQT_SIGNAL( clicked() ), newChild, TQT_SLOT( closePressed() ) );
- }
-}
-
-/** Shows the view taskbar. This should be connected with your "View" menu. */
-bool KMdiMainFrm::isViewTaskBarOn()
-{
- if ( m_pTaskBar )
- return m_pTaskBar->isSwitchedOn();
- else
- return false;
-}
-
-/** Shows the view taskbar. This should be connected with your "View" menu. */
-void KMdiMainFrm::showViewTaskBar()
-{
- if ( m_pTaskBar )
- m_pTaskBar->switchOn( true );
-}
-
-/** Hides the view taskbar. This should be connected with your "View" menu. */
-void KMdiMainFrm::hideViewTaskBar()
-{
- if ( m_pTaskBar )
- m_pTaskBar->switchOn( false );
-}
-
-//=============== fillWindowMenu ===============//
-void KMdiMainFrm::fillWindowMenu()
-{
- bool tabPageMode = false;
- if ( m_mdiMode == KMdi::TabPageMode )
- tabPageMode = true;
-
- bool IDEAlMode = false;
- if ( m_mdiMode == KMdi::IDEAlMode )
- IDEAlMode = true;
-
- bool noViewOpened = false;
- if ( m_pDocumentViews->isEmpty() )
- noViewOpened = true;
-
- // construct the menu and its submenus
- if ( !m_bClearingOfWindowMenuBlocked )
- m_pWindowMenu->clear();
-
- d->closeWindowAction->plug(m_pWindowMenu);
-
- int closeAllId = m_pWindowMenu->insertItem( i18n( "Close &All" ), this, TQT_SLOT( closeAllViews() ) );
- if ( noViewOpened )
- {
- d->closeWindowAction->setEnabled(false);
- m_pWindowMenu->setItemEnabled( closeAllId, false );
- }
-
- if ( !tabPageMode && !IDEAlMode )
- {
- int iconifyId = m_pWindowMenu->insertItem( i18n( "&Minimize All" ), this, TQT_SLOT( iconifyAllViews() ) );
- if ( noViewOpened )
- m_pWindowMenu->setItemEnabled( iconifyId, false );
- }
-
- m_pWindowMenu->insertSeparator();
- m_pWindowMenu->insertItem( i18n( "&MDI Mode" ), m_pMdiModeMenu );
- m_pMdiModeMenu->clear();
- m_pMdiModeMenu->insertItem( i18n( "&Toplevel Mode" ), this, TQT_SLOT( switchToToplevelMode() ) );
- m_pMdiModeMenu->insertItem( i18n( "C&hildframe Mode" ), this, TQT_SLOT( switchToChildframeMode() ) );
- m_pMdiModeMenu->insertItem( i18n( "Ta&b Page Mode" ), this, TQT_SLOT( switchToTabPageMode() ) );
- m_pMdiModeMenu->insertItem( i18n( "I&DEAl Mode" ), this, TQT_SLOT( switchToIDEAlMode() ) );
- switch ( m_mdiMode )
- {
- case KMdi::ToplevelMode:
- m_pMdiModeMenu->setItemChecked( m_pMdiModeMenu->idAt( 0 ), true );
- break;
- case KMdi::ChildframeMode:
- m_pMdiModeMenu->setItemChecked( m_pMdiModeMenu->idAt( 1 ), true );
- break;
- case KMdi::TabPageMode:
- m_pMdiModeMenu->setItemChecked( m_pMdiModeMenu->idAt( 2 ), true );
- break;
- case KMdi::IDEAlMode:
- m_pMdiModeMenu->setItemChecked( m_pMdiModeMenu->idAt( 3 ), true );
- break;
- default:
- break;
- }
-
- m_pWindowMenu->insertSeparator();
- if ( !tabPageMode && !IDEAlMode )
- {
- int placMenuId = m_pWindowMenu->insertItem( i18n( "&Tile" ), m_pPlacingMenu );
- m_pPlacingMenu->clear();
- m_pPlacingMenu->insertItem( i18n( "Ca&scade Windows" ), m_pMdi, TQT_SLOT( cascadeWindows() ) );
- m_pPlacingMenu->insertItem( i18n( "Cascade &Maximized" ), m_pMdi, TQT_SLOT( cascadeMaximized() ) );
- m_pPlacingMenu->insertItem( i18n( "Expand &Vertically" ), m_pMdi, TQT_SLOT( expandVertical() ) );
- m_pPlacingMenu->insertItem( i18n( "Expand &Horizontally" ), m_pMdi, TQT_SLOT( expandHorizontal() ) );
- m_pPlacingMenu->insertItem( i18n( "Tile &Non-Overlapped" ), m_pMdi, TQT_SLOT( tileAnodine() ) );
- m_pPlacingMenu->insertItem( i18n( "Tile Overla&pped" ), m_pMdi, TQT_SLOT( tilePragma() ) );
- m_pPlacingMenu->insertItem( i18n( "Tile V&ertically" ), m_pMdi, TQT_SLOT( tileVertically() ) );
- if ( m_mdiMode == KMdi::ToplevelMode )
- {
- m_pWindowMenu->setItemEnabled( placMenuId, false );
- }
- m_pWindowMenu->insertSeparator();
- int dockUndockId = m_pWindowMenu->insertItem( i18n( "&Dock/Undock" ), m_pDockMenu );
- m_pDockMenu->clear();
- m_pWindowMenu->insertSeparator();
- if ( noViewOpened )
- {
- m_pWindowMenu->setItemEnabled( placMenuId, false );
- m_pWindowMenu->setItemEnabled( dockUndockId, false );
- }
- }
- int entryCount = m_pWindowMenu->count();
-
- // for all child frame windows: give an ID to every window and connect them in the end with windowMenuItemActivated()
- int i = 100;
- KMdiChildView* pView = 0L;
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- TQValueList<TQDateTime> timeStamps;
- for ( ; it.current(); ++it )
- {
- pView = it.current();
- TQDateTime timeStamp( pView->getTimeStamp() );
-
- if ( pView->isToolView() )
- {
- continue;
- }
-
- TQString item;
- // set titles of minimized windows in brackets
- if ( pView->isMinimized() )
- {
- item += "(";
- item += pView->caption();
- item += ")";
- }
- else
- {
- item += " ";
- item += pView->caption();
- }
-
- // insert the window entry sorted by access time
- unsigned int indx;
- unsigned int windowItemCount = m_pWindowMenu->count() - entryCount;
- bool inserted = false;
- TQString tmpString;
- TQValueList<TQDateTime>::iterator timeStampIterator = timeStamps.begin();
- for ( indx = 0; indx <= windowItemCount; indx++, ++timeStampIterator )
- {
- bool putHere = false;
- if ( ( *timeStampIterator ) < timeStamp )
- {
- putHere = true;
- timeStamps.insert( timeStampIterator, timeStamp );
- }
- if ( putHere )
- {
- m_pWindowMenu->insertItem( item, pView, TQT_SLOT( slot_clickedInWindowMenu() ), 0, -1, indx + entryCount );
- if ( pView == m_pCurrentWindow )
- {
- m_pWindowMenu->setItemChecked( m_pWindowMenu->idAt( indx + entryCount ), true );
- }
- pView->setWindowMenuID( i );
- if ( !tabPageMode )
- {
- m_pDockMenu->insertItem( item, pView, TQT_SLOT( slot_clickedInDockMenu() ), 0, -1, indx );
- if ( pView->isAttached() )
- {
- m_pDockMenu->setItemChecked( m_pDockMenu->idAt( indx ), true );
- }
- }
- inserted = true;
- break;
- indx = windowItemCount + 1; // break the loop
- }
- }
- if ( !inserted )
- { // append it
- m_pWindowMenu->insertItem( item, pView, TQT_SLOT( slot_clickedInWindowMenu() ), 0, -1, windowItemCount + entryCount );
- if ( pView == m_pCurrentWindow )
- {
- m_pWindowMenu->setItemChecked( m_pWindowMenu->idAt( windowItemCount + entryCount ), true );
- }
- pView->setWindowMenuID( i );
- if ( !tabPageMode )
- {
- m_pDockMenu->insertItem( item, pView, TQT_SLOT( slot_clickedInDockMenu() ), 0, -1, windowItemCount );
- if ( pView->isAttached() )
- {
- m_pDockMenu->setItemChecked( m_pDockMenu->idAt( windowItemCount ), true );
- }
- }
- }
- i++;
- }
-}
-
-//================ windowMenuItemActivated ===============//
-
-void KMdiMainFrm::windowMenuItemActivated( int id )
-{
- if ( id < 100 )
- return ;
- id -= 100;
- KMdiChildView *pView = m_pDocumentViews->at( id );
- if ( !pView )
- return ;
- if ( pView->isMinimized() )
- pView->minimize();
- if ( m_mdiMode != KMdi::TabPageMode )
- {
- KMdiChildFrm * pTopChild = m_pMdi->topChild();
- if ( pTopChild )
- {
- if ( ( pView == pTopChild->m_pClient ) && pView->isAttached() )
- {
- return ;
- }
- }
- }
- activateView( pView );
-}
-
-//================ dockMenuItemActivated ===============//
-
-void KMdiMainFrm::dockMenuItemActivated( int id )
-{
- if ( id < 100 )
- return ;
- id -= 100;
- KMdiChildView *pView = m_pDocumentViews->at( id );
- if ( !pView )
- return ;
- if ( pView->isMinimized() )
- pView->minimize();
- if ( pView->isAttached() )
- {
- detachWindow( pView, true );
- }
- else
- { // is detached
- attachWindow( pView, true );
- }
-}
-
-//================ popupWindowMenu ===============//
-
-void KMdiMainFrm::popupWindowMenu( TQPoint p )
-{
- if ( !isFakingSDIApplication() )
- {
- m_pWindowMenu->popup( p );
- }
-}
-
-//================ dragEndTimeOut ===============//
-void KMdiMainFrm::dragEndTimeOut()
-{
- // send drag end to all concerned views.
- KMdiChildView * pView;
- for ( m_pDocumentViews->first(); ( pView = m_pDocumentViews->current() ) != 0L; m_pDocumentViews->next() )
- {
- KMdiChildFrmDragEndEvent dragEndEvent( 0L );
- TQApplication::sendEvent( pView, &dragEndEvent );
- }
-}
-
-//================ setFrameDecorOfAttachedViews ===============//
-
-void KMdiMainFrm::setFrameDecorOfAttachedViews( int frameDecor )
-{
- switch ( frameDecor )
- {
- case 0:
- m_frameDecoration = KMdi::Win95Look;
- break;
- case 1:
- m_frameDecoration = KMdi::KDE1Look;
- break;
- case 2:
- m_frameDecoration = KMdi::KDELook;
- break;
- case 3:
- m_frameDecoration = KMdi::KDELaptopLook;
- break;
- default:
- tqDebug( "unknown MDI decoration" );
- break;
- }
- setMenuForSDIModeSysButtons( m_pMainMenuBar );
- TQPtrListIterator<KMdiChildView> it( *m_pDocumentViews );
- for ( ; it.current(); ++it )
- {
- KMdiChildView* pView = it.current();
- if ( pView->isToolView() )
- continue;
- if ( pView->isAttached() )
- pView->mdiParent() ->redecorateButtons();
- }
-}
-
-void KMdiMainFrm::fakeSDIApplication()
-{
- m_bSDIApplication = true;
- if ( m_pTaskBar )
- m_pTaskBar->close();
- m_pTaskBar = 0L;
-}
-
-void KMdiMainFrm::closeViewButtonPressed()
-{
- KMdiChildView * pView = activeWindow();
- if ( pView )
- {
- pView->close();
- }
-}
-
-void KMdiMainFrm::setManagedDockPositionModeEnabled( bool enabled )
-{
- m_managedDockPositionMode = enabled;
-}
-
-void KMdiMainFrm::setActiveToolDock( KMdiDockContainer* td )
-{
- if ( td == d->activeDockPriority[ 0 ] )
- return ;
- if ( d->activeDockPriority[ 0 ] == 0 )
- {
- d->activeDockPriority[ 0 ] = td;
- // d->focusList=new KMdiFocusList(this);
- // if (m_pMdi) d->focusList->addWidgetTree(m_pMdi);
- // if (m_documentTabWidget) d->focusList->addWidgetTree(m_documentTabWidget);
- return ;
- }
- for ( int dst = 3, src = 2;src >= 0;dst--, src-- )
- {
- if ( d->activeDockPriority[ src ] == td )
- src--;
- if ( src < 0 )
- break;
- d->activeDockPriority[ dst ] = d->activeDockPriority[ src ];
- }
- d->activeDockPriority[ 0 ] = td;
-}
-
-void KMdiMainFrm::removeFromActiveDockList( KMdiDockContainer* td )
-{
- for ( int i = 0;i < 4;i++ )
- {
- if ( d->activeDockPriority[ i ] == td )
- {
- for ( ;i < 3;i++ )
- d->activeDockPriority[ i ] = d->activeDockPriority[ i + 1 ];
- d->activeDockPriority[ 3 ] = 0;
- break;
- }
- }
- /*
- if (d->activeDockPriority[0]==0) {
- if (d->focusList) d->focusList->restore();
- delete d->focusList;
- d->focusList=0;
- }
- */
-}
-
-void KMdiMainFrm::prevToolViewInDock()
-{
- KMdiDockContainer * td = d->activeDockPriority[ 0 ];
- if ( !td )
- return ;
- td->prevToolView();
-}
-
-void KMdiMainFrm::nextToolViewInDock()
-{
- KMdiDockContainer * td = d->activeDockPriority[ 0 ];
- if ( !td )
- return ;
- td->nextToolView();
-}
-
-KMdi::TabWidgetVisibility KMdiMainFrm::tabWidgetVisibility()
-{
- if ( m_documentTabWidget )
- return m_documentTabWidget->tabWidgetVisibility();
-
- return KMdi::NeverShowTabs;
-}
-
-void KMdiMainFrm::setTabWidgetVisibility( KMdi::TabWidgetVisibility visibility )
-{
- if ( m_documentTabWidget )
- m_documentTabWidget->setTabWidgetVisibility( visibility );
-}
-
-KTabWidget * KMdiMainFrm::tabWidget() const
-{
- return m_documentTabWidget;
-}
-
-#include "kmdimainfrm.moc"
-
-// vim: ts=2 sw=2 et
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmdimainfrm.h b/kmdi/kmdimainfrm.h
deleted file mode 100644
index af2134a39..000000000
--- a/kmdi/kmdimainfrm.h
+++ /dev/null
@@ -1,884 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdimainfrm.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// : 02/2000 by Massimo Morin (mmorin@schedsys.com)
-// 2000-2003 maintained by the KDevelop project
-// patches : */2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
-// : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDIMAINFRM_H_
-#define _KMDIMAINFRM_H_
-
-#include <kparts/dockmainwindow.h>
-#include <kmenubar.h>
-#include <kpopupmenu.h>
-
-#include <tqptrlist.h>
-#include <tqrect.h>
-#include <tqapplication.h>
-#include <tqdom.h>
-#include <tqguardedptr.h>
-
-#include "kmditaskbar.h"
-#include "kmdichildarea.h"
-#include "kmdichildview.h"
-#include "kmdiiterator.h"
-#include "kmdilistiterator.h"
-#include "kmdinulliterator.h"
-#include "kmditoolviewaccessor.h"
-
-class TQTimer;
-class TQPopupMenu;
-class TQMenuBar;
-
-
-class TQToolButton;
-
-namespace KMDIPrivate
-{
-class KMDIGUIClient;
-}
-
-class KMdiDockContainer;
-class KMdiMainFrmPrivate;
-
-/**
- * @short Internal class
- *
- * This special event is needed because the view has to inform the main frame that it`s being closed.
- */
-class KMDI_EXPORT KMdiViewCloseEvent : public TQCustomEvent
-{
-public:
- KMdiViewCloseEvent( KMdiChildView* pWnd ) : TQCustomEvent( TQEvent::User, pWnd ) {}
-};
-
-/**
- * \short Base class for all your special main frames.
- *
- * It contains the child frame area (QMainWindow's central widget) and a child view taskbar
- * for switching the MDI views. Most methods are virtual functions for later overriding.
- *
- * Basically, this class provides functionality for docking/undocking view windows and
- * manages the taskbar. Usually a developer will only need to know about this class and
- * \ref KMdiChildView.
- *
- * \par General usage
- *
- * Your program mainwidget should inherit KMdiMainFrm. Then usually you'll just need
- * addWindow() and removeWindowFromMdi() to control the views.
- * \code
- * class MyMainWindow : public KMdiMainFrm
- * { .... };
- * \endcode
- *
- * to define your main window class and
- *
- * \code
- * MyMainWindow mainframe;
- * tqApp->setMainWidget(&mainframe);
- * mainframe->addWindow(view1); // put it under MDI control
- * mainframe->addWindow(view2);
- * \endcode
- *
- * when you wish to use your main window class. The above example also adds a few windows
- * to the frame.
- *
- * KMdiMainFrm will provide the "Window" menu needed in common MDI applications. Just
- * insert it in your main menu:
- *
- * \code
- * if ( !isFakingSDIApplication() )
- * {
- * menuBar()->insertItem( i18n( "&Window" ), windowMenu() );
- * }
- * \endcode
- *
- * To synchronize the positions of the MDI control buttons inserted in your mainmenu:
- * \code
- * void B_MainModuleWidget::initMenuBar()
- * {
- * setMenuForSDIModeSysButtons( menuBar() );
- * }
- * ...
- * void B_MainModuleWidget::resizeEvent ( TQResizeEvent *e )
- * {
- * KMdiMainFrm::resizeEvent( e );
- * setSysButtonsAtMenuPosition();
- * }
- * \endcode
- *
- * \par Dynamic mode switching
- *
- * Dynamic switching of the MDI mode can be done via the following functions:
- * - switchToChildframeMode()
- * - switchToToplevelMode()
- * - switchToTabPageMode()
- * - switchToIDEAlMode()
- *
- * The MDI mode can be gotten using mdiMode(). If you need to fake the look of an SDI application
- * use fakeSDIApplication() to fake it and isFakingSDIApplication() to query whether or not an SDI
- * interface is being faked.
- *
- * You can dynamically change the shape of the attached MDI views using setFrameDecorOfAttachedViews().
- *
- * Additionally, here's a hint how to restore the mainframe's settings from config file:
- * \code
- *
- * // restore MDI mode (toplevel, childframe, tabpage)
- * int mdiMode = config->readIntEntry( "mainmodule session", "MDI mode", KMdi::ChildframeMode);
- * switch (mdiMode) {
- * case KMdi::ToplevelMode:
- * {
- * int childFrmModeHt = config->readIntEntry( "mainmodule session", "Childframe mode height", desktop()->height() - 50);
- * mainframe->resize( m_pMdiMainFrm->width(), childFrmModeHt);
- * mainframe->switchToToplevelMode();
- * }
- * break;
- * case KMdi::ChildframeMode:
- * break;
- * case KMdi::TabPageMode:
- * {
- * int childFrmModeHt = m_pCfgFileManager->readIntEntry( "mainmodule session", "Childframe mode height", desktop()->height() - 50);
- * mainframe->resize( m_pMdiMainFrm->width(), childFrmModeHt);
- * mainframe->switchToTabPageMode();
- * }
- * break;
- * default:
- * break;
- * }
- *
- * // restore a possible maximized Childframe mode
- * bool maxChildFrmMode = config->readBoolEntry( "mainmodule session", "maximized childframes", true);
- * mainframe->setEnableMaximizedChildFrmMode(maxChildFrmMode);
- * \endcode
- * The maximized-Childframe mode means that currently all views are maximized in Childframe mode's application desktop.
- *
- * \par Managing views
- *
- * This class provides placing algorithms in Childframe mode. The following is a list of the window placement functions
- * - tilePragma() - Tile the windows and allow them to overlap
- * - tileAnodine() - Tile the windows but don't allow them to overlap
- * - tileVertically() - Tile the windows vertically
- * - cascadeWindows() - cascade windows
- * - cascadeMaximized() - cascade windows and maximize their viewing area
- * - expandVertical() - expand all the windows to use the most amount of vertical space
- * - expandHorizontal() - expand all the windows to use the most amount of horizontal space
- *
- * activateView(KMdiChildView*) and activateView(int index) set the appropriate MDI child view as the active
- * one. It will be raised, will get an active MDI frame and will get the focus. Call activeView() to find out what the
- * current MDI view is.
- *
- * Use detachWindow() and attachWindow() for docking the MDI views to desktop and back.
- *
- * Connect accels of your program with activatePrevWin(), activateNextWin() and activateView(int index).
- *
- * Note: KMdiChildViews can be added in 2 meanings: Either as a normal child view (usually containing
- * user document views) or as a tool-view (usually containing status, info or control widgets).
- * The tool-views can be added as floating dockwidgets or as stay-on-top desktop windows in tool style.
- *
- * Also, pay attention to the fact that when you click on the close button of MDI views that their
- * close event should be redirected to closeWindow(). Otherwise the mainframe class will
- * not get noticed about the deleted view and a dangling pointer will remain in the MDI control. The
- * closeWindow() or the removeWindowFromMdi() method is for that issue. The difference is closeWindow()
- * deletes the view object. So if your application wants to control that by itself, call removeWindowFromMdi()
- * and call delete by yourself. See also KMdiChildView::closeEvent() for that issue.
- *
- * Here's an example how you can suggest things for the adding of views to the MDI control via flags:
- * \code
- * m_mapOfMdiWidgets.insert( pWnd, mh );
- * unsigned int mdiFlags = KMdi::StandardAdd;
- *
- * if ( !show )
- * mdiFlags |= KMdi::Hide;
- *
- * if ( !attach )
- * mdiFlags |= KMdi::Detach;
- *
- * if ( minimize )
- * mdiFlags |= KMdi::Minimize;
- *
- * if ( bToolWindow)
- * mdiFlags |= KMdi::ToolWindow;
- *
- * if ( m_pMdiMainFrm->isFakingSDIApplication() )
- * {
- * if ( attach ) //fake an SDI app
- * mdiFlags |= KMdi::Maximize;
- * }
- * else
- * {
- * m_pMdiMainFrm->addWindow( pWnd, TQPoint(20, 20), KMdi::AddWindowFlags(mdiFlags));
- * return;
- * }
- * m_pMdiMainFrm->addWindow( pWnd, KMdi::AddWindowFlags(mdiFlags));
- * \endcode
- */
-class KMDI_EXPORT KMdiMainFrm : public KParts::DockMainWindow
-{
- friend class KMdiChildView;
- friend class KMdiTaskBar;
- Q_OBJECT
-
- friend class KMdiToolViewAccessor;
- // attributes
-protected:
- KMdi::MdiMode m_mdiMode;
- KMdiChildArea *m_pMdi;
- KMdiTaskBar *m_pTaskBar;
- TQPtrList<KMdiChildView> *m_pDocumentViews;
- TQMap<TQWidget*, KMdiToolViewAccessor*> *m_pToolViews;
- KMdiChildView *m_pCurrentWindow;
- TQPopupMenu *m_pWindowPopup;
- TQPopupMenu *m_pTaskBarPopup;
- TQPopupMenu *m_pWindowMenu;
- TQPopupMenu *m_pDockMenu;
- TQPopupMenu *m_pMdiModeMenu;
- TQPopupMenu *m_pPlacingMenu;
- KMenuBar *m_pMainMenuBar;
-
- TQPixmap *m_pUndockButtonPixmap;
- TQPixmap *m_pMinButtonPixmap;
- TQPixmap *m_pRestoreButtonPixmap;
- TQPixmap *m_pCloseButtonPixmap;
-
- TQToolButton *m_pUndock;
- TQToolButton *m_pMinimize;
- TQToolButton *m_pRestore;
- TQToolButton *m_pClose;
- TQPoint m_undockPositioningOffset;
- bool m_bMaximizedChildFrmMode;
- int m_oldMainFrmHeight;
- int m_oldMainFrmMinHeight;
- int m_oldMainFrmMaxHeight;
- static KMdi::FrameDecor m_frameDecoration;
- bool m_bSDIApplication;
- KDockWidget* m_pDockbaseAreaOfDocumentViews;
- TQDomDocument* m_pTempDockSession;
- bool m_bClearingOfWindowMenuBlocked;
-
- TQTimer* m_pDragEndTimer;
-
- bool m_bSwitching;
-
- KDockWidget* m_leftContainer;
- KDockWidget* m_rightContainer;
- KDockWidget* m_topContainer;
- KDockWidget* m_bottomContainer;
-
-
-private:
- KMdiMainFrmPrivate* d;
- KMDIPrivate::KMDIGUIClient* m_mdiGUIClient;
- bool m_managedDockPositionMode;
-
- // methods
-public:
-#ifdef qdoc
- KMdiMainFrm( TQWidget* parentWidget, const char* name = "", KMdi::MdiMode mdiMode = KMdi::ChildframeMode, WFlags flags = WType_TopLevel | WDestructiveClose );
-#else
- KMdiMainFrm( TQWidget* parentWidget, const char* name = "", KMdi::MdiMode mdiMode = KMdi::ChildframeMode, WFlags flags = (WFlags)(WType_TopLevel | WDestructiveClose) );
-#endif
- virtual ~KMdiMainFrm();
-
- /**
- * Control whether or not the standard MDI menu is displayed
- * when a context menu is displayed
- */
- void setStandardMDIMenuEnabled( bool showModeMenu = true );
-
- void setManagedDockPositionModeEnabled( bool enabled );
-
- /**
- * Returns whether the application's MDI views are in maximized state or not.
- */
- bool isInMaximizedChildFrmMode() { return m_bMaximizedChildFrmMode; }
-
- /**
- * Returns the MDI mode. This can be one of the enumerations KMdi::MdiMode.
- */
- KMdi::MdiMode mdiMode() { return m_mdiMode; }
-
- /**
- * Returns the focused attached MDI view.
- */
- KMdiChildView* activeWindow();
-
- /**
- * Returns a popup menu filled according to the MDI view state. You can override this
- * method to insert additional entries there. The popup menu is usually popuped when the user
- * clicks with the right mouse button on a taskbar entry. The default entries are:
- * Undock/Dock, Restore/Maximize/Minimize, Close and an empty sub-popup ( windowPopup() )
- * menu called Operations.
- */
- virtual TQPopupMenu * taskBarPopup( KMdiChildView *pWnd, bool bIncludeWindowPopup = false );
-
- /**
- * Returns a popup menu with only a title "Window". You can fill it with own operations entries
- * on the MDI view. This popup menu is inserted as last menu item in taskBarPopup() .
- */
- virtual TQPopupMenu * windowPopup( KMdiChildView *pWnd, bool bIncludeTaskbarPopup = true );
-
- /**
- * Called in the constructor (forces a resize of all MDI views)
- */
- virtual void applyOptions();
-
- /**
- * Returns the KMdiChildView belonging to the given caption string.
- */
- KMdiChildView * findWindow( const TQString& caption );
-
- enum ExistsAs {DocumentView, ToolView, AnyView};
- /**
- * Returns whether this MDI child view is under MDI control (using addWindow() ) or not.
- */
- bool windowExists( KMdiChildView *pWnd, ExistsAs as );
-
- /**
- * Catches certain Qt events and processes it here.
- * Currently, here this catches only the KMdiViewCloseEvent (a KMdi user event) which is sent
- * from itself in childWindowCloseRequest() right after a KMdiChildView::closeEvent() .
- * The reason for this event to itself is simple: It just wants to break the function call stack.
- * It continues the processing with calling closeWindow() .
- * You see, a close() is translated to a closeWindow() .
- * It is necessary that the main frame has to start an MDI view close action because it must
- * remove the MDI view from MDI control, additionally.
- *
- * This method calls TQMainWindow::event , additionally.
- */
- virtual bool event( TQEvent* e );
-
- /**
- * If there's a main menubar given, it will create the 4 maximize mode buttons there (undock, minimize, restore, close).
- */
- virtual void setSysButtonsAtMenuPosition();
-
- /**
- * Returns the height of the taskbar.
- */
- virtual int taskBarHeight() { return m_pTaskBar ? m_pTaskBar->height() : 0; }
-
- /**
- * Sets an offset value that is used on detachWindow() . The undocked window
- * is visually moved on the desktop by this offset.
- */
- virtual void setUndockPositioningOffset( TQPoint offset ) { m_undockPositioningOffset = offset; }
-
- /**
- * If you don't want to know about the inner structure of the KMdi system, you can use
- * this iterator to handle with the MDI view list in a more abstract way.
- * The iterator hides what special data structure is used in KMdi.
- * The caller must delete the iterator once he does not need it anymore.
- */
- // FIXME And what exactly are we supposed to fix? -mattr
- KMdiIterator<KMdiChildView*>* createIterator()
- {
- if ( m_pDocumentViews == 0L )
- {
- return new KMdiNullIterator<KMdiChildView*>();
- }
- else
- {
- return new KMdiListIterator<KMdiChildView>( *m_pDocumentViews );
- }
- }
-
- /**
- * Deletes an KMdiIterator created in the KMdi library (needed for the windows dll problem).
- */
- void deleteIterator( KMdiIterator<KMdiChildView*>* pIt )
- {
- delete pIt;
- }
-
- /**
- * Returns a popup menu that contains the MDI controlled view list.
- * Additionally, this menu provides some placing actions for these views.
- * Usually, you insert this popup menu in your main menubar as "Window" menu.
- */
- TQPopupMenu* windowMenu() const { return m_pWindowMenu; };
-
- /**
- * Sets a background color for the MDI view area widget.
- */
- virtual void setBackgroundColor( const TQColor &c ) { m_pMdi->setBackgroundColor( c ); }
-
- /**
- * Sets a background pixmap for the MDI view area widget.
- */
- virtual void setBackgroundPixmap( const TQPixmap &pm ) { m_pMdi->setBackgroundPixmap( pm ); }
-
- /**
- * Sets a size that is used as the default size for a newly to the MDI system added KMdiChildView .
- * By default this size is 600x400. So all non-resized added MDI views appear in that size.
- */
- void setDefaultChildFrmSize( const TQSize& sz ) { m_pMdi->m_defaultChildFrmSize = sz; }
-
- /**
- * Returns the default size for a newly added KMdiChildView. See setDefaultChildFrmSize() .
- */
- TQSize defaultChildFrmSize() { return m_pMdi->m_defaultChildFrmSize; }
-
- /**
- * Do nothing when in Toplevel mode
- */
- virtual void setMinimumSize( int minw, int minh );
-
- /**
- * Returns the Childframe mode height of this. Makes only sense when in Toplevel mode.
- */
- int childFrameModeHeight() { return m_oldMainFrmHeight; };
- /**
- * Tells the MDI system a QMenu where it can insert buttons for
- * the system menu, undock, minimize, restore actions.
- * If no such menu is given, KMdi simply overlays the buttons
- * at the upper right-hand side of the main widget.
- */
- virtual void setMenuForSDIModeSysButtons( KMenuBar* menuBar = 0 );
-
- /**
- * @return the decoration of the window frame of docked (attached) MDI views
- */
- static int frameDecorOfAttachedViews() { return m_frameDecoration; }
-
- /**
- * An SDI application user interface is faked:
- * @li an opened view is always maximized
- * @li buttons for maximized childframe mode aren't inserted in the main menubar
- * @li taskbar and windowmenu are not created/updated
- */
- void fakeSDIApplication();
-
- /**
- * @returns if we are faking an SDI application (fakeSDIApplication())
- */
- bool isFakingSDIApplication() const { return m_bSDIApplication; }
-
- virtual bool eventFilter( TQObject *obj, TQEvent *e );
- void findRootDockWidgets( TQPtrList<KDockWidget>* pRootDockWidgetList, TQValueList<TQRect>* pPositionList );
-
- /** We're switching something.*/
- void setSwitching( const bool switching ) { m_bSwitching = switching; }
- bool switching( void ) const { return m_bSwitching; }
-
-public slots:
- /**
- * addWindow demands a KMdiChildView. This method wraps every TQWidget in such an object and
- * this way you can put every widget under MDI control.
- */
- KMdiChildView* createWrapper( TQWidget *view, const TQString& name, const TQString& shortName );
-
- /**
- * Adds a KMdiChildView to the MDI system. The main frame takes control of it.
- * \param pWnd the parent view.
- * \param flags the flags for the view such as:
- * \li whether the view should be attached or detached.
- * \li whether the view should be shown or hidden
- * \li whether the view should be maximized, minimized or restored (normalized)
- * \li whether the view should be added as tool view (stay-on-top and toplevel) or added as document-type view.
- */
- virtual void addWindow( KMdiChildView* pWnd, int flags = KMdi::StandardAdd );
-
- //KDE4: merge the two methods
- /**
- * Adds a KMdiChildView to the MDI system. The main frame takes control of it.
- * \param pWnd the parent view.
- * \param flags
- * You can specify here whether:
- * \li the view should be attached or detached.
- * \li shown or hidden
- * \li maximized, minimized or restored (normalized)
- * \li added as tool view (stay-on-top and toplevel) or added as
- * document-type view.
- * \param index the index of the tab we should insert the new tab after.
- * If index == -1 then the tab will just be appended to the end.
- * Using this parameter in childview mode has no effect.
- * \since 3.3
- */
- void addWindow( KMdiChildView* pWnd, int flags, int index );
-
- /**
- * Adds a KMdiChildView to the MDI system. The main frame takes control of it.
- * \param pWnd the parent view.
- * \param pos move the child view to the specified position
- * \param flags the flags for the view such as:
- * \li whether the view should be attached or detached.
- * \li whether the view should be shown or hidden
- * \li whether the view should be maximized, minimized or restored (normalized)
- * \li whether the view should be added as tool view (stay-on-top and toplevel) or
- * added as document-type view.
- */
- virtual void addWindow( KMdiChildView* pWnd, TQPoint pos, int flags = KMdi::StandardAdd );
-
- /**
- * Adds a KMdiChildView to the MDI system. The main frame takes control of it.
- * \param pWnd the parent view.
- * \param rectNormal Sets the geometry for this child view
- * \param flags the flags for the view such as:
- * \li whether the view should be attached or detached.
- * \li whether the view should be shown or hidden
- * \li whether the view should be maximized, minimized or restored (normalized)
- * \li whether the view should be added as tool view (stay-on-top and toplevel) or
- * added as document-type view.
- */
- virtual void addWindow( KMdiChildView* pWnd, TQRect rectNormal, int flags = KMdi::StandardAdd );
-
- /**
- * Usually called from addWindow() when adding a tool view window. It reparents the given widget
- * as toplevel and stay-on-top on the application's main widget.
- */
- virtual KMdiToolViewAccessor *addToolWindow( TQWidget* pWnd, KDockWidget::DockPosition pos = KDockWidget::DockNone,
- TQWidget* pTargetWnd = 0L, int percent = 50, const TQString& tabToolTip = 0,
- const TQString& tabCaption = 0 );
-
- virtual void deleteToolWindow( TQWidget* pWnd );
- virtual void deleteToolWindow( KMdiToolViewAccessor *accessor );
-
- /**
- * Using this method you have to use the setWidget method of the access object, and it is very recommendet, that you use
- * the widgetContainer() method for the parent of your newly created widget
- */
- KMdiToolViewAccessor *createToolWindow();
-
- /**
- * Removes a KMdiChildView from the MDI system and from the main frame`s control.
- * The caller is responsible for deleting the view. If the view is not deleted it will
- * be reparented to 0
- */
- virtual void removeWindowFromMdi( KMdiChildView *pWnd );
-
- /**
- * Removes a KMdiChildView from the MDI system and from the main frame`s control.
- * Note: The view will be deleted!
- */
- virtual void closeWindow( KMdiChildView *pWnd, bool layoutTaskBar = true );
-
- /**
- * Switches the KMdiTaskBar on and off.
- */
- virtual void slot_toggleTaskBar();
-
- /**
- * Makes a main frame controlled undocked KMdiChildView docked.
- * Doesn't work on KMdiChildView which aren't added to the MDI system.
- * Use addWindow() for that.
- */
- virtual void attachWindow( KMdiChildView *pWnd, bool bShow = true, bool bAutomaticResize = false );
-
- /**
- * Makes a docked KMdiChildView undocked.
- * The view window still remains under the main frame's MDI control.
- */
- virtual void detachWindow( KMdiChildView *pWnd, bool bShow = true );
-
- /**
- * Someone wants that the MDI view to be closed. This method sends a KMdiViewCloseEvent to itself
- * to break the function call stack. See also event() .
- */
- virtual void childWindowCloseRequest( KMdiChildView *pWnd );
-
- /**
- * Close all views
- */
- virtual void closeAllViews();
-
- /**
- * Iconfiy all views
- */
- virtual void iconifyAllViews();
-
- /**
- * Closes the view of the active (topchild) window
- */
- virtual void closeActiveView();
-
- /**
- * Undocks all view windows (unix-like)
- */
- virtual void switchToToplevelMode();
- virtual void finishToplevelMode();
-
- /**
- * Docks all view windows (Windows-like)
- */
- virtual void switchToChildframeMode();
- virtual void finishChildframeMode();
-
- /**
- * Docks all view windows (Windows-like)
- */
- virtual void switchToTabPageMode();
- virtual void finishTabPageMode();
-
- /**
- * Docks all view windows. Toolviews use dockcontainers
- */
- virtual void switchToIDEAlMode();
- virtual void finishIDEAlMode( bool full = true );
-
- /**
- * Sets the appearance of the IDEAl mode. See KMultiTabBar styles for the first 3 bits.
- * @deprecated use setToolviewStyle(int flags) instead
- */
- void setIDEAlModeStyle( int flags ) KDE_DEPRECATED;
- //KDE4: Get rid of the above.
- /**
- * Sets the appearance of the toolview tabs.
- * @param flags See KMdi::ToolviewStyle.
- * @since 3.3
- */
- void setToolviewStyle( int flags );
- /**
- * @return if the view taskbar should be shown if there are MDI views
- */
- bool isViewTaskBarOn();
-
- /**
- * Shows the view taskbar. This should be connected with your "View" menu.
- */
- virtual void showViewTaskBar();
-
- /**
- * Hides the view taskbar. This should be connected with your "View" menu.
- */
- virtual void hideViewTaskBar();
-
- /**
- * Update of the window menu contents.
- */
- virtual void fillWindowMenu();
-
- /**
- * Cascades the windows without resizing them.
- */
- virtual void cascadeWindows() { m_pMdi->cascadeWindows(); }
-
- /**
- * Cascades the windows resizing them to the maximum available size.
- */
- virtual void cascadeMaximized() { m_pMdi->cascadeMaximized(); }
-
- /**
- * Maximizes only in vertical direction.
- */
- virtual void expandVertical() { m_pMdi->expandVertical(); }
-
- /**
- * Maximizes only in horizontal direction.
- */
- virtual void expandHorizontal() { m_pMdi->expandHorizontal(); }
-
- /**
- * Tile Pragma
- */
- virtual void tilePragma() { m_pMdi->tilePragma(); }
-
- /**
- * Tile Anodine
- */
- virtual void tileAnodine() { m_pMdi->tileAnodine(); }
-
- /**
- * Tile Vertically
- */
- virtual void tileVertically() { m_pMdi->tileVertically(); }
-
- /**
- * Sets the decoration of the window frame of docked (attached) MDI views
- * @deprecated Will be removed in KDE 4
- */
- virtual void setFrameDecorOfAttachedViews( int frameDecor );
-
- /**
- * If in Childframe mode, we can switch between maximized or restored shown MDI views
- */
- virtual void setEnableMaximizedChildFrmMode( bool bEnable );
-
- /**
- * Activates the next open view
- */
- virtual void activateNextWin();
-
- /**
- * Activates the previous open view
- */
- virtual void activatePrevWin();
-
- /**
- * Activates the view first viewed concerning to the access time.
- */
- virtual void activateFirstWin();
-
- /**
- * Activates the view last viewed concerning to the access time.
- */
- virtual void activateLastWin();
-
- /**
- * Activates the view with the tab page index (TabPage mode only)
- */
- virtual void activateView( int index );
-
-private:
- void setupToolViewsForIDEALMode();
- void setupTabbedDocumentViewSpace();
- class KMdiDocumentViewTabWidget * m_documentTabWidget;
-
-protected:
-
- virtual void resizeEvent( TQResizeEvent * );
-
- /**
- * Creates a new MDI taskbar (showing the MDI views as taskbar entries) and shows it.
- */
- virtual void createTaskBar();
-
- /**
- * Creates the MDI view area and connects some signals and slots with the KMdiMainFrm widget.
- */
- virtual void createMdiManager();
-
- /**
- * prevents fillWindowMenu() from m_pWindowMenu->clear(). You have to care for it by yourself.
- * This is useful if you want to add some actions in your overridden fillWindowMenu() method.
- */
- void blockClearingOfWindowMenu( bool bBlocked ) { m_bClearingOfWindowMenuBlocked = bBlocked; }
-
- void findToolViewsDockedToMain( TQPtrList<KDockWidget>* list, KDockWidget::DockPosition dprtmw );
- void dockToolViewsIntoContainers( TQPtrList<KDockWidget>& widgetsToReparent, KDockWidget *container );
- TQStringList prepareIdealToTabs( KDockWidget* container );
- void idealToolViewsToStandardTabs( TQStringList widgetNames, KDockWidget::DockPosition pos, int sizee );
-
- /** Get tabwidget visibility */
- KMdi::TabWidgetVisibility tabWidgetVisibility();
-
- /** Set tabwidget visibility */
- void setTabWidgetVisibility( KMdi::TabWidgetVisibility );
-
- /** Returns the tabwidget used in IDEAl and Tabbed modes. Returns 0 in other modes. */
- class KTabWidget * tabWidget() const;
-
-
-protected slots: // Protected slots
- /**
- * Sets the focus to this MDI view, raises it, activates its taskbar button and updates
- * the system buttons in the main menubar when in maximized (Maximize mode).
- */
- virtual void activateView( KMdiChildView *pWnd );
-
- /**
- * Activates the MDI view (see activateView() ) and popups the taskBar popup menu (see taskBarPopup() ).
- */
- virtual void taskbarButtonRightClicked( KMdiChildView *pWnd );
-
- /**
- * Turns the system buttons for maximize mode (SDI mode) off, and disconnects them
- */
- void switchOffMaximizeModeForMenu( KMdiChildFrm* oldChild );
-
- /**
- * Reconnects the system buttons form maximize mode (SDI mode) with the new child frame
- */
- void updateSysButtonConnections( KMdiChildFrm* oldChild, KMdiChildFrm* newChild );
-
- /**
- * Usually called when the user clicks an MDI view item in the "Window" menu.
- */
- void windowMenuItemActivated( int id );
-
- /**
- * Usually called when the user clicks an MDI view item in the sub-popup menu "Docking" of the "Window" menu.
- */
- void dockMenuItemActivated( int id );
-
- /**
- * Popups the "Window" menu. See also windowPopup() .
- */
- void popupWindowMenu( TQPoint p );
-
- /**
- * The timer for main widget moving has elapsed -> send drag end to all concerned views.
- */
- void dragEndTimeOut();
-
- /**
- * internally used to handle click on view close button (TabPage mode, only)
- */
- void closeViewButtonPressed();
-
-signals:
- /**
- * Signals the last attached KMdiChildView has been closed
- */
- void lastChildFrmClosed();
-
- /**
- * Signals the last KMdiChildView (that is under MDI control) has been closed
- */
- void lastChildViewClosed();
-
- /**
- * Signals that the Toplevel mode has been left
- */
- void leftTopLevelMode();
-
- /**
- * Signals that a child view has been detached (undocked to desktop)
- */
- void childViewIsDetachedNow( TQWidget* );
-
- /** Signals we need to collapse the overlapped containers */
- void collapseOverlapContainers();
-
- /** Signals the MDI mode has been changed */
- void mdiModeHasBeenChangedTo( KMdi::MdiMode );
-
- void viewActivated( KMdiChildView* );
- void viewDeactivated( KMdiChildView* );
-
-public slots:
- void prevToolViewInDock();
- void nextToolViewInDock();
-
-private slots:
- void setActiveToolDock( KMdiDockContainer* );
- void removeFromActiveDockList( KMdiDockContainer* );
- void slotDocCurrentChanged( TQWidget* );
- void verifyToplevelHeight();
-#define protected public
-signals:
-#undef protected
-
- void toggleTop();
- void toggleLeft();
- void toggleRight();
- void toggleBottom();
-};
-
-#endif //_KMDIMAINFRM_H_
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmdinulliterator.h b/kmdi/kmdinulliterator.h
deleted file mode 100644
index ffa375d36..000000000
--- a/kmdi/kmdinulliterator.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmdinulliterator.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 02/2000 by Massimo Morin
-// changes : 02/2000 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Massimo Morin (mmorin@schedsys.com)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDINULLITERATOR_H_
-#define _KMDINULLITERATOR_H_
-
-#include "kmdiiterator.h"
-
-template <class Item>
-class KMdiNullIterator : public KMdiIterator<Item> {
-public:
- KMdiNullIterator() {};
- virtual void first() {}
- virtual void last() {}
- virtual void next() {}
- virtual void prev() {}
- virtual bool isDone() const { return true; }
- virtual Item currentItem() const {
- /* should really never go inside here */
- return 0;
- }
-};
-
-#endif // _KMDINULLITERATOR_H_
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmditaskbar.cpp b/kmdi/kmditaskbar.cpp
deleted file mode 100644
index 018e2b38e..000000000
--- a/kmdi/kmditaskbar.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmditaskbar.cpp
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-// patches : 02/2000 by Massimo Morin (mmorin@schedsys.com)
-//
-// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifdef None
-#undef None
-#endif
-
-#include "kmditaskbar.h"
-#include "kmditaskbar.moc"
-
-#include "kmdimainfrm.h"
-#include "kmdichildview.h"
-#include "kmdidefines.h"
-
-#include <tqtooltip.h>
-#include <tqlabel.h>
-#include <tqwidget.h>
-#include <tqstyle.h>
-
-#include <tqnamespace.h>
-
-/*
- @quickhelp: KMdiTaskBar
- @widget: Taskbar
- This window lists the currently open windows.<br>
- Each button corresponds to a single MDI (child) window.<br>
- The button is enabled (clickable) when the window is docked , and can be
- pressed to bring it to the top of the other docked windows.<br>
- The button text becomes red when new output is shown in the window and it is not the active one.<br>
-*/
-
-//####################################################################
-//
-// KMdiTaskBarButton
-//
-//####################################################################
-KMdiTaskBarButton::KMdiTaskBarButton( KMdiTaskBar *pTaskBar, KMdiChildView *win_ptr )
- : TQPushButton( pTaskBar ),
- m_actualText( "" )
-{
- setToggleButton( true );
- m_pWindow = win_ptr;
- TQToolTip::add
- ( this, win_ptr->caption() );
- setFocusPolicy( TQ_NoFocus );
-}
-
-KMdiTaskBarButton::~KMdiTaskBarButton()
-{}
-
-void KMdiTaskBarButton::mousePressEvent( TQMouseEvent* e )
-{
- switch ( e->button() )
- {
- case Qt::LeftButton:
- emit leftMouseButtonClicked( m_pWindow );
- break;
- case Qt::RightButton:
- emit rightMouseButtonClicked( m_pWindow );
- break;
- default:
- break;
- }
- emit clicked( m_pWindow );
-}
-
-/** slot version of setText */
-void KMdiTaskBarButton::setNewText( const TQString& s )
-{
- setText( s );
- emit buttonTextChanged( 0 );
-}
-
-void KMdiTaskBarButton::setText( const TQString& s )
-{
- m_actualText = s;
- TQButton::setText( s );
-}
-
-void KMdiTaskBarButton::fitText( const TQString& origStr, int newWidth )
-{
- TQButton::setText( m_actualText );
-
- int actualWidth = sizeHint().width();
- int realLetterCount = origStr.length();
- int newLetterCount = ( newWidth * realLetterCount ) / actualWidth;
- int w = newWidth + 1;
- TQString s = origStr;
- while ( ( w > newWidth ) && ( newLetterCount >= 1 ) )
- {
- if ( newLetterCount < realLetterCount )
- {
- if ( newLetterCount > 3 )
- s = origStr.left( newLetterCount / 2 ) + "..." + origStr.right( newLetterCount / 2 );
- else
- {
- if ( newLetterCount > 1 )
- s = origStr.left( newLetterCount ) + "..";
- else
- s = origStr.left( 1 );
- }
- }
- TQFontMetrics fm = fontMetrics();
- w = fm.width( s );
- newLetterCount--;
- }
-
- TQButton::setText( s );
-}
-
-TQString KMdiTaskBarButton::actualText() const
-{
- return m_actualText;
-}
-
-//####################################################################
-//
-// KMdiTaskBar
-//
-//####################################################################
-
-KMdiTaskBar::KMdiTaskBar( KMdiMainFrm *parent, TQMainWindow::ToolBarDock dock )
- : KToolBar( parent, "KMdiTaskBar", /*honor_style*/ false, /*readConfig*/ true )
- , m_pCurrentFocusedWindow( 0 )
- , m_pStretchSpace( 0 )
- , m_layoutIsPending( false )
- , m_bSwitchedOn( false )
-{
- m_pFrm = parent;
- m_pButtonList = new TQPtrList<KMdiTaskBarButton>;
- m_pButtonList->setAutoDelete( true );
- //QT30 setFontPropagation(TQWidget::SameFont);
- setMinimumWidth( 1 );
- setFocusPolicy( TQ_NoFocus );
- parent->moveToolBar( this, dock ); //XXX obsolete!
-}
-
-KMdiTaskBar::~KMdiTaskBar()
-{
- delete m_pButtonList;
-}
-
-KMdiTaskBarButton * KMdiTaskBar::addWinButton( KMdiChildView *win_ptr )
-{
- if ( m_pStretchSpace )
- {
- delete m_pStretchSpace;
- m_pStretchSpace = 0L;
- setStretchableWidget( 0L );
- }
-
- KMdiTaskBarButton *b = new KMdiTaskBarButton( this, win_ptr );
- TQObject::connect( b, TQT_SIGNAL( clicked() ), win_ptr, TQT_SLOT( setFocus() ) );
- TQObject::connect( b, TQT_SIGNAL( clicked( KMdiChildView* ) ), this, TQT_SLOT( setActiveButton( KMdiChildView* ) ) );
- TQObject::connect( b, TQT_SIGNAL( leftMouseButtonClicked( KMdiChildView* ) ), m_pFrm, TQT_SLOT( activateView( KMdiChildView* ) ) );
- TQObject::connect( b, TQT_SIGNAL( rightMouseButtonClicked( KMdiChildView* ) ), m_pFrm, TQT_SLOT( taskbarButtonRightClicked( KMdiChildView* ) ) );
- TQObject::connect( b, TQT_SIGNAL( buttonTextChanged( int ) ), this, TQT_SLOT( layoutTaskBar( int ) ) );
- m_pButtonList->append( b );
- b->setToggleButton( true );
- b->setText( win_ptr->tabCaption() );
-
- layoutTaskBar();
-
- m_pStretchSpace = new TQLabel( this, "empty" );
- m_pStretchSpace->setText( "" );
- setStretchableWidget( m_pStretchSpace );
- m_pStretchSpace->show();
-
- if ( m_bSwitchedOn )
- {
- b->show();
- show();
- }
- return b;
-}
-
-void KMdiTaskBar::removeWinButton( KMdiChildView *win_ptr, bool haveToLayoutTaskBar )
-{
- KMdiTaskBarButton * b = getButton( win_ptr );
- if ( b )
- {
- m_pButtonList->removeRef( b );
- if ( haveToLayoutTaskBar )
- layoutTaskBar();
- }
- if ( m_pButtonList->count() == 0 )
- {
- if ( m_pStretchSpace != 0L )
- {
- delete m_pStretchSpace;
- m_pStretchSpace = 0L;
- hide();
- }
- }
-}
-
-void KMdiTaskBar::switchOn( bool bOn )
-{
- m_bSwitchedOn = bOn;
- if ( !bOn )
- {
- hide();
- }
- else
- {
- if ( m_pButtonList->count() > 0 )
- {
- show();
- }
- else
- {
- hide();
- }
- }
-}
-
-KMdiTaskBarButton * KMdiTaskBar::getButton( KMdiChildView *win_ptr )
-{
- for ( KMdiTaskBarButton * b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- if ( b->m_pWindow == win_ptr )
- return b;
- }
- return 0;
-}
-
-KMdiTaskBarButton * KMdiTaskBar::getNextWindowButton( bool bRight, KMdiChildView *win_ptr )
-{
- if ( bRight )
- {
- for ( KMdiTaskBarButton * b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- if ( b->m_pWindow == win_ptr )
- {
- b = m_pButtonList->next();
- if ( !b )
- b = m_pButtonList->first();
- if ( win_ptr != b->m_pWindow )
- return b;
- else
- return 0;
- }
- }
- }
- else
- {
- for ( KMdiTaskBarButton * b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- if ( b->m_pWindow == win_ptr )
- {
- b = m_pButtonList->prev();
- if ( !b )
- b = m_pButtonList->last();
- if ( win_ptr != b->m_pWindow )
- return b;
- else
- return 0;
- }
- }
- }
- return 0;
-}
-
-void KMdiTaskBar::setActiveButton( KMdiChildView *win_ptr )
-{
- KMdiTaskBarButton * newPressedButton = 0L;
- KMdiTaskBarButton* oldPressedButton = 0L;
- for ( KMdiTaskBarButton * b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- if ( b->m_pWindow == win_ptr )
- newPressedButton = b;
- if ( b->m_pWindow == m_pCurrentFocusedWindow )
- oldPressedButton = b;
- }
-
- if ( newPressedButton != 0L && newPressedButton != oldPressedButton )
- {
- if ( oldPressedButton != 0L )
- oldPressedButton->toggle(); // switch off
- newPressedButton->toggle(); // switch on
- m_pCurrentFocusedWindow = win_ptr;
- }
-}
-
-void KMdiTaskBar::layoutTaskBar( int taskBarWidth )
-{
- if ( m_layoutIsPending )
- return ;
- m_layoutIsPending = true;
-
- if ( !taskBarWidth )
- // no width is given
- taskBarWidth = width();
-
- // calculate current width of all taskbar buttons
- int allButtonsWidth = 0;
- KMdiTaskBarButton *b = 0;
- for ( b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- allButtonsWidth += b->width();
- }
-
- // calculate actual width of all taskbar buttons
- int allButtonsWidthHint = 0;
- for ( b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- TQFontMetrics fm = b->fontMetrics();
- TQString s = b->actualText();
- TQSize sz = fm.size( ShowPrefix, s );
- int w = sz.width() + 6;
- int h = sz.height() + sz.height() / 8 + 10;
- w += h;
- allButtonsWidthHint += w;
- }
-
- // if there's enough space, use actual width
- int buttonCount = m_pButtonList->count();
- int tbHandlePixel;
- tbHandlePixel = style().pixelMetric( TQStyle::PM_DockWindowHandleExtent, this );
- int buttonAreaWidth = taskBarWidth - tbHandlePixel - style().pixelMetric( TQStyle::PM_DefaultFrameWidth, this ) - 5;
- if ( ( ( allButtonsWidthHint ) <= buttonAreaWidth ) || ( width() < parentWidget() ->width() ) )
- {
- for ( b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- b->setText( b->actualText() );
- if ( b->width() != b->sizeHint().width() )
- {
- b->setFixedWidth( b->sizeHint().width() );
- b->show();
- }
- }
- }
- else
- {
- // too many buttons for actual width
- int newButtonWidth;
- if ( buttonCount != 0 )
- newButtonWidth = buttonAreaWidth / buttonCount;
- else
- newButtonWidth = 0;
- if ( orientation() == Qt::Vertical )
- newButtonWidth = 80;
- if ( newButtonWidth > 0 )
- for ( b = m_pButtonList->first();b;b = m_pButtonList->next() )
- {
- b->fitText( b->actualText(), newButtonWidth );
- if ( b->width() != newButtonWidth )
- {
- b->setFixedWidth( newButtonWidth );
- b->show();
- }
- }
- }
- m_layoutIsPending = false;
-}
-
-void KMdiTaskBar::resizeEvent( TQResizeEvent* rse )
-{
- if ( !m_layoutIsPending )
- {
- if ( m_pButtonList->count() != 0 )
- {
- layoutTaskBar( rse->size().width() );
- }
- }
- KToolBar::resizeEvent( rse );
-}
-
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
diff --git a/kmdi/kmditaskbar.h b/kmdi/kmditaskbar.h
deleted file mode 100644
index 35393b733..000000000
--- a/kmdi/kmditaskbar.h
+++ /dev/null
@@ -1,219 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmditaskbar.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// - 06/2000 stand-alone Qt extension set of
-// classes and a Qt-based library
-// 2000-2003 maintained by the KDevelop project
-//
-// copyright : (C) 1999-2003 by Falk Brettschneider
-// and
-// Szymon Stefanek (stefanek@tin.it)
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef _KMDITASKBAR_H_
-#define _KMDITASKBAR_H_
-
-#include <ktoolbar.h>
-#include <tqptrlist.h>
-#include <tqpixmap.h>
-#include <tqlabel.h>
-#include <tqpushbutton.h>
-
-#include "kmdidefines.h"
-
-class KMdiMainFrm;
-class KMdiChildView;
-class KMdiTaskBar;
-
-class KMdiTaskBarButtonPrivate;
-
-/**
- * @short Internal class.
- *
- * It's a special kind of TQPushButton catching mouse clicks.
- * And you have the ability to abbreviate the text that it fits in the button.
- */
-class KMDI_EXPORT KMdiTaskBarButton : public TQPushButton
-{
- Q_OBJECT
- // methods
-public:
- /**
- * Constructor (sets to toggle button, adds a tooltip (caption) and sets to NoFocus
- */
- KMdiTaskBarButton( KMdiTaskBar *pTaskBar, KMdiChildView *win_ptr );
- /**
- * Destructor
- */
- ~KMdiTaskBarButton();
- /**
- * text() returns the possibly abbreviated text including the dots in it. But actualText() returns the full text.
- */
- TQString actualText() const;
- /**
- * Given the parameter newWidth this function possibly abbreviates the parameter string and sets a new button text.
- */
- void fitText( const TQString&, int newWidth );
- /**
- * Sets the text and avoids any abbreviation. Memorizes that text in m_actualText, too.
- */
- void setText( const TQString& );
-signals:
- /**
- * Emitted when the button has been clicked. Internally connected to setFocus of the according MDI view.
- */
- void clicked( KMdiChildView* );
- /**
- * Internally connected with KMdiMainFrm::activateView
- */
- void leftMouseButtonClicked( KMdiChildView* );
- /**
- * Internally connected with KMdiMainFrm::taskbarButtonRightClicked
- */
- void rightMouseButtonClicked( KMdiChildView* );
- /**
- * Emitted when the button text has changed. Internally connected with KMdiTaskBar::layoutTaskBar
- */
- void buttonTextChanged( int );
-public slots:
- /**
- * A slot version of setText
- */
- void setNewText( const TQString& );
-protected slots:
- /**
- * Reimplemented from its base class to catch right and left mouse button clicks
- */
- void mousePressEvent( TQMouseEvent* );
-
- // attributes
-public:
- /**
- * The according MDI view
- */
- KMdiChildView *m_pWindow;
-protected:
- /**
- * Internally we must remember the real text because the button text can be abbreviated.
- */
- TQString m_actualText;
-
-private:
- KMdiTaskBarButtonPrivate *d;
-};
-
-
-class KMdiTaskBarPrivate;
-/**
- * @short Internal class.
- *
- * It's a special kind of TQToolBar that acts as taskbar for child views.
- * KMdiTaskBarButtons can be added or removed dynamically.<br>
- * The button sizes are adjusted dynamically, as well.
- */
-class KMDI_EXPORT KMdiTaskBar : public KToolBar
-{
- Q_OBJECT
-public:
- /**
- * Constructor (NoFocus, minimum width = 1, an internal TQPtrList of taskbar buttons (autodelete))
- */
- KMdiTaskBar( KMdiMainFrm *parent, TQMainWindow::ToolBarDock dock );
- /**
- * Destructor (deletes the taskbar button list)
- */
- ~KMdiTaskBar();
- /**
- *Add a new KMdiTaskBarButton . The width doesn't change.
- * If there's not enough space, all taskbar buttons will be resized to a new smaller size.
- * Probably button texts must be abbreviated now.
- */
- KMdiTaskBarButton * addWinButton( KMdiChildView *win_ptr );
- /**
- * Removes a KMdiTaskBarButton and deletes it. If the rest of the buttons are smaller
- * than they usually are, all those buttons will be resized in a way that the new free size is used as well.
- */
- void removeWinButton( KMdiChildView *win_ptr, bool haveToLayoutTaskBar = true );
- /**
- * Returns the neighbor taskbar button of the taskbar button of the MDI view given by parameter
- * bRight specifies the side, of course left is used if bRight is false.
- */
- KMdiTaskBarButton * getNextWindowButton( bool bRight, KMdiChildView *win_ptr );
- /**
- * Get the button belonging to the MDI view given as parameter.
- */
- KMdiTaskBarButton * getButton( KMdiChildView *win_ptr );
- /**
- * Switch it on or off.
- */
- void switchOn( bool bOn );
- /**
- * @return whether switched on or off.
- */
- bool isSwitchedOn() const
- {
- return m_bSwitchedOn;
- };
-protected:
- /**
- * Reimplemented from its base class to call layoutTaskBar, additionally.
- */
- void resizeEvent( TQResizeEvent* );
-protected slots:
- /**
- * Checks if all buttons fits into this. If not, it recalculates all button widths
- * in a way that all buttons fits into the taskbar and have got equal width.
- * The text of the buttons will be abbreviated when nessecary, all buttons get a
- * fixed width and show() is called for each one.
- * If one drags the taskbar to a vertical orientation, the button width is set to 80 pixel.
- */
- void layoutTaskBar( int taskBarWidth = 0 );
-public slots:
- /**
- * Pushes the desired taskbar button down (switch on), the old one is released (switched off).
- * Actually it's a radiobutton group behavior.
- */
- void setActiveButton( KMdiChildView *win_ptr );
-protected:
- /**
- * A list of taskbar buttons.
- * Note: Each button stands for one MDI view (toolviews doesn't have got a taskbar button).
- */
- TQPtrList<KMdiTaskBarButton>* m_pButtonList;
- /**
- * The belonging MDI mainframe (parent widget of this)
- */
- KMdiMainFrm* m_pFrm;
- /**
- * The MDI view belonging to the currently pressed taskbar button
- */
- KMdiChildView* m_pCurrentFocusedWindow;
- /**
- * A stretchable widget used as 'space' at the end of a half filled taskbar
- */
- TQLabel* m_pStretchSpace;
- bool m_layoutIsPending;
- bool m_bSwitchedOn;
-
-private:
- KMdiTaskBarPrivate *d;
-};
-
-#endif //_KMDITASKBAR_H_
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmditoolviewaccessor.cpp b/kmdi/kmditoolviewaccessor.cpp
deleted file mode 100644
index c85921a27..000000000
--- a/kmdi/kmditoolviewaccessor.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmditoolviewaccessor.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 08/2003 by Joseph Wenninger (jowenn@kde.org)
-// changes : ---
-// patches : ---
-//
-// copyright : (C) 2003 by Joseph Wenninger (jowenn@kde.org)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef NO_KDE
-# include <kdebug.h>
-#endif
-#include "kmditoolviewaccessor_p.h"
-#include "kmdiguiclient.h"
-#include "kmdimainfrm.h"
-
-#include "kmditoolviewaccessor.h"
-#include "kmditoolviewaccessor_p.h"
-
-KMdiToolViewAccessor::KMdiToolViewAccessor( KMdiMainFrm *parent, TQWidget *widgetToWrap, const TQString& tabToolTip, const TQString& tabCaption )
- : TQObject( parent )
-{
- mdiMainFrm = parent;
- d = new KMdiToolViewAccessorPrivate();
- if ( widgetToWrap->inherits( "KDockWidget" ) )
- {
- d->widgetContainer = tqt_dynamic_cast<KDockWidget*>( widgetToWrap );
- d->widget = d->widgetContainer->getWidget();
- }
- else
- {
- d->widget = widgetToWrap;
- TQString finalTabCaption;
- if ( tabCaption == 0 )
- {
- finalTabCaption = widgetToWrap->caption();
- if ( finalTabCaption.isEmpty() && !widgetToWrap->icon() )
- {
- finalTabCaption = widgetToWrap->name();
- }
- }
- else
- {
- finalTabCaption = tabCaption;
- }
- d->widgetContainer = parent->createDockWidget( widgetToWrap->name(),
- ( widgetToWrap->icon() ? ( *( widgetToWrap->icon() ) ) : TQPixmap() ),
- 0L, // parent
- widgetToWrap->caption(),
- finalTabCaption );
- d->widgetContainer->setWidget( widgetToWrap );
- if ( tabToolTip != 0 )
- {
- d->widgetContainer->setToolTipString( tabToolTip );
- }
- }
- //mdiMainFrm->m_pToolViews->insert(d->widget,this);
- if ( mdiMainFrm->m_mdiGUIClient )
- mdiMainFrm->m_mdiGUIClient->addToolView( this );
- else
- kdDebug( 760 ) << "mdiMainFrm->m_mdiGUIClient == 0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
-
- d->widget->installEventFilter( this );
-}
-
-KMdiToolViewAccessor::KMdiToolViewAccessor( KMdiMainFrm *parent )
-{
- mdiMainFrm = parent;
- d = new KMdiToolViewAccessorPrivate();
-}
-
-KMdiToolViewAccessor::~KMdiToolViewAccessor()
-{
- if ( mdiMainFrm->m_pToolViews )
- mdiMainFrm->m_pToolViews->remove
- ( d->widget );
- delete d;
-
-}
-
-TQWidget *KMdiToolViewAccessor::wrapperWidget()
-{
- if ( !d->widgetContainer )
- {
- d->widgetContainer = mdiMainFrm->createDockWidget( "KMdiToolViewAccessor::null", TQPixmap() );
- connect( d->widgetContainer, TQT_SIGNAL( widgetSet( TQWidget* ) ), this, TQT_SLOT( setWidgetToWrap( TQWidget* ) ) );
- }
- return d->widgetContainer;
-}
-
-TQWidget *KMdiToolViewAccessor::wrappedWidget()
-{
- return d->widget;
-}
-
-
-void KMdiToolViewAccessor::setWidgetToWrap( TQWidget *widgetToWrap, const TQString& tabToolTip, const TQString& tabCaption )
-{
- Q_ASSERT( !( d->widget ) );
- Q_ASSERT( !widgetToWrap->inherits( "KDockWidget" ) );
- disconnect( d->widgetContainer, TQT_SIGNAL( widgetSet( TQWidget* ) ), this, TQT_SLOT( setWidgetToWrap( TQWidget* ) ) );
- delete d->widget;
- d->widget = widgetToWrap;
- KDockWidget *tmp = d->widgetContainer;
-
- TQString finalTabCaption;
- if ( tabCaption == 0 )
- {
- finalTabCaption = widgetToWrap->caption();
- if ( finalTabCaption.isEmpty() && !widgetToWrap->icon() )
- {
- finalTabCaption = widgetToWrap->name();
- }
- }
- else
- {
- finalTabCaption = tabCaption;
- }
-
- if ( !tmp )
- {
- tmp = mdiMainFrm->createDockWidget( widgetToWrap->name(),
- widgetToWrap->icon() ? ( *( widgetToWrap->icon() ) ) : TQPixmap(),
- 0L, // parent
- widgetToWrap->caption(),
- finalTabCaption );
- d->widgetContainer = tmp;
- if ( tabToolTip != 0 )
- {
- d->widgetContainer->setToolTipString( tabToolTip );
- }
- }
- else
- {
- tmp->setCaption( widgetToWrap->caption() );
- tmp->setTabPageLabel( finalTabCaption );
- tmp->setPixmap( widgetToWrap->icon() ? ( *( widgetToWrap->icon() ) ) : TQPixmap() );
- tmp->setName( widgetToWrap->name() );
- if ( tabToolTip != 0 )
- {
- d->widgetContainer->setToolTipString( tabToolTip );
- }
- }
- tmp->setWidget( widgetToWrap );
- mdiMainFrm->m_pToolViews->insert( widgetToWrap, this );
- if ( mdiMainFrm->m_mdiGUIClient )
- mdiMainFrm->m_mdiGUIClient->addToolView( this );
- else
- kdDebug( 760 ) << "mdiMainFrm->m_mdiGUIClient == 0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
-
- d->widget->installEventFilter( this );
-}
-
-
-bool KMdiToolViewAccessor::eventFilter( TQObject *, TQEvent *e )
-{
- if ( e->type() == TQEvent::IconChange )
- {
- d->widgetContainer->setPixmap( d->widget->icon() ? ( *d->widget->icon() ) : TQPixmap() );
- }
- return false;
-}
-
-void KMdiToolViewAccessor::placeAndShow( KDockWidget::DockPosition pos, TQWidget* pTargetWnd , int percent )
-{
- place( pos, pTargetWnd, percent );
- show();
-}
-void KMdiToolViewAccessor::place( KDockWidget::DockPosition pos, TQWidget* pTargetWnd , int percent )
-{
- Q_ASSERT( d->widgetContainer );
- if ( !d->widgetContainer )
- return ;
- if ( pos == KDockWidget::DockNone )
- {
- d->widgetContainer->setEnableDocking( KDockWidget::DockNone );
- d->widgetContainer->reparent( mdiMainFrm, (WFlags)(WType_TopLevel | WType_Dialog), TQPoint( 0, 0 ), true ); //pToolView->isVisible());
- }
- else
- { // add (and dock) the toolview as DockWidget view
-
- KDockWidget* pCover = d->widgetContainer;
-
- KDockWidget* pTargetDock = 0L;
- if ( pTargetWnd->inherits( "KDockWidget" ) || pTargetWnd->inherits( "KDockWidget_Compat::KDockWidget" ) )
- {
- pTargetDock = ( KDockWidget* ) pTargetWnd;
- }
-
- // Should we dock to ourself?
- bool DockToOurself = false;
- if ( mdiMainFrm->m_pDockbaseAreaOfDocumentViews )
- {
- if ( pTargetWnd == mdiMainFrm->m_pDockbaseAreaOfDocumentViews->getWidget() )
- {
- DockToOurself = true;
- pTargetDock = mdiMainFrm->m_pDockbaseAreaOfDocumentViews;
- }
- else if ( pTargetWnd == mdiMainFrm->m_pDockbaseAreaOfDocumentViews )
- {
- DockToOurself = true;
- pTargetDock = mdiMainFrm->m_pDockbaseAreaOfDocumentViews;
- }
- }
- // this is not inheriting TQWidget*, its plain impossible that this condition is true
- //if (pTargetWnd == this) DockToOurself = true;
- if ( !DockToOurself )
- if ( pTargetWnd != 0L )
- {
- pTargetDock = mdiMainFrm->dockManager->findWidgetParentDock( pTargetWnd );
- if ( !pTargetDock )
- {
- if ( pTargetWnd->parentWidget() )
- {
- pTargetDock = mdiMainFrm->dockManager->findWidgetParentDock( pTargetWnd->parentWidget() );
- }
- }
- }
- if ( !pTargetDock || pTargetWnd == mdiMainFrm->getMainDockWidget() )
- {
- if ( mdiMainFrm->m_managedDockPositionMode && ( mdiMainFrm->m_pMdi || mdiMainFrm->m_documentTabWidget ) )
- {
- KDockWidget * dw1 = pTargetDock->findNearestDockWidget( pos );
- if ( dw1 )
- pCover->manualDock( dw1, KDockWidget::DockCenter, percent );
- else
- pCover->manualDock ( pTargetDock, pos, 20 );
- return ;
- }
- }
- pCover->manualDock( pTargetDock, pos, percent );
- //check pCover->show();
- }
-}
-
-void KMdiToolViewAccessor::hide()
-{
- Q_ASSERT( d->widgetContainer );
- if ( !d->widgetContainer )
- return ;
- d->widgetContainer->undock();
-}
-
-void KMdiToolViewAccessor::show()
-{
- Q_ASSERT( d->widgetContainer );
- if ( !d->widgetContainer )
- return ;
- d->widgetContainer->makeDockVisible();
-}
-
-
-#ifndef NO_INCLUDE_MOCFILES
-#include "kmditoolviewaccessor.moc"
-#endif
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmditoolviewaccessor.h b/kmdi/kmditoolviewaccessor.h
deleted file mode 100644
index a58375ec8..000000000
--- a/kmdi/kmditoolviewaccessor.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmditoolviewaccessor.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 08/2003 by Joseph Wenninger (jowenn@kde.org)
-// changes : ---
-// patches : ---
-//
-// copyright : (C) 2003 by Joseph Wenninger (jowenn@kde.org)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-#ifndef _KMDITOOLVIEWACCESSOR_H_
-#define _KMDITOOLVIEWACCESSOR_H_
-
-#include <tqwidget.h>
-#include <tqpixmap.h>
-#include <tqrect.h>
-#include <tqapplication.h>
-#include <tqdatetime.h>
-
-#include <kdockwidget.h>
-
-namespace KMDIPrivate
-{
-class KMDIGUIClient;
-}
-
-
-class KMDI_EXPORT KMdiToolViewAccessor : public TQObject
-{
- Q_OBJECT
-
-
- friend class KMdiMainFrm;
- friend class KMDIPrivate::KMDIGUIClient;
-
-private:
- /**
- * Internally used by KMdiMainFrm to store a temporary information that the method
- * activate() is unnecessary and that it can by escaped.
- * This saves from unnecessary calls when activate is called directly.
- */
- bool m_bInterruptActivation;
- /**
- * Internally used to prevent cycles between KMdiMainFrm::activateView() and KMdiChildView::activate().
- */
- bool m_bMainframesActivateViewIsPending;
- /**
- *
- */
- bool m_bFocusInEventIsPending;
-
-private:
- KMdiToolViewAccessor( class KMdiMainFrm *parent , TQWidget *widgetToWrap, const TQString& tabToolTip = 0, const TQString& tabCaption = 0 );
- KMdiToolViewAccessor( class KMdiMainFrm *parent );
-public:
- ~KMdiToolViewAccessor();
- TQWidget *wrapperWidget();
- TQWidget *wrappedWidget();
- void place( KDockWidget::DockPosition pos = KDockWidget::DockNone, TQWidget* pTargetWnd = 0L, int percent = 50 );
- void placeAndShow( KDockWidget::DockPosition pos = KDockWidget::DockNone, TQWidget* pTargetWnd = 0L, int percent = 50 );
- void show();
-public slots:
- void setWidgetToWrap( TQWidget* widgetToWrap, const TQString& tabToolTip = 0, const TQString& tabCaption = 0 );
- void hide();
-private:
- class KMdiToolViewAccessorPrivate *d;
- class KMdiMainFrm *mdiMainFrm;
-
-protected:
- bool eventFilter( TQObject *o, TQEvent *e );
-};
-
-
-#endif //_KMDITOOLVIEWACCESSOR_H_
-// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
-
diff --git a/kmdi/kmditoolviewaccessor_p.h b/kmdi/kmditoolviewaccessor_p.h
deleted file mode 100644
index ecbaa76a3..000000000
--- a/kmdi/kmditoolviewaccessor_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : kmditoolviewaccessor_p.h
-//----------------------------------------------------------------------------
-// Project : KDE MDI extension
-//
-// begin : 08/2003 by Joseph Wenninger (jowenn@kde.org)
-// changes : ---
-// patches : ---
-//
-// copyright : (C) 2003 by Joseph Wenninger (jowenn@kde.org)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-
-#ifndef KMDI_TOOLVIEW_ACCESSOR_PRIVATE_H_
-#define KMDI_TOOLVIEW_ACCESSOR_PRIVATE_H_
-
-
-#include <tqwidget.h>
-#include <kdockwidget.h>
-#include <tqguardedptr.h>
-#include <kaction.h>
-
-class KMDI_EXPORT KMdiToolViewAccessorPrivate {
-public:
- KMdiToolViewAccessorPrivate() {
- widgetContainer=0;
- widget=0;
- }
- ~KMdiToolViewAccessorPrivate() {
- delete action;
- if (!widgetContainer.isNull()) widgetContainer->undock();
- delete (KDockWidget*)widgetContainer;
- }
- TQGuardedPtr<KDockWidget> widgetContainer;
- TQWidget* widget;
- TQGuardedPtr<KAction> action;
-};
-
-
-#endif
-
-
diff --git a/kmdi/res/filenew.xpm b/kmdi/res/filenew.xpm
deleted file mode 100644
index b261800d6..000000000
--- a/kmdi/res/filenew.xpm
+++ /dev/null
@@ -1,27 +0,0 @@
-/* XPM */
-#ifndef _FILENEW_XPM_
-#define _FILENEW_XPM_
-
-static const char *filenew[] = {
-"10 14 5 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #DCDCDC",
-"# c #C0C0C0",
-"....... ",
-".++++@@. ",
-".++++#+@. ",
-".++++#++@.",
-".++++#....",
-".+++++###.",
-".++++++++.",
-".++++++++.",
-".++++++++.",
-".++++++++.",
-".++++++++.",
-".++++++++.",
-".++++++++.",
-".........."};
-
-#endif
diff --git a/kmdi/res/kde2_closebutton.xpm b/kmdi/res/kde2_closebutton.xpm
deleted file mode 100644
index 5c05e7149..000000000
--- a/kmdi/res/kde2_closebutton.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-#ifndef _KDE2_CLOSEBUTTON_XPM_
-#define _KDE2_CLOSEBUTTON_XPM_
-
-static const char* kde2_closebutton[]={
-"12 12 2 1",
-". s None c None",
-"# c #000000",
-"............",
-"............",
-"...#....#...",
-"..###..###..",
-"...######...",
-"....####....",
-"....####....",
-"...######...",
-"..###..###..",
-"...#....#...",
-"............",
-"............"};
-
-#endif
diff --git a/kmdi/res/kde2_maxbutton.xpm b/kmdi/res/kde2_maxbutton.xpm
deleted file mode 100644
index c8ef81139..000000000
--- a/kmdi/res/kde2_maxbutton.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-#ifndef _KDE2_MAXBUTTON_XPM_
-#define _KDE2_MAXBUTTON_XPM_
-
-static const char* kde2_maxbutton[]={
-"12 12 2 1",
-". s None c None",
-"# c #000000",
-"............",
-"............",
-"..########..",
-"..########..",
-"..##....##..",
-"..##....##..",
-"..##....##..",
-"..##....##..",
-"..########..",
-"..########..",
-"............",
-"............"};
-
-#endif
diff --git a/kmdi/res/kde2_minbutton.xpm b/kmdi/res/kde2_minbutton.xpm
deleted file mode 100644
index 98669195d..000000000
--- a/kmdi/res/kde2_minbutton.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-#ifndef _KDE2_MINBUTTON_XPM_
-#define _KDE2_MINBUTTON_XPM_
-
-static const char* kde2_minbutton[]={
-"12 12 2 1",
-". s None c None",
-"# c #000000",
-"............",
-"............",
-"............",
-"............",
-"....####....",
-"....####....",
-"....####....",
-"....####....",
-"............",
-"............",
-"............",
-"............"};
-
-#endif
diff --git a/kmdi/res/kde2_restorebutton.xpm b/kmdi/res/kde2_restorebutton.xpm
deleted file mode 100644
index a6e01fcba..000000000
--- a/kmdi/res/kde2_restorebutton.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-#ifndef _KDE2_RESTOREBUTTON_XPM_
-#define _KDE2_RESTOREBUTTON_XPM_
-
-static const char* kde2_restorebutton[]={
-"12 12 2 1",
-". s None c None",
-"# c #000000",
-"............",
-".########...",
-".########...",
-".##....##...",
-".##.########",
-".##.########",
-".#####....##",
-".#####....##",
-"....##....##",
-"....########",
-"....########",
-"............"};
-
-#endif
diff --git a/kmdi/res/kde2_undockbutton.xpm b/kmdi/res/kde2_undockbutton.xpm
deleted file mode 100644
index 711bf01cc..000000000
--- a/kmdi/res/kde2_undockbutton.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-#ifndef _KDE2_UNDOCKBUTTON_XPM_
-#define _KDE2_UNDOCKBUTTON_XPM_
-
-static const char* kde2_undockbutton[]={
-"12 12 2 1",
-". s None c None",
-"# c #000000",
-"............",
-".#####......",
-".#####......",
-".####.......",
-".#####......",
-".##.###.....",
-".....###....",
-"......###...",
-".......###..",
-"........##..",
-"............",
-"............"};
-
-#endif
diff --git a/kmdi/res/kde2laptop_closebutton.xpm b/kmdi/res/kde2laptop_closebutton.xpm
deleted file mode 100644
index 6801e4e33..000000000
--- a/kmdi/res/kde2laptop_closebutton.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-#ifndef _KDE2LAPTOP_CLOSEBUTTON_XPM_
-#define _KDE2LAPTOP_CLOSEBUTTON_XPM_
-
-static const char* kde2laptop_closebutton[]={
-"20 8 2 1",
-". s None c None",
-"# c #000000",
-".......#....#.......",
-"......###..###......",
-".......######.......",
-"........####........",
-"........####........",
-".......######.......",
-"......###..###......",
-".......#....#......."};
-
-#endif
diff --git a/kmdi/res/kde2laptop_closebutton_menu.xpm b/kmdi/res/kde2laptop_closebutton_menu.xpm
deleted file mode 100644
index 9d0712319..000000000
--- a/kmdi/res/kde2laptop_closebutton_menu.xpm
+++ /dev/null
@@ -1,25 +0,0 @@
-/* XPM */
-#ifndef _KDE2LAPTOP_CLOSEBUTTON_MENU_XPM_
-#define _KDE2LAPTOP_CLOSEBUTTON_MENU_XPM_
-
-static const char* kde2laptop_closebutton_menu[]={
-"27 14 3 1",
-". s None c None",
-"+ c #303030",
-"# c #000000",
-"##########################.",
-"#........................#+",
-"#........................#+",
-"#.........#....#.........#+",
-"#........###..###........#+",
-"#.........######.........#+",
-"#..........####..........#+",
-"#..........####..........#+",
-"#.........######.........#+",
-"#........###..###........#+",
-"#.........#....#.........#+",
-"#........................#+",
-"##########################+",
-".++++++++++++++++++++++++++"};
-
-#endif
diff --git a/kmdi/res/kde2laptop_maxbutton.xpm b/kmdi/res/kde2laptop_maxbutton.xpm
deleted file mode 100644
index b8ce6de2c..000000000
--- a/kmdi/res/kde2laptop_maxbutton.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-#ifndef _KDE2LAPTOP_MAXBUTTON_XPM_
-#define _KDE2LAPTOP_MAXBUTTON_XPM_
-
-static const char* kde2laptop_maxbutton[]={
-"20 8 2 1",
-". s None c None",
-"# c #000000",
-"........##..........",
-".......####.........",
-"......######........",
-".....########.......",
-".....########.......",
-"....................",
-".....########.......",
-".....########......."};
-
-#endif
diff --git a/kmdi/res/kde2laptop_minbutton.xpm b/kmdi/res/kde2laptop_minbutton.xpm
deleted file mode 100644
index 6bcf76c57..000000000
--- a/kmdi/res/kde2laptop_minbutton.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-#ifndef _KDE2LAPTOP_MINBUTTON_XPM_
-#define _KDE2LAPTOP_MINBUTTON_XPM_
-
-static const char* kde2laptop_minbutton[]={
-"20 8 2 1",
-". s None c None",
-"# c #000000",
-"......########......",
-"......########......",
-"....................",
-"......########......",
-"......########......",
-".......######.......",
-"........####........",
-".........##........."};
-
-#endif
diff --git a/kmdi/res/kde2laptop_restorebutton.xpm b/kmdi/res/kde2laptop_restorebutton.xpm
deleted file mode 100644
index 803ce6db4..000000000
--- a/kmdi/res/kde2laptop_restorebutton.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-#ifndef _KDE2LAPTOP_RESTOREBUTTON_XPM_
-#define _KDE2LAPTOP_RESTOREBUTTON_XPM_
-
-static const char* kde2laptop_restorebutton[]={
-"20 8 2 1",
-". s None c None",
-"# c #000000",
-".......##...........",
-"........##..........",
-".....##..##.........",
-".....###..##........",
-".....####..##.......",
-".....#####..#.......",
-".....######.........",
-".....#######........"};
-
-#endif
diff --git a/kmdi/res/kde2laptop_undockbutton.xpm b/kmdi/res/kde2laptop_undockbutton.xpm
deleted file mode 100644
index 1f23ecaf8..000000000
--- a/kmdi/res/kde2laptop_undockbutton.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-#ifndef _KDE2LAPTOP_UNDOCKBUTTON_XPM_
-#define _KDE2LAPTOP_UNDOCKBUTTON_XPM_
-
-static const char* kde2laptop_undockbutton[]={
-"20 8 2 1",
-". s None c None",
-"# c #000000",
-".....######.........",
-".....#####..........",
-".....####...........",
-".....#####..........",
-".....##.###.........",
-".....#...###........",
-"..........###.......",
-"...........##......."};
-
-#endif
diff --git a/kmdi/res/kde_closebutton.xpm b/kmdi/res/kde_closebutton.xpm
deleted file mode 100644
index e714359a8..000000000
--- a/kmdi/res/kde_closebutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _KDE_CLOSEBUTTON_XPM_
-#define _KDE_CLOSEBUTTON_XPM_
-
-static const char *kde_closebutton[] = {
-/* width height num_colors chars_per_pixel */
-"16 16 3 1",
-/* colors */
-" s None c None",
-". c white",
-"X c #707070",
-/* pixels */
-" ",
-" ",
-" .X .X ",
-" .XX .XX ",
-" .XX .XX ",
-" .XX .XX ",
-" .XX.XX ",
-" .XXX ",
-" .XXX ",
-" .XX.XX ",
-" .XX .XX ",
-" .XX .XX ",
-" .XX .XX ",
-" .X .X ",
-" ",
-" "};
-
-#endif
diff --git a/kmdi/res/kde_maxbutton.xpm b/kmdi/res/kde_maxbutton.xpm
deleted file mode 100644
index 2af3bf882..000000000
--- a/kmdi/res/kde_maxbutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _KDE_MAXBUTTON_XPM_
-#define _KDE_MAXBUTTON_XPM_
-
-static const char *kde_maxbutton[] = {
-/* width height num_colors chars_per_pixel */
-"16 16 3 1",
-/* colors */
-" s None c None",
-". c white",
-"X c #707070",
-/* pixels */
-" ",
-" ",
-" ........... ",
-" .XXXXXXXXXX ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X........X ",
-" .XXXXXXXXXX ",
-" ",
-" ",
-" "};
-
-#endif
diff --git a/kmdi/res/kde_minbutton.xpm b/kmdi/res/kde_minbutton.xpm
deleted file mode 100644
index c4e609ae7..000000000
--- a/kmdi/res/kde_minbutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _KDE_MINBUTTON_XPM_
-#define _KDE_MINBUTTON_XPM_
-
-static const char *kde_minbutton[] = {
-/* width height num_colors chars_per_pixel */
-"16 16 3 1",
-/* colors */
-" s None c None",
-". c white",
-"X c #707070",
-/* pixels */
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ... ",
-" . X ",
-" .XX ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
-
-#endif
diff --git a/kmdi/res/kde_restorebutton.xpm b/kmdi/res/kde_restorebutton.xpm
deleted file mode 100644
index 4ec185133..000000000
--- a/kmdi/res/kde_restorebutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _KDE_RESTOREBUTTON_XPM_
-#define _KDE_RESTOREBUTTON_XPM_
-
-static const char *kde_restorebutton[] = {
-/* width height num_colors chars_per_pixel */
-"16 16 3 1",
-/* colors */
-" s None c None",
-". c #707070",
-"X c white",
-/* pixels */
-" ",
-" ",
-" ........... ",
-" .XXXXXXXXXX ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X .X ",
-" .X........X ",
-" .XXXXXXXXXX ",
-" ",
-" ",
-" "};
-
-#endif
diff --git a/kmdi/res/kde_undockbutton.xpm b/kmdi/res/kde_undockbutton.xpm
deleted file mode 100644
index de97e9e77..000000000
--- a/kmdi/res/kde_undockbutton.xpm
+++ /dev/null
@@ -1,27 +0,0 @@
-/* XPM */
-#ifndef _KDE_UNDOCKBUTTON_XPM_
-#define _KDE_UNDOCKBUTTON_XPM_
-
-static const char *kde_undockbutton[]={
-"16 16 3 1",
-". c None",
-"# c #ffffff",
-"a c #707070",
-"................",
-"................",
-"..#aaaaaaa......",
-"..#aa#####......",
-"..#aaa..........",
-"..#a#aa.........",
-"..#a.#aa........",
-"..#a..#aa.......",
-"..#a...#aa......",
-"..#a....#aa.....",
-".........#aa....",
-"..........#aa...",
-"...........#aa..",
-"............#...",
-"................",
-"................"};
-
-#endif
diff --git a/kmdi/res/win_closebutton.xpm b/kmdi/res/win_closebutton.xpm
deleted file mode 100644
index d8be02435..000000000
--- a/kmdi/res/win_closebutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _WIN_CLOSEBUTTON_XPM_
-#define _WIN_CLOSEBUTTON_XPM_
-
-static const char *win_closebutton[] = {
-/* width height num_colors chars_per_pixel */
-" 16 14 4 1",
-/* colors */
-". c #000000",
-"# c #808080",
-"a c None",
-"b c #ffffff",
-/* pixels */
-"bbbbbbbbbbbbbbb.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaa..aaaa..aa#.",
-"baaaa..aa..aaa#.",
-"baaaaa....aaaa#.",
-"baaaaaa..aaaaa#.",
-"baaaaa....aaaa#.",
-"baaaa..aa..aaa#.",
-"baaa..aaaa..aa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"b##############.",
-"................"
-};
-
-#endif
diff --git a/kmdi/res/win_maxbutton.xpm b/kmdi/res/win_maxbutton.xpm
deleted file mode 100644
index 95e501a82..000000000
--- a/kmdi/res/win_maxbutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _WIN_MAXBUTTON_XPM_
-#define _WIN_MAXBUTTON_XPM_
-
-static const char *win_maxbutton[] = {
-/* width height num_colors chars_per_pixel */
-" 16 14 4 1",
-/* colors */
-". c #000000",
-"# c #808080",
-"a c None",
-"b c #ffffff",
-/* pixels */
-"bbbbbbbbbbbbbbb.",
-"baaaaaaaaaaaaa#.",
-"baa.........aa#.",
-"baa.........aa#.",
-"baa.aaaaaaa.aa#.",
-"baa.aaaaaaa.aa#.",
-"baa.aaaaaaa.aa#.",
-"baa.aaaaaaa.aa#.",
-"baa.aaaaaaa.aa#.",
-"baa.aaaaaaa.aa#.",
-"baa.........aa#.",
-"baaaaaaaaaaaaa#.",
-"b##############.",
-"................"
-};
-
-#endif
diff --git a/kmdi/res/win_minbutton.xpm b/kmdi/res/win_minbutton.xpm
deleted file mode 100644
index 1e8787e78..000000000
--- a/kmdi/res/win_minbutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _WIN_MINBUTTON_XPM_
-#define _WIN_MINBUTTON_XPM_
-
-static const char *win_minbutton[] = {
-/* width height num_colors chars_per_pixel */
-" 16 14 4 1",
-/* colors */
-". c #000000",
-"# c #808080",
-"a c None",
-"b c #ffffff",
-/* pixels */
-"bbbbbbbbbbbbbbb.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaaaaaaaaaaaa#.",
-"baaa......aaaa#.",
-"baaa......aaaa#.",
-"baaaaaaaaaaaaa#.",
-"b##############.",
-"................"
-};
-
-#endif
diff --git a/kmdi/res/win_restorebutton.xpm b/kmdi/res/win_restorebutton.xpm
deleted file mode 100644
index 87bb5b30f..000000000
--- a/kmdi/res/win_restorebutton.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-#ifndef _WIN_RESTOREBUTTON_XPM_
-#define _WIN_RESTOREBUTTON_XPM_
-
-static const char *win_restorebutton[] = {
-/* width height num_colors chars_per_pixel */
-" 16 14 4 1",
-/* colors */
-". c #000000",
-"# c #808080",
-"a c None",
-"b c #ffffff",
-/* pixels */
-"bbbbbbbbbbbbbbb.",
-"baaaaaaaaaaaaa#.",
-"baaaa......aaa#.",
-"baaaa......aaa#.",
-"baaaa.aaaa.aaa#.",
-"baa......a.aaa#.",
-"baa......a.aaa#.",
-"baa.aaaa...aaa#.",
-"baa.aaaa.aaaaa#.",
-"baa.aaaa.aaaaa#.",
-"baa......aaaaa#.",
-"baaaaaaaaaaaaa#.",
-"b##############.",
-"................"
-};
-
-#endif
diff --git a/kmdi/res/win_undockbutton.xpm b/kmdi/res/win_undockbutton.xpm
deleted file mode 100644
index 386ebd8a9..000000000
--- a/kmdi/res/win_undockbutton.xpm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* XPM */
-#ifndef _WIN_UNDOCKBUTTON_XPM_
-#define _WIN_UNDOCKBUTTON_XPM_
-
-static const char* win_undockbutton[]={
-"16 14 4 1",
-"b c #808080",
-"# c #000000",
-"a c None",
-". c #ffffff",
-"...............#",
-".aaaaaaaaaaaaab#",
-".aaaaaaaaaaaaab#",
-".aaa####aaaaaab#",
-".aaa###aaaaaaab#",
-".aaa####aaaaaab#",
-".aaa#a###aaaaab#",
-".aaaaaa###aaaab#",
-".aaaaaaa###aaab#",
-".aaaaaaaa###aab#",
-".aaaaaaaaa#aaab#",
-".aaaaaaaaaaaaab#",
-".bbbbbbbbbbbbbb#",
-"################"};
-
-#endif
diff --git a/kmdi/test/Makefile.am b/kmdi/test/Makefile.am
deleted file mode 100644
index 73e0b8a13..000000000
--- a/kmdi/test/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-check_PROGRAMS = kfourchildren
-METASOURCES = AUTO
-
-INCLUDES = -I$(top_srcdir)/kmdi -I.. $(all_includes)
-
-kfourchildren_SOURCES = hello.cpp main.cpp mainwidget.cpp
-kfourchildren_LDFLAGS = -no-undefined $(all_libraries)
-kfourchildren_LDADD = $(top_builddir)/kmdi/libkmdi.la \
- $(top_builddir)/kutils/libkutils.la
-
diff --git a/kmdi/test/README b/kmdi/test/README
deleted file mode 100644
index cf3902083..000000000
--- a/kmdi/test/README
+++ /dev/null
@@ -1,16 +0,0 @@
-This example shows the use of KMdi.
-Either you inherit your views from KMdiChildView or you wrap your common widgets by KMdiChildViews.
-Your main widget must inherit from KMdiMainFrm.
-
-
-
-Call
- qmake kFourChildren -o Makefile
- make
-to build the example app.
-Likely you must set the environment variable TDEDIR (to e.g. /opt/trinity).
-
-
-
-Find more details on:
- http://www.geocities.com/gigafalk/qextmdi.htm
diff --git a/kmdi/test/hello.cpp b/kmdi/test/hello.cpp
deleted file mode 100644
index d92233ea6..000000000
--- a/kmdi/test/hello.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-** $Id$
-**
-** Copyright (C) 1992-1999 Troll Tech AS. All rights reserved.
-**
-** This file is part of an example program for Qt. This example
-** program may be used, distributed and modified without limitation.
-**
-*****************************************************************************/
-
-#include "hello.h"
-#include <tqpushbutton.h>
-#include <tqtimer.h>
-#include <tqpainter.h>
-#include <tqpixmap.h>
-
-/*
- Constructs a Hello widget. Starts a 40 ms animation timer.
-*/
-
-Hello::Hello( const char *title, const char *text, TQWidget *parentWidget )
- : KMdiChildView(title, parentWidget), t(text), b(0)
-{
- TQTimer *timer = new TQTimer(this);
- TQObject::connect( timer, TQT_SIGNAL(timeout()), TQT_SLOT(animate()) );
- timer->start( 40 );
-
- resize( 260, 130 );
-}
-
-
-/*
- This private slot is called each time the timer fires.
-*/
-
-void Hello::animate()
-{
- b = (b + 1) & 15;
- repaint( false );
-}
-
-
-/*
- Handles mouse button release events for the Hello widget.
-
- We emit the clicked() signal when the mouse is released inside
- the widget.
-*/
-
-void Hello::mouseReleaseEvent( TQMouseEvent *e )
-{
- if ( rect().contains( e->pos() ) )
- emit clicked();
-}
-
-
-/*
- Handles paint events for the Hello widget.
-
- Flicker-free update. The text is first drawn in the pixmap and the
- pixmap is then blt'ed to the screen.
-*/
-
-void Hello::paintEvent( TQPaintEvent * )
-{
- static int sin_tbl[16] = {
- 0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38};
-
- if ( t.isEmpty() )
- return;
-
- // 1: Compute some sizes, positions etc.
- TQFontMetrics fm = fontMetrics();
- int w = fm.width(t) + 20;
- int h = fm.height() * 2;
- int pmx = width()/2 - w/2;
- int pmy = height()/2 - h/2;
-
- // 2: Create the pixmap and fill it with the widget's background
- TQPixmap pm( w, h );
- pm.fill( this, pmx, pmy );
-
- // 3: Paint the pixmap. Cool wave effect
- TQPainter p;
- int x = 10;
- int y = h/2 + fm.descent();
- int i = 0;
- p.begin( &pm );
- p.setFont( font() );
- while ( !t[i].isNull() ) {
- int i16 = (b+i) & 15;
- p.setPen( TQColor((15-i16)*16,255,255,TQColor::Hsv) );
- p.drawText( x, y-sin_tbl[i16]*h/800, t.mid(i,1), 1 );
- x += fm.width( t[i] );
- i++;
- }
- p.end();
-
- // 4: Copy the pixmap to the Hello widget
- bitBlt( this, pmx, pmy, &pm );
-}
-
-#include "hello.moc"
-
diff --git a/kmdi/test/hello.h b/kmdi/test/hello.h
deleted file mode 100644
index 808d25b90..000000000
--- a/kmdi/test/hello.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-** $Id$
-**
-** Copyright (C) 1992-1999 Troll Tech AS. All rights reserved.
-**
-** This file is part of an example program for Qt. This example
-** program may be used, distributed and modified without limitation.
-**
-*****************************************************************************/
-
-#ifndef HELLO_H
-#define HELLO_H
-
-#include <tqstring.h>
-#include <kmdichildview.h>
-
-class TQWidget;
-class TQMouseEvent;
-class TQPaintEvent;
-
-class Hello : public KMdiChildView
-{
- Q_OBJECT
-public:
- Hello( const char *title, const char *text, TQWidget* parentWidget = 0 );
-signals:
- void clicked();
-protected:
- void mouseReleaseEvent( TQMouseEvent * );
- void paintEvent( TQPaintEvent * );
-private slots:
- void animate();
-private:
- TQString t;
- int b;
-};
-
-#endif
diff --git a/kmdi/test/main.cpp b/kmdi/test/main.cpp
deleted file mode 100644
index 4f14a410c..000000000
--- a/kmdi/test/main.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//----------------------------------------------------------------------------
-// filename : main.cpp
-//----------------------------------------------------------------------------
-// Project : Qt MDI extension
-//
-// begin : 07/1999 by Szymon Stefanek as part of kvirc
-// (an IRC application)
-// changes : 09/1999 by Falk Brettschneider to create an
-// stand-alone Qt extension set of
-// classes and a Qt-based library
-// 02/2000 by Massimo Morin (mmorin@schedsys.com)
-//
-// copyright : (C) 1999-2000 by Szymon Stefanek (stefanek@tin.it)
-// and
-// Falk Brettschneider
-// email : falkbr@tdevelop.org (Falk Brettschneider)
-//----------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Library General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-//----------------------------------------------------------------------------
-
-#ifndef NO_KDE
-# include <kapplication.h>
- TDEApplication* theApp;
-#else
-# include <tqapplication.h>
- TQApplication* theApp;
-#endif
-
-//#include <iostream.h>
-#include "mainwidget.h"
-#include "hello.h"
-
-#define SHOW(v) cout << #v << " -> " << v << endl;
-
-int main( int argc, char **argv )
-{
-#ifndef NO_KDE
- TDEApplication a(argc,argv,"KFourChildren");
-#else
- TQApplication a(argc,argv);
-#endif
- theApp = &a;
-
- RestartWidget* restartWidget = new RestartWidget;
- MainWidget* mainWdg = new MainWidget(restartWidget->dockConfig,restartWidget->mdimode);
- restartWidget->setWindow(mainWdg);
-
- Hello* h1 = new Hello( "Hello1", "Click the right mouse button on the mainframe!", mainWdg);
- h1->setTabCaption("Tab changed");
- h1->setBackgroundColor( Qt::white );
- mainWdg->addWindow( h1);
-// SHOW(h1->caption());
-// SHOW(h1->tabCaption());
-
- TQWidget* w = new TQWidget(mainWdg);
- KMdiChildView* h2 = mainWdg->createWrapper(w, "I'm a common but wrapped QWidget!", "Hello2");
- mainWdg->addWindow( h2 );
-// SHOW(h2->caption());
-// SHOW(h2->tabCaption());
-
- Hello* h3 = new Hello( "Hello3", "Dock me using the taskbar button context menu!", 0);
- h3->setBackgroundColor( Qt::white );
- h3->setFont( TQFont("times",20,TQFont::Bold) );
- mainWdg->addWindow( h3, KMdi::Detach ); // undock this!
- h3->setGeometry( 20, 20, 400, 100);
-
- Hello* h4 = new Hello( "Hello4", "Hello world!", mainWdg);
- h4->setMDICaption("Hello4 both changed");
- h4->setFont( TQFont("times",32,TQFont::Bold) );
- mainWdg->addWindow( h4);
-// SHOW(h4->caption());
-// SHOW(h4->tabCaption());
-
- Hello* h5 = new Hello( "Hello5", "I'm not a MDI widget :-(");
- h5->setGeometry(40, 40, 400, 100);
- h5->setFont( TQFont("times",20,TQFont::Bold) );
- h5->setCaption("MDI Test Application");
- h5->show();
-
-#if 0
- KMdiIterator<KMdiChildView*> *it = mainWdg->createIterator();
- for ( it->first(); !it->isDone(); it->next()) {
- //cout << "--> " << it->currentItem()->caption() << endl;
-
- }
- //delete it;
-#endif
-
- mainWdg->resize(500,500);
- a.setMainWidget( restartWidget );
- restartWidget->show();
- mainWdg->show();
-
- mainWdg->cascadeWindows();
- return a.exec();
-}
diff --git a/kmdi/test/mainwidget.cpp b/kmdi/test/mainwidget.cpp
deleted file mode 100644
index e8aa8da1d..000000000
--- a/kmdi/test/mainwidget.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************
- mainwidget.cpp - description
- -------------------
- begin : Mon Nov 8 1999
- copyright : (C) 1999 by Falk Brettschneider
- email : falkbr@tdevelop.org
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include <tqlayout.h>
-#include <tqmenubar.h>
-#include <tqtoolbar.h>
-#include <tqmultilineedit.h>
-#include <tqlistview.h>
-#include <tqfile.h>
-#include <kmdimainfrm.h>
-#include <kmditoolviewaccessor.h>
-
-#include "mainwidget.h"
-
-MainWidget::MainWidget(TQDomElement& dockConfig,KMdi::MdiMode mode)
-: KMdiMainFrm(0L, "theMDIMainFrm",mode)
- ,m_dockConfig(dockConfig)
-{
- setIDEAlModeStyle(1); // KDEV3
-
- dockManager->setReadDockConfigMode(KDockManager::RestoreAllDockwidgets);
- initMenu();
-
- if (m_dockConfig.hasChildNodes()) {
- readDockConfig(m_dockConfig);
- }
-
- TQMultiLineEdit* mle = new TQMultiLineEdit(0L,"theMultiLineEditWidget");
- mle->setText("This is a TQMultiLineEdit widget.");
- addToolWindow( mle, KDockWidget::DockBottom, m_pMdi, 70);
-
- TQMultiLineEdit* mle2 = new TQMultiLineEdit(0L,"theMultiLineEditWidget2");
- addToolWindow( mle2, KDockWidget::DockCenter, mle, 70);
-
- TQMultiLineEdit* mle3 = new TQMultiLineEdit(0L,"theMultiLineEditWidget3");
- addToolWindow( mle3, KDockWidget::DockCenter, mle, 70);
-
- TQMultiLineEdit* mle4 = new TQMultiLineEdit(0L,"theMultiLineEditWidget4");
- addToolWindow( mle4, KDockWidget::DockCenter, mle, 70);
-
- KMdiToolViewAccessor *tva=createToolWindow();
- tva->setWidgetToWrap(new TQMultiLineEdit(tva->wrapperWidget(),"theMultiLineEditWidget5"));
- tva->placeAndShow(KDockWidget::DockCenter,mle,70);
-
- TQListView* lv = new TQListView(0L,"theListViewWidget");
-#include "../res/filenew.xpm"
- lv->setIcon(filenew);
- lv->addColumn("Test", 50);
- lv->addColumn("KMDI", 70);
- new TQListViewItem(lv,TQString("test"),TQString("test"));
- addToolWindow( lv, KDockWidget::DockLeft, m_pMdi, 35, "1");
-
- TQListView* lv2 = new TQListView(0L,"theListViewWidget2");
- lv2->setIcon(filenew);
- lv2->addColumn("Test2", 50);
- lv2->addColumn("KMDI2", 70);
- new TQListViewItem(lv,TQString("test2"),TQString("test2"));
- addToolWindow( lv2, KDockWidget::DockCenter, lv, 35, "2");
-
- TQListView* lv3 = new TQListView(0L,"theListViewWidget3");
- lv3->setIcon(filenew);
- lv3->addColumn("Test3", 50);
- lv3->addColumn("KMDI3", 70);
- new TQListViewItem(lv,TQString("test3"),TQString("test3"));
- addToolWindow( lv3, KDockWidget::DockCenter, lv, 35, "3");
-
- dockManager->finishReadDockConfig();
-
- setMenuForSDIModeSysButtons( menuBar());
-}
-
-MainWidget::~MainWidget()
-{
- writeDockConfig(m_dockConfig);
- TQDomDocument doc = m_dockConfig.ownerDocument();
- TQString s = doc.toString();
- TQFile f("/tmp/dc.txt");
- f.open(IO_ReadWrite);
- f.tqwriteBlock(s.latin1(), s.length());
- f.close();
-}
-
-void MainWidget::initMenu()
-{
- menuBar()->insertItem("&Window", windowMenu());
- menuBar()->insertItem("&Docking", dockHideShowMenu());
-}
-
-/** additionally fit the system menu button position to the menu position */
-void MainWidget::resizeEvent( TQResizeEvent *pRSE)
-{
- KMdiMainFrm::resizeEvent( pRSE);
- setSysButtonsAtMenuPosition();
-}
-
-RestartWidget::RestartWidget():KMainWindow()
-{
- mdimode=KMdi::ChildframeMode;
- TQVBoxLayout* bl = new TQVBoxLayout(this);
- TQLabel* l = new TQLabel("This is for the testing of\nKMdiMainFrm::read/writeDockConfig().\n", this);
- TQCheckBox* b1 = new TQCheckBox("KMdiMainFrm close/restart", this);
- b1->toggle();
- TQObject::connect(b1, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(onStateChanged(int)));
- bl->add(l);
- bl->add(b1);
- bl->setMargin(10);
- bl->activate();
- show();
-
- dockConfig = domDoc.createElement("dockConfig");
- domDoc.appendChild(dockConfig);
-}
-
-void RestartWidget::onStateChanged(int on)
-{
- if (on) {
- m_w = new MainWidget(dockConfig,mdimode);
- m_w->resize(500,500);
- m_w->show();
- }
- else {
- mdimode=m_w->mdiMode();
- m_w->close();
- delete m_w;
- }
-
-}
-
-void RestartWidget::setWindow(MainWidget *w) {
- m_w=w;
-}
-
-#include "mainwidget.moc"
diff --git a/kmdi/test/mainwidget.h b/kmdi/test/mainwidget.h
deleted file mode 100644
index 953512005..000000000
--- a/kmdi/test/mainwidget.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************
- mainwidget.h - description
- -------------------
- begin : Mon Nov 8 1999
- copyright : (C) 1999 by Falk Brettschneider
- email : falkbr@tdevelop.org
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef MAINWIDGET_H
-#define MAINWIDGET_H
-
-#include <tqcheckbox.h>
-#include <tqlayout.h>
-#include <tqlabel.h>
-#include <tqdom.h>
-#include <kmdimainfrm.h>
-
-/**
- *@author Falk Brettschneider
- */
-class MainWidget : public KMdiMainFrm
-{
- Q_OBJECT
-public:
- MainWidget(TQDomElement& dockConfig,KMdi::MdiMode mode);
- virtual ~MainWidget();
- void initMenu();
-
-protected: // Protected methods
- virtual void resizeEvent( TQResizeEvent *pRSE);
-private:
- TQDomElement m_dockConfig;
-};
-
-
-
-/**
- *@author Falk Brettschneider
- * This allows me to test KMdiMainFrm::read/writeDockConfig by
- * closing and restarting the MainWidget via checkbox click.
- */
-class RestartWidget : public KMainWindow
-{
- Q_OBJECT
-// methods
-public:
- RestartWidget();
- void setWindow(MainWidget *w);
-
-private slots:
- void onStateChanged(int on);
-
-// attributes
-public:
- TQDomDocument domDoc;
- TQDomElement dockConfig;
- KMdi::MdiMode mdimode;
-private:
- MainWidget *m_w;
-};
-
-#endif