Remove use of TDE_VERSION

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
master
Michele Calgaro 4 days ago
parent e5595fbfda
commit c2f28aadde
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -185,59 +185,6 @@ AC_SUBST(LIBXSLT_LIBS)
AC_SUBST(LIBXSLT_CFLAGS)
dnl **********
dnl check whether we need the qextmdi lib
dnl (Shamlesly stolen from gideon souorces and
dnl modified for quanta by fredi)
dnl **********
AC_DEFUN([QUANTA_CHECK_MDI],
[
AC_MSG_CHECKING(whether to use tdemdi lib from tdelibs)
AC_CACHE_VAL(ac_cv_mdi_setup,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$KDE_INCLUDES $TQT_INCLUDES"
AC_TRY_LINK([
#include <tdeversion.h>
],
[
#if TDE_VERSION < ((3<<16) | (3<<8) | (92))
KDE_choke me
#endif
],
ac_cv_mdi_setup=yes,
ac_cv_mdi_setup=no
)
CXXFLAGS="$save_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_mdi_setup" = "yes"; then
LIB_KMDI="-ltdemdi"
QEXTMDI_SUBDIR=""
KMDI_INCLUDES=""
AC_MSG_RESULT(yes)
else
LIB_KMDI='$(top_builddir)/lib/compatibility/tdemdi/libquantatdemdi.la'
QEXTMDI_SUBDIR="tdemdi"
KMDI_INCLUDES='-I$(top_srcdir)/lib/compatibility/tdemdi/qextmdi'
CXXFLAGS="$CXXFLAGS -DCOMPAT_KMDI"
AC_MSG_RESULT(no)
fi
AC_SUBST(LIB_KMDI)
AC_SUBST(KMDI_INCLUDES)
AC_SUBST(QEXTMDI_SUBDIR)
AM_CONDITIONAL(include_qextmdi, test -n "$QEXTMDI_SUBDIR")
])
dnl Check if tdemdi is present, if not use giden's one
QUANTA_CHECK_MDI
KDE_CHECK_HEADER(cvsservice_stub.h, [cvsservice_stub_h="found"], [cvsservice_stub_h="none"])
AM_CONDITIONAL(include_cvsservice, test "$cvsservice_stub_h" = "found")
if test "$cvsservice_stub_h" = "found"; then

@ -24,8 +24,6 @@
#include <tqrect.h>
#include <tqcursor.h>
#include "tdeversion.h"
class KImageMapEditor;
class Area;

@ -23,8 +23,6 @@
#include <tqpoint.h>
#include <tqrect.h>
#include "tdeversion.h"
/**
*@author Jan Schäfer
*/

@ -197,11 +197,7 @@ KImageMapEditor::KImageMapEditor(TQWidget *parentWidget, const char *,
KImageMapEditor::~KImageMapEditor() {
writeConfig();
#if TDE_VERSION < 300
delete accel;
#endif
delete areas;
delete currentSelected;
delete copyArea;
delete defaultArea;
@ -622,10 +618,7 @@ void KImageMapEditor::setupActions()
"Click this to remove points from a polygon."));
removePointAction->setExclusiveGroup("drawing");
#if TDE_VERSION < 300
TDEAction *cancelAction =
#endif
new TDEAction(i18n("Cancel Drawing"), Key_Escape, this, TQ_SLOT( slotCancelDrawing() ),
new TDEAction(i18n("Cancel Drawing"), Key_Escape, this, TQ_SLOT( slotCancelDrawing() ),
actionCollection(), "canceldrawing" );
moveLeftAction = new TDEAction(i18n("Move Left"), Key_Left, this, TQ_SLOT( slotMoveLeft() ),
@ -651,18 +644,6 @@ void KImageMapEditor::setupActions()
decreaseHeightAction = new TDEAction(i18n("Decrease Height"), Key_Down + SHIFT, this, TQ_SLOT( slotDecreaseHeight() ),
actionCollection() , "decreaseheight" );
#if TDE_VERSION < 300
accel = new TDEAccel(widget());
cancelAction->plugAccel(accel, true);
moveLeftAction->plugAccel(accel, true);
moveRightAction->plugAccel(accel, true);
moveUpAction->plugAccel(accel, true);
moveDownAction->plugAccel(accel, true);
increaseWidthAction->plugAccel(accel, true);
decreaseWidthAction->plugAccel(accel, true);
increaseHeightAction->plugAccel(accel, true);
decreaseHeightAction->plugAccel(accel, true);
#endif
toFrontAction = new TDEAction(i18n("Bring to Front"), 0 , this, TQ_SLOT( slotToFront() ),
actionCollection() , "tofront" );

@ -27,8 +27,6 @@
#include <tdeparts/browserextension.h>
#include <tdeparts/factory.h>
#include <tdeversion.h>
#include "kimearea.h"
/**
@ -111,9 +109,6 @@ class TDESelectAction;
class TDERadioAction;
class TDERecentFilesAction;
class TDEAction;
#if TDE_VERSION < 300
class TDEAccel;
#endif
///class TQListViewItem;
class KCommandHistory;
class TDEApplication;
@ -309,10 +304,6 @@ private:
TDERecentFilesAction* recentFilesAction;
#if TDE_VERSION < 300
TDEAccel *accel;
#endif
KDockMainWindow *mainDock;
KDockWidget* areaDock;
KDockWidget* mapsDock;

@ -24,8 +24,6 @@
#include <tdelocale.h>
#include <tqmap.h>
#include "tdeversion.h"
class TQPainter;
class TQPointArray;
class TQListViewItem;

@ -23,14 +23,7 @@
#include "drawzone.h"
CutCommand::CutCommand(KImageMapEditor * document, const AreaSelection & a)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Cut %1" ).arg( a.typeString() ))
: KNamedCommand (i18n( "Cut %1" ).arg( a.typeString() ))
{
_document=document;
_cutAreaSelection=new AreaSelection();
@ -78,13 +71,7 @@ DeleteCommand::DeleteCommand(KImageMapEditor * document, const AreaSelection & a
}
PasteCommand::PasteCommand(KImageMapEditor *document, const AreaSelection & a)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Paste %1" ).arg( a.typeString() ))
: KNamedCommand(i18n( "Paste %1" ).arg( a.typeString() ))
{
_document=document;
_pasteAreaSelection=new AreaSelection();
@ -123,13 +110,7 @@ void PasteCommand::unexecute()
MoveCommand::MoveCommand (KImageMapEditor *document, AreaSelection * a, const TQPoint & oldPoint)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Move %1" ).arg( a->typeString() ))
: KNamedCommand(i18n( "Move %1" ).arg( a->typeString() ))
{
_document=document;
_areaSelection=new AreaSelection();
@ -185,13 +166,7 @@ void MoveCommand::unexecute()
ResizeCommand::ResizeCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Resize %1" ).arg( a->typeString() ))
: KNamedCommand(i18n( "Resize %1" ).arg( a->typeString() ))
{
_areaSelection=new AreaSelection();
_areaSelection->setAreaList( a->getAreaList() );
@ -232,13 +207,7 @@ void ResizeCommand::unexecute()
AddPointCommand::AddPointCommand (KImageMapEditor *document, AreaSelection *a, const TQPoint & p)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Add point to %1" ).arg( a->typeString() ))
: KNamedCommand(i18n( "Add point to %1" ).arg( a->typeString() ))
{
if (a->type()!=Area::Polygon)
{
@ -281,13 +250,7 @@ void AddPointCommand::unexecute()
}
RemovePointCommand::RemovePointCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Remove point from %1" ).arg( a->typeString() ))
: KNamedCommand(i18n( "Remove point from %1" ).arg( a->typeString() ))
{
if (a->type()!=Area::Polygon)
{
@ -334,13 +297,7 @@ void RemovePointCommand::unexecute()
CreateCommand::CreateCommand (KImageMapEditor *document, Area *area)
:
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
(i18n( "Create %1" ).arg( area->typeString() ))
: KNamedCommand(i18n( "Create %1" ).arg( area->typeString() ))
{
_document=document;
_area=area;

@ -21,21 +21,11 @@
#include <kcommand.h>
#include <tdeversion.h>
class KImageMapEditor;
class AreaSelection;
class CutCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class CutCommand : public KNamedCommand
{
public:
CutCommand (KImageMapEditor * document, const AreaSelection & selection);
@ -60,12 +50,7 @@ class DeleteCommand : public CutCommand
DeleteCommand (KImageMapEditor * document, const AreaSelection & selection);
};
class PasteCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class PasteCommand : public KNamedCommand
{
public:
PasteCommand (KImageMapEditor * document, const AreaSelection & selection);
@ -82,12 +67,7 @@ KNamedCommand
};
class MoveCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class MoveCommand : public KNamedCommand
{
public:
MoveCommand (KImageMapEditor *document, AreaSelection *a,const TQPoint & oldPoint);
@ -105,12 +85,7 @@ KNamedCommand
//- Area *_oldArea;
};
class ResizeCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class ResizeCommand : public KNamedCommand
{
public:
ResizeCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea);
@ -127,12 +102,7 @@ KNamedCommand
Area *_newArea;
};
class AddPointCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class AddPointCommand : public KNamedCommand
{
public:
AddPointCommand (KImageMapEditor *document, AreaSelection *a, const TQPoint & p);
@ -149,12 +119,7 @@ KNamedCommand
int _coordpos;
};
class RemovePointCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class RemovePointCommand : public KNamedCommand
{
public:
RemovePointCommand (KImageMapEditor *document, AreaSelection *a, Area *oldArea);
@ -172,12 +137,7 @@ KNamedCommand
};
class CreateCommand : public
#if TDE_VERSION < 300
KCommand
#else
KNamedCommand
#endif
class CreateCommand : public KNamedCommand
{
public:
CreateCommand (KImageMapEditor *document, Area *area);

@ -24,8 +24,6 @@
#include <kurl.h>
#include "kimagemapeditor.h"
#include "tdeversion.h"
class TQLineEdit;
class TQMultiLineEdit;
class TQSpinBox;

@ -246,15 +246,7 @@ void KimeShell::optionsConfigureKeys() {
void KimeShell::optionsConfigureToolbars()
{
#if defined(TDE_MAKE_VERSION)
# if TDE_VERSION >= TDE_MAKE_VERSION(3,1,0)
saveMainWindowSettings(TDEGlobal::config(), autoSaveGroup());
# else
saveMainWindowSettings(TDEGlobal::config() );
# endif
#else
saveMainWindowSettings(TDEGlobal::config() );
#endif
// use the standard toolbar editor
KEditToolbar dlg(factory());
@ -265,15 +257,7 @@ void KimeShell::optionsConfigureToolbars()
void KimeShell::applyNewToolbarConfig()
{
#if defined(TDE_MAKE_VERSION)
# if TDE_VERSION >= TDE_MAKE_VERSION(3,1,0)
applyMainWindowSettings(TDEGlobal::config(), autoSaveGroup());
# else
applyMainWindowSettings(TDEGlobal::config());
# endif
#else
applyMainWindowSettings(TDEGlobal::config());
#endif
}

@ -24,5 +24,3 @@ include_directories( SYSTEM
tde_add_library( quantamodule STATIC_PIC AUTOMOC
SOURCES qextfileinfo.cpp ksavealldialog.cpp
)
add_subdirectory( compatibility )

@ -1,6 +1,3 @@
SUBDIRS = compatibility
noinst_LTLIBRARIES = libquantamodule.la
METASOURCES = AUTO

@ -1,2 +0,0 @@
add_subdirectory( tdemdi )

@ -1,12 +0,0 @@
if include_qextmdi
KMDI_SUBDIR = tdemdi
endif
SUBDIRS = $(KMDI_SUBDIR)
#enable the below when there is something in the compatibility lib
#noinst_LTLIBRARIES = libcompat.la
#libcompat_la_SOURCES =
#AM_CPPFLAGS = $(all_includes)
METASOURCES = AUTO

@ -1,24 +0,0 @@
add_subdirectory( qextmdi )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/lib/compatibility/tdemdi/qextmdi
)
include_directories( SYSTEM
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
)
##### quantatdemdi (static)
tde_add_library( quantatdemdi STATIC_PIC AUTOMOC
SOURCES
dummy.cpp
LINK
tdeparts-shared
tdeio-shared
quantaqextmdi-static
)

@ -1,21 +0,0 @@
# Here resides the library of general KDevelop-related utilities,
# which may be linked by any plugin or part. This is installed
# as a shared library, including header files
INCLUDES = $(all_includes)
noinst_LTLIBRARIES = libquantatdemdi.la
libquantatdemdi_la_LDFLAGS = $(all_libraries) -no-undefined
libquantatdemdi_la_LIBADD = $(top_builddir)/lib/compatibility/tdemdi/qextmdi/libquantaqextmdi.la -ltdetexteditor $(LIB_TDEPARTS) $(LIB_TDEIO)
libquantatdemdi_la_SOURCES = dummy.cpp
SUBDIRS = qextmdi
AM_CFLAGS =
AM_CXXFLAGS =
AM_FFLAGS =
#lib_LIBRARIES = libquanta_la
#libquanta_la_SOURCES =
#libquanta_la_LDFLAGS =

@ -1,30 +0,0 @@
#add_subdirectory( res )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/lib/compatibility/tdemdi/qextmdi/res
)
include_directories( SYSTEM
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
)
##### quantatdemdi (static)
tde_add_library( quantaqextmdi STATIC_PIC AUTOMOC
SOURCES
tdemdichildarea.cpp tdemdichildfrm.cpp
tdemdichildfrmcaption.cpp tdemdichildview.cpp
tdemdimainfrm.cpp tdemditaskbar.cpp
tdemultitabbar.cpp tdemditoolviewaccessor.cpp
tdemdidocumentviewtabwidget.cpp tdemdifocuslist.cpp
tdemdiguiclient.cpp ktabwidget.cpp
ktabbar.cpp kdockwidget.cpp
kdockwidget_private.cpp tdemdidockcontainer.cpp
LINK
tdeparts-shared
)

@ -1,18 +0,0 @@
# Here resides the qextmdi library.
INCLUDES = -I$(top_srcdir)/lib/compatibility/tdemdi/qextmdi/res -I$(top_builddir)/lib/compatibility/tdemdi/qextmdi $(all_includes)
noinst_LTLIBRARIES = libquantaqextmdi.la
libquantaqextmdi_la_LDFLAGS = $(all_libraries)
libquantaqextmdi_la_LIBADD = $(LIB_TDEPARTS)
libquantaqextmdi_la_SOURCES = tdemdichildarea.cpp tdemdichildfrm.cpp tdemdichildfrmcaption.cpp \
tdemdichildview.cpp tdemdimainfrm.cpp tdemditaskbar.cpp \
tdemultitabbar.cpp \
tdemditoolviewaccessor.cpp tdemdidocumentviewtabwidget.cpp tdemdifocuslist.cpp \
tdemdiguiclient.cpp \
ktabwidget.cpp ktabbar.cpp kdockwidget.cpp kdockwidget_private.cpp tdemdidockcontainer.cpp
METASOURCES = AUTO
#AM_CXXFLAGS = -DNO_INCLUDE_MOCFILES

@ -1,175 +0,0 @@
/* This file is part of the KDE libraries
Copyright (c) 2002-2003 KDE Team
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 _KDE_MACROS_H_
#define _KDE_MACROS_H_
/* Set by configure */
#undef __TDE_HAVE_GCC_VISIBILITY
/**
* The TDE_NO_EXPORT macro marks the symbol of the given variable
* to be hidden. A hidden symbol is stripped during the linking step,
* so it can't be used from outside the resulting library, which is similar
* to static. However, static limits the visibility to the current
* compilation unit. hidden symbols can still be used in multiple compilation
* units.
*
* \code
* int TDE_NO_EXPORT foo;
* int TDE_EXPORT bar;
* \end
*/
#ifdef __TDE_HAVE_GCC_VISIBILITY
#define TDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define TDE_EXPORT __attribute__ ((visibility("default")))
#elif defined(TQ_WS_WIN)
#define TDE_NO_EXPORT
#define TDE_EXPORT __declspec(dllexport)
#else
#define TDE_NO_EXPORT
#define TDE_EXPORT
#endif
/**
* TDE_EXPORT_PLUGIN is a workaround for TQt not being able to
* cope with symbol visibility.
*/
#define TDE_EXPORT_PLUGIN(PLUGIN) \
TQ_EXTERN_C TDE_EXPORT const char* qt_ucm_query_verification_data(); \
TQ_EXTERN_C TDE_EXPORT TQUnknownInterface* ucm_instantiate(); \
TQ_EXPORT_PLUGIN(PLUGIN)
/**
* The TDE_PACKED can be used to hint the compiler that a particular
* structure or class should not contain unnecessary paddings.
*/
#ifdef __GNUC__
#define TDE_PACKED __attribute__((__packed__))
#else
#define TDE_PACKED
#endif
/**
* The TDE_DEPRECATED macro can be used to trigger compile-time warnings
* with newer compilers when deprecated functions are used.
*
* For non-inline functions, the macro gets inserted at the very end of the
* function declaration, right before the semicolon:
*
* \code
* DeprecatedConstructor() TDE_DEPRECATED;
* void deprecatedFunctionA() TDE_DEPRECATED;
* int deprecatedFunctionB() const TDE_DEPRECATED;
* \endcode
*
* Functions which are implemented inline are handled differently: for them,
* the TDE_DEPRECATED macro is inserted at the front, right before the return
* type, but after "static" or "virtual":
*
* \code
* TDE_DEPRECATED void deprecatedInlineFunctionA() { .. }
* virtual TDE_DEPRECATED int deprecatedInlineFunctionB() { .. }
* static TDE_DEPRECATED bool deprecatedInlineFunctionC() { .. }
* \end
*
* You can also mark whole structs or classes as deprecated, by inserting the
* TDE_DEPRECATED macro after the struct/class keyword, but before the
* name of the struct/class:
*
* \code
* class TDE_DEPRECATED DeprecatedClass { };
* struct TDE_DEPRECATED DeprecatedStruct { };
* \endcode
*
* \note
* It does not make much sense to use the TDE_DEPRECATED keyword for a TQt signal;
* this is because usually get called by the class which they belong to,
* and one'd assume that a class author doesn't use deprecated methods of his
* own class. The only exception to this are signals which are connected to
* other signals; they get invoked from moc-generated code. In any case,
* printing a warning message in either case is not useful.
* For slots, it can make sense (since slots can be invoked directly) but be
* aware that if the slots get triggered by a signal, the will get called from
* moc code as well and thus the warnings are useless.
*
* \par
* Also note that it is not possible to use TDE_DEPRECATED for classes which
* use the k_dcop keyword (to indicate a DCOP interface declaration); this is
* because the dcopidl program would choke on the unexpected declaration
* syntax.
*/
#ifndef TDE_DEPRECATED
#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
/* gcc >= 3.2 */
# define TDE_DEPRECATED __attribute__ ((deprecated))
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
/* msvc >= 7 */
# define TDE_DEPRECATED __declspec(deprecated)
#else
# define TDE_DEPRECATED
#endif
#endif
/**
* This macro, and it's friends going up to 10 reserve a fixed number of virtual
* functions in a class. Because adding virtual functions to a class changes the
* size of the vtable, adding virtual functions to a class breaks binary
* compatibility. However, by using this macro, and decrementing it as new
* virtual methods are added, binary compatibility can still be preserved.
*
* \note The added functions must be added to the header at the same location
* as the macro; changing the order of virtual functions in a header is also
* binary incompatible as it breaks the layout of the vtable.
*/
#define RESERVE_VIRTUAL_1 \
virtual void reservedVirtual1() {}
#define RESERVE_VIRTUAL_2 \
virtual void reservedVirtual2() {} \
RESERVE_VIRTUAL_1
#define RESERVE_VIRTUAL_3 \
virtual void reservedVirtual3() {} \
RESERVE_VIRTUAL_2
#define RESERVE_VIRTUAL_4 \
virtual void reservedVirtual4() {} \
RESERVE_VIRTUAL_3
#define RESERVE_VIRTUAL_5 \
virtual void reservedVirtual5() {} \
RESERVE_VIRTUAL_4
#define RESERVE_VIRTUAL_6 \
virtual void reservedVirtual6() {} \
RESERVE_VIRTUAL_5
#define RESERVE_VIRTUAL_7 \
virtual void reservedVirtual7() {} \
RESERVE_VIRTUAL_6
#define RESERVE_VIRTUAL_8 \
virtual void reservedVirtual8() {} \
RESERVE_VIRTUAL_7
#define RESERVE_VIRTUAL_9 \
virtual void reservedVirtual9() {} \
RESERVE_VIRTUAL_8
#define RESERVE_VIRTUAL_10 \
virtual void reservedVirtual10() {} \
RESERVE_VIRTUAL_9
#endif /* _KDE_MACROS_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,89 +0,0 @@
/* This file is part of the KDE libraries
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.
*/
/***********************************************************************
************************************************************************
IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT
************************************************************************
************************************************************************
THIS IS ___NOT___ PART OF THE PUBLIC API YET. DON'T USE IT IN YOUR
APPLICATIONS,SINCE IT'S MOST PROBABLY ___NOT___ GOING TO STAY BINARY
COMPATIBLE. THIS HEADER IS ONLY INSTALLED, BECAUSE IT IS NEEDED IN
KDE 3.1'S KATE APPLICATON
************************************************************************
************************************************************************
IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT
************************************************************************
***********************************************************************/
#ifndef KDOCKWIDGET_P_H
#define KDOCKWIDGET_P_H
#include <kdockwidget.h>
#include <tqstringlist.h>
// Add some describing comment !!
class TDEUI_EXPORT KDockContainer
{
public:
KDockContainer();
virtual ~KDockContainer();
virtual KDockWidget *parentDockWidget();
virtual void insertWidget (KDockWidget *, TQPixmap, const TQString &, int &);
virtual void showWidget(KDockWidget *);
virtual void removeWidget(KDockWidget*);
virtual void undockWidget(KDockWidget*);
virtual void save(TDEConfig *cfg,const TQString& group_or_prefix);
virtual void save(TQDomElement& dockElement);
virtual void load(TDEConfig *cfg,const TQString& group_or_prefix);
virtual void load(TQDomElement& dockElement);
virtual void setToolTip (KDockWidget *, TQString &);
virtual void setPixmap(KDockWidget*,const TQPixmap&);
TQStringList containedWidgets() const;
virtual bool dockDragEnter(KDockWidget* dockWidget, TQMouseEvent *event);
virtual bool dockDragMove(KDockWidget* dockWidget, TQMouseEvent *event);
virtual bool dockDragLeave(KDockWidget* dockWidget, TQMouseEvent *event);
protected:
friend class KDockManager;
friend class KDockSplitter;
void prepareSave(TQStringList &names);
void activateOverlapMode(int nonOverlapSize);
void deactivateOverlapMode();
bool isOverlapMode();
private:
struct ListItem {
struct ListItem *prev;
struct ListItem *next;
char *data;
};
struct ListItem *m_childrenListBegin;
struct ListItem *m_childrenListEnd;
class KDockContainerPrivate;
KDockContainerPrivate *d;
bool m_overlapMode;
int m_nonOverlapSize;
};
#endif

@ -1,631 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Max Judin <novaprint@mtu-net.ru>
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 "kdockwidget.h"
#include "kdockwidget_p.h"
#include "kdockwidget_private.h"
#include <tqpainter.h>
#include <tqcursor.h>
#include <kdebug.h>
#include <tqtimer.h>
#include <tqapplication.h>
KDockSplitter::KDockSplitter(TQWidget *parent, const char *name, TQt::Orientation orient, int pos, bool highResolution)
: TQWidget(parent, name)
{
m_dontRecalc=false;
divider = 0L;
child0 = 0L;
child1 = 0L;
fixedWidth0=-1;
fixedWidth1=-1;
fixedHeight0=-1;
fixedHeight1=-1;
m_orientation = orient;
mOpaqueResize = false;
mKeepSize = false;
mHighResolution = highResolution;
setSeparatorPos( pos, false );
initialised = false;
}
void KDockSplitter::activate(TQWidget *c0, TQWidget *c1)
{
if ( c0 ) child0 = c0;
if ( c1 ) child1 = c1;
setupMinMaxSize();
if (divider) delete divider;
divider = new TQFrame(this, "pannerdivider");
divider->setFrameStyle(TQFrame::Panel | TQFrame::Raised);
divider->setLineWidth(1);
divider->raise();
if (m_orientation ==TQt::Horizontal)
divider->setCursor(TQCursor(sizeVerCursor));
else
divider->setCursor(TQCursor(sizeHorCursor));
divider->installEventFilter(this);
initialised= true;
updateName();
divider->show();
resizeEvent(0);
if (fixedWidth0!=-1) restoreFromForcedFixedSize((KDockWidget*)child0);
if (fixedWidth1!=-1) restoreFromForcedFixedSize((KDockWidget*)child1);
if (((KDockWidget*)child0)->forcedFixedWidth()!=-1)
{
setForcedFixedWidth(((KDockWidget*)child0),((KDockWidget*)child0)->forcedFixedWidth());
//TQTimer::singleShot(100,this,TQ_SLOT(delayedResize()));
}
else
if (((KDockWidget*)child1)->forcedFixedWidth()!=-1)
{
setForcedFixedWidth(((KDockWidget*)child1),((KDockWidget*)child1)->forcedFixedWidth());
//TQTimer::singleShot(100,this,TQ_SLOT(delayedResize()));
}
if (((KDockWidget*)child0)->forcedFixedHeight()!=-1)
{
setForcedFixedHeight(((KDockWidget*)child0),((KDockWidget*)child0)->forcedFixedHeight());
//TQTimer::singleShot(100,this,TQ_SLOT(delayedResize()));
}
else
if (((KDockWidget*)child1)->forcedFixedHeight()!=-1)
{
setForcedFixedHeight(((KDockWidget*)child1),((KDockWidget*)child1)->forcedFixedHeight());
//TQTimer::singleShot(100,this,TQ_SLOT(delayedResize()));
}
}
/*
void KDockSplitter::delayedResize()
{
kdDebug(282)<<"*********************** DELAYED RESIZE !!!!!!!!!!!!!!!"<<endl;
resizeEvent(0);
}*/
void KDockSplitter::setForcedFixedWidth(KDockWidget *dw,int w)
{
int factor = (mHighResolution)? 10000:100;
if (dw==child0)
{
if (fixedWidth0==-1) savedXPos=xpos;
if (w==fixedWidth0) return;
fixedWidth0=w;
setSeparatorPos(w*factor/width(),true);
// setupMinMaxSize();
// kdDebug(282)<<"Set forced fixed width for widget 0 :"<<w<<endl;
}
else
{
if (fixedWidth1==-1) savedXPos=xpos;
if (w==fixedWidth1) return;
fixedWidth1=w;
setSeparatorPos((width()-w)*factor/width(),true);
// kdDebug(282)<<"Set forced fixed width for widget 1 :"<<w<<endl;
// kdDebug(282)<<"Width() :"<<width()<<endl;
}
divider->hide();
setupMinMaxSize();
}
void KDockSplitter::setForcedFixedHeight(KDockWidget *dw,int h)
{
int factor = (mHighResolution)? 10000:100;
if (dw==child0)
{
if (fixedHeight0==-1) savedXPos=xpos;
if (h==fixedHeight0) return;
fixedHeight0=h;
// setupMinMaxSize();
setSeparatorPos(h*factor/height(),true);
// kdDebug(282)<<"Set forced fixed width for widget 0 :"<<h<<endl;
}
else
{
if (fixedHeight1==-1) savedXPos=xpos;
if (h==fixedHeight1) return;
fixedHeight1=h;
setSeparatorPos((height()-h)*factor/height(),true);
// kdDebug(282)<<"Set forced fixed height for widget 1 :"<<h<<endl;
}
divider->hide();
setupMinMaxSize();
}
void KDockSplitter::restoreFromForcedFixedSize(KDockWidget *dw)
{
if (dw==child0)
{
fixedWidth0=-1;
fixedHeight0=-1;
setSeparatorPos(savedXPos,true);
}
else
{
fixedWidth1=-1;
fixedHeight1=-1;
setSeparatorPos(savedXPos,true);
}
divider->show();
}
void KDockSplitter::setupMinMaxSize()
{
// Set the minimum and maximum sizes
int minx, maxx, miny, maxy;
if (m_orientation ==TQt::Horizontal) {
miny = child0->minimumSize().height() + child1->minimumSize().height()+4;
maxy = child0->maximumSize().height() + child1->maximumSize().height()+4;
minx = (child0->minimumSize().width() > child1->minimumSize().width()) ? child0->minimumSize().width() : child1->minimumSize().width();
maxx = (child0->maximumSize().width() > child1->maximumSize().width()) ? child0->maximumSize().width() : child1->maximumSize().width();
miny = (miny > 4) ? miny : 4;
maxy = (maxy < 32000) ? maxy : 32000;
minx = (minx > 2) ? minx : 2;
maxx = (maxx < 32000) ? maxx : 32000;
} else {
minx = child0->minimumSize().width() + child1->minimumSize().width()+4;
maxx = child0->maximumSize().width() + child1->maximumSize().width()+4;
miny = (child0->minimumSize().height() > child1->minimumSize().height()) ? child0->minimumSize().height() : child1->minimumSize().height();
maxy = (child0->maximumSize().height() > child1->maximumSize().height()) ? child0->maximumSize().height() : child1->maximumSize().height();
minx = (minx > 4) ? minx : 4;
maxx = (maxx < 32000) ? maxx : 32000;
miny = (miny > 2) ? miny : 2;
maxy = (maxy < 32000) ? maxy : 32000;
}
setMinimumSize(minx, miny);
setMaximumSize(maxx, maxy);
}
void KDockSplitter::deactivate()
{
delete divider;
divider = 0L;
initialised= false;
}
void KDockSplitter::setSeparatorPos(int pos, bool do_resize)
{
xpos = pos;
if (do_resize)
resizeEvent(0);
}
void KDockSplitter::setSeparatorPosX( int pos, bool do_resize )
{
savedXPos = pos;
setSeparatorPos( pos, do_resize );
}
int KDockSplitter::separatorPos() const
{
return xpos;
}
void KDockSplitter::resizeEvent(TQResizeEvent *ev)
{
// kdDebug(282)<<"ResizeEvent :"<< ((initialised) ? "initialised":"not initialised")<<", "<< ((ev) ? "real event":"")<<
// ", "<<(isVisible() ?"visible":"")<<endl;
if (initialised){
double factor = (mHighResolution)? 10000.0:100.0;
// real resize event, recalculate xpos
if (ev && mKeepSize && isVisible()) {
// kdDebug(282)<<"mKeepSize : "<< ((m_orientation ==TQt::Horizontal) ? "Horizontal":"Vertical") <<endl;
if (ev->oldSize().width() != ev->size().width())
{
if (m_orientation ==TQt::Horizontal) {
xpos = tqRound(factor * checkValue( child0->height()+1 ) / height());
} else {
xpos = tqRound(factor * checkValue( child0->width()+1 ) / width());
}
}
}
else
{
// kdDebug(282)<<"!mKeepSize : "<< ((m_orientation ==TQt::Horizontal) ? "Horizontal":"Vertical") <<endl;
if (/*ev &&*/ isVisible()) {
if (m_orientation ==TQt::Horizontal) {
/* if (ev->oldSize().height() != ev->size().height())*/
{
if (fixedHeight0!=-1)
// xpos=floor(fixedHeight0*factor/height());
xpos=tqRound(fixedHeight0*factor/height());
else
if (fixedHeight1!=-1)
// xpos=ceil((height()-fixedHeight1)*factor/height());
xpos=tqRound((height()-fixedHeight1)*factor/height());
}
}
else
{
/* if (ev->oldSize().width() != ev->size().width()) */
{
if (fixedWidth0!=-1)
// xpos=floor(fixedWidth0*factor/width());
xpos=tqRound(fixedWidth0*factor/width());
else
if (fixedWidth1!=-1)
// xpos=ceil((width()-fixedWidth1)*factor/width());
xpos=tqRound((width()-fixedWidth1)*factor/width());
}
}
}
// else kdDebug(282)<<"Something else happened"<<endl;
}
KDockContainer *dc;
KDockWidget *c0=(KDockWidget*)child0;
KDockWidget *c1=(KDockWidget*)child1;
bool stdHandling=false;
if ( ( (m_orientation==TQt::Vertical) &&((fixedWidth0==-1) && (fixedWidth1==-1)) ) ||
( (m_orientation==TQt::Horizontal) &&((fixedHeight0==-1) && (fixedHeight1==-1)) ) ) {
if ((c0->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c0->getWidget()))
&& (dc->m_overlapMode)) {
int position= tqRound((m_orientation ==TQt::Vertical ? width() : height()) * xpos/factor);
position=checkValueOverlapped(position,child0);
child0->raise();
divider->raise();
if (m_orientation ==TQt::Horizontal){
child0->setGeometry(0, 0, width(), position);
child1->setGeometry(0, dc->m_nonOverlapSize+4, width(),
height()-dc->m_nonOverlapSize-4);
divider->setGeometry(0, position, width(), 4);
} else {
child0->setGeometry(0, 0, position, height());
child1->setGeometry(dc->m_nonOverlapSize+4, 0,
width()-dc->m_nonOverlapSize-4, height());
divider->setGeometry(position, 0, 4, height());
}
} else {
if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))
&& (dc->m_overlapMode)) {
int position= tqRound((m_orientation ==TQt::Vertical ? width() : height()) * xpos/factor);
position=checkValueOverlapped(position,child1);
child1->raise();
divider->raise();
if (m_orientation ==TQt::Horizontal){
child0->setGeometry(0, 0, width(), height()-dc->m_nonOverlapSize-4);
child1->setGeometry(0, position+4, width(),
height()-position-4);
divider->setGeometry(0, position, width(), 4);
} else {
child0->setGeometry(0, 0, width()-dc->m_nonOverlapSize-4, height());
child1->setGeometry(position+4, 0,
width()-position-4, height());
divider->setGeometry(position, 0, 4, height());
}
}
else stdHandling=true;
}
}
else stdHandling=true;
if (stdHandling) {
int position = checkValue( tqRound((m_orientation ==TQt::Vertical ? width() : height()) * xpos/factor) );
if (m_orientation ==TQt::Horizontal){
child0->setGeometry(0, 0, width(), position);
child1->setGeometry(0, position+4, width(), height()-position-4);
divider->setGeometry(0, position, width(), 4);
} else {
child0->setGeometry(0, 0, position, height());
child1->setGeometry(position+4, 0, width()-position-4, height());
divider->setGeometry(position, 0, 4, height());
}
}
}
}
int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidget) const {
if (initialised) {
if (m_orientation ==TQt::Vertical) {
if (child0==overlappingWidget) {
if (position<(child0->minimumSize().width()))
position=child0->minimumSize().width();
if (position>width()) position=width()-4;
} else if (position>(width()-(child1->minimumSize().width())-4)){
position=width()-(child1->minimumSize().width())-4;
if (position<0) position=0;
}
} else {// orientation ==TQt::Horizontal
if (child0==overlappingWidget) {
if (position<(child0->minimumSize().height()))
position=child0->minimumSize().height();
if (position>height()) position=height()-4;
} else if (position>(height()-(child1->minimumSize().height())-4)){
position=height()-(child1->minimumSize().height())-4;
if (position<0) position=0;
}
}
}
return position;
}
int KDockSplitter::checkValue( int position ) const
{
if (initialised){
if (m_orientation ==TQt::Vertical){
if (position < (child0->minimumSize().width()))
position = child0->minimumSize().width();
if ((width()-4-position) < (child1->minimumSize().width()))
position = width() - (child1->minimumSize().width()) -4;
} else {
if (position < (child0->minimumSize().height()))
position = (child0->minimumSize().height());
if ((height()-4-position) < (child1->minimumSize().height()))
position = height() - (child1->minimumSize().height()) -4;
}
}
if (position < 0) position = 0;
if ((m_orientation ==TQt::Vertical) && (position > width()))
position = width();
if ((m_orientation ==TQt::Horizontal) && (position > height()))
position = height();
return position;
}
bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e)
{
TQMouseEvent *mev;
bool handled = false;
int factor = (mHighResolution)? 10000:100;
switch (e->type()) {
case TQEvent::MouseMove:
mev= (TQMouseEvent*)e;
child0->setUpdatesEnabled(mOpaqueResize);
child1->setUpdatesEnabled(mOpaqueResize);
if (m_orientation ==TQt::Horizontal) {
if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
{
handled=true; break;
}
if (!mOpaqueResize) {
int position = checkValue( mapFromGlobal(mev->globalPos()).y() );
divider->move( 0, position );
} else {
xpos = factor * checkValue( mapFromGlobal(mev->globalPos()).y() ) / height();
resizeEvent(0);
divider->repaint(true);
}
} else {
if ((fixedWidth0!=-1) || (fixedWidth1!=-1))
{
handled=true; break;
}
if (!mOpaqueResize) {
int position = checkValue( mapFromGlobal(TQCursor::pos()).x() );
divider->move( position, 0 );
} else {
xpos = factor * checkValue( mapFromGlobal( mev->globalPos()).x() ) / width();
resizeEvent(0);
divider->repaint(true);
}
}
handled= true;
break;
case TQEvent::MouseButtonRelease:
child0->setUpdatesEnabled(true);
child1->setUpdatesEnabled(true);
mev= (TQMouseEvent*)e;
if (m_orientation ==TQt::Horizontal){
if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
{
handled=true; break;
}
xpos = factor* checkValue( mapFromGlobal(mev->globalPos()).y() ) / height();
resizeEvent(0);
divider->repaint(true);
} else {
if ((fixedWidth0!=-1) || (fixedWidth1!=-1))
{
handled=true; break;
}
xpos = factor* checkValue( mapFromGlobal(mev->globalPos()).x() ) / width();
resizeEvent(0);
divider->repaint(true);
}
handled= true;
break;
default:
break;
}
return (handled) ? true : TQWidget::eventFilter( o, e );
}
bool KDockSplitter::event( TQEvent* e )
{
if ( e->type() == TQEvent::LayoutHint ){
// change children min/max size
setupMinMaxSize();
setSeparatorPos(xpos);
}
return TQWidget::event(e);
}
TQWidget* KDockSplitter::getAnother( TQWidget* w ) const
{
return ( w == child0 ) ? child1 : child0;
}
void KDockSplitter::updateName()
{
if ( !initialised ) return;
TQString new_name = TQString( child0->name() ) + "," + child1->name();
parentWidget()->setName( new_name.latin1() );
parentWidget()->setCaption( child0->caption() + "," + child1->caption() );
parentWidget()->repaint( false );
((KDockWidget*)parentWidget())->firstName = child0->name();
((KDockWidget*)parentWidget())->lastName = child1->name();
((KDockWidget*)parentWidget())->splitterOrientation = m_orientation;
TQWidget* p = parentWidget()->parentWidget();
if ( p && p->inherits("KDockSplitter" ) )
((KDockSplitter*)p)->updateName();
}
void KDockSplitter::setOpaqueResize(bool b)
{
mOpaqueResize = b;
}
bool KDockSplitter::opaqueResize() const
{
return mOpaqueResize;
}
void KDockSplitter::setKeepSize(bool b)
{
mKeepSize = b;
}
bool KDockSplitter::keepSize() const
{
return mKeepSize;
}
void KDockSplitter::setHighResolution(bool b)
{
if (mHighResolution) {
if (!b) xpos = xpos/100;
} else {
if (b) xpos = xpos*100;
}
mHighResolution = b;
}
bool KDockSplitter::highResolution() const
{
return mHighResolution;
}
/*************************************************************************/
KDockButton_Private::KDockButton_Private( TQWidget *parent, const char * name )
:TQPushButton( parent, name )
{
moveMouse = false;
setFocusPolicy( TQWidget::NoFocus );
}
KDockButton_Private::~KDockButton_Private()
{
}
void KDockButton_Private::drawButton( TQPainter* p )
{
p->fillRect( 0,0, width(), height(), TQBrush(colorGroup().brush(TQColorGroup::Background)) );
p->drawPixmap( (width() - pixmap()->width()) / 2, (height() - pixmap()->height()) / 2, *pixmap() );
if ( moveMouse && !isDown() ){
p->setPen( white );
p->moveTo( 0, height() - 1 );
p->lineTo( 0, 0 );
p->lineTo( width() - 1, 0 );
p->setPen( colorGroup().dark() );
p->lineTo( width() - 1, height() - 1 );
p->lineTo( 0, height() - 1 );
}
if ( isOn() || isDown() ){
p->setPen( colorGroup().dark() );
p->moveTo( 0, height() - 1 );
p->lineTo( 0, 0 );
p->lineTo( width() - 1, 0 );
p->setPen( white );
p->lineTo( width() - 1, height() - 1 );
p->lineTo( 0, height() - 1 );
}
}
void KDockButton_Private::enterEvent( TQEvent * )
{
moveMouse = true;
repaint();
}
void KDockButton_Private::leaveEvent( TQEvent * )
{
moveMouse = false;
repaint();
}
/*************************************************************************/
KDockWidgetPrivate::KDockWidgetPrivate()
: TQObject()
,index(-1)
,splitPosInPercent(50)
,pendingFocusInEvent(false)
,blockHasUndockedSignal(false)
,pendingDtor(false)
,forcedWidth(-1)
,forcedHeight(-1)
,isContainer(false)
,container(0)
,resizePos(0,0)
,resizing(false)
{
#ifndef NO_KDE2
windowType = NET::Normal;
#endif
_parent = 0L;
transient = false;
}
KDockWidgetPrivate::~KDockWidgetPrivate()
{
}
void KDockWidgetPrivate::slotFocusEmbeddedWidget(TQWidget* w)
{
if (w) {
TQWidget* embeddedWdg = ((KDockWidget*)w)->getWidget();
if (embeddedWdg && ((embeddedWdg->focusPolicy() == TQWidget::ClickFocus) || (embeddedWdg->focusPolicy() == TQWidget::StrongFocus))) {
embeddedWdg->setFocus();
}
}
}
#ifndef NO_INCLUDE_MOCFILES // for TQt-only projects, because tmake doesn't take this name
#include "kdockwidget_private.moc"
#endif

@ -1,207 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Max Judin <novaprint@mtu-net.ru>
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.
*/
/*
IMPORTANT Note: This file compiles also in TQt-only mode by using the NO_KDE2 precompiler definition
*/
#ifndef KDOCKWIDGET_PRIVATE_H
#define KDOCKWIDGET_PRIVATE_H
#include <tqwidget.h>
#include <tqpushbutton.h>
#ifndef NO_KDE2
#include <netwm_def.h>
#endif
class TQFrame;
class KDockContainer;
/**
* Like TQSplitter but specially designed for dockwidgets stuff.
* @internal
*
* @author Max Judin.
*/
class TDEUI_EXPORT KDockSplitter : public TQWidget
{
TQ_OBJECT
public:
KDockSplitter(TQWidget *parent= 0, const char *name= 0, Orientation orient=TQt::Vertical, int pos= 50, bool highResolution=false);
virtual ~KDockSplitter(){};
void activate(TQWidget *c0, TQWidget *c1 = 0L);
void deactivate();
int separatorPos() const;
void setSeparatorPos(int pos, bool do_resize = true);
/**
* For usage from outside.
* If the splitter is in fixed position when called,
* the value of @p pos will be saved and used when the splitter
* is restored.
* If @p do_resize is true, the size will be changed unless the splitter
* is in fixed mode.
*/
// ### please come up with a nicer name
void setSeparatorPosX(int pos, bool do_resize=false);
virtual bool eventFilter(TQObject *, TQEvent *);
virtual bool event( TQEvent * );
TQWidget* getFirst() const { return child0; }
TQWidget* getLast() const { return child1; }
TQWidget* getAnother( TQWidget* ) const;
void updateName();
void setOpaqueResize(bool b=true);
bool opaqueResize() const;
void setKeepSize(bool b=true);
bool keepSize() const;
void setHighResolution(bool b=true);
bool highResolution() const;
void setForcedFixedWidth(KDockWidget *dw,int w);
void setForcedFixedHeight(KDockWidget *dw,int h);
void restoreFromForcedFixedSize(KDockWidget *dw);
Orientation orientation(){return m_orientation;}
protected:
friend class KDockContainer;
int checkValue( int ) const;
int checkValueOverlapped( int ,TQWidget*) const;
virtual void resizeEvent(TQResizeEvent *);
/*
protected slots:
void delayedResize();*/
private:
void setupMinMaxSize();
TQWidget *child0, *child1;
Orientation m_orientation;
bool initialised;
TQFrame* divider;
int xpos, savedXPos;
bool mOpaqueResize, mKeepSize, mHighResolution;
int fixedWidth0,fixedWidth1;
int fixedHeight0,fixedHeight1;
bool m_dontRecalc;
};
/**
* A mini-button usually placed in the dockpanel.
* @internal
*
* @author Max Judin.
*/
class TDEUI_EXPORT KDockButton_Private : public TQPushButton
{
TQ_OBJECT
public:
KDockButton_Private( TQWidget *parent=0, const char *name=0 );
~KDockButton_Private();
protected:
virtual void drawButton( TQPainter * );
virtual void enterEvent( TQEvent * );
virtual void leaveEvent( TQEvent * );
private:
bool moveMouse;
};
/**
* resizing enum
**/
/**
* additional KDockWidget stuff (private)
*/
class TDEUI_EXPORT KDockWidgetPrivate : public TQObject
{
TQ_OBJECT
public:
KDockWidgetPrivate();
~KDockWidgetPrivate();
public slots:
/**
* Especially used for Tab page docking. Switching the pages requires additional setFocus() for the embedded widget.
*/
void slotFocusEmbeddedWidget(TQWidget* w = 0L);
public:
enum KDockWidgetResize
{ResizeLeft,ResizeTop,ResizeRight,ResizeBottom,ResizeBottomLeft,ResizeTopLeft,ResizeBottomRight,ResizeTopRight};
int index;
int splitPosInPercent;
bool pendingFocusInEvent;
bool blockHasUndockedSignal;
bool pendingDtor;
int forcedWidth;
int forcedHeight;
bool isContainer;
#ifndef NO_KDE2
NET::WindowType windowType;
#endif
TQWidget *_parent;
bool transient;
TQGuardedPtr<TQWidget> container;
TQPoint resizePos;
bool resizing;
KDockWidgetResize resizeMode;
};
class TDEUI_EXPORT KDockWidgetHeaderPrivate
: public TQObject
{
public:
KDockWidgetHeaderPrivate( TQObject* parent )
: TQObject( parent )
{
forceCloseButtonHidden=false;
toDesktopButton = 0;
showToDesktopButton = true;
topLevel = false;
dummy=0;
}
KDockButton_Private* toDesktopButton;
bool showToDesktopButton;
bool topLevel;
TQPtrList<KDockButton_Private> btns;
bool forceCloseButtonHidden;
TQWidget *dummy;
};
#endif

@ -1,426 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2003 Stephan Binner <binner@kde.org>
Copyright (C) 2003 Zack Rusin <zack@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 <tqapplication.h>
#include <tqcursor.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <tqtimer.h>
#include <tqpushbutton.h>
#include <tqtooltip.h>
#include <tdeglobalsettings.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include "ktabbar.h"
#include "ktabwidget.h"
KTabBar::KTabBar( TQWidget *parent, const char *name )
: TQTabBar( parent, name ), mReorderStartTab( -1 ), mReorderPreviousTab( -1 ),
mHoverCloseButtonTab( 0 ), mDragSwitchTab( 0 ), mHoverCloseButton( 0 ),
mHoverCloseButtonEnabled( false ), mHoverCloseButtonDelayed( true ),
mTabReorderingEnabled( false ), mTabCloseActivatePrevious( false )
{
setAcceptDrops( true );
setMouseTracking( true );
mEnableCloseButtonTimer = new TQTimer( this );
connect( mEnableCloseButtonTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( enableCloseButton() ) );
mActivateDragSwitchTabTimer = new TQTimer( this );
connect( mActivateDragSwitchTabTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( activateDragSwitchTab() ) );
connect(this, TQ_SIGNAL(layoutChanged()), TQ_SLOT(onLayoutChange()));
}
KTabBar::~KTabBar()
{
//For the future
//delete d;
}
void KTabBar::setTabEnabled( int id, bool enabled )
{
TQTab * t = tab( id );
if ( t ) {
if ( t->isEnabled() != enabled ) {
t->setEnabled( enabled );
TQRect r( t->rect() );
if ( !enabled && id == currentTab() && count()>1 ) {
TQPtrList<TQTab> *tablist = tabList();
if ( mTabCloseActivatePrevious )
t = tablist->at( count()-2 );
else {
int index = indexOf( id );
index += ( index+1 == count() ) ? -1 : 1;
t = tabAt( index );
}
if ( t->isEnabled() ) {
r = r.unite( t->rect() );
tablist->append( tablist->take( tablist->findRef( t ) ) );
emit selected( t->identifier() );
}
}
repaint( r );
}
}
}
void KTabBar::mouseDoubleClickEvent( TQMouseEvent *e )
{
if( e->button() != TQt::LeftButton )
return;
TQTab *tab = selectTab( e->pos() );
if( tab ) {
emit( mouseDoubleClick( indexOf( tab->identifier() ) ) );
return;
}
TQTabBar::mouseDoubleClickEvent( e );
}
void KTabBar::mousePressEvent( TQMouseEvent *e )
{
if( e->button() == TQt::LeftButton ) {
mEnableCloseButtonTimer->stop();
mDragStart = e->pos();
}
else if( e->button() == TQt::RightButton ) {
TQTab *tab = selectTab( e->pos() );
if( tab ) {
emit( contextMenu( indexOf( tab->identifier() ), mapToGlobal( e->pos() ) ) );
return;
}
}
TQTabBar::mousePressEvent( e );
}
void KTabBar::mouseMoveEvent( TQMouseEvent *e )
{
if ( e->state() == TQt::LeftButton ) {
TQTab *tab = selectTab( e->pos() );
if ( mDragSwitchTab && tab != mDragSwitchTab ) {
mActivateDragSwitchTabTimer->stop();
mDragSwitchTab = 0;
}
int delay = TDEGlobalSettings::dndEventDelay();
TQPoint newPos = e->pos();
if( newPos.x() > mDragStart.x()+delay || newPos.x() < mDragStart.x()-delay ||
newPos.y() > mDragStart.y()+delay || newPos.y() < mDragStart.y()-delay )
{
if( tab ) {
emit( initiateDrag( indexOf( tab->identifier() ) ) );
return;
}
}
}
else if ( e->state() == TQt::MidButton ) {
if (mReorderStartTab==-1) {
int delay = TDEGlobalSettings::dndEventDelay();
TQPoint newPos = e->pos();
if( newPos.x() > mDragStart.x()+delay || newPos.x() < mDragStart.x()-delay ||
newPos.y() > mDragStart.y()+delay || newPos.y() < mDragStart.y()-delay )
{
TQTab *tab = selectTab( e->pos() );
if( tab && mTabReorderingEnabled ) {
mReorderStartTab = indexOf( tab->identifier() );
grabMouse( sizeAllCursor );
return;
}
}
}
else {
TQTab *tab = selectTab( e->pos() );
if( tab ) {
int reorderStopTab = indexOf( tab->identifier() );
if ( mReorderStartTab!=reorderStopTab && mReorderPreviousTab!=reorderStopTab ) {
emit( moveTab( mReorderStartTab, reorderStopTab ) );
mReorderPreviousTab=mReorderStartTab;
mReorderStartTab=reorderStopTab;
return;
}
}
}
}
if ( mHoverCloseButtonEnabled && mReorderStartTab==-1) {
TQTab *t = selectTab( e->pos() );
if( t && t->iconSet() && t->isEnabled() ) {
TQPixmap pixmap = t->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal );
TQRect rect( 0, 0, pixmap.width() + 4, pixmap.height() +4);
int xoff = 0, yoff = 0;
// The additional offsets were found by try and error, TODO: find the rational behind them
if ( t == tab( currentTab() ) ) {
xoff = style().pixelMetric( TQStyle::PM_TabBarTabShiftHorizontal, this ) + 3;
yoff = style().pixelMetric( TQStyle::PM_TabBarTabShiftVertical, this ) - 4;
}
else {
xoff = 7;
yoff = 0;
}
rect.moveLeft( t->rect().left() + 2 + xoff );
rect.moveTop( t->rect().center().y()-pixmap.height()/2 + yoff );
if ( rect.contains( e->pos() ) ) {
if ( mHoverCloseButton ) {
if ( mHoverCloseButtonTab == t )
return;
mEnableCloseButtonTimer->stop();
delete mHoverCloseButton;
}
mHoverCloseButton = new TQPushButton( this );
mHoverCloseButton->setIconSet( TDEGlobal::iconLoader()->loadIconSet("window-close", TDEIcon::Toolbar, TDEIcon::SizeSmall) );
mHoverCloseButton->setGeometry( rect );
TQToolTip::add(mHoverCloseButton,i18n("Close this tab"));
mHoverCloseButton->setFlat(true);
mHoverCloseButton->show();
if ( mHoverCloseButtonDelayed ) {
mHoverCloseButton->setEnabled(false);
mEnableCloseButtonTimer->start( TQApplication::doubleClickInterval(), true );
}
mHoverCloseButtonTab = t;
connect( mHoverCloseButton, TQ_SIGNAL( clicked() ), TQ_SLOT( closeButtonClicked() ) );
return;
}
}
if ( mHoverCloseButton ) {
mEnableCloseButtonTimer->stop();
delete mHoverCloseButton;
mHoverCloseButton = 0;
}
}
TQTabBar::mouseMoveEvent( e );
}
void KTabBar::enableCloseButton()
{
mHoverCloseButton->setEnabled(true);
}
void KTabBar::activateDragSwitchTab()
{
TQTab *tab = selectTab( mapFromGlobal( TQCursor::pos() ) );
if ( tab && mDragSwitchTab == tab )
setCurrentTab( mDragSwitchTab );
mDragSwitchTab = 0;
}
void KTabBar::mouseReleaseEvent( TQMouseEvent *e )
{
if( e->button() == TQt::MidButton ) {
if ( mReorderStartTab==-1 ) {
TQTab *tab = selectTab( e->pos() );
if( tab ) {
emit( mouseMiddleClick( indexOf( tab->identifier() ) ) );
return;
}
}
else {
releaseMouse();
setCursor( arrowCursor );
mReorderStartTab=-1;
mReorderPreviousTab=-1;
}
}
TQTabBar::mouseReleaseEvent( e );
}
void KTabBar::dragMoveEvent( TQDragMoveEvent *e )
{
TQTab *tab = selectTab( e->pos() );
if( tab ) {
bool accept = false;
// The receivers of the testCanDecode() signal has to adjust
// 'accept' accordingly.
emit testCanDecode( e, accept);
if ( accept && tab != TQTabBar::tab( currentTab() ) ) {
mDragSwitchTab = tab;
mActivateDragSwitchTabTimer->start( TQApplication::doubleClickInterval()*2, true );
}
e->accept( accept );
return;
}
e->accept( false );
TQTabBar::dragMoveEvent( e );
}
void KTabBar::dropEvent( TQDropEvent *e )
{
TQTab *tab = selectTab( e->pos() );
if( tab ) {
mActivateDragSwitchTabTimer->stop();
mDragSwitchTab = 0;
emit( receivedDropEvent( indexOf( tab->identifier() ) , e ) );
return;
}
TQTabBar::dropEvent( e );
}
#ifndef TQT_NO_WHEELEVENT
void KTabBar::wheelEvent( TQWheelEvent *e )
{
if ( e->orientation() ==TQt::Horizontal )
return;
emit( wheelDelta( e->delta() ) );
}
#endif
void KTabBar::setTabColor( int id, const TQColor& color )
{
TQTab *t = tab( id );
if ( t ) {
mTabColors.insert( id, color );
repaint( t->rect(), false );
}
}
const TQColor &KTabBar::tabColor( int id ) const
{
if ( mTabColors.contains( id ) )
return mTabColors[id];
return colorGroup().foreground();
}
int KTabBar::insertTab( TQTab *t, int index )
{
int res = TQTabBar::insertTab( t, index );
if ( mTabCloseActivatePrevious && count() > 2 ) {
TQPtrList<TQTab> *tablist = tabList();
tablist->insert( count()-2, tablist->take( tablist->findRef( t ) ) );
}
return res;
}
void KTabBar::removeTab( TQTab *t )
{
mTabColors.remove( t->identifier() );
TQTabBar::removeTab( t );
}
void KTabBar::paintLabel( TQPainter *p, const TQRect& br,
TQTab *t, bool has_focus ) const
{
TQRect r = br;
bool selected = currentTab() == t->identifier();
if ( t->iconSet() ) {
// the tab has an iconset, draw it in the right mode
TQIconSet::Mode mode = ( t->isEnabled() && isEnabled() )
? TQIconSet::Normal : TQIconSet::Disabled;
if ( mode == TQIconSet::Normal && has_focus )
mode = TQIconSet::Active;
TQPixmap pixmap = t->iconSet()->pixmap( TQIconSet::Small, mode );
int pixw = pixmap.width();
int pixh = pixmap.height();
r.setLeft( r.left() + pixw + 4 );
r.setRight( r.right() + 2 );
int inactiveXShift = style().pixelMetric( TQStyle::PM_TabBarTabShiftHorizontal, this );
int inactiveYShift = style().pixelMetric( TQStyle::PM_TabBarTabShiftVertical, this );
int right = t->text().isEmpty() ? br.right() - pixw : br.left() + 2;
p->drawPixmap( right + (selected ? 0 : inactiveXShift),
br.center().y() - pixh / 2 + (selected ? 0 : inactiveYShift),
pixmap );
}
TQStyle::SFlags flags = TQStyle::Style_Default;
if ( isEnabled() && t->isEnabled() )
flags |= TQStyle::Style_Enabled;
if ( has_focus )
flags |= TQStyle::Style_HasFocus;
TQColorGroup cg( colorGroup() );
if ( mTabColors.contains( t->identifier() ) )
cg.setColor( TQColorGroup::Foreground, mTabColors[t->identifier()] );
style().drawControl( TQStyle::CE_TabBarLabel, p, this, r,
t->isEnabled() ? cg : palette().disabled(),
flags, TQStyleOption(t) );
}
bool KTabBar::isTabReorderingEnabled() const
{
return mTabReorderingEnabled;
}
void KTabBar::setTabReorderingEnabled( bool on )
{
mTabReorderingEnabled = on;
}
bool KTabBar::tabCloseActivatePrevious() const
{
return mTabCloseActivatePrevious;
}
void KTabBar::setTabCloseActivatePrevious( bool on )
{
mTabCloseActivatePrevious = on;
}
void KTabBar::closeButtonClicked()
{
emit closeRequest( indexOf( mHoverCloseButtonTab->identifier() ) );
}
void KTabBar::setHoverCloseButton( bool button )
{
mHoverCloseButtonEnabled = button;
if ( !button )
onLayoutChange();
}
bool KTabBar::hoverCloseButton() const
{
return mHoverCloseButtonEnabled;
}
void KTabBar::setHoverCloseButtonDelayed( bool delayed )
{
mHoverCloseButtonDelayed = delayed;
}
bool KTabBar::hoverCloseButtonDelayed() const
{
return mHoverCloseButtonDelayed;
}
void KTabBar::onLayoutChange()
{
mEnableCloseButtonTimer->stop();
delete mHoverCloseButton;
mHoverCloseButton = 0;
mHoverCloseButtonTab = 0;
mActivateDragSwitchTabTimer->stop();
mDragSwitchTab = 0;
}
#include "ktabbar.moc"

@ -1,114 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2003 Stephan Binner <binner@kde.org>
Copyright (C) 2003 Zack Rusin <zack@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 KTABBAR_H
#define KTABBAR_H
#include <tqtabbar.h>
#include <tdelibs_export.h>
class TQTimer;
class TQPushButton;
class KTabBarPrivate;
/**
* @since 3.2
*/
class TDEUI_EXPORT KTabBar: public TQTabBar
{
TQ_OBJECT
public:
KTabBar( TQWidget* parent=0, const char* name=0 );
virtual ~KTabBar();
virtual void setTabEnabled( int, bool );
const TQColor &tabColor( int ) const;
void setTabColor( int, const TQColor& );
virtual int insertTab( TQTab *, int index = -1 );
virtual void removeTab( TQTab * );
void setTabReorderingEnabled( bool enable );
bool isTabReorderingEnabled() const;
void setHoverCloseButton( bool );
bool hoverCloseButton() const;
void setHoverCloseButtonDelayed( bool );
bool hoverCloseButtonDelayed() const;
void setTabCloseActivatePrevious( bool );
bool tabCloseActivatePrevious() const;
signals:
void contextMenu( int, const TQPoint & );
void mouseDoubleClick( int );
void mouseMiddleClick( int );
void initiateDrag( int );
void testCanDecode(const TQDragMoveEvent *e, bool &accept /* result */);
void receivedDropEvent( int, TQDropEvent * );
void moveTab( int, int );
void closeRequest( int );
#ifndef TQT_NO_WHEELEVENT
void wheelDelta( int );
#endif
protected:
virtual void mouseDoubleClickEvent( TQMouseEvent *e );
virtual void mousePressEvent( TQMouseEvent *e );
virtual void mouseMoveEvent( TQMouseEvent *e );
virtual void mouseReleaseEvent( TQMouseEvent *e );
#ifndef TQT_NO_WHEELEVENT
virtual void wheelEvent( TQWheelEvent *e );
#endif
virtual void dragMoveEvent( TQDragMoveEvent *e );
virtual void dropEvent( TQDropEvent *e );
virtual void paintLabel( TQPainter*, const TQRect&, TQTab*, bool ) const;
protected slots:
virtual void closeButtonClicked();
virtual void onLayoutChange();
virtual void enableCloseButton();
virtual void activateDragSwitchTab();
private:
TQPoint mDragStart;
int mReorderStartTab;
int mReorderPreviousTab;
TQMap<int, TQColor> mTabColors;
TQTab *mHoverCloseButtonTab, *mDragSwitchTab;
TQPushButton *mHoverCloseButton;
TQTimer *mEnableCloseButtonTimer, *mActivateDragSwitchTabTimer;
bool mHoverCloseButtonEnabled;
bool mHoverCloseButtonDelayed;
bool mTabReorderingEnabled;
bool mTabCloseActivatePrevious;
KTabBarPrivate * d;
};
#endif

@ -1,523 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2003 Stephan Binner <binner@kde.org>
Copyright (C) 2003 Zack Rusin <zack@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 <tqapplication.h>
#include <tqstyle.h>
#include <tdeconfig.h>
#include <kiconloader.h>
#include <kstringhandler.h>
#include "ktabwidget.h"
#include "ktabbar.h"
class KTabWidgetPrivate {
public:
bool m_automaticResizeTabs;
int m_maxLength;
int m_minLength;
unsigned int m_CurrentMaxLength;
//holds the full names of the tab, otherwise all we
//know about is the shortened name
TQStringList m_tabNames;
KTabWidgetPrivate() {
m_automaticResizeTabs = false;
TDEConfigGroupSaver groupsaver(TDEGlobal::config(), "General");
m_maxLength = TDEGlobal::config()->readNumEntry("MaximumTabLength", 30);
m_minLength = TDEGlobal::config()->readNumEntry("MinimumTabLength", 3);
m_CurrentMaxLength = m_minLength;
}
};
KTabWidget::KTabWidget( TQWidget *parent, const char *name, WFlags f )
: TQTabWidget( parent, name, f )
{
d = new KTabWidgetPrivate;
setTabBar( new KTabBar(this, "tabbar") );
setAcceptDrops( true );
connect(tabBar(), TQ_SIGNAL(contextMenu( int, const TQPoint & )), TQ_SLOT(contextMenu( int, const TQPoint & )));
connect(tabBar(), TQ_SIGNAL(mouseDoubleClick( int )), TQ_SLOT(mouseDoubleClick( int )));
connect(tabBar(), TQ_SIGNAL(mouseMiddleClick( int )), TQ_SLOT(mouseMiddleClick( int )));
connect(tabBar(), TQ_SIGNAL(initiateDrag( int )), TQ_SLOT(initiateDrag( int )));
connect(tabBar(), TQ_SIGNAL(testCanDecode(const TQDragMoveEvent *, bool & )), TQ_SIGNAL(testCanDecode(const TQDragMoveEvent *, bool & )));
connect(tabBar(), TQ_SIGNAL(receivedDropEvent( int, TQDropEvent * )), TQ_SLOT(receivedDropEvent( int, TQDropEvent * )));
connect(tabBar(), TQ_SIGNAL(moveTab( int, int )), TQ_SLOT(moveTab( int, int )));
connect(tabBar(), TQ_SIGNAL(closeRequest( int )), TQ_SLOT(closeRequest( int )));
#ifndef TQT_NO_WHEELEVENT
connect(tabBar(), TQ_SIGNAL(wheelDelta( int )), TQ_SLOT(wheelDelta( int )));
#endif
}
KTabWidget::~KTabWidget()
{
delete d;
}
void KTabWidget::insertTab( TQWidget *child, const TQString &label, int index )
{
TQTabWidget::insertTab( child, label, index );
}
void KTabWidget::insertTab( TQWidget *child, const TQIconSet& iconset, const TQString &label, int index )
{
TQTabWidget::insertTab( child, iconset, label, index );
}
void KTabWidget::insertTab( TQWidget *child, TQTab *tab, int index )
{
TQTabWidget::insertTab( child, tab, index);
if ( d->m_automaticResizeTabs ) {
if ( index < 0 || index >= count() ) {
d->m_tabNames.append( tab->text() );
resizeTabs( d->m_tabNames.count()-1 );
}
else {
d->m_tabNames.insert( d->m_tabNames.at( index ), tab->text() );
resizeTabs( index );
}
}
}
void KTabWidget::setTabBarHidden( bool hide )
{
TQWidget *rightcorner = this->cornerWidget( TopRight );
TQWidget *leftcorner = this->cornerWidget( TopLeft );
if ( hide ) {
if ( leftcorner ) leftcorner->hide();
if ( rightcorner ) rightcorner->hide();
tabBar()->hide();
} else {
tabBar()->show();
if ( leftcorner ) leftcorner->show();
if ( rightcorner ) rightcorner->show();
}
}
bool KTabWidget::isTabBarHidden() const
{
return !( tabBar()->isVisible() );
}
void KTabWidget::setTabColor( TQWidget *w, const TQColor& color )
{
TQTab *t = tabBar()->tabAt( indexOf( w ) );
if (t) {
static_cast<KTabBar*>(tabBar())->setTabColor( t->identifier(), color );
}
}
TQColor KTabWidget::tabColor( TQWidget *w ) const
{
TQTab *t = tabBar()->tabAt( indexOf( w ) );
if (t) {
return static_cast<KTabBar*>(tabBar())->tabColor( t->identifier() );
} else {
return TQColor();
}
}
void KTabWidget::setTabReorderingEnabled( bool on)
{
static_cast<KTabBar*>(tabBar())->setTabReorderingEnabled( on );
}
bool KTabWidget::isTabReorderingEnabled() const
{
return static_cast<KTabBar*>(tabBar())->isTabReorderingEnabled();
}
void KTabWidget::setTabCloseActivatePrevious( bool previous)
{
static_cast<KTabBar*>(tabBar())->setTabCloseActivatePrevious( previous );
}
bool KTabWidget::tabCloseActivatePrevious() const
{
return static_cast<KTabBar*>(tabBar())->tabCloseActivatePrevious();
}
unsigned int KTabWidget::tabBarWidthForMaxChars( uint maxLength )
{
int hframe, overlap;
hframe = tabBar()->style().pixelMetric( TQStyle::PM_TabBarTabHSpace, tabBar() );
overlap = tabBar()->style().pixelMetric( TQStyle::PM_TabBarTabOverlap, tabBar() );
TQFontMetrics fm = tabBar()->fontMetrics();
int x = 0;
for( int i=0; i < count(); ++i ) {
TQString newTitle = d->m_tabNames[ i ];
newTitle = KStringHandler::rsqueeze( newTitle, maxLength ).leftJustify( d->m_minLength, ' ' );
TQTab* tab = tabBar()->tabAt( i );
int lw = fm.width( newTitle );
int iw = 0;
if ( tab->iconSet() )
iw = tab->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4;
x += ( tabBar()->style().sizeFromContents( TQStyle::CT_TabBarTab, this,
TQSize( TQMAX( lw + hframe + iw, TQApplication::globalStrut().width() ), 0 ),
TQStyleOption( tab ) ) ).width();
}
return x;
}
void KTabWidget::changeTab( TQWidget *w, const TQString &label )
{
TQTabWidget::changeTab( w, label );
if ( d->m_automaticResizeTabs ) {
int index = indexOf( w );
if ( index != -1 ) {
d->m_tabNames[ index ] = label;
resizeTabs( index );
}
}
}
void KTabWidget::changeTab( TQWidget *w, const TQIconSet &iconset, const TQString &label )
{
TQTabWidget::changeTab( w, iconset, label );
if ( d->m_automaticResizeTabs ) {
int index = indexOf( w );
if ( index != -1 ) {
d->m_tabNames[ index ] = label;
resizeTabs( index );
}
}
}
TQString KTabWidget::label( int index ) const
{
if ( d->m_automaticResizeTabs ) {
if ( index >= 0 && index < count() )
return d->m_tabNames[ index ];
else
return TQString();
}
else
return TQTabWidget::label( index );
}
TQString KTabWidget::tabLabel( TQWidget * w ) const
{
if ( d->m_automaticResizeTabs ) {
int index = indexOf( w );
if ( index == -1 )
return TQString();
else
return d->m_tabNames[ index ];
}
else
return TQTabWidget::tabLabel( w );
}
void KTabWidget::setTabLabel( TQWidget *w, const TQString &l )
{
TQTabWidget::setTabLabel( w, l );
if ( d->m_automaticResizeTabs ) {
int index = indexOf( w );
if ( index != -1 ) {
d->m_tabNames[ index ] = l;
resizeTabs( index );
}
}
}
void KTabWidget::resizeTabs( int changeTabIndex )
{
uint newMaxLength;
if ( d->m_automaticResizeTabs ) {
// Calculate new max length
newMaxLength=d->m_maxLength;
uint lcw=0, rcw=0;
int tabBarHeight = tabBar()->sizeHint().height();
if ( cornerWidget( TopLeft ) && cornerWidget( TopLeft )->isVisible() )
lcw = TQMAX( cornerWidget( TopLeft )->width(), tabBarHeight );
if ( cornerWidget( TopRight ) && cornerWidget( TopRight )->isVisible() )
rcw = TQMAX( cornerWidget( TopRight )->width(), tabBarHeight );
uint maxTabBarWidth = width() - lcw - rcw;
for ( ; newMaxLength > (uint)d->m_minLength; newMaxLength-- ) {
if ( tabBarWidthForMaxChars( newMaxLength ) < maxTabBarWidth )
break;
}
}
else
newMaxLength = 4711;
// Update hinted or all tabs
if ( d->m_CurrentMaxLength != newMaxLength ) {
d->m_CurrentMaxLength = newMaxLength;
for( int i = 0; i < count(); ++i )
updateTab( i );
}
else if ( changeTabIndex != -1 )
updateTab( changeTabIndex );
}
void KTabWidget::updateTab( int index )
{
TQString title = d->m_automaticResizeTabs ? d->m_tabNames[ index ] : TQTabWidget::label( index );
removeTabToolTip( page( index ) );
if ( title.length() > d->m_CurrentMaxLength )
setTabToolTip( page( index ), title );
title = KStringHandler::rsqueeze( title, d->m_CurrentMaxLength ).leftJustify( d->m_minLength, ' ' );
title.replace( '&', "&&" );
if ( TQTabWidget::label( index ) != title )
TQTabWidget::setTabLabel( page( index ), title );
}
void KTabWidget::dragMoveEvent( TQDragMoveEvent *e )
{
if ( isEmptyTabbarSpace( e->pos() ) ) {
bool accept = false;
// The receivers of the testCanDecode() signal has to adjust
// 'accept' accordingly.
emit testCanDecode( e, accept);
e->accept( accept );
return;
}
e->accept( false );
TQTabWidget::dragMoveEvent( e );
}
void KTabWidget::dropEvent( TQDropEvent *e )
{
if ( isEmptyTabbarSpace( e->pos() ) ) {
emit ( receivedDropEvent( e ) );
return;
}
TQTabWidget::dropEvent( e );
}
#ifndef TQT_NO_WHEELEVENT
void KTabWidget::wheelEvent( TQWheelEvent *e )
{
if ( e->orientation() ==TQt::Horizontal )
return;
if ( isEmptyTabbarSpace( e->pos() ) )
wheelDelta( e->delta() );
else
e->ignore();
}
void KTabWidget::wheelDelta( int delta )
{
if ( count() < 2 )
return;
int page = currentPageIndex();
if ( delta < 0 )
page = (page + 1) % count();
else {
page--;
if ( page < 0 )
page = count() - 1;
}
setCurrentPage( page );
}
#endif
void KTabWidget::mouseDoubleClickEvent( TQMouseEvent *e )
{
if( e->button() != TQt::LeftButton )
return;
if ( isEmptyTabbarSpace( e->pos() ) ) {
emit( mouseDoubleClick() );
return;
}
TQTabWidget::mouseDoubleClickEvent( e );
}
void KTabWidget::mousePressEvent( TQMouseEvent *e )
{
if ( e->button() == TQt::RightButton ) {
if ( isEmptyTabbarSpace( e->pos() ) ) {
emit( contextMenu( mapToGlobal( e->pos() ) ) );
return;
}
} else if ( e->button() == TQt::MidButton ) {
if ( isEmptyTabbarSpace( e->pos() ) ) {
emit( mouseMiddleClick() );
return;
}
}
TQTabWidget::mousePressEvent( e );
}
void KTabWidget::receivedDropEvent( int index, TQDropEvent *e )
{
emit( receivedDropEvent( page( index ), e ) );
}
void KTabWidget::initiateDrag( int index )
{
emit( initiateDrag( page( index ) ) );
}
void KTabWidget::contextMenu( int index, const TQPoint &p )
{
emit( contextMenu( page( index ), p ) );
}
void KTabWidget::mouseDoubleClick( int index )
{
emit( mouseDoubleClick( page( index ) ) );
}
void KTabWidget::mouseMiddleClick( int index )
{
emit( mouseMiddleClick( page( index ) ) );
}
void KTabWidget::moveTab( int from, int to )
{
TQString tablabel = label( from );
TQWidget *w = page( from );
TQColor color = tabColor( w );
TQIconSet tabiconset = tabIconSet( w );
TQString tabtooltip = tabToolTip( w );
bool current = ( w == currentPage() );
bool enabled = isTabEnabled( w );
blockSignals(true);
removePage( w );
// Work-around tdemdi brain damage which calls showPage() in insertTab()
TQTab * t = new TQTab();
t->setText(tablabel);
TQTabWidget::insertTab( w, t, to );
if ( d->m_automaticResizeTabs ) {
if ( to < 0 || to >= count() )
d->m_tabNames.append( TQString() );
else
d->m_tabNames.insert( d->m_tabNames.at( to ), TQString() );
}
w = page( to );
changeTab( w, tabiconset, tablabel );
setTabToolTip( w, tabtooltip );
setTabColor( w, color );
if ( current )
showPage( w );
setTabEnabled( w, enabled );
blockSignals(false);
emit ( movedTab( from, to ) );
}
void KTabWidget::removePage( TQWidget * w ) {
if ( d->m_automaticResizeTabs ) {
int index = indexOf( w );
if ( index != -1 )
d->m_tabNames.remove( d->m_tabNames.at( index ) );
}
TQTabWidget::removePage( w );
if ( d->m_automaticResizeTabs )
resizeTabs();
}
bool KTabWidget::isEmptyTabbarSpace( const TQPoint &p ) const
{
TQPoint point( p );
TQSize size( tabBar()->sizeHint() );
if ( ( tabPosition()==Top && point.y()< size.height() ) || ( tabPosition()==Bottom && point.y()>(height()-size.height() ) ) ) {
TQWidget *rightcorner = cornerWidget( TopRight );
if ( rightcorner ) {
if ( point.x()>=width()-rightcorner->width() )
return false;
}
TQWidget *leftcorner = cornerWidget( TopLeft );
if ( leftcorner ) {
if ( point.x()<=leftcorner->width() )
return false;
point.setX( point.x()-size.height() );
}
if ( tabPosition()==Bottom )
point.setY( point.y()-( height()-size.height() ) );
TQTab *tab = tabBar()->selectTab( point);
if( !tab )
return true;
}
return false;
}
void KTabWidget::setHoverCloseButton( bool button )
{
static_cast<KTabBar*>(tabBar())->setHoverCloseButton( button );
}
bool KTabWidget::hoverCloseButton() const
{
return static_cast<KTabBar*>(tabBar())->hoverCloseButton();
}
void KTabWidget::setHoverCloseButtonDelayed( bool delayed )
{
static_cast<KTabBar*>(tabBar())->setHoverCloseButtonDelayed( delayed );
}
bool KTabWidget::hoverCloseButtonDelayed() const
{
return static_cast<KTabBar*>(tabBar())->hoverCloseButtonDelayed();
}
void KTabWidget::setAutomaticResizeTabs( bool enabled )
{
if ( d->m_automaticResizeTabs==enabled )
return;
d->m_automaticResizeTabs = enabled;
if ( enabled ) {
d->m_tabNames.clear();
for( int i = 0; i < count(); ++i )
d->m_tabNames.append( tabBar()->tabAt( i )->text() );
}
else
for( int i = 0; i < count(); ++i )
tabBar()->tabAt( i )->setText( d->m_tabNames[ i ] );
resizeTabs();
}
bool KTabWidget::automaticResizeTabs() const
{
return d->m_automaticResizeTabs;
}
void KTabWidget::closeRequest( int index )
{
emit( closeRequest( page( index ) ) );
}
void KTabWidget::resizeEvent( TQResizeEvent *e )
{
TQTabWidget::resizeEvent( e );
resizeTabs();
}
#include "ktabwidget.moc"

@ -1,292 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2003 Stephan Binner <binner@kde.org>
Copyright (C) 2003 Zack Rusin <zack@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 KTABWIDGET_H
#define KTABWIDGET_H
#include <tqtabwidget.h>
#include <tqstringlist.h>
#include <tdelibs_export.h>
class KTabWidgetPrivate;
/**
* \brief A widget containing multiple tabs
*
* @since 3.2
*/
class TDEUI_EXPORT KTabWidget : public TQTabWidget
{
TQ_OBJECT
TQ_PROPERTY( bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled )
TQ_PROPERTY( bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton )
TQ_PROPERTY( bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed )
TQ_PROPERTY( bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious )
TQ_PROPERTY( bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs )
public:
KTabWidget( TQWidget *parent = 0, const char *name = 0, WFlags f = 0 );
/**
* Destructor.
*/
virtual ~KTabWidget();
/*!
Set the tab of the given widget to \a color.
*/
void setTabColor( TQWidget *, const TQColor& color );
TQColor tabColor( TQWidget * ) const;
/*!
Returns true if tab ordering with the middle mouse button
has been enabled.
*/
bool isTabReorderingEnabled() const;
/*!
Returns true if the close button is shown on tabs
when mouse is hovering over them.
*/
bool hoverCloseButton() const;
/*!
Returns true if the close button is shown on tabs
after a delay.
*/
bool hoverCloseButtonDelayed() const;
/*!
Returns true if closing the current tab activates the previous
actice tab instead of the one to the right.
@since 3.3
*/
bool tabCloseActivatePrevious() const;
/*!
Returns true if calling setTitle() will resize tabs
to the width of the tab bar.
@since 3.4
*/
bool automaticResizeTabs() const;
/*!
If \a hide is true, the tabbar is hidden along with any corner
widgets.
@since 3.4
*/
void setTabBarHidden( bool hide );
/*!
Return true if the tabbar is hidden.
@since 3.4
*/
bool isTabBarHidden() const;
/*!
Reimplemented for internal reasons.
*/
virtual void insertTab( TQWidget *, const TQString &, int index = -1 );
/*!
Reimplemented for internal reasons.
*/
virtual void insertTab( TQWidget *child, const TQIconSet& iconset,
const TQString &label, int index = -1 );
/*!
Reimplemented for internal reasons.
*/
virtual void insertTab( TQWidget *, TQTab *, int index = -1 );
/*!
Reimplemented for internal reasons.
*/
void changeTab( TQWidget *, const TQString & );
/*!
Reimplemented for internal reasons.
*/
void changeTab( TQWidget *child, const TQIconSet& iconset, const TQString &label );
/*!
Reimplemented for internal reasons.
*/
TQString label( int ) const;
/*!
Reimplemented for internal reasons.
*/
TQString tabLabel( TQWidget * ) const;
/*!
Reimplemented for internal reasons.
*/
void setTabLabel( TQWidget *, const TQString & );
public slots:
/*!
Move a widget's tab from first to second specified index and emit
signal movedTab( int, int ) afterwards.
*/
virtual void moveTab( int, int );
/*!
Removes the widget, reimplemented for
internal reasons (keeping labels in sync).
*/
virtual void removePage ( TQWidget * w );
/*!
If \a enable is true, tab reordering with middle button will be enabled.
Note that once enabled you shouldn't rely on previously queried
currentPageIndex() or indexOf( TQWidget * ) values anymore.
You can connect to signal movedTab(int, int) which will notify
you from which index to which index a tab has been moved.
*/
void setTabReorderingEnabled( bool enable );
/*!
If \a enable is true, a close button will be shown on mouse hover
over tab icons which will emit signal closeRequest( TQWidget * )
when pressed.
*/
void setHoverCloseButton( bool enable );
/*!
If \a delayed is true, a close button will be shown on mouse hover
over tab icons after mouse double click delay else immediately.
*/
void setHoverCloseButtonDelayed( bool delayed );
/*!
If \a delayed is true, closing the current tab activates the
previous active tab instead of the one to the right.
@since 3.3
*/
void setTabCloseActivatePrevious( bool previous );
/*!
If \a enable is true, tabs will be resized to the width of the tab bar.
Does not work reliable with "TQTabWidget* foo=new KTabWidget()" and if
you change tabs via the tabbar or by accessing tabs directly.
@since 3.4
*/
void setAutomaticResizeTabs( bool enable );
signals:
/*!
Connect to this and set accept to true if you can and want to decode the event.
*/
void testCanDecode(const TQDragMoveEvent *e, bool &accept /* result */);
/*!
Received an event in the empty space beside tabbar. Usually creates a new tab.
This signal is only possible after testCanDecode and positive accept result.
*/
void receivedDropEvent( TQDropEvent * );
/*!
Received an drop event on given widget's tab.
This signal is only possible after testCanDecode and positive accept result.
*/
void receivedDropEvent( TQWidget *, TQDropEvent * );
/*!
Request to start a drag operation on the given tab.
*/
void initiateDrag( TQWidget * );
/*!
The right mouse button was pressed over empty space besides tabbar.
*/
void contextMenu( const TQPoint & );
/*!
The right mouse button was pressed over a widget.
*/
void contextMenu( TQWidget *, const TQPoint & );
/*!
A tab was moved from first to second index. This signal is only
possible after you have called setTabReorderingEnabled( true ).
*/
void movedTab( int, int );
/*!
A double left mouse button click was performed over empty space besides tabbar.
@since 3.3
*/
void mouseDoubleClick();
/*!
A double left mouse button click was performed over the widget.
*/
void mouseDoubleClick( TQWidget * );
/*!
A middle mouse button click was performed over empty space besides tabbar.
*/
void mouseMiddleClick();
/*!
A middle mouse button click was performed over the widget.
*/
void mouseMiddleClick( TQWidget * );
/*!
The close button of a widget's tab was clicked. This signal is
only possible after you have called setHoverCloseButton( true ).
*/
void closeRequest( TQWidget * );
protected:
virtual void mouseDoubleClickEvent( TQMouseEvent *e );
virtual void mousePressEvent( TQMouseEvent * );
virtual void dragMoveEvent( TQDragMoveEvent * );
virtual void dropEvent( TQDropEvent * );
unsigned int tabBarWidthForMaxChars( uint maxLength );
#ifndef TQT_NO_WHEELEVENT
virtual void wheelEvent( TQWheelEvent *e );
#endif
virtual void resizeEvent( TQResizeEvent * );
protected slots:
virtual void receivedDropEvent( int, TQDropEvent * );
virtual void initiateDrag( int );
virtual void contextMenu( int, const TQPoint & );
virtual void mouseDoubleClick( int );
virtual void mouseMiddleClick( int );
virtual void closeRequest( int );
#ifndef TQT_NO_WHEELEVENT
virtual void wheelDelta( int );
#endif
private:
bool isEmptyTabbarSpace( const TQPoint & ) const;
void resizeTabs( int changedTabIndex = -1 );
void updateTab( int index );
KTabWidgetPrivate *d;
};
#endif

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -1,87 +0,0 @@
/*
This file is part of the KDE libraries
Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
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 _TDELIBS_EXPORT_H
#define _TDELIBS_EXPORT_H
/* needed for TDE_EXPORT macros */
#include <tdemacros.h>
/* needed, because e.g. Q_OS_UNIX is so frequently used */
#include <tqglobal.h>
#ifdef TQ_WS_WIN
#include <tdelibs_export_win.h>
#else /* Q_OS_UNIX */
#undef TDE_EXPORT
#define TDE_EXPORT
/* export statements for unix */
#define TDECORE_EXPORT TDE_EXPORT
#define TDEUI_EXPORT TDE_EXPORT
#define TDEFX_EXPORT TDE_EXPORT
#define TDEPRINT_EXPORT TDE_EXPORT
#define TDEDNSSD_EXPORT TDE_EXPORT
#define TDEIO_EXPORT TDE_EXPORT
#define DCOP_EXPORT TDE_EXPORT
#define TDEPARTS_EXPORT TDE_EXPORT
#define KTEXTEDITOR_EXPORT TDE_EXPORT
#define KABC_EXPORT TDE_EXPORT
#define TDESU_EXPORT TDE_EXPORT
#define KVCARD_EXPORT TDE_EXPORT
#define TDERESOURCES_EXPORT TDE_EXPORT
#define KSTYLE_EXPORT TDE_EXPORT
#define TDEHTML_EXPORT TDE_EXPORT
#define KMDI_EXPORT TDE_EXPORT
#define TDEUTILS_EXPORT TDE_EXPORT
#define KATEPARTINTERFACES_EXPORT TDE_EXPORT
#define KATEPART_EXPORT TDE_EXPORT
#define KMID_EXPORT TDE_EXPORT
#define TDEIMPROXY_EXPORT TDE_EXPORT
#define KDE_ARTS_EXPORT TDE_EXPORT
#define KPATH_SEPARATOR ':'
#ifndef O_BINARY
#define O_BINARY 0 /* for open() */
#endif
#endif
#endif /*_TDELIBS_EXPORT_H*/
/* workaround for tdecore: stupid moc's grammar doesn't accept two macros
between 'class' keyword and <classname>: */
#ifdef TDE_DEPRECATED
# ifndef TDECORE_EXPORT_DEPRECATED
# define TDECORE_EXPORT_DEPRECATED TDE_DEPRECATED TDECORE_EXPORT
# endif
# ifndef TDEIO_EXPORT_DEPRECATED
# define TDEIO_EXPORT_DEPRECATED TDE_DEPRECATED TDEIO_EXPORT
# endif
# ifndef TDEUI_EXPORT_DEPRECATED
# define TDEUI_EXPORT_DEPRECATED TDE_DEPRECATED TDEUI_EXPORT
# endif
# ifndef KABC_EXPORT_DEPRECATED
# define KABC_EXPORT_DEPRECATED TDE_DEPRECATED KABC_EXPORT
# endif
#endif
/* (let's add KDE****_EXPORT_DEPRECATED for other libraries if it's needed) */

@ -1,787 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildarea.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 TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
// and
// Falk Brettschneider
// email : falkbr@kdevelop.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 "tdemdichildarea.h"
#include "tdemdichildarea.moc"
#include "tdemdidefines.h"
#include <tdeconfig.h>
#include <kdebug.h>
#include <tdeglobal.h>
#include <tdeglobalsettings.h>
#include <math.h>
#include <tqpopupmenu.h>
///////////////////////////////////////////////////////////////////////////////
// KMdiChildArea
///////////////////////////////////////////////////////////////////////////////
//============ KMdiChildArea ============//
KMdiChildArea::KMdiChildArea( TQWidget *parent )
: TQFrame( parent, "tdemdi_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( TQWidget::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
TQObject::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
TQObject::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();
TQFocusEvent::setReason( TQFocusEvent::Other );
child->m_pClient->setFocus();
}
}
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() & TQt::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();
}

@ -1,305 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildarea.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 TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Falk Brettschneider
// and
// Szymon Stefanek (stefanek@tin.it)
// email : falkbr@kdevelop.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 _TDEMDI_CHILD_AREA_H_
#define _TDEMDI_CHILD_AREA_H_
#include <tqframe.h>
#include <tqptrlist.h>
#include "tdemdichildfrm.h"
#include "tdemdichildview.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;
TQ_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.
* @param child
*/
void destroyChildButNotItsView( KMdiChildFrm *lpC, bool bFocusTopChild = true );
/**
* Brings the child @p child to the top of the stack
* The child is focused if @p setFocus is true. If setFocus is false, the
* child is just raised.
* @param child
*/
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 ) TDE_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 // _TDEMDI_CHILDAREA_H_

File diff suppressed because it is too large Load Diff

@ -1,446 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildfrm.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 TQt extension set of
// classes and a TQt-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@kdevelop.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 _TDEMDI_CHILD_FRM_H_
#define _TDEMDI_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 "tdemdichildfrmcaption.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
{
TQ_OBJECT
public:
KMdiWin32IconButton( TQWidget* parent, const char* name = 0 );
virtual void mousePressEvent( TQMouseEvent* );
signals:
void pressed();
};
//==============================================================================
/* some special events, see tdemdidefines.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;
TQ_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<TQWidget::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<TQWidget::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 //_TDEMDI_CHILD_FRM_H_

@ -1,320 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildfrmcaption.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 TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
// and
// Falk Brettschneider
// email : falkbr@kdevelop.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 "tdemdichildfrmcaption.h"
#include "tdemdichildfrmcaption.moc"
#include <tqpainter.h>
#include <tqapplication.h>
#include <tqcursor.h>
#include <tqtoolbutton.h>
#include <tqpopupmenu.h>
#include "tdemdidefines.h"
#include "tdemdichildfrm.h"
#include "tdemdichildarea.h"
#include "tdemdimainfrm.h"
#include <tdelocale.h>
#include <iostream>
#ifdef TQ_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, "tdemdi_childfrmcaption" )
{
m_szCaption = i18n( "Unnamed" );
m_bActive = false;
m_pParent = parent;
setBackgroundMode( NoBackground );
setFocusPolicy( TQWidget::NoFocus );
m_bChildInDrag = false;
}
//============== ~KMdiChildFrmCaption =============//
KMdiChildFrmCaption::~KMdiChildFrmCaption()
{}
//============= mousePressEvent ==============//
void KMdiChildFrmCaption::mousePressEvent( TQMouseEvent *e )
{
if ( e->button() == TQt::LeftButton )
{
setMouseTracking( false );
if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
{
TQApplication::setOverrideCursor( TQt::sizeAllCursor, true );
}
m_pParent->m_bDragging = true;
m_offset = mapToParent( e->pos() );
}
else if ( e->button() == TQt::RightButton )
{
m_pParent->systemMenu()->popup( mapToGlobal( e->pos() ) );
}
}
//============= mouseReleaseEvent ============//
void KMdiChildFrmCaption::mouseReleaseEvent( TQMouseEvent *e )
{
if ( e->button() == TQt::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( TQt::sizeAllCursor, true );
m_pParent->m_bDragging = true;
m_offset = mapFromGlobal( TQCursor::pos() );
}

@ -1,144 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildfrmcaption.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 TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Falk Brettschneider
// and
// Szymon Stefanek (stefanek@tin.it)
// email : falkbr@kdevelop.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 _TDEMDI_CHILD_FRM_CAPTION_H_
#define _TDEMDI_CHILD_FRM_CAPTION_H_
#include <tqwidget.h>
#include "tdemdidefines.h"
class KMdiChildFrm;
class KMdiChildFrmCaptionPrivate;
/**
* @short Internal class.
*
* It's the caption bar of a child frame widget.
*/
class KMDI_EXPORT KMdiChildFrmCaption : public TQWidget
{
TQ_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 //_TDEMDI_CHILD_FRM_CAPTION_H_

@ -1,771 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildview.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 TQt extension set of
// classes and a TQt-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@kdevelop.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 "tdemdichildview.h"
#include "tdemdichildview.moc"
#include <tqdatetime.h>
#include <tqobjectlist.h>
#include "tdemdimainfrm.h"
#include "tdemdichildfrm.h"
#include "tdemdidefines.h"
#include <kdebug.h>
#include <tdelocale.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( TQWidget::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 )
{
setGeometry( 0, 0, 0, 0 ); // reset
m_szCaption = i18n( "Unnamed" );
m_sTabCaption = m_szCaption;
setFocusPolicy( TQWidget::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 newGeoTQt;
newGeoTQt.setX( newGeometry.x() - nFrameSizeLeft );
newGeoTQt.setY( newGeometry.y() - nFrameSizeTop );
newGeoTQt.setWidth( newGeometry.width() + nFrameSizeLeft + KMDI_CHILDFRM_DOUBLE_BORDER / 2 );
newGeoTQt.setHeight( newGeometry.height() + nFrameSizeTop + KMDI_CHILDFRM_DOUBLE_BORDER / 2 );
// newGeoTQt.setWidth(newGeometry.width()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER);
// newGeoTQt.setHeight(newGeometry.height()+mdiParent()->captionHeight()+KMDI_MDI_CHILDFRM_DOUBLE_BORDER);
// set the geometry
mdiParent()->setGeometry( newGeoTQt );
}
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 newGeoTQt;
newGeoTQt.setX( newGeometry.x() - nFrameSizeLeft );
newGeoTQt.setY( newGeometry.y() - nFrameSizeTop );
newGeoTQt.setWidth( newGeometry.width() );
newGeoTQt.setHeight( newGeometry.height() );
// set the geometry
setGeometry( newGeoTQt );
}
}
//============== 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 newGeoTQt;
newGeoTQt.setX( newGeometry.x() + nFrameSizeLeft );
newGeoTQt.setY( newGeometry.y() + nFrameSizeTop );
newGeoTQt.setWidth( newGeometry.width() - nTotalFrameWidth );
newGeoTQt.setHeight( newGeometry.height() - nTotalFrameHeight );
// set the geometry
setGeometry( newGeoTQt );
}
}
//============== 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( TQWidget::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 = TQObject::sender();
if ( pLostChild && ( pLostChild->isWidgetType() ) )
{
TQObjectList* list = ( ( TQObject* ) ( pLostChild ) ) ->queryList( "TQWidget" );
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() == TQt::Key_Tab )
{
TQWidget* w = ( TQWidget* ) obj;
TQWidget::FocusPolicy wfp = w->focusPolicy();
if ( wfp == TQWidget::StrongFocus || wfp == TQWidget::TabFocus || w->focusPolicy() == TQWidget::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" );
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 = ( ( TQChildEvent* ) e ) ->child();
if ( ( pLostChild != 0L ) && ( pLostChild->isWidgetType() ) )
{
TQObjectList * list = pLostChild->queryList( "TQWidget" );
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 );
TQWidget::FocusPolicy wfp = widg->focusPolicy();
if ( wfp == TQWidget::StrongFocus || wfp == TQWidget::TabFocus || widg->focusPolicy() == TQWidget::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 = ( ( TQChildEvent* ) e ) ->child();
if ( ( pNewChild != 0L ) && ( pNewChild->isWidgetType() ) )
{
TQWidget * pNewWidget = ( TQWidget* ) pNewChild;
if ( pNewWidget->testWFlags( TQt::WType_Dialog | TQt::WShowModal ) )
return false;
TQObjectList *list = pNewWidget->queryList( "TQWidget" );
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, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( slot_childDestroyed() ) );
TQWidget::FocusPolicy wfp = widg->focusPolicy();
if ( wfp == TQWidget::StrongFocus || wfp == TQWidget::TabFocus || widg->focusPolicy() == TQWidget::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 ( obj == this )
iconUpdated( this, icon() ? ( *icon() ) : TQPixmap() );
else if ( obj == m_trackChanges )
setIcon( m_trackChanges->icon() ? ( *( m_trackChanges->icon() ) ) : TQPixmap() );
}
if ( e->type() == TQEvent::CaptionChange )
{
if ( obj == 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" );
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();
}

@ -1,614 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdichildview.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 TQt extension set of
// classes and a TQt-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@kdevelop.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 _TDEMDI_CHILD_VIEW_H_
#define _TDEMDI_CHILD_VIEW_H_
#include <tqwidget.h>
#include <tqpixmap.h>
#include <tqrect.h>
#include <tqapplication.h>
#include <tqdatetime.h>
#include "tdemdichildfrm.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, TQ_SIGNAL(childViewIsDetachedNow(TQWidget*)), this, TQ_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;
TQ_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 TQt::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 //_TDEMDI_CHILD_VIEW_H_

@ -1,117 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdidefines.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 TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Falk Brettschneider
// and
// Szymon Stefanek (stefanek@tin.it)
// email : falkbr@kdevelop.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 _TDEMDI_DEFINES_H_
#define _TDEMDI_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 TQt 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 //_TDEMDI_DEFINES_H_

@ -1,854 +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 "tdemdimainfrm.h"
#include "tdemdidockcontainer.h"
#include "tdemdidockcontainer.moc"
#include "kdockwidget_private.h"
#include <tqwidgetstack.h>
#include <tqlayout.h>
#include <tqtimer.h>
#include <tqtooltip.h>
#include <tdemultitabbar.h>
#include <tdeglobalsettings.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <tdeapplication.h>
#include <tdeconfig.h>
#include <tdelocale.h>
//TODO: Well, this is already defined in tdeui/kdockwidget.cpp
static const char* const tdemdi_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 = 17;
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 ) )
{
( static_cast<KDockWidgetHeader*>( w->getHeader()->tqt_cast( "KDockWidgetHeader" ) ) )->removeButton( m_overlapButtons[w] );
m_overlapButtons.remove( w );
}
m_map.remove( w );
w->undock();
}
deactivated( this );
}
void KMdiDockContainer::init()
{
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() );
}
// try to restore splitter size
if ( parentDockWidget() && parentDockWidget()->parent() )
{
KDockSplitter * sp = static_cast<KDockSplitter*>( parentDockWidget()->parent()->tqt_cast( "KDockSplitter" ) );
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 ( w->getHeader()->tqt_cast( "KDockWidgetHeader" ) )
{
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 = static_cast<KDockWidgetHeader*>( w->getHeader()->tqt_cast( "KDockWidgetHeader" ) );
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** >( tdemdi_not_close_xpm ) );
hdr->addButton( btn );
m_overlapButtons.insert( w, btn );
btn->setOn( !isOverlapMode() );
connect( btn, TQ_SIGNAL( clicked() ), this, TQ_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 ), TQ_SIGNAL( clicked( int ) ), this, TQ_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 = dynamic_cast<KMultiTabBarTab*>( obj );
if ( !obj )
{
kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no tab" << endl;
break;
}
KDockWidget* w = m_revMap[ dynamic_cast<KMultiTabBarTab*>( obj )->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 = static_cast<KDockWidgetHeader*>( w->getHeader()->tqt_cast( "KDockWidgetHeader" ) );
if ( !hdr )
{
kdDebug(760) << "Wrong header type in KMdiDockContainer::eventFilter" << endl;
break;
}
m_dockManager = w->dockManager();
m_dragPanel = 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, 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 = 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 ) )
{
( static_cast<KDockWidgetHeader*>( w->getHeader() ->tqt_cast( "KDockWidgetHeader" ) ) )->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 = static_cast<KDockWidget*>( m_ws->widget( t )->tqt_cast( "KDockWidget" ) );
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 = static_cast<KDockSplitter*>( parentDockWidget()->parent()->tqt_cast( "KDockSplitter" ) );
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_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 );
tdeApp->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, TQ_SLOT( delayedRaise() ) );
kdDebug( 760 ) << k_funcinfo << "raising " << it.key()->name() << endl;
break;
}
}
}
if ( m_delayedRaise == -1 )
TQTimer::singleShot( 0, this, TQ_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 = static_cast<KDockSplitter*>( parentDockWidget() ->
parent() ->tqt_cast( "KDockSplitter" ) );
if ( sp )
cfg->writeEntry( "separatorPos", 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_tb->width() );
else
deactivateOverlapMode();
m_separatorPos = cfg->readNumEntry( "separatorPos", 18 );
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 );
}
tdeApp->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());
tdeApp->sendPostedEvents();
tdeApp->syncX();*/
m_delayedRaise = it.data();
TQTimer::singleShot( 0, this, TQ_SLOT( delayedRaise() ) );
kdDebug( 760 ) << k_funcinfo << "raising" << it.key() ->name() << endl;
break;
}
}
}
if ( m_delayedRaise == -1 )
TQTimer::singleShot( 0, this, TQ_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 = 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() );
}

@ -1,166 +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 _TDEMDI_DOCK_CONTAINER_
#define _TDEMDI_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
{
TQ_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 TQDomElement
*/
virtual void save( TQDomElement& );
/**
* Load the config from a TQDomElement
*/
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

@ -1,149 +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 <ktabbar.h>
#include <tdepopupmenu.h>
#include "tdemdidocumentviewtabwidget.h"
KMdiDocumentViewTabWidget::KMdiDocumentViewTabWidget( TQWidget* parent, const char* name ) : KTabWidget( parent, name )
{
m_visibility = KMdi::ShowWhenMoreThanOneTab;
tabBar() ->hide();
#ifndef TQ_WS_WIN //todo
setHoverCloseButton( true );
#endif
connect( this, TQ_SIGNAL( closeRequest( TQWidget* ) ), this, TQ_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 );
maybeShow();
}
void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label )
{
KTabWidget::addTab( child, iconset, label );
showPage( child );
maybeShow();
}
void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, TQTab * tab )
{
KTabWidget::addTab( child, tab );
showPage( child );
maybeShow();
}
void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, const TQString & label, int index )
{
KTabWidget::insertTab( child, label, index );
showPage( child );
maybeShow();
tabBar() ->repaint();
}
void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index )
{
KTabWidget::insertTab( child, iconset, label, index );
showPage( child );
maybeShow();
tabBar() ->repaint();
}
void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, TQTab * tab, int index )
{
KTabWidget::insertTab( child, tab, index );
showPage( child );
maybeShow();
tabBar() ->repaint();
}
void KMdiDocumentViewTabWidget::removePage ( TQWidget * w )
{
KTabWidget::removePage( w );
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()
{
if ( m_visibility == KMdi::AlwaysShowTabs )
{
tabBar() ->show();
if ( cornerWidget() )
{
if ( count() == 0 )
cornerWidget() ->hide();
else
cornerWidget() ->show();
}
}
if ( m_visibility == KMdi::ShowWhenMoreThanOneTab )
{
if ( count() < 2 )
tabBar() ->hide();
if ( count() > 1 )
tabBar() ->show();
if ( cornerWidget() )
{
if ( count() < 2 )
cornerWidget() ->hide();
else
cornerWidget() ->show();
}
}
if ( m_visibility == KMdi::NeverShowTabs )
{
tabBar() ->hide();
}
}
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 "tdemdidocumentviewtabwidget.moc"
#endif

@ -1,122 +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 _TDEMDI_DOCUMENT_VIEW_TAB_WIDGET_H_
#define _TDEMDI_DOCUMENT_VIEW_TAB_WIDGET_H_
#include <ktabwidget.h>
#include <tdemdidefines.h>
class TDEPopupMenu;
//KDE4: Add a d pointer
/**
* A reimplementation of KTabWidget for KMDI
*/
class KMDI_EXPORT KMdiDocumentViewTabWidget:
public KTabWidget
{
TQ_OBJECT
public:
KMdiDocumentViewTabWidget( TQWidget* parent, const char* name = 0 );
~KMdiDocumentViewTabWidget();
/**
* Add a tab into the tabwidget
* \sa TQTabWidget
* \sa KTabWidget
*/
virtual void addTab ( TQWidget * child, const TQString & label );
/**
* Add a tab into the tabwidget
* \sa TQTabWidget
* \sa KTabWidget
*/
virtual void addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label );
/**
* Add a tab into the tabwidget
* \sa TQTabWidget
* \sa KTabWidget
*/
virtual void addTab ( TQWidget * child, TQTab * tab );
/**
* Insert a tab into the tabwidget with a label
* \sa TQTabWidget
* \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 TQTabWidget
* \sa KTabWidget
*/
virtual void insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index = -1 );
/**
* Inserts a tab into the tabwidget
* \sa TQTabWidget
* \sa KTabWidget
*/
virtual void insertTab ( TQWidget * child, TQTab * tab, int index = -1 );
/**
* Removes the tab from the tabwidget
* \sa TQTabWidget
* \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:
/**
* 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();
KMdi::TabWidgetVisibility m_visibility;
signals:
void initiateTabMove(int, int);
};
#endif

@ -1,68 +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 "tdemdifocuslist.h"
#include "tdemdifocuslist.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( TQWidget::ClickFocus );
kdDebug( 760 ) << "KMdiFocusList::addWidgetTree: adding toplevel" << endl;
connect( w, TQ_SIGNAL( destroyed( TQObject * ) ), this, TQ_SLOT( objectHasBeenDestroyed( TQObject* ) ) );
TQObjectList *l = w->queryList( "TQWidget" );
TQObjectListIt it( *l );
TQObject *obj;
while ( ( obj = it.current() ) != 0 )
{
TQWidget * wid = ( TQWidget* ) obj;
m_list.insert( wid, wid->focusPolicy() );
wid->setFocusPolicy( TQWidget::ClickFocus );
kdDebug( 760 ) << "KMdiFocusList::addWidgetTree: adding widget" << endl;
connect( wid, TQ_SIGNAL( destroyed( TQObject * ) ), this, TQ_SLOT( objectHasBeenDestroyed( TQObject* ) ) );
++it;
}
delete l;
}
void KMdiFocusList::restore()
{
for ( TQMap<TQWidget*, TQWidget::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 );
}

@ -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
{
TQ_OBJECT
public:
KMdiFocusList( TQObject *parent );
~KMdiFocusList();
void addWidgetTree( TQWidget* );
void restore();
protected slots:
void objectHasBeenDestroyed( TQObject* );
private:
TQMap<TQWidget*, TQWidget::FocusPolicy> m_list;
};
#endif

@ -1,313 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
based on tdetoolbarhandler.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 "tdemdiguiclient.h"
#include "tdemdiguiclient.moc"
#include <tqpopupmenu.h>
#include <tdeapplication.h>
#include <tdeconfig.h>
#include <tdetoolbar.h>
#include <tdemainwindow.h>
#include <tdelocale.h>
#include <tdeaction.h>
#include <tqstring.h>
#include <assert.h>
#include <kdebug.h>
#include <kdockwidget.h>
#include <tdeversion.h>
#include "tdemdimainfrm.h"
#include "tdemditoolviewaccessor.h"
#include "tdemditoolviewaccessor_p.h"
namespace
{
const char *actionListName = "show_tdemdi_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 = "tdemdiviewactions.rc";
}
using namespace KMDIPrivate;
ToggleToolViewAction::ToggleToolViewAction( const TQString& text, const TDEShortcut& cut, KDockWidget *dw, KMdiMainFrm *mdiMainFrm,
TQObject* parent, const char* name )
: TDEToggleAction( text, cut, parent, name ), m_dw( dw ), m_mdiMainFrm( mdiMainFrm )
{
if ( m_dw )
{
connect( this, TQ_SIGNAL( toggled( bool ) ), this, TQ_SLOT( slotToggled( bool ) ) );
connect( m_dw->dockManager(), TQ_SIGNAL( change() ), this, TQ_SLOT( anDWChanged() ) );
connect( m_dw, TQ_SIGNAL( destroyed() ), this, TQ_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() &&
( ( static_cast<KDockWidget*>( m_dw->parentDockTabGroup() ->
parent() ->tqt_cast( "KDockWidget" ) ) ) ->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(), TQ_SIGNAL( change() ), this, TQ_SLOT( anDWChanged() ) );
disconnect( this, TQ_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(), TQ_SIGNAL( clientAdded( KXMLGUIClient * ) ),
this, TQ_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() ->tdeaccel() == 0 )
actionCollection() ->setWidget( mdiMainFrm );
m_toolMenu = new TDEActionMenu( i18n( "Tool &Views" ), actionCollection(), "tdemdi_toolview_menu" );
if ( showMDIModeAction )
{
m_mdiModeAction = new TDESelectAction( 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, TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( changeViewMode( int ) ) );
}
else
m_mdiModeAction = 0;
connect( m_mdiMainFrm, TQ_SIGNAL( mdiModeHasBeenChangedTo( KMdi::MdiMode ) ),
this, TQ_SLOT( mdiModeHasBeenChangedTo( KMdi::MdiMode ) ) );
m_gotoToolDockMenu = new TDEActionMenu( i18n( "Tool &Docks" ), actionCollection(), "tdemdi_tooldock_menu" );
m_gotoToolDockMenu->insert( new TDEAction( i18n( "Switch Top Dock" ), ALT + CTRL + SHIFT + Key_T, this, TQ_SIGNAL( toggleTop() ),
actionCollection(), "tdemdi_activate_top" ) );
m_gotoToolDockMenu->insert( new TDEAction( i18n( "Switch Left Dock" ), ALT + CTRL + SHIFT + Key_L, this, TQ_SIGNAL( toggleLeft() ),
actionCollection(), "tdemdi_activate_left" ) );
m_gotoToolDockMenu->insert( new TDEAction( i18n( "Switch Right Dock" ), ALT + CTRL + SHIFT + Key_R, this, TQ_SIGNAL( toggleRight() ),
actionCollection(), "tdemdi_activate_right" ) );
m_gotoToolDockMenu->insert( new TDEAction( i18n( "Switch Bottom Dock" ), ALT + CTRL + SHIFT + Key_B, this, TQ_SIGNAL( toggleBottom() ),
actionCollection(), "tdemdi_activate_bottom" ) );
m_gotoToolDockMenu->insert( new TDEActionSeparator( actionCollection(), "tdemdi_goto_menu_separator" ) );
m_gotoToolDockMenu->insert( new TDEAction( i18n( "Previous Tool View" ), ALT + CTRL + Key_Left, m_mdiMainFrm, TQ_SLOT( prevToolViewInDock() ),
actionCollection(), "tdemdi_prev_toolview" ) );
m_gotoToolDockMenu->insert( new TDEAction( i18n( "Next Tool View" ), ALT + CTRL + Key_Right, m_mdiMainFrm, TQ_SLOT( nextToolViewInDock() ),
actionCollection(), "tdemdi_next_toolview" ) );
actionCollection() ->readShortcutSettings( "Shortcuts", tdeApp->config() );
}
KMDIGUIClient::~KMDIGUIClient()
{
// actionCollection()->writeShortcutSettings( "KMDI Shortcuts", tdeApp->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 TDEAction( "TESTKMDIGUICLIENT", TQString(), 0,
// this, TQ_SLOT(blah()),actionCollection(),"nothing"));
TQPtrList<TDEAction> 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( "tdemdi_toolview_" ) + mtva->wrappedWidget() ->name();
// try to read the action shortcut
TDEShortcut sc;
TDEConfig *cfg = tdeApp->config();
TQString _grp = cfg->group();
cfg->setGroup( "Shortcuts" );
// if ( cfg->hasKey( aname ) )
sc = TDEShortcut( cfg->readEntry( aname, "" ) );
cfg->setGroup( _grp );
TDEAction *a = new ToggleToolViewAction( i18n( "Show %1" ).arg( mtva->wrappedWidget() ->caption() ),
/*TQString()*/sc, dynamic_cast<KDockWidget*>( mtva->wrapperWidget() ),
m_mdiMainFrm, actionCollection(), aname.latin1() );
( ( ToggleToolViewAction* ) a ) ->setCheckedState( i18n( "Hide %1" ).arg( mtva->wrappedWidget() ->caption() ) );
connect( a, TQ_SIGNAL( destroyed( TQObject* ) ), this, TQ_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<TDEAction*>( a ) );
/* if (!m_toolMenu.isNull()) m_toolMenu->remove(static_cast<TDEAction*>(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();
}

@ -1,147 +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 TDEMDIGUICLIENT_H
#define TDEMDIGUICLIENT_H
#include <tqobject.h>
#include <tqguardedptr.h>
#include <kxmlguiclient.h>
#include <tdeaction.h>
#include "tdemdidefines.h"
class TDEMainWindow;
class TDEToolBar;
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
{
TQ_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<TDEAction> m_toolViewActions;
TQPtrList<TDEAction> m_documentViewActions;
TDEActionMenu *m_docMenu;
TDEActionMenu *m_toolMenu;
TDESelectAction *m_mdiModeAction;
TDEActionMenu *m_gotoToolDockMenu;
};
/**
* A TDEToggleAction specifically for toggling the showing
* or the hiding of a KMDI tool view
*/
class KMDI_EXPORT ToggleToolViewAction: public TDEToggleAction
{
TQ_OBJECT
public:
ToggleToolViewAction( const TQString& text, const TDEShortcut& cut = TDEShortcut(), 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

@ -1,49 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdiiterator.h
//----------------------------------------------------------------------------
// Project : KDE MDI extension
//
// begin : 02/2000 by Massimo Morin
// changes : 02/2000 by Falk Brettschneider to create an
// - 06/2000 stand-alone TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Massimo Morin (mmorin@schedsys.com)
// and
// Falk Brettschneider
// email : falkbr@kdevelop.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 _TDEMDIITERATOR_H_
#define _TDEMDIITERATOR_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 // _TDEMDIITERATOR_H_

@ -1,59 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdilistiterator.h
//----------------------------------------------------------------------------
// Project : KDE MDI extension
//
// begin : 02/2000 by Massimo Morin
// changes : 02/2000 by Falk Brettschneider to create an
// - 06/2000 stand-alone TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Massimo Morin (mmorin@schedsys.com)
// and
// Falk Brettschneider
// email : falkbr@kdevelop.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 _TDEMDILISTITERATOR_H_
#define _TDEMDILISTITERATOR_H_
#include <tdemdiiterator.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() == NULL; }
virtual Item* currentItem() const { return m_iterator->current(); }
virtual ~KMdiListIterator() { delete m_iterator; }
private:
TQPtrListIterator<Item> *m_iterator;
};
#endif // _TDEMDILISTITERATOR_H_

File diff suppressed because it is too large Load Diff

@ -1,871 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdimainfrm.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 TQt extension set of
// classes and a TQt-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@kdevelop.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 _TDEMDIMAINFRM_H_
#define _TDEMDIMAINFRM_H_
#include <tdeparts/dockmainwindow.h>
#include <tdemenubar.h>
#include <tdepopupmenu.h>
#include <tqptrlist.h>
#include <tqrect.h>
#include <tqapplication.h>
#include <tqdom.h>
#include <tqguardedptr.h>
#include "tdemditaskbar.h"
#include "tdemdichildarea.h"
#include "tdemdichildview.h"
#include "tdemdiiterator.h"
#include "tdemdilistiterator.h"
#include "tdemdinulliterator.h"
#include "tdemditoolviewaccessor.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 (TQMainWindow'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;
TQ_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:
KMdiMainFrm( TQWidget* parentWidget, const char* name = "", KMdi::MdiMode mdiMode = KMdi::ChildframeMode, WFlags flags = WType_TopLevel | WDestructiveClose );
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 TQt 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.
*/
// 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 TQMenu 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 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* pView, int flags = KMdi::StandardAdd );
//KDE4: merge the two methods
/**
* Adds a KMdiChildView to the MDI system. The main frame takes control of it.
* \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.
* \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.
* \since 3.3
*/
void addWindow( KMdiChildView* pView, int flags, int index );
/**
* Adds a KMdiChildView to the MDI system. The main frame takes control of it.
* \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* pView, TQPoint pos, int flags = KMdi::StandardAdd );
/**
* Adds a KMdiChildView to the MDI system. The main frame takes control of it.
* \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* pView, 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 ) TDE_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 //_TDEMDIMAINFRM_H_

@ -1,47 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemdinulliterator.h
//----------------------------------------------------------------------------
// Project : KDE MDI extension
//
// begin : 02/2000 by Massimo Morin
// changes : 02/2000 by Falk Brettschneider to create an
// - 06/2000 stand-alone TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Massimo Morin (mmorin@schedsys.com)
// and
// Falk Brettschneider
// email : falkbr@kdevelop.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 _TDEMDINULLITERATOR_H_
#define _TDEMDINULLITERATOR_H_
#include "tdemdiiterator.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 // _TDEMDINULLITERATOR_H_

@ -1,388 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemditaskbar.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 TQt extension set of
// classes and a TQt-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@kdevelop.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 "tdemditaskbar.h"
#include "tdemditaskbar.moc"
#include "tdemdimainfrm.h"
#include "tdemdichildview.h"
#include "tdemdidefines.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( TQWidget::NoFocus );
}
KMdiTaskBarButton::~KMdiTaskBarButton()
{}
void KMdiTaskBarButton::mousePressEvent( TQMouseEvent* e )
{
switch ( e->button() )
{
case TQt::LeftButton:
emit leftMouseButtonClicked( m_pWindow );
break;
case TQt::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 )
: TDEToolBar( 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( TQWidget::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, TQ_SIGNAL( clicked() ), win_ptr, TQ_SLOT( setFocus() ) );
TQObject::connect( b, TQ_SIGNAL( clicked( KMdiChildView* ) ), this, TQ_SLOT( setActiveButton( KMdiChildView* ) ) );
TQObject::connect( b, TQ_SIGNAL( leftMouseButtonClicked( KMdiChildView* ) ), m_pFrm, TQ_SLOT( activateView( KMdiChildView* ) ) );
TQObject::connect( b, TQ_SIGNAL( rightMouseButtonClicked( KMdiChildView* ) ), m_pFrm, TQ_SLOT( taskbarButtonRightClicked( KMdiChildView* ) ) );
TQObject::connect( b, TQ_SIGNAL( buttonTextChanged( int ) ), this, TQ_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() == TQt::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() );
}
}
TDEToolBar::resizeEvent( rse );
}

@ -1,219 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemditaskbar.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 TQt extension set of
// classes and a TQt-based library
// 2000-2003 maintained by the KDevelop project
//
// copyright : (C) 1999-2003 by Falk Brettschneider
// and
// Szymon Stefanek (stefanek@tin.it)
// email : falkbr@kdevelop.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 _TDEMDITASKBAR_H_
#define _TDEMDITASKBAR_H_
#include <tdetoolbar.h>
#include <tqptrlist.h>
#include <tqpixmap.h>
#include <tqlabel.h>
#include <tqpushbutton.h>
#include "tdemdidefines.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 KMdiTaskBarButton : public TQPushButton
{
TQ_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 TDEToolBar
{
TQ_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 //_TDEMDITASKBAR_H_

@ -1,267 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemditoolviewaccessor.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 "tdemditoolviewaccessor_p.h"
#include "tdemdiguiclient.h"
#include "tdemdimainfrm.h"
#include "tdemditoolviewaccessor.h"
#include "tdemditoolviewaccessor_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 = 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, TQ_SIGNAL( widgetSet( TQWidget* ) ), this, TQ_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, TQ_SIGNAL( widgetSet( TQWidget* ) ), this, TQ_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, TQt::WType_TopLevel | TQt::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 "tdemditoolviewaccessor.moc"
#endif

@ -1,85 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemditoolviewaccessor.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 _TDEMDITOOLVIEWACCESSOR_H_
#define _TDEMDITOOLVIEWACCESSOR_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
{
TQ_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 //_TDEMDITOOLVIEWACCESSOR_H_

@ -1,51 +0,0 @@
//----------------------------------------------------------------------------
// filename : tdemditoolviewaccessor_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 <tdeaction.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<TDEAction> action;
};
#endif

@ -1,988 +0,0 @@
/***************************************************************************
tdemultitabbar.cpp - description
-------------------
begin : 2001
copyright : (C) 2001,2002,2003 by 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 "tdemultitabbar.h"
#include "tdemultitabbar.moc"
#include "tdemultitabbar_p.h"
#include "tdemultitabbar_p.moc"
#include <tqbutton.h>
#include <tqpopupmenu.h>
#include <tqlayout.h>
#include <tqpainter.h>
#include <tqtooltip.h>
#include <tqfontmetrics.h>
#include <tqstyle.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <tqapplication.h>
#include <math.h>
#define NEARBYINT(i) ((int(float(i) + 0.5)))
class KMultiTabBarTabPrivate {
public:
TQPixmap pix;
};
KMultiTabBarInternal::KMultiTabBarInternal(TQWidget *parent, KMultiTabBar::KMultiTabBarMode bm):TQScrollView(parent)
{
m_expandedTabSize=-1;
m_showActiveTabTexts=false;
m_tabs.setAutoDelete(true);
m_barMode=bm;
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
if (bm==KMultiTabBar::Vertical)
{
box=new TQWidget(viewport());
mainLayout=new TQVBoxLayout(box);
mainLayout->setAutoAdd(true);
box->setFixedWidth(24);
setFixedWidth(24);
}
else
{
box=new TQWidget(viewport());
mainLayout=new TQHBoxLayout(box);
mainLayout->setAutoAdd(true);
box->setFixedHeight(24);
setFixedHeight(24);
}
addChild(box);
setFrameStyle(NoFrame);
viewport()->setBackgroundMode(TQt::PaletteBackground);
/* box->setPaletteBackgroundColor(TQt::red);
setPaletteBackgroundColor(TQt::green);*/
}
void KMultiTabBarInternal::setStyle(enum KMultiTabBar::KMultiTabBarStyle style)
{
m_style=style;
for (uint i=0;i<m_tabs.count();i++)
m_tabs.at(i)->setStyle(m_style);
if ( (m_style==KMultiTabBar::KDEV3) ||
(m_style==KMultiTabBar::KDEV3ICON ) ) {
delete mainLayout;
mainLayout=0;
resizeEvent(0);
} else if (mainLayout==0) {
if (m_barMode==KMultiTabBar::Vertical)
{
box=new TQWidget(viewport());
mainLayout=new TQVBoxLayout(box);
box->setFixedWidth(24);
setFixedWidth(24);
}
else
{
box=new TQWidget(viewport());
mainLayout=new TQHBoxLayout(box);
box->setFixedHeight(24);
setFixedHeight(24);
}
addChild(box);
for (uint i=0;i<m_tabs.count();i++)
mainLayout->add(m_tabs.at(i));
mainLayout->setAutoAdd(true);
}
viewport()->repaint();
}
void KMultiTabBarInternal::drawContents ( TQPainter * paint, int clipx, int clipy, int clipw, int cliph )
{
TQScrollView::drawContents (paint , clipx, clipy, clipw, cliph );
if (m_position==KMultiTabBar::Right)
{
paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,0,viewport()->height());
paint->setPen(colorGroup().background().dark(120));
paint->drawLine(1,0,1,viewport()->height());
}
else
if (m_position==KMultiTabBar::Left)
{
paint->setPen(colorGroup().light());
paint->drawLine(23,0,23,viewport()->height());
paint->drawLine(22,0,22,viewport()->height());
paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,0,viewport()->height());
}
else
if (m_position==KMultiTabBar::Bottom)
{
paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,viewport()->width(),0);
paint->setPen(colorGroup().background().dark(120));
paint->drawLine(0,1,viewport()->width(),1);
}
else
{
paint->setPen(colorGroup().light());
paint->drawLine(0,23,viewport()->width(),23);
paint->drawLine(0,22,viewport()->width(),22);
/* paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,0,viewport()->height());*/
}
}
void KMultiTabBarInternal::contentsMousePressEvent(TQMouseEvent *ev)
{
ev->ignore();
}
void KMultiTabBarInternal::mousePressEvent(TQMouseEvent *ev)
{
ev->ignore();
}
#define CALCDIFF(m_tabs,diff,i) if (m_lines>(int)lines) {\
/*kdDebug()<<"i="<<i<<" tabCount="<<tabCount<<" space="<<space<<endl;*/ \
uint ulen=0;\
diff=0; \
for (uint i2=i;i2<tabCount;i2++) {\
uint l1=m_tabs.at(i2)->neededSize();\
if ((ulen+l1)>space){\
if (ulen==0) diff=0;\
else diff=((float)(space-ulen))/(i2-i);\
break;\
}\
ulen+=l1;\
}\
} else {diff=0; }
void KMultiTabBarInternal::resizeEvent(TQResizeEvent *ev) {
/* kdDebug()<<"KMultiTabBarInternal::resizeEvent"<<endl;
kdDebug()<<"KMultiTabBarInternal::resizeEvent - box geometry"<<box->geometry()<<endl;
kdDebug()<<"KMultiTabBarInternal::resizeEvent - geometry"<<geometry()<<endl;*/
if (ev) TQScrollView::resizeEvent(ev);
if ( (m_style==KMultiTabBar::KDEV3) ||
(m_style==KMultiTabBar::KDEV3ICON) ){
box->setGeometry(0,0,width(),height());
int lines=1;
uint space;
float tmp=0;
if ((m_position==KMultiTabBar::Bottom) || (m_position==KMultiTabBar::Top))
space=width();
else
space=height();
int cnt=0;
//CALCULATE LINES
const uint tabCount=m_tabs.count();
for (uint i=0;i<tabCount;i++) {
cnt++;
tmp+=m_tabs.at(i)->neededSize();
if (tmp>space) {
if (cnt>1)i--;
else if (i==(tabCount-1)) break;
cnt=0;
tmp=0;
lines++;
}
}
//SET SIZE & PLACE
float diff=0;
cnt=0;
if ((m_position==KMultiTabBar::Bottom) || (m_position==KMultiTabBar::Top)) {
setFixedHeight(lines*24);
box->setFixedHeight(lines*24);
m_lines=height()/24-1;
lines=0;
CALCDIFF(m_tabs,diff,0)
tmp=-diff;
//kdDebug()<<"m_lines recalculated="<<m_lines<<endl;
for (uint i=0;i<tabCount;i++) {
KMultiTabBarTab *tab=m_tabs.at(i);
cnt++;
tmp+=tab->neededSize()+diff;
if (tmp>space) {
//kdDebug()<<"about to start new line"<<endl;
if (cnt>1) {
CALCDIFF(m_tabs,diff,i)
i--;
}
else {
//kdDebug()<<"placing line on old line"<<endl;
kdDebug()<<"diff="<<diff<<endl;
tab->removeEventFilter(this);
tab->move(NEARBYINT(tmp-tab->neededSize()),lines*24);
// tab->setFixedWidth(tab->neededSize()+diff);
tab->setFixedWidth(NEARBYINT(tmp+diff)-tab->x());;
tab->installEventFilter(this);
CALCDIFF(m_tabs,diff,(i+1))
}
tmp=-diff;
cnt=0;
lines++;
//kdDebug()<<"starting new line:"<<lines<<endl;
} else {
//kdDebug()<<"Placing line on line:"<<lines<<" pos: (x/y)=("<<tmp-m_tabs.at(i)->neededSize()<<"/"<<lines*24<<")"<<endl;
//kdDebug()<<"diff="<<diff<<endl;
tab->removeEventFilter(this);
tab->move(NEARBYINT(tmp-tab->neededSize()),lines*24);
tab->setFixedWidth(NEARBYINT(tmp+diff)-tab->x());;
//tab->setFixedWidth(tab->neededSize()+diff);
tab->installEventFilter(this);
}
}
}
else {
setFixedWidth(lines*24);
box->setFixedWidth(lines*24);
m_lines=lines=width()/24;
lines=0;
CALCDIFF(m_tabs,diff,0)
tmp=-diff;
for (uint i=0;i<tabCount;i++) {
KMultiTabBarTab *tab=m_tabs.at(i);
cnt++;
tmp+=tab->neededSize()+diff;
if (tmp>space) {
if (cnt>1) {
CALCDIFF(m_tabs,diff,i);
tmp=-diff;
i--;
}
else {
tab->removeEventFilter(this);
tab->move(lines*24,NEARBYINT(tmp-tab->neededSize()));
tab->setFixedHeight(NEARBYINT(tmp+diff)-tab->y());;
tab->installEventFilter(this);
}
cnt=0;
tmp=-diff;
lines++;
} else {
tab->removeEventFilter(this);
tab->move(lines*24,NEARBYINT(tmp-tab->neededSize()));
tab->setFixedHeight(NEARBYINT(tmp+diff)-tab->y());;
tab->installEventFilter(this);
}
}
}
//kdDebug()<<"needed lines:"<<m_lines<<endl;
} else {
int size=0; /*move the calculation into another function and call it only on add tab and tab click events*/
for (int i=0;i<(int)m_tabs.count();i++)
size+=(m_barMode==KMultiTabBar::Vertical?m_tabs.at(i)->height():m_tabs.at(i)->width());
if ((m_position==KMultiTabBar::Bottom) || (m_position==KMultiTabBar::Top))
box->setGeometry(0,0,size,height());
else box->setGeometry(0,0,width(),size);
}
}
void KMultiTabBarInternal::showActiveTabTexts(bool show)
{
m_showActiveTabTexts=show;
}
KMultiTabBarTab* KMultiTabBarInternal::tab(int id) const
{
for (TQPtrListIterator<KMultiTabBarTab> it(m_tabs);it.current();++it){
if (it.current()->id()==id) return it.current();
}
return 0;
}
bool KMultiTabBarInternal::eventFilter(TQObject *, TQEvent *e) {
if (e->type()==TQEvent::Resize) resizeEvent(0);
return false;
}
int KMultiTabBarInternal::appendTab(const TQPixmap &pic ,int id,const TQString& text)
{
KMultiTabBarTab *tab;
m_tabs.append(tab= new KMultiTabBarTab(pic,text,id,box,m_position,m_style));
tab->installEventFilter(this);
tab->showActiveTabText(m_showActiveTabTexts);
if (m_style==KMultiTabBar::KONQSBC)
{
if (m_expandedTabSize<tab->neededSize()) {
m_expandedTabSize=tab->neededSize();
for (uint i=0;i<m_tabs.count();i++)
m_tabs.at(i)->setSize(m_expandedTabSize);
} else tab->setSize(m_expandedTabSize);
} else tab->updateState();
tab->show();
resizeEvent(0);
return 0;
}
void KMultiTabBarInternal::removeTab(int id)
{
for (uint pos=0;pos<m_tabs.count();pos++)
{
if (m_tabs.at(pos)->id()==id)
{
m_tabs.remove(pos);
resizeEvent(0);
break;
}
}
}
void KMultiTabBarInternal::setPosition(enum KMultiTabBar::KMultiTabBarPosition pos)
{
m_position=pos;
for (uint i=0;i<m_tabs.count();i++)
m_tabs.at(i)->setTabsPosition(m_position);
viewport()->repaint();
}
KMultiTabBarButton::KMultiTabBarButton(const TQPixmap& pic,const TQString& text, TQPopupMenu *popup,
int id,TQWidget *parent,KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style)
:TQPushButton(TQIconSet(),text,parent),m_style(style)
{
setIconSet(pic);
setText(text);
m_position=pos;
if (popup) setPopup(popup);
setFlat(true);
setFixedHeight(24);
setFixedWidth(24);
m_id=id;
TQToolTip::add(this,text);
connect(this,TQ_SIGNAL(clicked()),this,TQ_SLOT(slotClicked()));
}
KMultiTabBarButton::KMultiTabBarButton(const TQString& text, TQPopupMenu *popup,
int id,TQWidget *parent,KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style)
:TQPushButton(TQIconSet(),text,parent),m_style(style)
{
setText(text);
m_position=pos;
if (popup) setPopup(popup);
setFlat(true);
setFixedHeight(24);
setFixedWidth(24);
m_id=id;
TQToolTip::add(this,text);
connect(this,TQ_SIGNAL(clicked()),this,TQ_SLOT(slotClicked()));
}
KMultiTabBarButton::~KMultiTabBarButton() {
}
int KMultiTabBarButton::id() const{
return m_id;
}
void KMultiTabBarButton::setText(const TQString& text)
{
TQPushButton::setText(text);
m_text=text;
TQToolTip::add(this,text);
}
void KMultiTabBarButton::slotClicked()
{
emit clicked(m_id);
}
void KMultiTabBarButton::setPosition(KMultiTabBar::KMultiTabBarPosition pos)
{
m_position=pos;
repaint();
}
void KMultiTabBarButton::setStyle(KMultiTabBar::KMultiTabBarStyle style)
{
m_style=style;
repaint();
}
void KMultiTabBarButton::hideEvent( TQHideEvent* he) {
TQPushButton::hideEvent(he);
KMultiTabBar *tb=dynamic_cast<KMultiTabBar*>(parentWidget());
if (tb) tb->updateSeparator();
}
void KMultiTabBarButton::showEvent( TQShowEvent* he) {
TQPushButton::showEvent(he);
KMultiTabBar *tb=dynamic_cast<KMultiTabBar*>(parentWidget());
if (tb) tb->updateSeparator();
}
TQSize KMultiTabBarButton::sizeHint() const
{
constPolish();
int w = 0, h = 0;
// calculate contents size...
#ifndef TQT_NO_ICONSET
if ( iconSet() && !iconSet()->isNull() ) {
int iw = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4;
int ih = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height();
w += iw;
h = TQMAX( h, ih );
}
#endif
if ( isMenuButton() )
w += style().pixelMetric(TQStyle::PM_MenuButtonIndicator, this);
if ( pixmap() ) {
TQPixmap *pm = (TQPixmap *)pixmap();
w += pm->width();
h += pm->height();
} else {
TQString s( text() );
bool empty = s.isEmpty();
if ( empty )
s = TQString::fromLatin1("XXXX");
TQFontMetrics fm = fontMetrics();
TQSize sz = fm.size( ShowPrefix, s );
if(!empty || !w)
w += sz.width();
if(!empty || !h)
h = TQMAX(h, sz.height());
}
return (style().sizeFromContents(TQStyle::CT_ToolButton, this, TQSize(w, h)).
expandedTo(TQApplication::globalStrut()));
}
KMultiTabBarTab::KMultiTabBarTab(const TQPixmap& pic, const TQString& text,
int id,TQWidget *parent,KMultiTabBar::KMultiTabBarPosition pos,
KMultiTabBar::KMultiTabBarStyle style)
:KMultiTabBarButton(text,0,id,parent,pos,style),
m_showActiveTabText(false)
{
d=new KMultiTabBarTabPrivate();
setIcon(pic);
m_expandedSize=24;
setToggleButton(true);
}
KMultiTabBarTab::~KMultiTabBarTab() {
delete d;
}
void KMultiTabBarTab::setTabsPosition(KMultiTabBar::KMultiTabBarPosition pos)
{
if ((pos!=m_position) && ((pos==KMultiTabBar::Left) || (pos==KMultiTabBar::Right))) {
if (!d->pix.isNull()) {
TQWMatrix temp;// (1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F);
temp.rotate(180);
d->pix=d->pix.xForm(temp);
setIconSet(d->pix);
}
}
setPosition(pos);
// repaint();
}
void KMultiTabBarTab::setIcon(const TQString& icon)
{
TQPixmap pic=SmallIcon(icon);
setIcon(pic);
}
void KMultiTabBarTab::setIcon(const TQPixmap& icon)
{
if (m_style!=KMultiTabBar::KDEV3) {
if ((m_position==KMultiTabBar::Left) || (m_position==KMultiTabBar::Right)) {
TQWMatrix rotateMatrix;
if (m_position==KMultiTabBar::Left)
rotateMatrix.rotate(90);
else
rotateMatrix.rotate(-90);
TQPixmap pic=icon.xForm(rotateMatrix); //TODO FIX THIS, THIS SHOWS WINDOW
d->pix=pic;
setIconSet(pic);
} else setIconSet(icon);
}
}
void KMultiTabBarTab::slotClicked()
{
updateState();
KMultiTabBarButton::slotClicked();
}
void KMultiTabBarTab::setState(bool b)
{
setOn(b);
updateState();
}
void KMultiTabBarTab::updateState()
{
if (m_style!=KMultiTabBar::KONQSBC) {
if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) {
TQPushButton::setText(m_text);
} else {
kdDebug()<<"KMultiTabBarTab::updateState(): setting text to an empty TQString***************"<<endl;
TQPushButton::setText(TQString());
}
if ((m_position==KMultiTabBar::Right || m_position==KMultiTabBar::Left)) {
setFixedWidth(24);
if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) {
setFixedHeight(KMultiTabBarButton::sizeHint().width());
} else setFixedHeight(36);
} else {
setFixedHeight(24);
if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) {
setFixedWidth(KMultiTabBarButton::sizeHint().width());
} else setFixedWidth(36);
}
} else {
if ((!isOn()) || (!m_showActiveTabText))
{
setFixedWidth(24);
setFixedHeight(24);
return;
}
if ((m_position==KMultiTabBar::Right || m_position==KMultiTabBar::Left))
setFixedHeight(m_expandedSize);
else
setFixedWidth(m_expandedSize);
}
TQApplication::sendPostedEvents(0,TQEvent::Paint | TQEvent::Move | TQEvent::Resize | TQEvent::LayoutHint);
TQApplication::flush();
}
int KMultiTabBarTab::neededSize()
{
return (((m_style!=KMultiTabBar::KDEV3)?24:0)+TQFontMetrics(TQFont()).width(m_text)+6);
}
void KMultiTabBarTab::setSize(int size)
{
m_expandedSize=size;
updateState();
}
void KMultiTabBarTab::showActiveTabText(bool show)
{
m_showActiveTabText=show;
}
void KMultiTabBarTab::drawButtonLabel(TQPainter *p) {
drawButton(p);
}
void KMultiTabBarTab::drawButton(TQPainter *paint)
{
if (m_style!=KMultiTabBar::KONQSBC) drawButtonStyled(paint);
else drawButtonClassic(paint);
}
void KMultiTabBarTab::drawButtonStyled(TQPainter *paint) {
TQSize sh;
const int width = 36; // rotated
const int height = 24;
if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) {
if ((m_position==KMultiTabBar::Left) || (m_position==KMultiTabBar::Right))
sh=TQSize(this->height(),this->width());//KMultiTabBarButton::sizeHint();
else sh=TQSize(this->width(),this->height());
}
else
sh=TQSize(width,height);
TQPixmap pixmap( sh.width(),height); ///,sh.height());
pixmap.fill(eraseColor());
TQPainter painter(&pixmap);
TQStyle::SFlags st=TQStyle::Style_Default;
st|=TQStyle::Style_Enabled;
if (isOn()) st|=TQStyle::Style_On;
style().drawControl(TQStyle::CE_PushButton,&painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), colorGroup(),st);
style().drawControl(TQStyle::CE_PushButtonLabel,&painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), colorGroup(),st);
switch (m_position) {
case KMultiTabBar::Left:
paint->rotate(-90);
paint->drawPixmap(1-pixmap.width(),0,pixmap);
break;
case KMultiTabBar::Right:
paint->rotate(90);
paint->drawPixmap(0,1-pixmap.height(),pixmap);
break;
default:
paint->drawPixmap(0,0,pixmap);
break;
}
// style().drawControl(TQStyle::CE_PushButtonLabel,painter,this, TQRect(0,0,pixmap.width(),pixmap.height()),
// colorGroup(),TQStyle::Style_Enabled);
}
void KMultiTabBarTab::drawButtonClassic(TQPainter *paint)
{
TQPixmap pixmap;
if ( iconSet())
pixmap = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal );
paint->fillRect(0, 0, 24, 24, colorGroup().background());
if (!isOn())
{
if (m_position==KMultiTabBar::Right)
{
paint->fillRect(0,0,21,21,TQBrush(colorGroup().background()));
paint->setPen(colorGroup().background().dark(150));
paint->drawLine(0,22,23,22);
paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap);
paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,0,23);
paint->setPen(colorGroup().background().dark(120));
paint->drawLine(1,0,1,23);
}
else
if ((m_position==KMultiTabBar::Bottom) || (m_position==KMultiTabBar::Top))
{
paint->fillRect(0,1,23,22,TQBrush(colorGroup().background()));
paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap);
paint->setPen(colorGroup().background().dark(120));
paint->drawLine(23,0,23,23);
paint->setPen(colorGroup().light());
paint->drawLine(0,22,23,22);
paint->drawLine(0,23,23,23);
paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,23,0);
paint->setPen(colorGroup().background().dark(120));
paint->drawLine(0,1,23,1);
}
else
{
paint->setPen(colorGroup().background().dark(120));
paint->drawLine(0,23,23,23);
paint->fillRect(0,0,23,21,TQBrush(colorGroup().background()));
paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap);
paint->setPen(colorGroup().light());
paint->drawLine(23,0,23,23);
paint->drawLine(22,0,22,23);
paint->setPen(colorGroup().shadow());
paint->drawLine(0,0,0,23);
}
}
else
{
if (m_position==KMultiTabBar::Right)
{
paint->setPen(colorGroup().shadow());
paint->drawLine(0,height()-1,23,height()-1);
paint->drawLine(0,height()-2,23,height()-2);
paint->drawLine(23,0,23,height()-1);
paint->drawLine(22,0,22,height()-1);
paint->fillRect(0,0,21,height()-3,TQBrush(colorGroup().light()));
paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap);
if (m_showActiveTabText)
{
if (height()<25+4) return;
TQPixmap tpixmap(height()-25-3, width()-2);
TQPainter painter(&tpixmap);
painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),TQBrush(colorGroup().light()));
painter.setPen(colorGroup().text());
painter.drawText(0,+width()/2+TQFontMetrics(TQFont()).height()/2,m_text);
paint->rotate(90);
kdDebug()<<"tpixmap.width:"<<tpixmap.width()<<endl;
paint->drawPixmap(25,-tpixmap.height()+1,tpixmap);
}
}
else
if (m_position==KMultiTabBar::Top)
{
paint->fillRect(0,0,width()-1,23,TQBrush(colorGroup().light()));
paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap);
if (m_showActiveTabText)
{
paint->setPen(colorGroup().text());
paint->drawText(25,height()/2+TQFontMetrics(TQFont()).height()/2,m_text);
}
}
else
if (m_position==KMultiTabBar::Bottom)
{
paint->setPen(colorGroup().shadow());
paint->drawLine(0,23,width()-1,23);
paint->drawLine(0,22,width()-1,22);
paint->fillRect(0,0,width()-1,21,TQBrush(colorGroup().light()));
paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap);
if (m_showActiveTabText)
{
paint->setPen(colorGroup().text());
paint->drawText(25,height()/2+TQFontMetrics(TQFont()).height()/2,m_text);
}
}
else
{
paint->setPen(colorGroup().shadow());
paint->drawLine(0,height()-1,23,height()-1);
paint->drawLine(0,height()-2,23,height()-2);
paint->fillRect(0,0,23,height()-3,TQBrush(colorGroup().light()));
paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap);
if (m_showActiveTabText)
{
if (height()<25+4) return;
TQPixmap tpixmap(height()-25-3, width()-2);
TQPainter painter(&tpixmap);
painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),TQBrush(colorGroup().light()));
painter.setPen(colorGroup().text());
painter.drawText(tpixmap.width()-TQFontMetrics(TQFont()).width(m_text),+width()/2+TQFontMetrics(TQFont()).height()/2,m_text);
paint->rotate(-90);
kdDebug()<<"tpixmap.width:"<<tpixmap.width()<<endl;
paint->drawPixmap(-24-tpixmap.width(),2,tpixmap);
}
}
}
}
KMultiTabBar::KMultiTabBar(KMultiTabBarMode bm, TQWidget *parent,const char *name):TQWidget(parent,name)
{
m_buttons.setAutoDelete(false);
if (bm==Vertical)
{
m_l=new TQVBoxLayout(this);
setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Expanding, true);
// setFixedWidth(24);
}
else
{
m_l=new TQHBoxLayout(this);
setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Fixed, true);
// setFixedHeight(24);
}
m_l->setMargin(0);
m_l->setAutoAdd(false);
m_internal=new KMultiTabBarInternal(this,bm);
setPosition((bm==KMultiTabBar::Vertical)?KMultiTabBar::Right:KMultiTabBar::Bottom);
setStyle(VSNET);
// setStyle(KDEV3);
//setStyle(KONQSBC);
m_l->insertWidget(0,m_internal);
m_l->insertWidget(0,m_btnTabSep=new TQFrame(this));
m_btnTabSep->setFixedHeight(4);
m_btnTabSep->setFrameStyle(TQFrame::Panel | TQFrame::Sunken);
m_btnTabSep->setLineWidth(2);
m_btnTabSep->hide();
updateGeometry();
}
KMultiTabBar::~KMultiTabBar() {
}
/*int KMultiTabBar::insertButton(TQPixmap pic,int id ,const TQString&)
{
(new TDEToolbarButton(pic,id,m_internal))->show();
return 0;
}*/
int KMultiTabBar::appendButton(const TQPixmap &pic ,int id,TQPopupMenu *popup,const TQString&)
{
KMultiTabBarButton *btn;
m_buttons.append(btn= new KMultiTabBarButton(pic,TQString(),
popup,id,this,m_position,m_internal->m_style));
m_l->insertWidget(0,btn);
btn->show();
m_btnTabSep->show();
return 0;
}
void KMultiTabBar::updateSeparator() {
bool hideSep=true;
for (TQPtrListIterator<KMultiTabBarButton> it(m_buttons);it.current();++it){
if (it.current()->isVisibleTo(this)) {
hideSep=false;
break;
}
}
if (hideSep) m_btnTabSep->hide();
else m_btnTabSep->show();
}
int KMultiTabBar::appendTab(const TQPixmap &pic ,int id ,const TQString& text)
{
m_internal->appendTab(pic,id,text);
return 0;
}
KMultiTabBarButton* KMultiTabBar::button(int id) const
{
for (TQPtrListIterator<KMultiTabBarButton> it(m_buttons);it.current();++it){
if (it.current()->id()==id) return it.current();
}
return 0;
}
KMultiTabBarTab* KMultiTabBar::tab(int id) const
{
return m_internal->tab(id);
}
void KMultiTabBar::removeButton(int id)
{
for (uint pos=0;pos<m_buttons.count();pos++)
{
if (m_buttons.at(pos)->id()==id)
{
m_buttons.take(pos)->deleteLater();
break;
}
}
if (m_buttons.count()==0) m_btnTabSep->hide();
}
void KMultiTabBar::removeTab(int id)
{
m_internal->removeTab(id);
}
void KMultiTabBar::setTab(int id,bool state)
{
KMultiTabBarTab *ttab=tab(id);
if (ttab)
{
ttab->setState(state);
}
}
bool KMultiTabBar::isTabRaised(int id) const
{
KMultiTabBarTab *ttab=tab(id);
if (ttab)
{
return ttab->isOn();
}
return false;
}
void KMultiTabBar::showActiveTabTexts(bool show)
{
m_internal->showActiveTabTexts(show);
}
void KMultiTabBar::setStyle(KMultiTabBarStyle style)
{
m_internal->setStyle(style);
}
void KMultiTabBar::setPosition(KMultiTabBarPosition pos)
{
m_position=pos;
m_internal->setPosition(pos);
for (uint i=0;i<m_buttons.count();i++)
m_buttons.at(i)->setPosition(pos);
}
void KMultiTabBar::fontChange(const TQFont& /* oldFont */)
{
for (uint i=0;i<tabs()->count();i++)
tabs()->at(i)->resize();
repaint();
}
TQPtrList<KMultiTabBarTab>* KMultiTabBar::tabs() {return m_internal->tabs();}
TQPtrList<KMultiTabBarButton>* KMultiTabBar::buttons() {return &m_buttons;}

@ -1,249 +0,0 @@
/***************************************************************************
tdemultitabbar.h - description
-------------------
begin : 2001
copyright : (C) 2001,2002,2003 by 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 _TDEMultitabbar_h_
#define _TDEMultitabbar_h_
#include <tqscrollview.h>
#include <tqvbox.h>
#include <tqhbox.h>
#include <tqlayout.h>
#include <tqstring.h>
#include <tqptrlist.h>
#include <tqpushbutton.h>
#include <tdelibs_export.h>
class TQPixmap;
class TQPainter;
class TQFrame;
class KMultiTabBarPrivate;
class KMultiTabBarTabPrivate;
class KMultiTabBarButtonPrivate;
class KMultiTabBarInternal;
/**
* A Widget for horizontal and vertical tabs.
* It is possible to add normal buttons to the top/left
* The handling if only one tab at a time or multiple tabs
* should be raisable is left to the "user".
*@author Joseph Wenninger
*/
class TDEUTILS_EXPORT KMultiTabBar: public TQWidget
{
TQ_OBJECT
public:
enum KMultiTabBarMode{Horizontal,Vertical};
enum KMultiTabBarPosition{Left, Right, Top, Bottom};
/**
* VSNET == Visual Studio .Net like (only show the text of active tabs
* KDEV3 == Kdevelop 3 like (always show the text)
* KONQSBC == konqy's classic sidebar style (unthemed), this one is disabled
* at the moment, but will be renabled soon too
*/
enum KMultiTabBarStyle{VSNET=0, KDEV3=1, KONQSBC=2, KDEV3ICON=3,STYLELAST=0xffff};
KMultiTabBar(KMultiTabBarMode bm,TQWidget *parent=0,const char *name=0);
virtual ~KMultiTabBar();
/**
* append a new button to the button area. The button can later on be accessed with button(ID)
* eg for connecting signals to it
* @param pic a pixmap for the button
* @param id an arbitraty ID value. It will be emitted in the clicked signal for identifying the button
* if more than one button is connected to a signals.
* @param popup A popup menu which should be displayed if the button is clicked
* @param not_used_yet will be used for a popup text in the future
*/
int appendButton(const TQPixmap &pic,int id=-1,TQPopupMenu* popup=0,const TQString& not_used_yet=TQString());
/**
* remove a button with the given ID
*/
void removeButton(int id);
/**
* append a new tab to the tab area. It can be accessed lateron with tabb(id);
* @param pic a bitmap for the tab
* @param id an arbitrary ID which can be used later on to identify the tab
* @param text if a mode with text is used it will be the tab text, otherwise a mouse over hint
*/
int appendTab(const TQPixmap &pic,int id=-1,const TQString& text=TQString());
/**
* remove a tab with a given ID
*/
void removeTab(int id);
/**
* set a tab to "raised"
* @param id The ID of the tab to manipulate
* @param state true == activated/raised, false == not active
*/
void setTab(int id ,bool state);
/**
* return the state of a tab, identified by it's ID
*/
bool isTabRaised(int id) const;
/**
* get a pointer to a button within the button area identified by its ID
*/
class KMultiTabBarButton *button(int id) const;
/**
* get a pointer to a tab within the tab area, identiifed by its ID
*/
class KMultiTabBarTab *tab(int id) const;
/**
* set the real position of the widget.
* @param pos if the mode is horizontal, only use top, bottom, if it is vertical use left or right
*/
void setPosition(KMultiTabBarPosition pos);
/**
* set the display style of the tabs
*/
void setStyle(KMultiTabBarStyle style);
/**
* be carefull, don't delete tabs yourself and don't delete the list itself
*/
TQPtrList<KMultiTabBarTab>* tabs();
/**
* be carefull, don't delete buttons yourself and don't delete the list itself
*/
TQPtrList<KMultiTabBarButton>* buttons();
/**
* might vanish, not sure yet
*/
void showActiveTabTexts(bool show=true);
protected:
friend class KMultiTabBarButton;
virtual void fontChange( const TQFont& );
void updateSeparator();
private:
class KMultiTabBarInternal *m_internal;
TQBoxLayout *m_l;
TQFrame *m_btnTabSep;
TQPtrList<KMultiTabBarButton> m_buttons;
KMultiTabBarPosition m_position;
KMultiTabBarPrivate *d;
};
/**
* This class should never be created except with the appendButton call of KMultiTabBar
*/
class TDEUTILS_EXPORT KMultiTabBarButton: public TQPushButton
{
TQ_OBJECT
public:
KMultiTabBarButton(const TQPixmap& pic,const TQString&, TQPopupMenu *popup,
int id,TQWidget *parent, KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
KMultiTabBarButton(const TQString&, TQPopupMenu *popup,
int id,TQWidget *parent, KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
virtual ~KMultiTabBarButton();
int id() const;
public slots:
/**
* this is used internaly, but can be used by the user, if (s)he wants to
* It the according call of KMultiTabBar is invoked though this modifications will be overwritten
*/
void setPosition(KMultiTabBar::KMultiTabBarPosition);
/**
* this is used internaly, but can be used by the user, if (s)he wants to
* It the according call of KMultiTabBar is invoked though this modifications will be overwritten
*/
void setStyle(KMultiTabBar::KMultiTabBarStyle);
/**
* modify the text of the button
*/
void setText(const TQString &);
TQSize sizeHint() const;
protected:
KMultiTabBar::KMultiTabBarPosition m_position;
KMultiTabBar::KMultiTabBarStyle m_style;
TQString m_text;
virtual void hideEvent( class TQHideEvent*);
virtual void showEvent( class TQShowEvent*);
private:
int m_id;
KMultiTabBarButtonPrivate *d;
signals:
/**
* this is emitted if the button is clicked
* @param id the ID identifying the button
*/
void clicked(int id);
protected slots:
virtual void slotClicked();
};
/**
* This class should never be created except with the appendTab call of KMultiTabBar
*/
class TDEUTILS_EXPORT KMultiTabBarTab: public KMultiTabBarButton
{
TQ_OBJECT
public:
KMultiTabBarTab(const TQPixmap& pic,const TQString&,int id,TQWidget *parent,
KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style);
virtual ~KMultiTabBarTab();
/**
* set the active state of the tab
* @param state true==active false==not active
*/
void setState(bool state);
/**
* choose if the text should always be displayed
* this is only used in classic mode if at all
*/
void showActiveTabText(bool show);
void resize(){ setSize( neededSize() ); }
private:
bool m_showActiveTabText;
int m_expandedSize;
KMultiTabBarTabPrivate *d;
protected:
friend class KMultiTabBarInternal;
void setSize(int);
int neededSize();
void updateState();
virtual void drawButton(TQPainter *);
virtual void drawButtonLabel(TQPainter *);
void drawButtonStyled(TQPainter *);
void drawButtonClassic(TQPainter *);
protected slots:
virtual void slotClicked();
void setTabsPosition(KMultiTabBar::KMultiTabBarPosition);
public slots:
virtual void setIcon(const TQString&);
virtual void setIcon(const TQPixmap&);
};
#endif

@ -1,68 +0,0 @@
/***************************************************************************
tdemultitabbar_p.h - description
-------------------
begin : 2003
copyright : (C) 2003 by 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 TDE_MULTI_TAB_BAR_P_H
#define TDE_MULTI_TAB_BAR_P_H
#include <tqscrollview.h>
#include <tdemultitabbar.h>
class KMultiTabBarInternal: public TQScrollView
{
TQ_OBJECT
public:
KMultiTabBarInternal(TQWidget *parent,KMultiTabBar::KMultiTabBarMode bm);
int appendTab(const TQPixmap &,int=-1,const TQString& =TQString());
KMultiTabBarTab *tab(int) const;
void removeTab(int);
void setPosition(enum KMultiTabBar::KMultiTabBarPosition pos);
void setStyle(enum KMultiTabBar::KMultiTabBarStyle style);
void showActiveTabTexts(bool show);
TQPtrList<KMultiTabBarTab>* tabs(){return &m_tabs;}
private:
friend class KMultiTabBar;
TQWidget *box;
TQBoxLayout *mainLayout;
TQPtrList<KMultiTabBarTab> m_tabs;
enum KMultiTabBar::KMultiTabBarPosition m_position;
bool m_showActiveTabTexts;
enum KMultiTabBar::KMultiTabBarStyle m_style;
int m_expandedTabSize;
int m_lines;
KMultiTabBar::KMultiTabBarMode m_barMode;
protected:
virtual bool eventFilter(TQObject *,TQEvent*);
virtual void drawContents ( TQPainter *, int, int, int, int);
/**
* [contentsM|m]ousePressEvent are reimplemented from TQScrollView
* in order to ignore all mouseEvents on the viewport, so that the
* parent can handle them.
*/
virtual void contentsMousePressEvent(TQMouseEvent *);
virtual void mousePressEvent(TQMouseEvent *);
virtual void resizeEvent(TQResizeEvent *);
};
#endif

@ -14,5 +14,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/src \
-I$(top_srcdir)/quanta/parsers \
-I$(top_srcdir)/quanta/project \
-I$(top_srcdir)/lib \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
noinst_HEADERS = styleeditor.h

@ -11,5 +11,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/src \
-I$(top_srcdir)/quanta/parsers \
-I$(top_srcdir)/quanta/project \
-I$(top_srcdir)/lib \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
noinst_HEADERS = cvsservicedcopif.h

@ -25,7 +25,6 @@
#include <tdeaction.h>
#include <tdeapplication.h>
#include <kcombobox.h>
#include <tdeversion.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <tdelistbox.h>

@ -21,5 +21,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/components/debuggerquanta \
-I$(top_srcdir)/quanta/parts/preview \
-I$(top_srcdir)/quanta/messages \
-I$(top_srcdir)/lib \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
noinst_HEADERS = pathmapper.h backtracelistview.h

@ -19,7 +19,6 @@
#include <tdelocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <tdeversion.h>
#include <tdelistview.h>
// Quanta includes

@ -16,7 +16,6 @@
#include <errno.h>
#include <kdebug.h>
#include <tdeversion.h>
#include <kgenericfactory.h>
#include <tdelocale.h>
#include <kmdcodec.h>

@ -19,7 +19,6 @@
#include <tdelocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <tdeversion.h>
#include <kinputdialog.h>
#include <tdelistview.h>

@ -23,7 +23,6 @@
#include <tqslider.h>
#include <tqcheckbox.h>
#include <tqcombobox.h>
#include <tdeversion.h>
#include <errno.h>
#include <tqstring.h>
#include <tqmap.h>

@ -19,7 +19,6 @@
#include <tdelocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <tdeversion.h>
#include <kinputdialog.h>
#include <tqclipboard.h>

@ -10,6 +10,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \
-I$(top_srcdir)/quanta/src \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/quanta/components/tableeditor \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
noinst_HEADERS = tableeditor.h tableitem.h

@ -18,7 +18,6 @@
#define TABLEITEM_H
#include <tqtable.h>
#include <tdeversion.h>
class TableItem : public TQTableItem
{

@ -12,7 +12,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib \
-I$(top_srcdir)/quanta/utility \
-I$(top_srcdir)/quanta/parsers \
-I$(top_srcdir)/quanta/src \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
SUBDIRS = settings tagdialogs

@ -38,7 +38,6 @@
#include <tdepopupmenu.h>
#include <kpushbutton.h>
#include <tdestandarddirs.h>
#include <tdeversion.h>
#include <kinputdialog.h>
#include <tdetoolbar.h>

@ -12,7 +12,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \
-I$(top_srcdir)/quanta/src \
-I$(top_srcdir)/quanta/parts/kafka \
-I$(top_srcdir)/lib \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
METASOURCES = AUTO

@ -10,7 +10,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \
-I$(top_srcdir)/quanta/parts/kafka \
-I$(top_srcdir)/quanta/treeviews \
-I$(top_srcdir)/lib \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
noinst_HEADERS = saparser.h parsercommon.h sagroupparser.h

@ -1,8 +1,2 @@
#This line is required for KDevelop
#tdevelop: KAFKA_SUBDIR=kafka
if BUILD_WYSIWYG
KAFKA_SUBDIR=kafka
endif
SUBDIRS = preview $(KAFKA_SUBDIR)
SUBDIRS = preview kafka

@ -1,42 +0,0 @@
build_vpl="yes"
#build_vpl="no"
AC_DEFUN([QUANTA_CHECK_VPL],
[
AC_MSG_CHECKING(whether VPL can be compiled)
AC_CACHE_VAL(ac_cv_vpl_setup,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$KDE_INCLUDES $TQT_INCLUDES"
AC_TRY_LINK([
#include <tdeversion.h>
],
[
#if TDE_VERSION < ((3<<16) | (1<<8) | (90))
KDE_choke me
#endif
],
ac_cv_vpl_setup=yes,
ac_cv_vpl_setup=no
)
CXXFLAGS="$save_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_vpl_setup" = "yes"; then
build_vpl="yes"
CXXFLAGS="$CXXFLAGS -DBUILD_KAFKAPART"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
#QUANTA_CHECK_VPL
AM_CONDITIONAL(BUILD_WYSIWYG, test "$build_vpl" = "yes")

@ -22,7 +22,6 @@
//kde includes
#include <tdeconfig.h>
#include <kdebug.h>
#include <tdeversion.h>
#include <tdehtml_settings.h>
#include <tdehtmlview.h>
#include <tdelocale.h>

@ -10,6 +10,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \
-I$(top_srcdir)/quanta/project \
-I$(top_srcdir)/quanta/messages \
-I$(top_srcdir)/lib \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)

@ -20,7 +20,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \
-I$(top_srcdir)/quanta/components/debugger \
-I$(top_srcdir)/quanta/components/debugger/interfaces \
-I$(top_builddir)/quanta/dialogs \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
noinst_HEADERS = teammembersdlg.h membereditdlg.h eventconfigurationdlg.h \
eventeditordlg.h

@ -32,7 +32,6 @@
#include <tdemessagebox.h>
#include <kurl.h>
#include <kprotocolinfo.h>
#include <tdeversion.h>
//app includes
#include "projectnewgeneral.h"

@ -31,7 +31,6 @@
#include <tdefiledialog.h>
#include <kprogress.h>
#include <kmimetype.h>
#include <tdeversion.h>
#include <kurlrequesterdlg.h>
#include <kurlrequester.h>

@ -17,7 +17,6 @@
#include <kcombobox.h>
#include <tdefiledialog.h>
#include <tdeversion.h>
#include <tdemessagebox.h>
#include <tdelocale.h>

@ -1,7 +1,5 @@
if BUILD_WYSIWYG
LIB_KAFKA = $(top_builddir)/quanta/parts/kafka/libkafkalibrary.la
KAFKAINCLUDE = -I$(top_srcdir)/quanta/parts/kafka -I$(top_builddir)/quanta/parts/kafka
endif
if include_cvsservice
CVSSERVICE_INCLUDE = -I$(top_srcdir)/quanta/components/cvsservice
@ -30,7 +28,7 @@ quanta_LDADD = $(top_builddir)/quanta/project/libproject.la \
$(top_builddir)/quanta/utility/libutility.la \
$(top_builddir)/lib/libquantamodule.la \
-lkatepartinterfaces $(LIB_TDENEWSTUFF) $(LIB_KAFKA) $(LIB_CVSSERVICE) \
$(LIB_KMDI) $(LIBXML_LIBS) $(LIBXSLT_LIBS) $(LIB_TDEABC) $(LIB_TDESPELL) $(LIB_TDEHTML) -lX11 -ltdefx
-ltdemdi $(LIBXML_LIBS) $(LIBXSLT_LIBS) $(LIB_TDEABC) $(LIB_TDESPELL) $(LIB_TDEHTML) -lX11 -ltdefx
# $(top_builddir)/lib/compatibility/libcompat.la
AM_CPPFLAGS = -I$(top_srcdir)/quanta/dialogs \
@ -57,7 +55,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/dialogs \
-I$(top_builddir)/quanta/components/framewizard \
-I$(top_builddir)/quanta/components/tableeditor \
-I$(top_builddir)/quanta/plugins \
$(KAFKAINCLUDE) $(CVSSERVICE_INCLUDE) $(KMDI_INCLUDES) \
$(KAFKAINCLUDE) $(CVSSERVICE_INCLUDE) \
$(KNEWSTUFF_INCLUDES) $(all_includes)
# -I$(top_srcdir)/lib/compatibility

@ -28,7 +28,6 @@
#include <tdeglobalsettings.h>
#include <ksplashscreen.h>
#include <dcopclient.h>
#include <tdeversion.h>
#include "config.h"
#include "quantacommon.h"

@ -68,7 +68,6 @@
#include <tdeconfig.h>
#include <tdehtmlview.h>
#include <kdialogbase.h>
#include <tdeversion.h>
#include <kkeydialog.h>
#include <kinputdialog.h>
#include <klibloader.h>

@ -38,7 +38,6 @@
#include <tqptrlist.h>
// include files for KDE
#include <tdeversion.h>
#include <kdockwidget.h>
#include <tdeparts/browserextension.h>
#include <tdeparts/dockmainwindow.h>

@ -33,7 +33,6 @@
#include <tdepopupmenu.h>
#include <tdemessagebox.h>
#include <kdirwatch.h>
#include <tdeversion.h>
#include <kdebug.h>
#include <kiconloader.h>

@ -42,7 +42,6 @@
#include <kiconloader.h>
#include <tdemessagebox.h>
#include <kurldrag.h>
#include <tdeversion.h>
#include <tdeparts/partmanager.h>
#include <kstatusbar.h>

@ -21,5 +21,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \
-I$(top_builddir)/quanta/dialogs/tagdialogs \
-I$(top_builddir)/quanta/components/csseditor \
-I$(top_srcdir)/quanta/plugins \
$(KMDI_INCLUDES) $(CVSSERVICE_INCLUDE) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS) $(all_includes)
$(CVSSERVICE_INCLUDE) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS) $(all_includes)
CXXFLAGS += $(ICU_CXXFLAGS)

@ -14,7 +14,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/quanta/src \
-I$(top_srcdir)/quanta/project \
-I$(top_srcdir)/lib \
$(KNEWSTUFF_INCLUDES) \
$(KMDI_INCLUDES) $(all_includes)
$(all_includes)
libutility_la_LDFLAGS = $(all_libraries)
noinst_HEADERS = qpevents.h tagactionmanager.h tagactionset.h

@ -16,8 +16,6 @@
#ifndef QUANTACOMMON_H
#define QUANTACOMMON_H
#include <tdeversion.h>
#include "qtag.h"
#include "node.h"
#include "parser.h"

@ -92,12 +92,8 @@ TagAction::TagAction( TQDomElement *element, TDEMainWindow *parentMainWindow, bo
setIcon(s);
m_file = 0L;
loopStarted = false;
#if TDE_VERSION >= TDE_MAKE_VERSION(3,4,0)
connect(this, TQ_SIGNAL(activated(TDEAction::ActivationReason, TQt::ButtonState)),
TQ_SLOT(slotActionActivated(TDEAction::ActivationReason, TQt::ButtonState)));
#else
connect(this, TQ_SIGNAL(activated()), TQ_SLOT(slotActionActivated()));
#endif
connect(this, TQ_SIGNAL(showMessage(const TQString&, bool)), m_parentMainWindow, TQ_SIGNAL(showMessage(const TQString&, bool)));
connect(this, TQ_SIGNAL(clearMessages()), m_parentMainWindow, TQ_SIGNAL(clearMessages()));
connect(this, TQ_SIGNAL(showMessagesView()), m_parentMainWindow, TQ_SLOT(slotShowMessagesView()));
@ -113,7 +109,6 @@ TQString TagAction::type()
return tag.attribute("type","");
}
#if TDE_VERSION >= TDE_MAKE_VERSION(3,4,0)
bool TagAction::slotActionActivated(TDEAction::ActivationReason reason, TQt::ButtonState /*state*/)
{
QuantaView *view = ViewManager::ref()->activeView();
@ -485,12 +480,6 @@ bool TagAction::slotActionActivated(TDEAction::ActivationReason reason, TQt::But
}
return true;
}
#else
// hack to compile. moc doesn't check the "#ifdef" at the declaration and the compiler complains
// of no matching function.
bool TagAction::slotActionActivated(TDEAction::ActivationReason /*reason*/, TQt::ButtonState /*state*/)
{return true;}
#endif
bool TagAction::slotActionActivated()
{

@ -18,7 +18,6 @@
#ifndef TAGACTION_H
#define TAGACTION_H
#include <tdeversion.h>
#include <tdeaction.h>
#include <tdeactioncollection.h>

@ -25,7 +25,6 @@
//kde includes
#include <tdeaction.h>
#include <tdeaccelmanager.h>
#include <tdeversion.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <tdemessagebox.h>

Loading…
Cancel
Save