1
0
Fork 0

canvas.gui: simplify MessageBox and Aircraft center with core changes.

This commit is contained in:
Thomas Geymayer 2014-08-05 00:22:14 +02:00
parent 804b42cfa4
commit a10e9c7b00
2 changed files with 6 additions and 24 deletions

View file

@ -207,25 +207,14 @@ var AircraftCenter = {
start = end;
end = math.min(end + 50, size(packages));
me._show_more = VBoxLayout.new();
me._list.addItem(me._show_more);
me._show_more.addSpacing(3);
var hbox = HBoxLayout.new();
me._show_more.addItem(hbox);
me._show_more.addSpacing(5);
hbox.addStretch(1);
hbox.addItem(
me._show_more =
gui.widgets.Button.new(me._scroll_content, style, {})
.setText("Show more...")
.listen("clicked", func
me._addPackageEntries(packages, start, end)
)
);
hbox.addStretch(1);
hbox = nil;
);
me._show_more.setContentsMargin(5);
me._list.addItem(me._show_more, 0, canvas.AlignHCenter);
}
# Add some stretch in case the scroll area is larger than the list

View file

@ -45,22 +45,20 @@ var MessageBox = {
return me;
}
var MARGIN = 12; # TODO implement margin in C++ layouting code
var MARGIN = 12;
var dlg = canvas.Window.new([300,120], "dialog")
.setTitle(me._title);
var root = dlg.getCanvas(1)
.set("background", style.getColor("bg_color"))
.createGroup();
var vbox = VBoxLayout.new();
vbox.setContentsMargin(MARGIN);
dlg.setLayout(vbox);
vbox.addSpacing(MARGIN);
var text_box = HBoxLayout.new();
vbox.addItem(text_box);
text_box.setSpacing(MARGIN);
text_box.addSpacing(MARGIN);
if( me._img != nil )
{
text_box.addItem(
@ -73,7 +71,6 @@ var MessageBox = {
var label_text = gui.widgets.Label.new(root, style, {wordWrap: 1})
.setText(me._text);
text_box.addItem(label_text, 1);
text_box.addSpacing(MARGIN);
vbox.addStretch(1);
@ -82,7 +79,6 @@ var MessageBox = {
if( me._standard_buttons & me.DontShowAgain )
{
button_box.addSpacing(MARGIN);
button_box.addItem(
gui.widgets.CheckBox.new(root, style, {})
.setText("Don't show again.")
@ -113,9 +109,6 @@ var MessageBox = {
);
})();
}
button_box.addSpacing(MARGIN);
vbox.addSpacing(MARGIN);
var w = math.max(300, vbox.sizeHint()[0]);
dlg.setSize(w, math.max(130, vbox.heightForWidth(w)));