2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 12:27:43 +00:00

Work on TextField

This commit is contained in:
Jack Andersen
2015-12-19 18:39:09 -10:00
parent 5d56ef2cf6
commit 95fd2f90a9
12 changed files with 366 additions and 31 deletions

View File

@@ -168,10 +168,9 @@ void ModalWindow::setFillColors(float t)
m_cornersFilled[i]->colorGlyphs(color);
}
ModalWindow::ModalWindow(ViewResources& res, View& parentView, int widthConstrain, int heightConstrain)
ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint)
: View(res, parentView),
m_widthConstrain(widthConstrain),
m_heightConstrain(heightConstrain),
m_constraint(constraint),
m_windowBg(res.themeData().splashBackground()),
m_windowBgClear(m_windowBg),
m_line1(res.themeData().splash1()),
@@ -302,10 +301,10 @@ void ModalWindow::resized(const boo::SWindowRect& root, const boo::SWindowRect&
float pf = rootView().viewRes().pixelFactor();
boo::SWindowRect centerRect = sub;
m_width = m_widthConstrain < 0 ? root.size[0] - CONTENT_MARGIN * pf * 2 : m_widthConstrain;
m_height = m_heightConstrain < 0 ? root.size[1] - CONTENT_MARGIN * pf * 2 : m_heightConstrain;
m_width = std::max(m_width, int(WINDOW_MIN_DIM * pf));
m_height = std::max(m_height, int(WINDOW_MIN_DIM * pf));
std::pair<int,int> constrained = m_constraint.solve(root.size[0] - CONTENT_MARGIN * pf * 2,
root.size[1] - CONTENT_MARGIN * pf * 2);
m_width = std::max(constrained.first, int(WINDOW_MIN_DIM * pf));
m_height = std::max(constrained.second, int(WINDOW_MIN_DIM * pf));
centerRect.size[0] = m_width;
centerRect.size[1] = m_height;
centerRect.location[0] = root.size[0] / 2 - m_width / 2.0;