Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorExMix <ExMix@Youris-MacBook-Pro.local>2013-05-23 16:31:39 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:55:50 +0300
commit6cc0074db7573147cfb1a9ad228ba6fd04a1c81e (patch)
tree50750e4dafbdb6d116cd30159bcb3ea776208a0e /gui
parent76605ec17b2ae0ff6112187f5ff3ab3c819fe2a2 (diff)
support a max width property for drawable texts
Diffstat (limited to 'gui')
-rw-r--r--gui/text_view.cpp9
-rw-r--r--gui/text_view.hpp2
2 files changed, 10 insertions, 1 deletions
diff --git a/gui/text_view.cpp b/gui/text_view.cpp
index 5f2a692c05..328012bed6 100644
--- a/gui/text_view.cpp
+++ b/gui/text_view.cpp
@@ -8,7 +8,7 @@
namespace gui
{
TextView::TextView(Params const & p)
- : Element(p)
+ : Element(p), m_maxWidth(numeric_limits<unsigned>::max())
{
setText(p.m_text);
@@ -50,6 +50,7 @@ namespace gui
params.m_doSplit = true;
params.m_delimiters = "\n";
params.m_useAllParts = true;
+ params.m_maxPixelWidth = m_maxWidth;
elem.reset(new graphics::StraightTextElement(params));
}
@@ -136,6 +137,12 @@ namespace gui
return m_boundRects;
}
+ void TextView::setMaxWidth(unsigned width)
+ {
+ m_maxWidth = width;
+ setIsDirtyLayout(true);
+ }
+
bool TextView::onTapStarted(m2::PointD const & pt)
{
return false;
diff --git a/gui/text_view.hpp b/gui/text_view.hpp
index a485722ec0..7702d6b105 100644
--- a/gui/text_view.hpp
+++ b/gui/text_view.hpp
@@ -20,6 +20,7 @@ namespace gui
map<EState, shared_ptr<graphics::StraightTextElement> > m_elems;
string m_text;
+ unsigned m_maxWidth;
mutable vector<m2::AnyRectD> m_boundRects;
@@ -41,6 +42,7 @@ namespace gui
void setText(string const & text);
string const & text() const;
+ void setMaxWidth(unsigned width);
vector<m2::AnyRectD> const & boundRects() const;
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;