mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Minor nit in UIDropDownList.
This commit is contained in:
@@ -38,17 +38,17 @@ UIDropDownList::UIDropDownList( const std::string& tag ) :
|
||||
mListBox->setParent( this );
|
||||
|
||||
mListBox->addEventListener( Event::OnWidgetFocusLoss,
|
||||
[this] ( auto event ) { onListBoxFocusLoss( event ); } );
|
||||
[this]( auto event ) { onListBoxFocusLoss( event ); } );
|
||||
mListBox->addEventListener( Event::OnItemSelected,
|
||||
[this] ( auto event ) { onItemSelected( event ); } );
|
||||
[this]( auto event ) { onItemSelected( event ); } );
|
||||
mListBox->addEventListener( Event::OnItemClicked,
|
||||
[this] ( auto event ) { onItemClicked( event ); } );
|
||||
[this]( auto event ) { onItemClicked( event ); } );
|
||||
mListBox->addEventListener( Event::OnItemKeyDown,
|
||||
[this] ( auto event ) { onItemKeyDown( event ); } );
|
||||
mListBox->addEventListener( Event::KeyDown, [this] ( auto event ) { onItemKeyDown( event ); } );
|
||||
mListBox->addEventListener( Event::OnClear, [this] ( auto event ) { onWidgetClear( event ); } );
|
||||
[this]( auto event ) { onItemKeyDown( event ); } );
|
||||
mListBox->addEventListener( Event::KeyDown, [this]( auto event ) { onItemKeyDown( event ); } );
|
||||
mListBox->addEventListener( Event::OnClear, [this]( auto event ) { onWidgetClear( event ); } );
|
||||
mListBoxCloseCb = mListBox->addEventListener( Event::OnClose,
|
||||
[this]( const Event* ) { mListBox = nullptr; } );
|
||||
[this]( const Event* ) { mListBox = nullptr; } );
|
||||
mListBox->addEventListener( Event::OnSelectionChanged, [this]( auto ) {
|
||||
if ( !mListBox->hasSelection() )
|
||||
mListBox->setSelected( 0 );
|
||||
@@ -250,6 +250,10 @@ void UIDropDownList::onItemKeyDown( const Event* Event ) {
|
||||
|
||||
if ( KEvent->getKeyCode() == KEY_RETURN )
|
||||
onItemClicked( Event );
|
||||
else if ( KEvent->getKeyCode() == KEY_ESCAPE ) {
|
||||
hide();
|
||||
setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void UIDropDownList::onListBoxFocusLoss( const Event* ) {
|
||||
@@ -278,6 +282,9 @@ void UIDropDownList::onItemSelected( const Event* ) {
|
||||
sendCommonEvent( Event::OnItemSelected );
|
||||
sendCommonEvent( Event::OnValueChange );
|
||||
sendCommonEvent( Event::OnSelectionChanged );
|
||||
|
||||
if ( !mListBox->isEnabled() )
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void UIDropDownList::show() {
|
||||
|
||||
@@ -66,12 +66,12 @@ Uint32 UIListBoxItem::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
|
||||
if ( Flags & EE_BUTTONS_LRM ) {
|
||||
UIListBox* LBParent = getParent()->getParent()->asType<UIListBox>();
|
||||
|
||||
if ( !LBParent->isMultiSelect() )
|
||||
setFocus();
|
||||
|
||||
LBParent->itemClicked( this );
|
||||
|
||||
select();
|
||||
|
||||
if ( !LBParent->isMultiSelect() )
|
||||
setFocus();
|
||||
}
|
||||
|
||||
return UITextView::onMouseClick( Pos, Flags );
|
||||
|
||||
Reference in New Issue
Block a user