Template Manager: select first item when getting focus if no selection
Change-Id: Ie012e010ca92728725535345c76fc9f5eb31a254
This commit is contained in:
@@ -576,12 +576,29 @@ void ThumbnailView::Paint( const Rectangle &aRect)
|
|||||||
|
|
||||||
void ThumbnailView::GetFocus()
|
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.
|
// Tell the accessible object that we got the focus.
|
||||||
ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation( GetAccessible( sal_False ) );
|
ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation( GetAccessible( sal_False ) );
|
||||||
if( pAcc )
|
if( pAcc )
|
||||||
pAcc->GetFocus();
|
pAcc->GetFocus();
|
||||||
|
|
||||||
|
Control::GetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailView::LoseFocus()
|
void ThumbnailView::LoseFocus()
|
||||||
|
Reference in New Issue
Block a user