Scrollbar improvements.
Minor fixes. --HG-- branch : dev
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 280 B |
BIN
bin/assets/ui/uitheme/uitheme_hscrollbar_button_menter_m.png
Normal file
|
After Width: | Height: | Size: 112 B |
BIN
bin/assets/ui/uitheme/uitheme_hscrollbar_button_menter_ml.png
Normal file
|
After Width: | Height: | Size: 196 B |
BIN
bin/assets/ui/uitheme/uitheme_hscrollbar_button_menter_mr.png
Normal file
|
After Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 270 B |
BIN
bin/assets/ui/uitheme/uitheme_hscrollbar_button_normal_m.png
Normal file
|
After Width: | Height: | Size: 116 B |
BIN
bin/assets/ui/uitheme/uitheme_hscrollbar_button_normal_ml.png
Normal file
|
After Width: | Height: | Size: 193 B |
BIN
bin/assets/ui/uitheme/uitheme_hscrollbar_button_normal_mr.png
Normal file
|
After Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 256 B |
BIN
bin/assets/ui/uitheme/uitheme_vscrollbar_button_menter_d.png
Normal file
|
After Width: | Height: | Size: 192 B |
BIN
bin/assets/ui/uitheme/uitheme_vscrollbar_button_menter_m.png
Normal file
|
After Width: | Height: | Size: 109 B |
BIN
bin/assets/ui/uitheme/uitheme_vscrollbar_button_menter_u.png
Normal file
|
After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 235 B |
BIN
bin/assets/ui/uitheme/uitheme_vscrollbar_button_normal_d.png
Normal file
|
After Width: | Height: | Size: 191 B |
BIN
bin/assets/ui/uitheme/uitheme_vscrollbar_button_normal_m.png
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
bin/assets/ui/uitheme/uitheme_vscrollbar_button_normal_u.png
Normal file
|
After Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_m.png
Normal file
|
After Width: | Height: | Size: 308 B |
|
After Width: | Height: | Size: 513 B |
|
After Width: | Height: | Size: 577 B |
|
Before Width: | Height: | Size: 1.3 KiB |
BIN
bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_m.png
Normal file
|
After Width: | Height: | Size: 279 B |
|
After Width: | Height: | Size: 509 B |
|
After Width: | Height: | Size: 488 B |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_d.png
Normal file
|
After Width: | Height: | Size: 497 B |
BIN
bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_m.png
Normal file
|
After Width: | Height: | Size: 303 B |
BIN
bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_u.png
Normal file
|
After Width: | Height: | Size: 581 B |
|
Before Width: | Height: | Size: 1.3 KiB |
BIN
bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_d.png
Normal file
|
After Width: | Height: | Size: 495 B |
BIN
bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_m.png
Normal file
|
After Width: | Height: | Size: 262 B |
BIN
bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_u.png
Normal file
|
After Width: | Height: | Size: 493 B |
@@ -157,6 +157,8 @@ class EE_API UIGenericGrid : public UIComplexControl {
|
||||
void updateVScroll();
|
||||
|
||||
void updateHScroll();
|
||||
|
||||
void setHScrollStep();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -236,6 +236,8 @@ class EE_API UIListBox : public UIComplexControl {
|
||||
virtual Uint32 onKeyDown( const UIEventKey &Event );
|
||||
|
||||
void itemKeyEvent( const UIEventKey &Event );
|
||||
|
||||
void setHScrollStep();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -811,6 +811,8 @@ void MapEditor::OnMapSizeChange( const UIEvent *Event ) {
|
||||
mMapVScroll->setMinValue( 0 );
|
||||
mMapVScroll->setMaxValue( v.y );
|
||||
mMapVScroll->setClickStep( mUIMap->Map()->getTileSize().getHeight() * mUIMap->Map()->getScale() );
|
||||
mMapHScroll->setPageStep( (Float)mUIMap->Map()->getViewSize().getWidth() );
|
||||
mMapVScroll->setPageStep( (Float)mUIMap->Map()->getViewSize().getHeight() );
|
||||
}
|
||||
|
||||
void MapEditor::OnScrollMapH( const UIEvent * Event ) {
|
||||
|
||||
@@ -207,6 +207,27 @@ void UIGenericGrid::updateHScroll() {
|
||||
}
|
||||
}
|
||||
|
||||
void UIGenericGrid::setHScrollStep() {
|
||||
Float width = (Float)mContainer->getRealSize().getWidth();
|
||||
|
||||
if ( ( mItemsNotVisible > 0 && UI_SCROLLBAR_AUTO == mVScrollMode ) || UI_SCROLLBAR_ALWAYS_ON == mVScrollMode )
|
||||
width -= mVScrollBar->getRealSize().getWidth();
|
||||
|
||||
Float maxWidth = 0;
|
||||
|
||||
if ( mCollumnsCount > 0 ) {
|
||||
for ( Uint32 i = 0; i < mCollumnsCount; i++ ) {
|
||||
maxWidth += mCollumnsWidth[i];
|
||||
}
|
||||
}
|
||||
|
||||
Float stepVal = width / (Float)maxWidth;
|
||||
|
||||
mHScrollBar->setPageStep( stepVal );
|
||||
|
||||
mHScrollBar->setClickStep( stepVal );
|
||||
}
|
||||
|
||||
void UIGenericGrid::updateScroll( bool FromScrollChange ) {
|
||||
if ( !mItems.size() )
|
||||
return;
|
||||
@@ -309,6 +330,8 @@ void UIGenericGrid::updateScroll( bool FromScrollChange ) {
|
||||
mHScrollBar->setPosition( 0, mSize.getHeight() - mHScrollBar->getSize().getHeight() );
|
||||
mHScrollBar->setSize( mSize.getWidth() - mVScrollBar->getSize().getWidth(), mHScrollBar->getSize().getHeight() );
|
||||
}
|
||||
|
||||
setHScrollStep();
|
||||
}
|
||||
|
||||
void UIGenericGrid::updateSize() {
|
||||
@@ -330,6 +353,8 @@ void UIGenericGrid::add( UIGridCell * Cell ) {
|
||||
updateSize();
|
||||
|
||||
updateScroll();
|
||||
|
||||
mVScrollBar->setPageStep( ( (Float)mContainer->getSize().getHeight() /(Float) mRowHeight ) / (Float)mItems.size() );
|
||||
}
|
||||
|
||||
void UIGenericGrid::remove( UIGridCell * Cell ) {
|
||||
|
||||
@@ -174,7 +174,7 @@ void UIListBox::setTheme( UITheme * Theme ) {
|
||||
|
||||
void UIListBox::autoPadding() {
|
||||
if ( mFlags & UI_AUTO_PADDING ) {
|
||||
mPaddingContainer = makePadding();
|
||||
mPaddingContainer = pxToDpI( makePadding() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,8 +227,8 @@ Uint32 UIListBox::addListBoxItem( const String& Text ) {
|
||||
if ( NULL != mFont ) {
|
||||
Uint32 twidth = mFont->getTextWidth( Text );
|
||||
|
||||
if ( twidth > (Uint32)dpToPxI( mMaxTextWidth ) ) {
|
||||
mMaxTextWidth = (Uint32)pxToDpI( twidth );
|
||||
if ( twidth > mMaxTextWidth ) {
|
||||
mMaxTextWidth = twidth;
|
||||
|
||||
updateListBoxItemsSize();
|
||||
}
|
||||
@@ -310,8 +310,8 @@ void UIListBox::clear() {
|
||||
mSelected.clear();
|
||||
mVScrollBar->setValue(0);
|
||||
|
||||
updateScroll();
|
||||
findMaxWidth();
|
||||
updateScroll();
|
||||
updateListBoxItemsSize();
|
||||
|
||||
sendCommonEvent( UIEvent::EventOnControlClear );
|
||||
@@ -361,7 +361,7 @@ void UIListBox::onSizeChange() {
|
||||
mHScrollBar->setSize( mSize.getWidth() - mVScrollBar->getSize().getWidth() + mHScrollPadding.Right, mHScrollBar->getSize().getHeight() + mHScrollPadding.Bottom );
|
||||
|
||||
if ( mContainer->isClipped() && UI_SCROLLBAR_AUTO == mHScrollMode ) {
|
||||
if ( (Int32)mMaxTextWidth <= mContainer->getSize().getWidth() ) {
|
||||
if ( (Int32)mMaxTextWidth <= mContainer->getRealSize().getWidth() ) {
|
||||
mHScrollBar->setVisible( false );
|
||||
mHScrollBar->setEnabled( false );
|
||||
mHScrollInit = 0;
|
||||
@@ -397,6 +397,19 @@ void UIListBox::setRowHeight() {
|
||||
}
|
||||
}
|
||||
|
||||
void UIListBox::setHScrollStep() {
|
||||
Float width = (Float)mContainer->getRealSize().getWidth();
|
||||
|
||||
if ( ( mItemsNotVisible > 0 && UI_SCROLLBAR_AUTO == mVScrollMode ) || UI_SCROLLBAR_ALWAYS_ON == mVScrollMode )
|
||||
width -= mVScrollBar->getRealSize().getWidth();
|
||||
|
||||
Float stepVal = width / (Float)mMaxTextWidth;
|
||||
|
||||
mHScrollBar->setPageStep( stepVal );
|
||||
|
||||
mHScrollBar->setClickStep( stepVal );
|
||||
}
|
||||
|
||||
void UIListBox::findMaxWidth() {
|
||||
Uint32 size = (Uint32)mItems.size();
|
||||
Int32 width;
|
||||
@@ -409,8 +422,8 @@ void UIListBox::findMaxWidth() {
|
||||
else
|
||||
width = mFont->getTextWidth( mTexts[i] );
|
||||
|
||||
if ( width > dpToPxI( mMaxTextWidth ) )
|
||||
mMaxTextWidth = (Uint32)pxToDpI( width );
|
||||
if ( width > (Int32)mMaxTextWidth )
|
||||
mMaxTextWidth = width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,8 +438,9 @@ void UIListBox::itemUpdateSize( UIListBoxItem * Item ) {
|
||||
if ( NULL != Item ) {
|
||||
Int32 width = (Int32)Item->getTextWidth();
|
||||
|
||||
if ( width > dpToPxI( mMaxTextWidth ) )
|
||||
mMaxTextWidth = (Uint32)pxToDpI( width );
|
||||
if ( width > (Int32)mMaxTextWidth ) {
|
||||
mMaxTextWidth = width;
|
||||
}
|
||||
|
||||
if ( !mHScrollBar->isVisible() ) {
|
||||
if ( width < mContainer->getSize().getWidth() )
|
||||
@@ -503,8 +517,8 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
|
||||
}
|
||||
|
||||
if ( Clipped && ( UI_SCROLLBAR_AUTO == mHScrollMode || UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) ) {
|
||||
if ( ( mVScrollBar->isVisible() && mContainer->getSize().getWidth() - mVScrollBar->getSize().getWidth() < (Int32)mMaxTextWidth ) ||
|
||||
( !mVScrollBar->isVisible() && mContainer->getSize().getWidth() < (Int32)mMaxTextWidth ) ) {
|
||||
if ( ( mVScrollBar->isVisible() && mContainer->getRealSize().getWidth() - mVScrollBar->getRealSize().getWidth() < (Int32)mMaxTextWidth ) ||
|
||||
( !mVScrollBar->isVisible() && mContainer->getRealSize().getWidth() < (Int32)mMaxTextWidth ) ) {
|
||||
mHScrollBar->setVisible( true );
|
||||
mHScrollBar->setEnabled( true );
|
||||
|
||||
@@ -513,9 +527,9 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
|
||||
Int32 ScrollH;
|
||||
|
||||
if ( mVScrollBar->isVisible() )
|
||||
ScrollH = mMaxTextWidth - mContainer->getSize().getWidth() + mVScrollBar->getSize().getWidth();
|
||||
ScrollH = pxToDpI( mMaxTextWidth ) - mContainer->getSize().getWidth() + mVScrollBar->getSize().getWidth();
|
||||
else
|
||||
ScrollH = mMaxTextWidth - mContainer->getSize().getWidth();
|
||||
ScrollH = pxToDpI( mMaxTextWidth ) - mContainer->getSize().getWidth();
|
||||
|
||||
Int32 HScrolleable = (Uint32)( mHScrollBar->getValue() * ScrollH );
|
||||
|
||||
@@ -640,6 +654,8 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
|
||||
mHScrollBar->setPosition( mHScrollPadding.Left, mSize.getHeight() - mHScrollBar->getSize().getHeight() + mHScrollPadding.Top );
|
||||
mHScrollBar->setSize( mSize.getWidth() - mVScrollBar->getSize().getWidth() + mHScrollPadding.Right, mHScrollBar->getSize().getHeight() + mHScrollPadding.Bottom );
|
||||
}
|
||||
|
||||
setHScrollStep();
|
||||
}
|
||||
|
||||
void UIListBox::itemKeyEvent( const UIEventKey &Event ) {
|
||||
|
||||
@@ -147,7 +147,6 @@ void UISkinComplex::setSkin( const Uint32& State ) {
|
||||
eeASSERT ( State < UISkinState::StateCount );
|
||||
|
||||
for ( Uint32 Side = 0; Side < SideCount; Side++ ) {
|
||||
|
||||
SubTexture * SubTexture = TextureAtlasManager::instance()->getSubTextureByName( std::string( mName + "_" + UISkin::getSkinStateName( State ) + "_" + SideSuffix[ Side ] ) );
|
||||
|
||||
if ( NULL != SubTexture )
|
||||
@@ -168,7 +167,7 @@ SubTexture * UISkinComplex::getSubTextureSide( const Uint32& State, const Uint32
|
||||
}
|
||||
|
||||
void UISkinComplex::stateNormalToState( const Uint32& State ) {
|
||||
if ( NULL == mSubTexture[ State ][ 0 ] ) {
|
||||
if ( NULL == mSubTexture[ State ][ Center ] ) {
|
||||
for ( Uint32 Side = 0; Side < SideCount; Side++ ) {
|
||||
mSubTexture[ State ][ Side ] = mSubTexture[ UISkinState::StateNormal ][ Side ];
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ UISlider::UISlider( const UISlider::CreateParams& Params ) :
|
||||
UIControl::CreateParams BgParams;
|
||||
BgParams.setParent( this );
|
||||
|
||||
if ( !mOrientation )
|
||||
if ( UI_HORIZONTAL == mOrientation )
|
||||
BgParams.Size = Sizei( mSize.getWidth() - 16, 8 );
|
||||
else
|
||||
BgParams.Size = Sizei( 8, mSize.getHeight() - 16 );
|
||||
@@ -41,7 +41,7 @@ UISlider::UISlider( const UISlider::CreateParams& Params ) :
|
||||
mSlider->setVisible( true );
|
||||
mSlider->setDragEnabled( true );
|
||||
|
||||
if ( !mOrientation )
|
||||
if ( UI_HORIZONTAL == mOrientation )
|
||||
mSlider->centerVertical();
|
||||
else
|
||||
mSlider->centerHorizontal();
|
||||
|
||||
@@ -159,7 +159,7 @@ void EETest::createUIThemeTextureAtlas() {
|
||||
std::string Path( MyPath + "ui/" + mThemeName );
|
||||
|
||||
if ( !FileSystem::fileExists( tgpath + EE_TEXTURE_ATLAS_EXTENSION ) ) {
|
||||
TexturePacker tp( 256, 256, true, 2 );
|
||||
TexturePacker tp( 512, 512, true, 2 );
|
||||
tp.addTexturesPath( Path );
|
||||
tp.packTextures();
|
||||
tp.save( tgpath + ".png", SAVE_TYPE_PNG );
|
||||
@@ -286,7 +286,7 @@ void EETest::createUI() {
|
||||
str[i-1] = "Test ListBox " + String::toStr(i) + " testing it right now!";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
UIControl::CreateParams Params( UIManager::instance()->getMainControl(), Vector2i(0,0), Sizei( 530, 380 ), UI_FILL_BACKGROUND | UI_CLIP_ENABLE | UI_BORDER );
|
||||
|
||||
Params.Border.setWidth( 2 );
|
||||
@@ -547,7 +547,7 @@ void EETest::createUI() {
|
||||
TxtGfxParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER;
|
||||
TxtGfxParams.SubTexture = mTheme->getIconByName( "ok" );
|
||||
|
||||
for ( Uint32 i = 0; i < 100; i++ ) {
|
||||
for ( Uint32 i = 0; i < 15; i++ ) {
|
||||
UIGridCell * Cell = eeNew( UIGridCell, ( CellParams ) );
|
||||
UITextBox * TxtBox = eeNew( UITextBox, ( TxtBoxParams ) );
|
||||
UITextInput * TxtInput = eeNew( UITextInput, ( TxtInputParams ) );
|
||||
@@ -587,6 +587,7 @@ void EETest::createUI() {
|
||||
eePRINTL( "CreateUI time: %4.3f ms.", TE.getElapsed().asMilliseconds() );
|
||||
/**/
|
||||
|
||||
/**/
|
||||
UIRadioButton * ctrl = eeNew( UIRadioButton, () );
|
||||
ctrl->setPosition( 100, 100 );
|
||||
ctrl->setSize( 320, 32 );
|
||||
@@ -658,7 +659,7 @@ void EETest::createUI() {
|
||||
|
||||
UIListBox * listBox = eeNew( UIListBox, () );
|
||||
listBox->setPosition( 50, 320 );
|
||||
listBox->setSize( 100, 160 );
|
||||
listBox->setSize( 200, 160 );
|
||||
listBox->setVisible( true );
|
||||
listBox->setEnabled( true );
|
||||
listBox->addListBoxItems( str );
|
||||
|
||||