diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-11-26 15:27:38 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-11-26 15:27:38 +0100 |
commit | 186123da28d0f0b21cf2255d50b6bd69ca38e37e (patch) | |
tree | 325408d9812d751085d543b8681c6ed4a5ab049a /svtools/source/contnr | |
parent | d2e5e59c6b28235a832cdc06480e30f0ed96b580 (diff) | |
parent | 8dc3743ca56382374183bec5cd1a11d53f3085b8 (diff) |
CWS gnumake2: resync to m94
Diffstat (limited to 'svtools/source/contnr')
-rw-r--r-- | svtools/source/contnr/svicnvw.cxx | 11 | ||||
-rw-r--r-- | svtools/source/contnr/svimpbox.cxx | 71 | ||||
-rw-r--r-- | svtools/source/contnr/svimpicn.cxx | 19 | ||||
-rw-r--r-- | svtools/source/contnr/svlbox.cxx | 73 | ||||
-rw-r--r-- | svtools/source/contnr/svtreebx.cxx | 37 |
5 files changed, 140 insertions, 71 deletions
diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx index b16cd67d12a5..6fd0f5bf0c9c 100644 --- a/svtools/source/contnr/svicnvw.cxx +++ b/svtools/source/contnr/svicnvw.cxx @@ -50,7 +50,6 @@ SvIcnVwDataEntry::~SvIcnVwDataEntry() SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) : SvLBox( pParent, nWinStyle | WB_BORDER ) { - nWinBits = nWinStyle; nIcnVwFlags = 0; pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON ); pImp->mpViewData = 0; @@ -72,8 +71,6 @@ SvIconView::SvIconView( Window* pParent , const ResId& rResId ) : SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) ); SetDefaultFont(); pImp->SetSelectionMode( GetSelectionMode() ); - pImp->SetWindowBits( nWindowStyle ); - nWinBits = nWindowStyle; } SvIconView::~SvIconView() @@ -403,10 +400,11 @@ SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const } -void SvIconView::SetWindowBits( WinBits nWinStyle ) +void SvIconView::StateChanged( StateChangedType i_nStateChange ) { - nWinBits = nWinStyle; - pImp->SetWindowBits( nWinStyle ); + SvLBox::StateChanged( i_nStateChange ); + if ( i_nStateChange == STATE_CHANGE_STYLE ) + pImp->SetStyle( GetStyle() ); } void SvIconView::PaintEntry( SvLBoxEntry* pEntry ) @@ -469,6 +467,7 @@ void SvIconView::SelectAll( BOOL bSelect, BOOL ) void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry ) { pImp->SetCursor( _pEntry ); + OnCurrentEntryChanged(); } SvLBoxEntry* SvIconView::GetCurEntry() const diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 7a06c4a30735..df6475c131ce 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -40,6 +40,8 @@ #include <svimpbox.hxx> #include <rtl/instance.hxx> #include <svtools/svtdata.hxx> +#include <tools/wintypes.hxx> +#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> // #102891# -------------------- @@ -75,7 +77,7 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvLBoxTreeList* pLBTree, WinBits n pTree = pLBTree; aSelEng.SetFunctionSet( (FunctionSet*)&aFctSet ); aSelEng.ExpandSelectionOnMouseMove( FALSE ); - SetWindowBits( nWinStyle ); + SetStyle( nWinStyle ); SetSelectionMode( SINGLE_SELECTION ); SetDragDropMode( 0 ); @@ -245,10 +247,10 @@ void SvImpLBox::CalcCellFocusRect( SvLBoxEntry* pEntry, Rectangle& rRect ) } } -void SvImpLBox::SetWindowBits( WinBits nWinStyle ) +void SvImpLBox::SetStyle( WinBits i_nWinStyle ) { - nWinBits = nWinStyle; - if((nWinStyle & WB_SIMPLEMODE) && aSelEng.GetSelectionMode()==MULTIPLE_SELECTION) + m_nStyle = i_nWinStyle; + if ( ( m_nStyle & WB_SIMPLEMODE) && ( aSelEng.GetSelectionMode() == MULTIPLE_SELECTION ) ) aSelEng.AddAlways( TRUE ); } @@ -675,6 +677,8 @@ void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect ) } } nFlags &= (~F_DESEL_ALL); + + pView->OnCurrentEntryChanged(); } void SvImpLBox::ShowCursor( BOOL bShow ) @@ -944,7 +948,7 @@ void SvImpLBox::Paint( const Rectangle& rRect ) // erst die Linien Zeichnen, dann clippen! pView->SetClipRegion(); - if( nWinBits & ( WB_HASLINES | WB_HASLINESATROOT ) ) + if( m_nStyle & ( WB_HASLINES | WB_HASLINESATROOT ) ) DrawNet(); pView->SetClipRegion( aClipRegion ); @@ -961,7 +965,7 @@ void SvImpLBox::Paint( const Rectangle& rRect ) { // do not select if multiselection or explicit set BOOL bNotSelect = ( aSelEng.GetSelectionMode() == MULTIPLE_SELECTION ) - || ( ( nWinBits & WB_NOINITIALSELECTION ) == WB_NOINITIALSELECTION ); + || ( ( m_nStyle & WB_NOINITIALSELECTION ) == WB_NOINITIALSELECTION ); SetCursor( pStartEntry, bNotSelect ); } @@ -986,7 +990,7 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop ) if( bInView && (!bMoveToTop || pStartEntry == pEntry) ) return; // ist schon sichtbar - if( pStartEntry || (nWinBits & WB_FORCE_MAKEVISIBLE) ) + if( pStartEntry || (m_nStyle & WB_FORCE_MAKEVISIBLE) ) nFlags &= (~F_FILLING); if( !bInView ) { @@ -1124,7 +1128,7 @@ void SvImpLBox::DrawNet() pView->DrawLine( aPos1, aPos2 ); } // Sichtbar im Control ? - if( n>= nOffs && ((nWinBits & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry))) + if( n>= nOffs && ((m_nStyle & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry))) { // kann aPos1 recyclet werden ? if( !pView->IsExpanded(pEntry) ) @@ -1146,7 +1150,7 @@ void SvImpLBox::DrawNet() nY += nEntryHeight; pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry )); } - if( nWinBits & WB_HASLINESATROOT ) + if( m_nStyle & WB_HASLINESATROOT ) { pEntry = pView->First(); aPos1.X() = pView->GetTabPos( pEntry, pFirstDynamicTab); @@ -1240,7 +1244,8 @@ USHORT SvImpLBox::AdjustScrollBars( Size& rSize ) Size aOSize( pView->Control::GetOutputSizePixel() ); - BOOL bVerSBar = ( pView->nWindowStyle & WB_VSCROLL ) != 0; + const WinBits nWindowStyle = pView->GetStyle(); + BOOL bVerSBar = ( nWindowStyle & WB_VSCROLL ) != 0; BOOL bHorBar = FALSE; long nMaxRight = aOSize.Width(); //GetOutputSize().Width(); Point aOrigin( pView->GetMapMode().GetOrigin() ); @@ -1248,7 +1253,7 @@ USHORT SvImpLBox::AdjustScrollBars( Size& rSize ) nMaxRight += aOrigin.X() - 1; long nVis = nMostRight - aOrigin.X(); if( pTabBar || ( - (pView->nWindowStyle & WB_HSCROLL) && + (nWindowStyle & WB_HSCROLL) && (nVis < nMostRight || nMaxRight < nMostRight) )) bHorBar = TRUE; @@ -1266,7 +1271,7 @@ USHORT SvImpLBox::AdjustScrollBars( Size& rSize ) nMaxRight -= nVerSBarWidth; if( !bHorBar ) { - if( (pView->nWindowStyle & WB_HSCROLL) && + if( (nWindowStyle & WB_HSCROLL) && (nVis < nMostRight || nMaxRight < nMostRight) ) bHorBar = TRUE; } @@ -1431,7 +1436,7 @@ void SvImpLBox::FillView() void SvImpLBox::ShowVerSBar() { - BOOL bVerBar = ( pView->nWindowStyle & WB_VSCROLL ) != 0; + BOOL bVerBar = ( pView->GetStyle() & WB_VSCROLL ) != 0; ULONG nVis = 0; if( !bVerBar ) nVis = pView->GetVisibleCount(); @@ -1673,7 +1678,7 @@ void SvImpLBox::EntrySelected( SvLBoxEntry* pEntry, BOOL bSelect ) return; /* - if( (nWinBits & WB_HIDESELECTION) && pEntry && !pView->HasFocus() ) + if( (m_nStyle & WB_HIDESELECTION) && pEntry && !pView->HasFocus() ) { SvViewData* pViewData = pView->GetViewData( pEntry ); pViewData->SetCursored( bSelect ); @@ -1935,7 +1940,7 @@ void SvImpLBox::EntryInserted( SvLBoxEntry* pEntry ) // die Linien invalidieren /* if( (bEntryVisible || bPrevEntryVisible) && - (nWinBits & ( WB_HASLINES | WB_HASLINESATROOT )) ) + (m_nStyle & ( WB_HASLINES | WB_HASLINESATROOT )) ) { SvLBoxTab* pTab = pView->GetFirstDynamicTab(); if( pTab ) @@ -2257,6 +2262,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) SvLBoxEntry* pNewCursor; + const WinBits nWindowStyle = pView->GetStyle(); switch( aCode ) { case KEY_UP: @@ -2340,7 +2346,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor ); } } - else if( pView->nWindowStyle & WB_HSCROLL ) + else if( nWindowStyle & WB_HSCROLL ) { long nThumb = aHorSBar.GetThumbPos(); nThumb += aHorSBar.GetLineSize(); @@ -2371,7 +2377,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor ); } } - else if ( pView->nWindowStyle & WB_HSCROLL ) + else if ( nWindowStyle & WB_HSCROLL ) { long nThumb = aHorSBar.GetThumbPos(); nThumb -= aHorSBar.GetLineSize(); @@ -2473,13 +2479,17 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) else if ( !bShift /*&& !bMod1*/ ) { if ( aSelEng.IsAddMode() ) + { // toggle selection pView->Select( pCursor, !pView->IsSelected( pCursor ) ); - else + } + else if ( !pView->IsSelected( pCursor ) ) { SelAllDestrAnch( FALSE ); pView->Select( pCursor, TRUE ); } + else + bKeyUsed = FALSE; } else bKeyUsed = FALSE; @@ -2512,7 +2522,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) case KEY_F8: if( bShift && pView->GetSelectionMode()==MULTIPLE_SELECTION && - !(nWinBits & WB_SIMPLEMODE)) + !(m_nStyle & WB_SIMPLEMODE)) { if( aSelEng.IsAlwaysAdding() ) aSelEng.AddAlways( FALSE ); @@ -2560,8 +2570,8 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) case KEY_A: if( bMod1 ) SelAllDestrAnch( TRUE ); -// else -// bKeyUsed = FALSE; #105907# assume user wants to use quicksearch with key "a", so key is handled! + else + bKeyUsed = FALSE; break; case KEY_SUBTRACT: @@ -2672,10 +2682,15 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) break; default: - if( bMod1 || rKeyCode.GetGroup() == KEYGROUP_FKEYS ) - // #105907# CTRL or Function key is pressed, assume user don't want to use quicksearch... - // if there are groups of keys which should not be handled, they can be added here - bKeyUsed = FALSE; + // is there any reason why we should eat the events here? The only place where this is called + // is from SvTreeListBox::KeyInput. If we set bKeyUsed to TRUE here, then the key input + // is just silenced. However, we want SvLBox::KeyInput to get a chance, to do the QuickSelection + // handling. + // (The old code here which intentionally set bKeyUsed to TRUE said this was because of "quick search" + // handling, but actually there was no quick search handling anymore. We just re-implemented it.) + // #i31275# / 2009-06-16 / frank.schoenheit@sun.com + bKeyUsed = FALSE; + break; } return bKeyUsed; } @@ -2690,7 +2705,7 @@ void __EXPORT SvImpLBox::GetFocus() // if( bSimpleTravel && !pView->IsSelected(pCursor) ) // pView->Select( pCursor, TRUE ); } - if( nWinBits & WB_HIDESELECTION ) + if( m_nStyle & WB_HIDESELECTION ) { SvLBoxEntry* pEntry = pView->FirstSelected(); while( pEntry ) @@ -2723,7 +2738,7 @@ void __EXPORT SvImpLBox::LoseFocus() pView->SetEntryFocus( pCursor,FALSE ); ShowCursor( FALSE ); - if( nWinBits & WB_HIDESELECTION ) + if( m_nStyle & WB_HIDESELECTION ) { SvLBoxEntry* pEntry = pView->FirstSelected(); while( pEntry ) @@ -3021,7 +3036,7 @@ void SvImpLBox::SetSelectionMode( SelectionMode eSelMode ) bSimpleTravel = TRUE; else bSimpleTravel = FALSE; - if( (nWinBits & WB_SIMPLEMODE) && (eSelMode == MULTIPLE_SELECTION) ) + if( (m_nStyle & WB_SIMPLEMODE) && (eSelMode == MULTIPLE_SELECTION) ) aSelEng.AddAlways( TRUE ); } diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index d1e471953663..0d335429d564 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -708,7 +708,7 @@ public: SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree, - WinBits nWinStyle ) : + WinBits i_nWinStyle ) : aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ), aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ) { @@ -716,7 +716,7 @@ SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree, pModel = pTree; pCurParent = 0; pZOrderList = new SvPtrarr; - SetWindowBits( nWinStyle ); + SetStyle( i_nWinStyle ); nHorDist = 0; nVerDist = 0; nFlags = 0; @@ -785,13 +785,12 @@ void SvImpIconView::Clear( BOOL bInCtor ) AdjustScrollBars(); } -void SvImpIconView::SetWindowBits( WinBits nWinStyle ) +void SvImpIconView::SetStyle( const WinBits i_nWinStyle ) { - nWinBits = nWinStyle; nViewMode = VIEWMODE_TEXT; - if( nWinStyle & WB_NAME ) + if( i_nWinStyle & WB_NAME ) nViewMode = VIEWMODE_NAME; - if( nWinStyle & WB_ICON ) + if( i_nWinStyle & WB_ICON ) nViewMode = VIEWMODE_ICON; } @@ -1754,8 +1753,8 @@ void SvImpIconView::AdjustScrollBars() else nVisibleHeight = nRealHeight; - bool bVerSBar = (pView->nWindowStyle & WB_VSCROLL) ? true : false; - bool bHorSBar = (pView->nWindowStyle & WB_HSCROLL) ? true : false; + bool bVerSBar = (pView->GetStyle() & WB_VSCROLL) ? true : false; + bool bHorSBar = (pView->GetStyle() & WB_HSCROLL) ? true : false; USHORT nResult = 0; if( nVirtHeight ) @@ -1903,7 +1902,7 @@ BOOL SvImpIconView::CheckHorScrollBar() return FALSE; const MapMode& rMapMode = pView->GetMapMode(); Point aOrigin( rMapMode.GetOrigin() ); - if(!(pView->nWindowStyle & WB_HSCROLL) && !aOrigin.X() ) + if(!(pView->GetStyle() & WB_HSCROLL) && !aOrigin.X() ) { long nWidth = aOutputSize.Width(); USHORT nCount = pZOrderList->Count(); @@ -1941,7 +1940,7 @@ BOOL SvImpIconView::CheckVerScrollBar() return FALSE; const MapMode& rMapMode = pView->GetMapMode(); Point aOrigin( rMapMode.GetOrigin() ); - if(!(pView->nWindowStyle & WB_VSCROLL) && !aOrigin.Y() ) + if(!(pView->GetStyle() & WB_VSCROLL) && !aOrigin.Y() ) { long nDeepest = 0; long nHeight = aOutputSize.Height(); diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index a69253c69629..11e19c6bab3c 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -685,6 +685,7 @@ SvLBox_Impl::SvLBox_Impl( SvLBox& _rBox ) ,m_bEntryMnemonicsEnabled( false ) ,m_pLink( NULL ) ,m_aMnemonicEngine( _rBox ) + ,m_aQuickSelectionEngine( _rBox ) { } @@ -699,7 +700,6 @@ SvLBox::SvLBox( Window* pParent, WinBits nWinStyle ) : DropTargetHelper( this ), DragSourceHelper( this ), eSelMode( NO_SELECTION ) { DBG_CTOR(SvLBox,0); - nWindowStyle = nWinStyle; nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK; nImpFlags = 0; pTargetEntry = 0; @@ -724,7 +724,6 @@ SvLBox::SvLBox( Window* pParent, const ResId& rResId ) : DBG_CTOR(SvLBox,0); pTargetEntry = 0; nImpFlags = 0; - nWindowStyle = 0; pLBoxImpl = new SvLBox_Impl( *this ); nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK; nDragDropMode = 0; @@ -1251,6 +1250,12 @@ ULONG SvLBox::SelectChilds( SvLBoxEntry* , BOOL ) return 0; } +void SvLBox::OnCurrentEntryChanged() +{ + if ( !pLBoxImpl->m_bDoingQuickSelection ) + pLBoxImpl->m_aQuickSelectionEngine.Reset(); +} + void SvLBox::SelectAll( BOOL /* bSelect */ , BOOL /* bPaint */ ) { DBG_CHKTHIS(SvLBox,0); @@ -1535,15 +1540,14 @@ void SvLBox::KeyInput( const KeyEvent& rKEvt ) Control::KeyInput( rKEvt ); } -const void* SvLBox::FirstSearchEntry( String& _rEntryText ) +const void* SvLBox::FirstSearchEntry( String& _rEntryText ) const { SvLBoxEntry* pEntry = GetCurEntry(); if ( pEntry ) pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( NextSearchEntry( pEntry, _rEntryText ) ) ); else { - if ( !pEntry ) - pEntry = FirstSelected(); + pEntry = FirstSelected(); if ( !pEntry ) pEntry = First(); } @@ -1554,11 +1558,23 @@ const void* SvLBox::FirstSearchEntry( String& _rEntryText ) return pEntry; } -const void* SvLBox::NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) +const void* SvLBox::NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const { SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pCurrentSearchEntry ) ); - pEntry = Next( pEntry ); + if ( ( ( GetChildCount( pEntry ) > 0 ) + || ( pEntry->HasChildsOnDemand() ) + ) + && !IsExpanded( pEntry ) + ) + { + pEntry = NextSibling( pEntry ); + } + else + { + pEntry = Next( pEntry ); + } + if ( !pEntry ) pEntry = First(); @@ -1572,7 +1588,7 @@ void SvLBox::SelectSearchEntry( const void* _pEntry ) { SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pEntry ) ); DBG_ASSERT( pEntry, "SvLBox::SelectSearchEntry: invalid entry!" ); - if ( pEntry ) + if ( !pEntry ) return; SelectAll( FALSE ); @@ -1580,17 +1596,50 @@ void SvLBox::SelectSearchEntry( const void* _pEntry ) Select( pEntry ); } -void SvLBox::ExecuteSearchEntry( const void* /*_pEntry*/ ) +void SvLBox::ExecuteSearchEntry( const void* /*_pEntry*/ ) const { // nothing to do here, we have no "execution" } +::vcl::StringEntryIdentifier SvLBox::CurrentEntry( String& _out_entryText ) const +{ + // always accept the current entry if there is one + SvLBoxEntry* pCurrentEntry( GetCurEntry() ); + if ( pCurrentEntry ) + { + _out_entryText = GetEntryText( pCurrentEntry ); + return pCurrentEntry; + } + return FirstSearchEntry( _out_entryText ); +} + +::vcl::StringEntryIdentifier SvLBox::NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const +{ + return NextSearchEntry( _currentEntry, _out_entryText ); +} + +void SvLBox::SelectEntry( ::vcl::StringEntryIdentifier _entry ) +{ + SelectSearchEntry( _entry ); +} + bool SvLBox::HandleKeyInput( const KeyEvent& _rKEvt ) { - if ( !IsEntryMnemonicsEnabled() ) - return false; + if ( IsEntryMnemonicsEnabled() + && pLBoxImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt ) + ) + return true; + + if ( ( GetStyle() & WB_QUICK_SEARCH ) != 0 ) + { + pLBoxImpl->m_bDoingQuickSelection = true; + const bool bHandled = pLBoxImpl->m_aQuickSelectionEngine.HandleKeyEvent( _rKEvt ); + pLBoxImpl->m_bDoingQuickSelection = false; + if ( bHandled ) + return true; + } - return pLBoxImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt ); + return false; } SvLBoxEntry* SvLBox::GetEntry( const Point&, BOOL ) const diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index e8863ebaf43f..9d6bc78caff9 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -65,10 +65,10 @@ DBG_NAME(SvTreeListBox) #define SV_LBOX_DEFAULT_INDENT_PIXEL 20 SvTreeListBox::SvTreeListBox( Window* pParent, WinBits nWinStyle ) - : SvLBox(pParent,nWinStyle ) + : SvLBox( pParent, nWinStyle ) { DBG_CTOR(SvTreeListBox,0); - InitTreeView( nWinStyle ); + InitTreeView(); SetSublistOpenWithLeftRight(); } @@ -78,13 +78,13 @@ SvTreeListBox::SvTreeListBox( Window* pParent , const ResId& rResId ) { DBG_CTOR(SvTreeListBox,0); - InitTreeView( 0 ); + InitTreeView(); Resize(); SetSublistOpenWithLeftRight(); } -void SvTreeListBox::InitTreeView( WinBits nWinStyle ) +void SvTreeListBox::InitTreeView() { DBG_CHKTHIS(SvTreeListBox,0); pCheckButtonData = NULL; @@ -102,7 +102,7 @@ void SvTreeListBox::InitTreeView( WinBits nWinStyle ) nTreeFlags = TREEFLAG_RECALCTABS; nIndent = SV_LBOX_DEFAULT_INDENT_PIXEL; nEntryHeightOffs = SV_ENTRYHEIGHTOFFS_PIXEL; - pImp = new SvImpLBox( this, GetModel(), nWinStyle ); + pImp = new SvImpLBox( this, GetModel(), GetStyle() ); aContextBmpMode = SVLISTENTRYFLAG_EXPANDED; nContextBmpWidthMax = 0; @@ -110,7 +110,7 @@ void SvTreeListBox::InitTreeView( WinBits nWinStyle ) SetSpaceBetweenEntries( 0 ); SetLineColor(); InitSettings( TRUE, TRUE, TRUE ); - SetWindowBits( nWinStyle ); + ImplInitStyle(); SetTabs(); } @@ -227,8 +227,9 @@ void SvTreeListBox::SetTabs() EndEditing( TRUE ); nTreeFlags &= (~TREEFLAG_RECALCTABS); nFocusWidth = -1; - BOOL bHasButtons = (nWindowStyle & WB_HASBUTTONS)!=0; - BOOL bHasButtonsAtRoot = (nWindowStyle & (WB_HASLINESATROOT | + const WinBits nStyle( GetStyle() ); + BOOL bHasButtons = (nStyle & WB_HASBUTTONS)!=0; + BOOL bHasButtonsAtRoot = (nStyle & (WB_HASLINESATROOT | WB_HASBUTTONSATROOT))!=0; long nStartPos = TAB_STARTPOS; long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width(); @@ -1492,12 +1493,14 @@ SvLBoxEntry* SvTreeListBox::GetCurEntry() const return pImp->GetCurEntry(); } -void SvTreeListBox::SetWindowBits( WinBits nWinStyle ) +void SvTreeListBox::ImplInitStyle() { DBG_CHKTHIS(SvTreeListBox,0); - nWindowStyle = nWinStyle; + + const WinBits nWindowStyle = GetStyle(); + nTreeFlags |= TREEFLAG_RECALCTABS; - if( nWinStyle & WB_SORT ) + if( nWindowStyle & WB_SORT ) { GetModel()->SetSortMode( SortAscending ); GetModel()->SetCompareHdl( LINK(this,SvTreeListBox,DefaultCompare)); @@ -1508,9 +1511,9 @@ void SvTreeListBox::SetWindowBits( WinBits nWinStyle ) GetModel()->SetCompareHdl( Link() ); } #ifdef OS2 - nWinStyle |= WB_VSCROLL; + nWindowStyle |= WB_VSCROLL; #endif - pImp->SetWindowBits( nWinStyle ); + pImp->SetStyle( nWindowStyle ); pImp->Resize(); Invalidate(); } @@ -1578,8 +1581,9 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags, BOOL bInUse = pEntry->HasInUseEmphasis(); // wenn eine ClipRegion von aussen gesetzt wird, dann // diese nicht zuruecksetzen - BOOL bResetClipRegion = !bHasClipRegion; - BOOL bHideSelection = ((nWindowStyle & WB_HIDESELECTION) && !HasFocus())!=0; + const WinBits nWindowStyle = GetStyle(); + const BOOL bResetClipRegion = !bHasClipRegion; + const BOOL bHideSelection = ((nWindowStyle & WB_HIDESELECTION) && !HasFocus())!=0; const StyleSettings& rSettings = GetSettings().GetStyleSettings(); Font aHighlightFont( GetFont() ); @@ -2367,6 +2371,7 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1, long SvTreeListBox::GetTextOffset() const { DBG_CHKTHIS(SvTreeListBox,0); + const WinBits nWindowStyle = GetStyle(); BOOL bHasButtons = (nWindowStyle & WB_HASBUTTONS)!=0; BOOL bHasButtonsAtRoot = (nWindowStyle & (WB_HASLINESATROOT | WB_HASBUTTONSATROOT))!=0; @@ -2519,6 +2524,8 @@ void SvTreeListBox::DataChanged( const DataChangedEvent& rDCEvt ) void SvTreeListBox::StateChanged( StateChangedType i_nStateChange ) { SvLBox::StateChanged( i_nStateChange ); + if ( i_nStateChange == STATE_CHANGE_STYLE ) + ImplInitStyle(); } void SvTreeListBox::InitSettings(BOOL bFont,BOOL bForeground,BOOL bBackground) |