Skip to content

Commit

Permalink
A couple of minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Mar 7, 2025
1 parent 48dbeda commit 0dba4a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/eepp/ui/uilistbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class EE_API UIListBox : public UITouchDraggableWidget {

UIListBoxItem* getItem( const Uint32& Index ) const;

const String& getItemText( const Uint32& Index ) const;

Uint32 getItemIndex( UIListBoxItem* Item );

Uint32 getItemIndex( const String& Text );
Expand Down
4 changes: 3 additions & 1 deletion src/eepp/ui/uiapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ UIApplication::UIApplication( const WindowSettings& windowSettings, const Settin
? appSettings.monospaceFont
: FontTrueType::New( "monospace", "assets/fonts/DejaVuSansMono.ttf" );

if ( monospaceFont && monospaceFont->getType() == FontType::TTF )
if ( monospaceFont && monospaceFont->getType() == FontType::TTF ) {
static_cast<FontTrueType*>( monospaceFont )->setEnableDynamicMonospace( true );
FontFamily::loadFromRegular( static_cast<FontTrueType*>( monospaceFont ) );
}

if ( appSettings.emojiFont == nullptr )
FontTrueType::New( "NotoEmoji-Regular", "assets/fonts/NotoEmoji-Regular.ttf" );
Expand Down
10 changes: 8 additions & 2 deletions src/eepp/ui/uilistbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ UIListBox::UIListBox( const std::string& tag ) :
mVScrollBar->setEnabled( false )->setVisible( false );
mVScrollBar->addEventListener( Event::OnSizeChange, cb );
mVScrollBar->addEventListener( Event::OnValueChange,
[this] ( auto event ) { onScrollValueChange( event ); } );
[this]( auto event ) { onScrollValueChange( event ); } );

mHScrollBar = UIScrollBar::NewHorizontal();
mHScrollBar->setParent( this );
Expand All @@ -68,7 +68,7 @@ UIListBox::UIListBox( const std::string& tag ) :
mHScrollBar->setEnabled( false )->setVisible( false );
mHScrollBar->addEventListener( Event::OnSizeChange, cb );
mHScrollBar->addEventListener( Event::OnValueChange,
[this] ( auto event ) { onHScrollValueChange( event ); } );
[this]( auto event ) { onHScrollValueChange( event ); } );

mDummyItem = createListBoxItem( "" );
mDummyItem->setSize( 0, 0 );
Expand Down Expand Up @@ -699,6 +699,12 @@ UIListBoxItem* UIListBox::getItem( const Uint32& Index ) const {
return mItems[Index];
}

const String& UIListBox::getItemText( const Uint32& Index ) const {
eeASSERT( Index < mItems.size() );

return mTexts[Index];
}

UIListBoxItem* UIListBox::getItemSelected() {
if ( mSelected.size() ) {
if ( NULL == mItems[mSelected.front()] )
Expand Down

0 comments on commit 0dba4a2

Please sign in to comment.