diff options
Diffstat (limited to 'src/komposelayout.cpp')
-rw-r--r-- | src/komposelayout.cpp | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/komposelayout.cpp b/src/komposelayout.cpp index 4eeacf0..567b275 100644 --- a/src/komposelayout.cpp +++ b/src/komposelayout.cpp @@ -34,8 +34,9 @@ KomposeLayout::KomposeLayout( KomposeWidget *parent, int type, int dist, const c : TQObject(parent, name), spacing(dist), widgetsChanged(false), - currentRows(0), - currentColumns(0), + filledRows(0), + filledColumns(0), + emptyColumns(0), parentWidget(parent) { setType( type ); @@ -115,7 +116,7 @@ void KomposeLayout::rearrangeContents() parentWidget->width(), parentWidget->height() - ( 40 + 2*spacing ) ); // arrange the filled desktops taking 90% of the screen - rearrangeContents( filledRect, filledContainers ); + rearrangeContents( filledRect, filledContainers, CONTAINER_FILLED ); // Arrange empty containers TQRect emptyRect( 0, @@ -123,7 +124,7 @@ void KomposeLayout::rearrangeContents() parentWidget->width(), ( 40 + 2*spacing ) ); // arrange the empty widget in one row - rearrangeContents( emptyRect, emptyContainers, 1, -1, false ); + rearrangeContents( emptyRect, emptyContainers, CONTAINER_EMPTY, 1, -1 ); } @@ -146,7 +147,7 @@ void KomposeLayout::rearrangeContents() * availRect specifies the size&pos of the contents * Specify either rows or cols to set a fixed number of those (setting both won't work correctly) */ -void KomposeLayout::rearrangeContents( const TQRect& availRect, const TQPtrList<KomposeWidget> widgets, int rows, int columns, bool setMemberRowsCols ) +void KomposeLayout::rearrangeContents( const TQRect& availRect, const TQPtrList<KomposeWidget> widgets, int containerType, int rows, int columns ) { // Check or empty list if (widgets.count() == 0) @@ -297,14 +298,15 @@ void KomposeLayout::rearrangeContents( const TQRect& availRect, const TQPtrList< if ( *maxRowHeightIt-h > 0 ) topOffset += *maxRowHeightIt-h; ++maxRowHeightIt; - } - - // Sync cols/rows member vars to current cols/rows - if ( setMemberRowsCols ) - { - currentRows = rows; - currentColumns = columns; - } + } + + // Sync cols/rows member vars to current cols/rows + if( containerType == CONTAINER_EMPTY ) { + emptyColumns = columns; + } else { + filledRows = rows; + filledColumns = columns; + } } @@ -320,12 +322,12 @@ KomposeWidget* KomposeLayout::getNeighbour( const KomposeWidget* widget, int dir KomposeWidget* neighbour = 0; if ( filledContainers.containsRef(widget) ) { - if ( ( neighbour = getNeighbour( filledContainers, widget, direction, WLAYOUT_HORIZONTAL ) ) == 0 ) + if ( ( neighbour = getNeighbour( filledContainers, CONTAINER_FILLED, widget, direction, WLAYOUT_HORIZONTAL ) ) == 0 ) return emptyContainers.first(); } else if ( emptyContainers.containsRef(widget) ) { - if ( ( neighbour = getNeighbour( emptyContainers, widget, direction, WLAYOUT_HORIZONTAL ) ) == 0 ) + if ( ( neighbour = getNeighbour( emptyContainers, CONTAINER_EMPTY, widget, direction, WLAYOUT_HORIZONTAL ) ) == 0 ) if ( direction == DLAYOUT_TOP ) return filledContainers.last(); else @@ -334,7 +336,7 @@ KomposeWidget* KomposeLayout::getNeighbour( const KomposeWidget* widget, int dir return neighbour; } else if (layoutType==TLAYOUT_GENERIC) - return getNeighbour( list, widget, direction, wrap ); + return getNeighbour( list, CONTAINER_GENERIC, widget, direction, wrap ); kdDebug() << "KomposeLayout::getNeighbour() - this should never happen!" << endl; return NULL; @@ -346,6 +348,7 @@ KomposeWidget* KomposeLayout::getNeighbour( const KomposeWidget* widget, int dir */ KomposeWidget* KomposeLayout::getNeighbour( TQPtrList<KomposeWidget> listToSearch, + int listType, const KomposeWidget* widget, int direction, int wrap ) @@ -366,6 +369,15 @@ KomposeWidget* KomposeLayout::getNeighbour( { if ( task == widget ) { + int currentRows, currentColumns; + if( listType == CONTAINER_EMPTY ) { + currentRows = 1; + currentColumns = emptyColumns; + } else { + currentRows = filledRows; + currentColumns = filledColumns; + } + switch ( direction ) { case DLAYOUT_RIGHT: |