summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-27 17:21:34 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-27 17:21:34 (GMT)
commit09d32f225b531e42416e31199aefcc256cf7ee50 (patch)
tree0b98e5c05613ddc20bfbe7688e62096258f656ed /src
parent2ae37525e3c8d79cbaee6dd8c511f1172c1cfdc2 (diff)
downloadpowder-09d32f225b531e42416e31199aefcc256cf7ee50.zip
powder-09d32f225b531e42416e31199aefcc256cf7ee50.tar.gz
Ensure previewview comment box resizing is triggered.
Diffstat (limited to 'src')
-rw-r--r--src/interface/Label.cpp8
-rw-r--r--src/interface/Label.h1
-rw-r--r--src/preview/PreviewView.cpp13
3 files changed, 18 insertions, 4 deletions
diff --git a/src/interface/Label.cpp b/src/interface/Label.cpp
index d4bd82e..e19b6b8 100644
--- a/src/interface/Label.cpp
+++ b/src/interface/Label.cpp
@@ -59,6 +59,14 @@ void Label::SetText(std::string text)
}
}
+void Label::AutoHeight()
+{
+ bool oldAH = autoHeight;
+ autoHeight = true;
+ updateMultiline();
+ autoHeight = oldAH;
+}
+
void Label::updateMultiline()
{
int lines = 1;
diff --git a/src/interface/Label.h b/src/interface/Label.h
index f701580..f5fa1a7 100644
--- a/src/interface/Label.h
+++ b/src/interface/Label.h
@@ -55,6 +55,7 @@ namespace ui
virtual bool HasSelection();
virtual void ClearSelection();
+ virtual void AutoHeight();
void SetTextColour(Colour textColour) { this->textColour = textColour; }
diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp
index 00683fc..2e3d1fa 100644
--- a/src/preview/PreviewView.cpp
+++ b/src/preview/PreviewView.cpp
@@ -199,16 +199,21 @@ void PreviewView::commentBoxAutoHeight()
if(!addCommentBox)
return;
int textWidth = Graphics::textwidth(addCommentBox->GetText().c_str());
- if(textWidth+10 > Size.X-(XRES/2)-48)
+ if(textWidth+15 > Size.X-(XRES/2)-48)
{
- commentBoxHeight = 59;
addCommentBox->SetMultiline(true);
addCommentBox->Appearance.VerticalAlign = ui::Appearance::AlignTop;
+ int oldSize = addCommentBox->Size.Y;
+ addCommentBox->AutoHeight();
+ int newSize = addCommentBox->Size.Y+5;
+ addCommentBox->Size.Y = oldSize;
+
+ commentBoxHeight = newSize+22;
commentBoxPositionX = (XRES/2)+4;
- commentBoxPositionY = Size.Y-58;
+ commentBoxPositionY = Size.Y-(newSize+21);
commentBoxSizeX = Size.X-(XRES/2)-8;
- commentBoxSizeY = 37;
+ commentBoxSizeY = newSize;
}
else
{