sixtyfps-compilerlib 0.0.1

Internal SixtyFPS compiler library
Documentation
/* LICENSE BEGIN
    This file is part of the SixtyFPS Project -- https://sixtyfps.io
    Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
    Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>

    SPDX-License-Identifier: GPL-3.0-only
    This file is also available under commercial licensing terms.
    Please contact info@sixtyfps.io for more information.
LICENSE END */

// FIXME: the font_size should be removed but is required right now to compile the printer_demo
export Button := NativeButton { property<length> font_size; }
export CheckBox := NativeCheckBox { }
export SpinBox := NativeSpinBox { property<length> font_size; }
export Slider := NativeSlider { max:100; }
export GroupBox := NativeGroupBox {
    GridLayout {
        padding_left: root.native_padding_left;
        padding_right: root.native_padding_right;
        padding_top: root.native_padding_top;
        padding_bottom: root.native_padding_bottom;
        $children
    }
 }
export LineEdit := NativeLineEdit {
    property <string> text;
    focused: input.has_focus;
    signal accepted(string);
    GridLayout {
        padding_left: root.native_padding_left;
        padding_right: root.native_padding_right;
        padding_top: root.native_padding_top;
        padding_bottom: root.native_padding_bottom;
        input := TextInput {
            text <=> root.text;
            accepted => {
                root.accepted(self.text);
            }
        }
    }
}

export ScrollView := Rectangle {
    property <length> viewport_width <=> fli.viewport_width;
    property <length> viewport_height <=> fli.viewport_height;
    property <length> viewport_x <=> fli.viewport_x;
    property <length> viewport_y <=> fli.viewport_y;

    border_width: 1lx;
    border_color: #d0d3cf;
    color: white;

    GridLayout {
        fli := Flickable {
            $children
            interactive: false;
            viewport_y: -vbar.value;
            viewport_x: -hbar.value;
            viewport_height: 1000lx;
            viewport_width: 1000lx;
        }
        vbar := NativeScrollBar {
            max: fli.viewport_height - fli.height;
            page_size: fli.height;
        }
        hbar := NativeScrollBar {
            horizontal: true;
            row: 1;
            max: fli.viewport_width - fli.width;
            page_size: fli.width;
        }

    }
}

export ListView := ScrollView {
    $children
}

export StandardListView := ListView {
    property<[StandardListViewItem]> model;
    for item[i] in model : NativeStandardListViewItem {
        item: item;
        index: i;
        height: 20lx;
        width: parent.width;
    }
}