Template Manager: select first item when getting focus if no selection
Change-Id: Ie012e010ca92728725535345c76fc9f5eb31a254
This commit is contained in:
parent
5fa5f9561d
commit
ec2f84b376
@ -576,12 +576,29 @@ void ThumbnailView::Paint( const Rectangle &aRect)
|
||||
|
||||
void ThumbnailView::GetFocus()
|
||||
{
|
||||
Control::GetFocus();
|
||||
// Select the first item if nothing selected
|
||||
int nSelected = -1;
|
||||
for (size_t i = 0, n = mItemList.size(); i < n && nSelected == -1; ++i)
|
||||
{
|
||||
if (mItemList[i]->isSelected())
|
||||
nSelected = i;
|
||||
}
|
||||
|
||||
if ( nSelected == -1 && mItemList.size( ) > 0 )
|
||||
{
|
||||
mItemList[0]->setSelection(true);
|
||||
maItemStateHdl.Call(mItemList[0]);
|
||||
|
||||
if (IsReallyVisible() && IsUpdateMode())
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
// Tell the accessible object that we got the focus.
|
||||
ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation( GetAccessible( sal_False ) );
|
||||
if( pAcc )
|
||||
pAcc->GetFocus();
|
||||
|
||||
Control::GetFocus();
|
||||
}
|
||||
|
||||
void ThumbnailView::LoseFocus()
|
||||
|
Loading…
x
Reference in New Issue
Block a user