Kaydet (Commit) 87e33366 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud Kaydeden (comit) Miklos Vajna

gridfixes: when the table controls doesn't have the focus use diff. color.

use a different color to paint the selection,
to be consistent with all our other controls

Change-Id: Ia5160dfb769279e2a8a3458b16fe8f6cec08145e
Reviewed-on: https://gerrit.libreoffice.org/537Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst 9684b9b6
......@@ -80,15 +80,15 @@ namespace svt { namespace table
virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle );
virtual void PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rRowArea,
const StyleSettings& _rStyle );
virtual void PaintRowHeader(
bool _bActive, bool _bSelected,
bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle );
virtual void PaintCell( ColPos const i_col,
bool _bActive, bool _bSelected,
bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle );
virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
......
......@@ -134,9 +134,8 @@ namespace svt { namespace table
However, the renderer is also allowed to render any
cell-independent content of this row.
@param _bActive
<TRUE/> if and only if the row to be painted contains the
currently active cell.
@param i_hasControlFocus
<TRUE/> if and only if the table control currently has the focus
@param _bSelected
<TRUE/> if and only if the row to be prepared is
selected currently.
......@@ -148,7 +147,7 @@ namespace svt { namespace table
@param _rStyle
the style to be used for drawing
*/
virtual void PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rRowArea,
const StyleSettings& _rStyle ) = 0;
......@@ -157,9 +156,8 @@ namespace svt { namespace table
The row to be painted is denoted by the most recent call to
->PrepareRow.
@param _bActive
<TRUE/> if and only if the row to be painted contains the
currently active cell.
@param i_hasControlFocus
<TRUE/> if and only if the table control currently has the focus
<br/>
Note that this flag is equal to the respective flag in the
previous ->PrepareRow call, it's passed here for convinience
......@@ -178,9 +176,9 @@ namespace svt { namespace table
@param _rStyle
the style to be used for drawing
*/
virtual void PaintRowHeader( bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle ) = 0;
virtual void PaintRowHeader( bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, Rectangle const & _rArea,
StyleSettings const & _rStyle ) = 0;
/** paints a certain cell
......@@ -195,8 +193,8 @@ namespace svt { namespace table
Note that this flag is equal to the respective flag in the
previous ->PrepareRow call, it's passed here for convinience
only.
@param _bActive
<TRUE/> if the cell is currently active.
@param i_hasControlFocus
<TRUE/> if and only if the table control currently has the focus
<br/>
Note that this flag is equal to the respective flag in the
previous ->PrepareRow call, it's passed here for convinience
......@@ -209,7 +207,7 @@ namespace svt { namespace table
the style to be used for drawing
*/
virtual void PaintCell( ColPos const i_col,
bool _bActive, bool _bSelected,
bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle ) = 0;
......
......@@ -320,7 +320,7 @@ namespace svt { namespace table
}
//------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
void GridTableRenderer::PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle )
{
// remember the row for subsequent calls to the other ->ITableRenderer methods
......@@ -336,7 +336,7 @@ namespace svt { namespace table
if ( _bSelected )
{
// selected rows use the background color from the style
backgroundColor = _rStyle.GetHighlightColor();
backgroundColor = i_hasControlFocus ? _rStyle.GetHighlightColor() : _rStyle.GetDeactiveColor();
if ( !aLineColor )
lineColor = backgroundColor;
}
......@@ -380,13 +380,10 @@ namespace svt { namespace table
_rDevice.DrawRect( _rRowArea );
_rDevice.Pop();
(void)_bActive;
// row containing the active cell not rendered any special at the moment
}
//------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
void GridTableRenderer::PaintRowHeader( bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle )
{
_rDevice.Push( PUSH_LINECOLOR | PUSH_TEXTCOLOR );
......@@ -409,8 +406,7 @@ namespace svt { namespace table
_rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags );
}
// TODO: active? selected?
(void)_bActive;
(void)i_hasControlFocus;
(void)_bSelected;
_rDevice.Pop();
}
......@@ -436,7 +432,7 @@ namespace svt { namespace table
};
//------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool _bActive,
void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool i_hasControlFocus,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
_rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
......@@ -453,7 +449,7 @@ namespace svt { namespace table
if ( _bSelected && !aLineColor )
{
// if no line color is specified by the model, use the usual selection color for lines in selected cells
lineColor = _rStyle.GetHighlightColor();
lineColor = i_hasControlFocus ? _rStyle.GetHighlightColor() : _rStyle.GetDeactiveColor();
}
_rDevice.SetLineColor( lineColor );
......@@ -462,9 +458,6 @@ namespace svt { namespace table
}
_rDevice.Pop();
(void)_bActive;
// no special painting for the active cell at the moment
}
//------------------------------------------------------------------------------------------------------------------
......
......@@ -106,6 +106,10 @@ namespace svt { namespace table
// forward certain settings to the data window
switch ( i_nStateChange )
{
case STATE_CHANGE_CONTROL_FOCUS:
m_pImpl->invalidateSelectedRows();
break;
case STATE_CHANGE_CONTROLBACKGROUND:
if ( IsControlBackground() )
getDataWindow().SetControlBackground( GetControlBackground() );
......
......@@ -223,10 +223,10 @@ namespace svt { namespace table
/** returns the position of the current row in the selection vector */
int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
/** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
/** ??? */
void invalidateSelectedRegion( RowPos _nPrevRow, RowPos _nCurRow );
/** invalidates the part of the data window which is covered by the given row
/** invalidates the part of the data window which is covered by the given rows
@param i_firstRow
the index of the first row to include in the invalidation
@param i_lastRow
......@@ -235,6 +235,14 @@ namespace svt { namespace table
*/
void invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow );
/** invalidates the part of the data window which is covered by the given row
*/
void invalidateRow( RowPos const i_row ) { invalidateRowRange( i_row, i_row ); }
/** invalidates all selected rows
*/
void invalidateSelectedRows();
void checkCursorPosition();
bool hasRowSelection() const { return !m_aSelectedRows.empty(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment