Allow ValueViewers to have a bounding box different from the Style's. This closes #64.

This commit is contained in:
Twan van Laarhoven
2020-06-01 01:18:13 +02:00
parent e9305c7554
commit 4ff603d413
24 changed files with 79 additions and 87 deletions
+6 -6
View File
@@ -55,9 +55,9 @@ TextFieldP TextCtrl::getFieldP() {
}
void TextCtrl::updateSize() {
wxSize cs = GetClientSize();
Style& style = getStyle();
style.width = cs.GetWidth() - 2;
style.height = cs.GetHeight() - 2;
ValueViewer& viewer = *viewers.front();
viewer.bounding_box.width = cs.GetWidth() - 2;
viewer.bounding_box.height = cs.GetHeight() - 2;
viewers.front()->getEditor()->determineSize(true);
}
@@ -76,9 +76,9 @@ void TextCtrl::onChangeSet() {
// initialize
if (viewers.empty()) {
// create a field, style and value
TextFieldP field(new TextField);
TextStyleP style(new TextStyle(field));
TextValueP value(new FakeTextValue(field, nullptr, false, false));
TextFieldP field = make_intrusive<TextField>();
TextStyleP style = make_intrusive<TextStyle>(field);
TextValueP value = make_intrusive<FakeTextValue>(field, nullptr, false, false);
// set stuff
field->index = 0;
field->multi_line = multi_line;