|
|
@ -34,8 +34,9 @@ KomposeLayout::KomposeLayout( KomposeWidget *parent, int type, int dist, const c
|
|
|
|
: TQObject(parent, name),
|
|
|
|
: TQObject(parent, name),
|
|
|
|
spacing(dist),
|
|
|
|
spacing(dist),
|
|
|
|
widgetsChanged(false),
|
|
|
|
widgetsChanged(false),
|
|
|
|
currentRows(0),
|
|
|
|
filledRows(0),
|
|
|
|
currentColumns(0),
|
|
|
|
filledColumns(0),
|
|
|
|
|
|
|
|
emptyColumns(0),
|
|
|
|
parentWidget(parent)
|
|
|
|
parentWidget(parent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setType( type );
|
|
|
|
setType( type );
|
|
|
@ -115,7 +116,7 @@ void KomposeLayout::rearrangeContents()
|
|
|
|
parentWidget->width(),
|
|
|
|
parentWidget->width(),
|
|
|
|
parentWidget->height() - ( 40 + 2*spacing ) );
|
|
|
|
parentWidget->height() - ( 40 + 2*spacing ) );
|
|
|
|
// arrange the filled desktops taking 90% of the screen
|
|
|
|
// arrange the filled desktops taking 90% of the screen
|
|
|
|
rearrangeContents( filledRect, filledContainers );
|
|
|
|
rearrangeContents( filledRect, filledContainers, CONTAINER_FILLED );
|
|
|
|
|
|
|
|
|
|
|
|
// Arrange empty containers
|
|
|
|
// Arrange empty containers
|
|
|
|
TQRect emptyRect( 0,
|
|
|
|
TQRect emptyRect( 0,
|
|
|
@ -123,7 +124,7 @@ void KomposeLayout::rearrangeContents()
|
|
|
|
parentWidget->width(),
|
|
|
|
parentWidget->width(),
|
|
|
|
( 40 + 2*spacing ) );
|
|
|
|
( 40 + 2*spacing ) );
|
|
|
|
// arrange the empty widget in one row
|
|
|
|
// 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
|
|
|
|
* 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)
|
|
|
|
* 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
|
|
|
|
// Check or empty list
|
|
|
|
if (widgets.count() == 0)
|
|
|
|
if (widgets.count() == 0)
|
|
|
@ -297,14 +298,15 @@ void KomposeLayout::rearrangeContents( const TQRect& availRect, const TQPtrList<
|
|
|
|
if ( *maxRowHeightIt-h > 0 )
|
|
|
|
if ( *maxRowHeightIt-h > 0 )
|
|
|
|
topOffset += *maxRowHeightIt-h;
|
|
|
|
topOffset += *maxRowHeightIt-h;
|
|
|
|
++maxRowHeightIt;
|
|
|
|
++maxRowHeightIt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Sync cols/rows member vars to current cols/rows
|
|
|
|
// Sync cols/rows member vars to current cols/rows
|
|
|
|
if ( setMemberRowsCols )
|
|
|
|
if( containerType == CONTAINER_EMPTY ) {
|
|
|
|
{
|
|
|
|
emptyColumns = columns;
|
|
|
|
currentRows = rows;
|
|
|
|
} else {
|
|
|
|
currentColumns = columns;
|
|
|
|
filledRows = rows;
|
|
|
|
}
|
|
|
|
filledColumns = columns;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -320,12 +322,12 @@ KomposeWidget* KomposeLayout::getNeighbour( const KomposeWidget* widget, int dir
|
|
|
|
KomposeWidget* neighbour = 0;
|
|
|
|
KomposeWidget* neighbour = 0;
|
|
|
|
if ( filledContainers.containsRef(widget) )
|
|
|
|
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();
|
|
|
|
return emptyContainers.first();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( emptyContainers.containsRef(widget) )
|
|
|
|
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 )
|
|
|
|
if ( direction == DLAYOUT_TOP )
|
|
|
|
return filledContainers.last();
|
|
|
|
return filledContainers.last();
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -334,7 +336,7 @@ KomposeWidget* KomposeLayout::getNeighbour( const KomposeWidget* widget, int dir
|
|
|
|
return neighbour;
|
|
|
|
return neighbour;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (layoutType==TLAYOUT_GENERIC)
|
|
|
|
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;
|
|
|
|
kdDebug() << "KomposeLayout::getNeighbour() - this should never happen!" << endl;
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
@ -346,6 +348,7 @@ KomposeWidget* KomposeLayout::getNeighbour( const KomposeWidget* widget, int dir
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
KomposeWidget* KomposeLayout::getNeighbour(
|
|
|
|
KomposeWidget* KomposeLayout::getNeighbour(
|
|
|
|
TQPtrList<KomposeWidget> listToSearch,
|
|
|
|
TQPtrList<KomposeWidget> listToSearch,
|
|
|
|
|
|
|
|
int listType,
|
|
|
|
const KomposeWidget* widget,
|
|
|
|
const KomposeWidget* widget,
|
|
|
|
int direction,
|
|
|
|
int direction,
|
|
|
|
int wrap )
|
|
|
|
int wrap )
|
|
|
@ -366,6 +369,15 @@ KomposeWidget* KomposeLayout::getNeighbour(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( task == widget )
|
|
|
|
if ( task == widget )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int currentRows, currentColumns;
|
|
|
|
|
|
|
|
if( listType == CONTAINER_EMPTY ) {
|
|
|
|
|
|
|
|
currentRows = 1;
|
|
|
|
|
|
|
|
currentColumns = emptyColumns;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
currentRows = filledRows;
|
|
|
|
|
|
|
|
currentColumns = filledColumns;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch ( direction )
|
|
|
|
switch ( direction )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case DLAYOUT_RIGHT:
|
|
|
|
case DLAYOUT_RIGHT:
|
|
|
|