mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 18:46:29 +03:00
Minor fixes.
--HG-- branch : dev
This commit is contained in:
@@ -158,12 +158,14 @@ void UIControl::setInternalSize( const Sizei& size ) {
|
||||
mSize = size;
|
||||
mRealSize = Sizei( size.x * PixelDensity::getPixelDensity(), size.y * PixelDensity::getPixelDensity() );
|
||||
updateCenter();
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
void UIControl::setInternalPixelsSize( const Sizei& size ) {
|
||||
mSize = PixelDensity::pxToDpI( size );
|
||||
mRealSize = size;
|
||||
updateCenter();
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
UIControl * UIControl::setSize( const Sizei& Size ) {
|
||||
@@ -696,7 +698,6 @@ void UIControl::onPositionChange() {
|
||||
}
|
||||
|
||||
void UIControl::onSizeChange() {
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
Rectf UIControl::getRectf() {
|
||||
|
||||
@@ -129,12 +129,10 @@ void UIGridLayout::pack() {
|
||||
|
||||
if ( getLayoutWidthRules() == MATCH_PARENT ) {
|
||||
setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
if ( getLayoutHeightRules() == MATCH_PARENT ) {
|
||||
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
UIControl * ChildLoop = mChild;
|
||||
@@ -145,9 +143,11 @@ void UIGridLayout::pack() {
|
||||
if ( getHorizontalAlign() == UI_HALIGN_RIGHT )
|
||||
pos.x = mSize.getWidth() - mPadding.Right;
|
||||
|
||||
bool usedLastRow = true;
|
||||
while ( NULL != ChildLoop ) {
|
||||
if ( ChildLoop->isWidget() && ChildLoop->isVisible() ) {
|
||||
UIWidget * widget = static_cast<UIWidget*>( ChildLoop );
|
||||
usedLastRow = true;
|
||||
|
||||
if ( widget->getLayoutWeight() != 0.f )
|
||||
targetSize.x = widget->getLayoutWeight() * ( mSize.getWidth() - mPadding.Left - mPadding.Right );
|
||||
@@ -161,6 +161,7 @@ void UIGridLayout::pack() {
|
||||
pos.x = getHorizontalAlign() == UI_HALIGN_RIGHT ? mSize.getWidth() - mPadding.Right : mPadding.Left;
|
||||
|
||||
pos.y += targetSize.getHeight() + mSpan.y;
|
||||
usedLastRow = false;
|
||||
} else {
|
||||
pos.x += getHorizontalAlign() == UI_HALIGN_RIGHT ? -mSpan.x : mSpan.x;
|
||||
}
|
||||
@@ -170,8 +171,7 @@ void UIGridLayout::pack() {
|
||||
}
|
||||
|
||||
if ( getLayoutHeightRules() == WRAP_CONTENT ) {
|
||||
setInternalHeight( pos.y + targetSize.getHeight() );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
setInternalHeight( pos.y + ( usedLastRow ? targetSize.getHeight() : 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,12 +70,10 @@ void UILinearLayout::pack() {
|
||||
void UILinearLayout::packVertical() {
|
||||
if ( getLayoutWidthRules() == MATCH_PARENT && 0 == mLayoutWeight ) {
|
||||
setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
if ( getLayoutHeightRules() == MATCH_PARENT ) {
|
||||
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
UIControl * ChildLoop = mChild;
|
||||
@@ -161,7 +159,6 @@ void UILinearLayout::packVertical() {
|
||||
if ( getLayoutHeightRules() == WRAP_CONTENT ) {
|
||||
setInternalHeight( curY );
|
||||
notifyLayoutAttrChangeParent();
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
} else if ( getLayoutHeightRules() == MATCH_PARENT ) {
|
||||
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
|
||||
}
|
||||
@@ -170,7 +167,6 @@ void UILinearLayout::packVertical() {
|
||||
setInternalWidth( maxX );
|
||||
packVertical();
|
||||
notifyLayoutAttrChangeParent();
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
alignAgainstLayout();
|
||||
@@ -179,12 +175,10 @@ void UILinearLayout::packVertical() {
|
||||
void UILinearLayout::packHorizontal() {
|
||||
if ( getLayoutWidthRules() == MATCH_PARENT ) {
|
||||
setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
if ( getLayoutHeightRules() == MATCH_PARENT && 0 == mLayoutWeight ) {
|
||||
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
UIControl * ChildLoop = mChild;
|
||||
@@ -270,17 +264,14 @@ void UILinearLayout::packHorizontal() {
|
||||
if ( getLayoutWidthRules() == WRAP_CONTENT ) {
|
||||
setInternalWidth( curX );
|
||||
notifyLayoutAttrChangeParent();
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
} else if ( getLayoutWidthRules() == MATCH_PARENT ) {
|
||||
setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
if ( getLayoutHeightRules() == WRAP_CONTENT && mSize.getHeight() != maxY ) {
|
||||
setInternalHeight( maxY );
|
||||
packHorizontal();
|
||||
notifyLayoutAttrChangeParent();
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
alignAgainstLayout();
|
||||
|
||||
@@ -42,12 +42,10 @@ void UIRelativeLayout::fixChilds() {
|
||||
|
||||
if ( getLayoutWidthRules() == MATCH_PARENT ) {
|
||||
setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
if ( getLayoutHeightRules() == MATCH_PARENT ) {
|
||||
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
|
||||
sendCommonEvent( UIEvent::EventOnSizeChange );
|
||||
}
|
||||
|
||||
UIControl * child = mChild;
|
||||
|
||||
@@ -750,7 +750,6 @@ void EETest::createNewUI() {
|
||||
"</window>"
|
||||
);
|
||||
|
||||
/*
|
||||
UIManager::instance()->loadLayoutFromString(
|
||||
"<window layout_width='800dp' layout_height='600dp' winflags='default|maximize'>"
|
||||
" <LinearLayout layout_width='match_parent' layout_height='match_parent'>"
|
||||
@@ -778,7 +777,6 @@ void EETest::createNewUI() {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void EETest::createMapEditor() {
|
||||
|
||||
Reference in New Issue
Block a user