diff options
author | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2014-10-02 00:58:08 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2014-10-02 00:59:24 +0200 |
commit | 0c2b43b70776ea49655a7f18c6c11dc64a5f25b2 (patch) | |
tree | 5cc803500f139a6584ecb4d1ed89098973e2e9f3 /svtools | |
parent | 13cb02ce1046779864109646a105c09c2e27249a (diff) |
Improved striped rows implementation
Some renaming, use variable for row background when not striped
Change-Id: I5b36fc751aa163dbb127406d7aefad01974fa371
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 35 | ||||
-rw-r--r-- | svtools/source/contnr/treelistentry.cxx | 7 |
2 files changed, 23 insertions, 19 deletions
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index c7d610c04daf..b991693c6c7c 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -380,7 +380,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : DragSourceHelper(this), mpImpl(new SvTreeListBoxImpl(*this)), mbContextBmpExpanded(false), - mbAlternatingRowColor(false), + mbAlternatingRowColors(false), eSelMode(NO_SELECTION), nMinWidthInChars(0) { @@ -410,7 +410,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, const ResId& rResId) : DragSourceHelper(this), mpImpl(new SvTreeListBoxImpl(*this)), mbContextBmpExpanded(false), - mbAlternatingRowColor(false), + mbAlternatingRowColors(false), eSelMode(NO_SELECTION), nMinWidthInChars(0) { @@ -470,14 +470,14 @@ IMPL_LINK_INLINE_END( SvTreeListBox, CloneHdl_Impl, SvTreeListEntry*, pEntry ) sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uLong nPos ) { sal_uLong nInsPos = pModel->Insert( pEntry, pParent, nPos ); - if(mbAlternatingRowColor) + if(mbAlternatingRowColors) { if(nPos == TREELIST_APPEND) - pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetAlternatingRowColor() ? - GetSettings().GetStyleSettings().GetAlternatingRowColor2() : - GetSettings().GetStyleSettings().GetAlternatingRowColor() ); + pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ? + GetSettings().GetStyleSettings().GetAlternatingRowColor() : + GetSettings().GetStyleSettings().GetRowColor() ); else - SetAlternatingRow( true ); + SetAlternatingRowColors( true ); } return nInsPos; } @@ -485,14 +485,14 @@ sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pPare sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos ) { sal_uLong nInsPos = pModel->Insert( pEntry, nRootPos ); - if(mbAlternatingRowColor) + if(mbAlternatingRowColors) { if(nRootPos == TREELIST_APPEND) - pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetAlternatingRowColor() ? - GetSettings().GetStyleSettings().GetAlternatingRowColor2() : - GetSettings().GetStyleSettings().GetAlternatingRowColor() ); + pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ? + GetSettings().GetStyleSettings().GetAlternatingRowColor() : + GetSettings().GetStyleSettings().GetRowColor() ); else - SetAlternatingRow( true ); + SetAlternatingRowColors( true ); } return nInsPos; } @@ -3410,21 +3410,22 @@ Size SvTreeListBox::GetOptimalSize() const return aRet; } -void SvTreeListBox::SetAlternatingRow( bool bEnable ) +void SvTreeListBox::SetAlternatingRowColors( bool bEnable ) { - mbAlternatingRowColor = bEnable; - if( mbAlternatingRowColor ) + mbAlternatingRowColors = bEnable; + if( mbAlternatingRowColors ) { SvTreeListEntry* pEntry = pModel->First(); for(size_t i = 0; pEntry; ++i) { - pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetAlternatingRowColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor2()); + pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetRowColor() : + GetSettings().GetStyleSettings().GetAlternatingRowColor()); pEntry = pModel->Next(pEntry); } } else for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry)) - pEntry->SetBackColor( GetSettings().GetStyleSettings().GetFieldColor() ); + pEntry->SetBackColor( GetSettings().GetStyleSettings().GetRowColor() ); pImp->UpdateAll(); } diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index c4c9220895eb..e294b9944129 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -20,6 +20,9 @@ #include <svtools/treelistentry.hxx> #include <svtools/treelist.hxx> +#include <vcl/svapp.hxx> +#include <vcl/settings.hxx> + #include <limits> void SvTreeListEntry::ClearChildren() @@ -54,7 +57,7 @@ SvTreeListEntry::SvTreeListEntry() , bIsMarked(false) , pUserData(NULL) , nEntryFlags(0) - , maBackColor(Color(COL_WHITE)) + , maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor()) { } @@ -65,7 +68,7 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r) , bIsMarked(r.bIsMarked) , pUserData(r.pUserData) , nEntryFlags(r.nEntryFlags) - , maBackColor(Color(COL_WHITE)) + , maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor()) { SvTreeListEntries::const_iterator it = r.maChildren.begin(), itEnd = r.maChildren.end(); for (; it != itEnd; ++it) |