canvas.gui: let widgets set layout size to allow user defined size hints.
This commit is contained in:
parent
2452ab0f5c
commit
bb1ab2d975
2 changed files with 9 additions and 9 deletions
|
@ -13,9 +13,9 @@ gui.Widget = {
|
|||
_size: [32, 32]
|
||||
});
|
||||
|
||||
m.setMinimumSize([16, 16]);
|
||||
m.setSizeHint([32, 32]);
|
||||
m.setMaximumSize([m._MAX_SIZE, m._MAX_SIZE]);
|
||||
m.setLayoutMinimumSize([16, 16]);
|
||||
m.setLayoutSizeHint([32, 32]);
|
||||
m.setLayoutMaximumSize([m._MAX_SIZE, m._MAX_SIZE]);
|
||||
|
||||
m.setSetGeometryFunc(m._impl.setGeometry);
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ DefaultStyle.widgets.button = {
|
|||
me._label.set("text", text);
|
||||
|
||||
var min_width = math.max(80, me._label.maxWidth() + 16);
|
||||
model.setMinimumSize([min_width, 16]);
|
||||
model.setSizeHint([min_width, 28]);
|
||||
model.setLayoutMinimumSize([min_width, 16]);
|
||||
model.setLayoutSizeHint([min_width, 28]);
|
||||
|
||||
return me;
|
||||
},
|
||||
|
@ -133,8 +133,8 @@ DefaultStyle.widgets.checkbox = {
|
|||
me._label.set("text", text);
|
||||
|
||||
var min_width = me._label.maxWidth() + 24;
|
||||
model.setMinimumSize([min_width, 18]);
|
||||
model.setSizeHint([min_width, 24]);
|
||||
model.setLayoutMinimumSize([min_width, 18]);
|
||||
model.setLayoutSizeHint([min_width, 24]);
|
||||
|
||||
return me;
|
||||
},
|
||||
|
@ -221,8 +221,8 @@ DefaultStyle.widgets.label = {
|
|||
}
|
||||
|
||||
model.setHeightForWidthFunc(hfw_func);
|
||||
model.setMinimumSize([min_width, 14]);
|
||||
model.setSizeHint([width_hint, 24]);
|
||||
model.setLayoutMinimumSize([min_width, 14]);
|
||||
model.setLayoutSizeHint([width_hint, 24]);
|
||||
|
||||
return me.update(model);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue