diff options
-rw-r--r-- | kompare/komparepart/kompare_qsplitter.h | 190 | ||||
-rw-r--r-- | kompare/komparepart/kompareconnectwidget.cpp | 4 | ||||
-rw-r--r-- | kompare/komparepart/kompareconnectwidget.h | 4 | ||||
-rw-r--r-- | kompare/komparepart/komparesplitter.cpp | 58 | ||||
-rw-r--r-- | kompare/komparepart/komparesplitter.h | 8 |
5 files changed, 42 insertions, 222 deletions
diff --git a/kompare/komparepart/kompare_qsplitter.h b/kompare/komparepart/kompare_qsplitter.h index 52009244..2b776944 100644 --- a/kompare/komparepart/kompare_qsplitter.h +++ b/kompare/komparepart/kompare_qsplitter.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** -** Definition of KQSplitter class +** Definition of TQSplitter class ** ** Created : 980105 ** @@ -21,192 +21,12 @@ ** **********************************************************************/ -#ifndef KQSPLITTER_H -#define KQSPLITTER_H +#ifndef TQSPLITTER_H +#define TQSPLITTER_H #include "tqframe.h" #include "tqvaluelist.h" -#ifndef TQT_NO_SPLITTER +#include <tqsplitter.h> -//class KQSplitterHandle; -class KQSplitterLayoutStruct; -class TQTextStream; - -class KQSplitterPrivate -{ -public: - KQSplitterPrivate() - : opaque( FALSE ), firstShow( TRUE ), tqchildrenCollapsible( TRUE ), - handleWidth( 0 ) { } - - TQPtrList<KQSplitterLayoutStruct> list; - bool opaque : 8; - bool firstShow : 8; - bool tqchildrenCollapsible : 8; - int handleWidth; -}; - -class TQ_EXPORT KQSplitter : public TQFrame -{ - Q_OBJECT - TQ_OBJECT - TQ_PROPERTY( Qt::Orientation orientation READ orientation WRITE setOrientation ) - TQ_PROPERTY( bool opaqueResize READ opaqueResize WRITE setOpaqueResize ) - TQ_PROPERTY( int handleWidth READ handleWidth WRITE setHandleWidth ) - TQ_PROPERTY( bool tqchildrenCollapsible READ tqchildrenCollapsible WRITE setChildrenCollapsible ) - -public: - // ### TQt 4.0: remove Auto from public API - enum ResizeMode { Stretch, KeepSize, FollowSizeHint, Auto }; - - KQSplitter( TQWidget* tqparent = 0, const char* name = 0 ); - KQSplitter( Qt::Orientation, TQWidget* tqparent = 0, const char* name = 0 ); - ~KQSplitter(); - - virtual void setOrientation( Qt::Orientation ); - Qt::Orientation orientation() const { return orient; } - - // ### TQt 4.0: make setChildrenCollapsible() and setCollapsible() virtual - - void setChildrenCollapsible( bool ); - bool tqchildrenCollapsible() const; - - void setCollapsible( TQWidget *w, bool ); - virtual void setResizeMode( TQWidget *w, ResizeMode ); - virtual void setOpaqueResize( bool = TRUE ); - bool opaqueResize() const; - - void moveToFirst( TQWidget * ); - void moveToLast( TQWidget * ); - - void refresh() { recalc( TRUE ); } - TQSize tqsizeHint() const; - TQSize tqminimumSizeHint() const; - - TQValueList<int> sizes() const; - void setSizes( TQValueList<int> ); - - int handleWidth() const; - void setHandleWidth( int ); - -protected: - void childEvent( TQChildEvent * ); - - bool event( TQEvent * ); - void resizeEvent( TQResizeEvent * ); - - int idAfter( TQWidget* ) const; - - void moveSplitter( TQCOORD pos, int id ); - virtual void drawSplitter( TQPainter*, TQCOORD x, TQCOORD y, - TQCOORD w, TQCOORD h ); - void styleChange( TQStyle& ); - int adjustPos( int, int ); - virtual void setRubberband( int ); - void getRange( int id, int *, int * ); - -public: // private (: - enum { DefaultResizeMode = 3 }; - - void init(); - void recalc( bool update = FALSE ); - void doResize(); - void storeSizes(); - void getRange( int id, int *, int *, int *, int * ); - void addContribution( int, int *, int *, bool ); - int adjustPos( int, int, int *, int *, int *, int * ); - bool collapsible( KQSplitterLayoutStruct * ); - void processChildEvents(); - KQSplitterLayoutStruct *findWidget( TQWidget * ); - KQSplitterLayoutStruct *addWidget( TQWidget *, bool prepend = FALSE ); - void recalcId(); - void doMove( bool backwards, int pos, int id, int delta, bool upLeft, - bool mayCollapse ); - void setGeo( TQWidget *w, int pos, int size, bool splitterMoved ); - int findWidgetJustBeforeOrJustAfter( int id, int delta, int &collapsibleSize ); - void updateHandles(); - - inline TQCOORD pick( const TQPoint &p ) const - { return orient ==Qt::Horizontal ? p.x() : p.y(); } - inline TQCOORD pick( const TQSize &s ) const - { return orient ==Qt::Horizontal ? s.width() : s.height(); } - - inline TQCOORD trans( const TQPoint &p ) const - { return orient ==Qt::Vertical ? p.x() : p.y(); } - inline TQCOORD trans( const TQSize &s ) const - { return orient ==Qt::Vertical ? s.width() : s.height(); } - - KQSplitterPrivate *d; - - Qt::Orientation orient; - friend class KQSplitterHandle; - -#ifndef TQT_NO_TEXTSTREAM -// tqmoc doesn't like these. -// friend TQ_EXPORT TQTextStream& operator<<( TQTextStream&, const KQSplitter& ); -// friend TQ_EXPORT TQTextStream& operator>>( TQTextStream&, KQSplitter& ); -#endif - -public: -#if defined(TQ_DISABLE_COPY) - KQSplitter( const KQSplitter & ); - KQSplitter& operator=( const KQSplitter & ); -#endif -}; - -#ifndef TQT_NO_TEXTSTREAM -TQ_EXPORT TQTextStream& operator<<( TQTextStream&, const KQSplitter& ); -TQ_EXPORT TQTextStream& operator>>( TQTextStream&, KQSplitter& ); -#endif - -class KQSplitterHandle : public TQWidget -{ - Q_OBJECT - TQ_OBJECT -public: - KQSplitterHandle( Qt::Orientation o, - KQSplitter *tqparent, const char* name=0 ); - void setOrientation( Qt::Orientation o ); - Qt::Orientation orientation() const { return orient; } - - bool opaque() const { return s->opaqueResize(); } - - TQSize tqsizeHint() const; - - int id() const { return myId; } // d->list.at(id())->wid == this - void setId( int i ) { myId = i; } - -protected: - void paintEvent( TQPaintEvent * ); - void mouseMoveEvent( TQMouseEvent * ); - void mousePressEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - -public: // private (: - Qt::Orientation orient; - bool opaq; - int myId; - - KQSplitter *s; -}; - -const uint Default = 2; - -class KQSplitterLayoutStruct : public TQt -{ -public: - TQCOORD sizer; - uint isHandle : 1; - uint collapsible : 2; - uint resizeMode : 2; - TQWidget *wid; - - KQSplitterLayoutStruct() - : sizer( -1 ), collapsible( Default ) { } - TQCOORD getSizer( Qt::Orientation orient ); -}; - -#endif // TQT_NO_SPLITTER - -#endif // KQSPLITTER_H +#endif // TQSPLITTER_H diff --git a/kompare/komparepart/kompareconnectwidget.cpp b/kompare/komparepart/kompareconnectwidget.cpp index 50c8f221..07781942 100644 --- a/kompare/komparepart/kompareconnectwidget.cpp +++ b/kompare/komparepart/kompareconnectwidget.cpp @@ -41,7 +41,7 @@ KompareConnectWidgetFrame::KompareConnectWidgetFrame( KompareListView* left, ViewSettings* settings, KompareSplitter* tqparent, const char* name ) : - KQSplitterHandle(Qt::Horizontal, (KQSplitter *)tqparent, name), + TQSplitterHandle(Qt::Horizontal, (TQSplitter *)tqparent, name), m_wid ( left, right, settings, this, name ), m_label ( "", this ), m_layout ( this ) @@ -88,7 +88,7 @@ void KompareConnectWidgetFrame::mousePressEvent( TQMouseEvent *e ) { if ( e->button() == Qt::LeftButton ) kMouseOffset = s->pick( e->pos() ); - KQSplitterHandle::mousePressEvent(e); + TQSplitterHandle::mousePressEvent(e); } void KompareConnectWidgetFrame::mouseReleaseEvent( TQMouseEvent *e ) diff --git a/kompare/komparepart/kompareconnectwidget.h b/kompare/komparepart/kompareconnectwidget.h index 1c96d752..a5561a8a 100644 --- a/kompare/komparepart/kompareconnectwidget.h +++ b/kompare/komparepart/kompareconnectwidget.h @@ -67,7 +67,7 @@ private: const Diff2::Difference* m_selectedDifference; }; -class KompareConnectWidgetFrame : public KQSplitterHandle +class KompareConnectWidgetFrame : public TQSplitterHandle { Q_OBJECT TQ_OBJECT @@ -81,7 +81,7 @@ public: KompareConnectWidget* wid() { return &m_wid; } protected: - // stop the tqparent KQSplitterHandle painting + // stop the tqparent TQSplitterHandle painting void paintEvent( TQPaintEvent* /* e */ ) { } void mouseMoveEvent( TQMouseEvent * ); diff --git a/kompare/komparepart/komparesplitter.cpp b/kompare/komparepart/komparesplitter.cpp index 2122e5d0..32b7aa29 100644 --- a/kompare/komparepart/komparesplitter.cpp +++ b/kompare/komparepart/komparesplitter.cpp @@ -36,7 +36,7 @@ using namespace Diff2; KompareSplitter::KompareSplitter( ViewSettings *settings, TQWidget * tqparent, const char *name) : - KQSplitter(Qt::Horizontal, tqparent, name ), + TQSplitter(Qt::Horizontal, tqparent, name ), m_settings( settings ) { TQFrame *scrollFrame = new TQFrame( tqparent, "scrollFrame" ); @@ -99,17 +99,17 @@ KompareSplitter::~KompareSplitter(){} \a prepend is TRUE, then recalcId() is very probably needed.) */ -KQSplitterLayoutStruct *KompareSplitter::addWidget( KompareListViewFrame *w, bool prepend ) +TQSplitterLayoutStruct *KompareSplitter::addWidget( KompareListViewFrame *w, bool prepend ) { /* This function is *not* a good place to make connections to and from * the KompareListView. Make them in the KompareListViewFrame constructor * instad - that way the connections get made upon creation, not upon the * next processing of the event queue. */ - KQSplitterLayoutStruct *s; + TQSplitterLayoutStruct *s; KompareConnectWidgetFrame *newHandle = 0; if ( d->list.count() > 0 ) { - s = new KQSplitterLayoutStruct; + s = new TQSplitterLayoutStruct; s->resizeMode = KeepSize; TQString tmp = "qt_splithandle_"; tmp += w->name(); @@ -127,7 +127,7 @@ KQSplitterLayoutStruct *KompareSplitter::addWidget( KompareListViewFrame *w, boo else d->list.append( s ); } - s = new KQSplitterLayoutStruct; + s = new TQSplitterLayoutStruct; s->resizeMode = DefaultResizeMode; s->wid = w; s->isHandle = FALSE; @@ -153,7 +153,7 @@ void KompareSplitter::childEvent( TQChildEvent *c ) if ( ((TQWidget*)c->child())->testWFlags( WType_TopLevel ) ) return; - KQSplitterLayoutStruct *s = d->list.first(); + TQSplitterLayoutStruct *s = d->list.first(); while ( s ) { if ( s->wid == c->child() ) return; @@ -162,10 +162,10 @@ void KompareSplitter::childEvent( TQChildEvent *c ) addWidget( (KompareListViewFrame*)c->child() ); recalc( isVisible() ); } else if ( c->type() == TQEvent::ChildRemoved ) { - KQSplitterLayoutStruct *prev = 0; + TQSplitterLayoutStruct *prev = 0; if ( d->list.count() > 1 ) prev = d->list.at( 1 ); // yes, this is correct - KQSplitterLayoutStruct *curr = d->list.first(); + TQSplitterLayoutStruct *curr = d->list.first(); while ( curr ) { if ( curr->wid == c->child() ) { d->list.removeRef( curr ); @@ -218,7 +218,7 @@ static TQPoint bottomRight( TQWidget *w ) void KompareSplitter::moveSplitter( TQCOORD p, int id ) { - KQSplitterLayoutStruct *s = d->list.at( id ); + TQSplitterLayoutStruct *s = d->list.at( id ); int farMin; int min; int max; @@ -259,7 +259,7 @@ void KompareSplitter::moveSplitter( TQCOORD p, int id ) void KompareSplitter::doMove( bool backwards, int pos, int id, int delta, bool mayCollapse, int* positions, int* widths ) { - KQSplitterLayoutStruct *s; + TQSplitterLayoutStruct *s; TQWidget *w; for ( ; id >= 0 && id < (int)d->list.count(); id = backwards ? id - delta : id + delta ) { @@ -294,7 +294,7 @@ void KompareSplitter::doMove( bool backwards, int pos, int id, int delta, void KompareSplitter::slotSetSelection( const DiffModel* model, const Difference* diff ) { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) { if ( curr->isHandle ) @@ -314,7 +314,7 @@ void KompareSplitter::slotSetSelection( const DiffModel* model, const Difference void KompareSplitter::slotSetSelection( const Difference* diff ) { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( curr->isHandle ) ((KompareConnectWidgetFrame*) @@ -328,7 +328,7 @@ void KompareSplitter::slotSetSelection( const Difference* diff ) void KompareSplitter::slotApplyDifference( bool apply ) { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( !curr->isHandle ) ((KompareListViewFrame*) @@ -338,7 +338,7 @@ void KompareSplitter::slotApplyDifference( bool apply ) void KompareSplitter::slotApplyAllDifferences( bool apply ) { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( !curr->isHandle ) ((KompareListViewFrame*) @@ -349,7 +349,7 @@ void KompareSplitter::slotApplyAllDifferences( bool apply ) void KompareSplitter::slotApplyDifference( const Difference* diff, bool apply ) { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( !curr->isHandle ) ((KompareListViewFrame*) @@ -359,7 +359,7 @@ void KompareSplitter::slotApplyDifference( const Difference* diff, bool apply ) void KompareSplitter::slotDifferenceClicked( const Difference* diff ) { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( !curr->isHandle ) ((KompareListViewFrame*) @@ -369,7 +369,7 @@ void KompareSplitter::slotDifferenceClicked( const Difference* diff ) void KompareSplitter::slotConfigChanged() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) { if ( !curr->isHandle ) { @@ -385,7 +385,7 @@ void KompareSplitter::slotConfigChanged() void KompareSplitter::slotDelayedRepaintHandles() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( curr->isHandle ) ((KompareConnectWidgetFrame*)curr->wid)->wid()->slotDelayedRepaint(); @@ -393,7 +393,7 @@ void KompareSplitter::slotDelayedRepaintHandles() void KompareSplitter::repaintHandles() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( curr->isHandle ) ((KompareConnectWidgetFrame*)curr->wid)->wid()->tqrepaint(); @@ -557,7 +557,7 @@ void KompareSplitter::slotUpdateVScrollValue() int KompareSplitter::scrollId() { - KQSplitterLayoutStruct *curr = d->list.first(); + TQSplitterLayoutStruct *curr = d->list.first(); for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( !curr->isHandle ) return ((KompareListViewFrame*) curr->wid)->view()->scrollId(); @@ -566,7 +566,7 @@ int KompareSplitter::scrollId() int KompareSplitter::lineSpacing() { - KQSplitterLayoutStruct *curr = d->list.first(); + TQSplitterLayoutStruct *curr = d->list.first(); for ( curr = d->list.first(); curr; curr = d->list.next() ) if ( !curr->isHandle ) return ((KompareListViewFrame*) @@ -576,7 +576,7 @@ int KompareSplitter::lineSpacing() int KompareSplitter::pageSize() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) { if ( !curr->isHandle ) @@ -590,7 +590,7 @@ int KompareSplitter::pageSize() bool KompareSplitter::needVScrollBar() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; int pagesize = pageSize(); for ( curr = d->list.first(); curr; curr = d->list.next() ) { @@ -607,7 +607,7 @@ bool KompareSplitter::needVScrollBar() int KompareSplitter::minVScrollId() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; int min = -1; int mSId; for ( curr = d->list.first(); curr; curr = d->list.next() ) @@ -623,7 +623,7 @@ int KompareSplitter::minVScrollId() int KompareSplitter::maxVScrollId() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; int max = 0; int mSId; for ( curr = d->list.first(); curr; curr = d->list.next() ) @@ -640,7 +640,7 @@ int KompareSplitter::maxVScrollId() bool KompareSplitter::needHScrollBar() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; for ( curr = d->list.first(); curr; curr = d->list.next() ) { if( !curr->isHandle ) @@ -655,7 +655,7 @@ bool KompareSplitter::needHScrollBar() int KompareSplitter::maxHScrollId() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; int max = 0; int mHSId; for ( curr = d->list.first(); curr; curr = d->list.next() ) @@ -673,7 +673,7 @@ int KompareSplitter::maxHScrollId() int KompareSplitter::maxContentsX() { - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; int max = 0; int mCX; for ( curr = d->list.first(); curr; curr = d->list.next() ) @@ -695,7 +695,7 @@ int KompareSplitter::minVisibleWidth() // despite the fact that *noone* has a pgright and pgleft key :P // But we do have mousewheels with horizontal scrolling functionality, // pressing shift and scrolling then goes left and right one page at the time - KQSplitterLayoutStruct *curr; + TQSplitterLayoutStruct *curr; int min = -1; int vW; for( curr = d->list.first(); curr; curr = d->list.next() ) diff --git a/kompare/komparepart/komparesplitter.h b/kompare/komparepart/komparesplitter.h index 3bb21824..2ce07e29 100644 --- a/kompare/komparepart/komparesplitter.h +++ b/kompare/komparepart/komparesplitter.h @@ -25,9 +25,9 @@ #include "komparelistview.h" #include "komparemodellist.h" -class KQSplitterLayoutStruct; +class TQSplitterLayoutStruct; class TQTextStream; -class KQSplitterHandle; +class TQSplitterHandle; namespace Diff2 { class DiffModel; @@ -35,7 +35,7 @@ class Difference; } class ViewSettings; -class KompareSplitter : public KQSplitter +class KompareSplitter : public TQSplitter { Q_OBJECT TQ_OBJECT @@ -83,7 +83,7 @@ private slots: void timerTimeout(); private: - KQSplitterLayoutStruct *addWidget(KompareListViewFrame *w, + TQSplitterLayoutStruct *addWidget(KompareListViewFrame *w, bool prepend = FALSE ); void doMove( bool backwards, int pos, int id, int delta, |