svghmi/widget_textlist.ysl2
author Edouard Tisserant
Thu, 24 Nov 2022 11:47:56 +0100
changeset 3690 f41733be17a8
parent 3556 5d73bed497de
permissions -rw-r--r--
SVGHMI: move declaration of "xmlns" javascript const so that widgets can use it.

This was broken in earlier commit, when changing initial execution order because of implementing websocket reconnect.
3354
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
// widget_textlist.ysl2
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
widget_desc("TextList") {
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
    longdesc
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
    ||
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
    TextList widget is a svg:group, list items are labeled elements
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
    in that group.
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
    To use a TextList, clone (svg:use) one of the items inside the widget 
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
    that expects a TextList.
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
    In this list, (translated) text content is what matters. Nevertheless
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
    text style of the cloned item will be applied in client widget.
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
    ||
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
    shortdesc > A named list of ordered texts 
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    18
    arg name="listname"
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
}
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    21
widget_defs("TextList") {
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    22
    |     texts: [
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    23
    foreach "func:refered_elements($hmi_element/*[@inkscape:label])[self::svg:text]" {
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    24
    |         id("«@id»"),
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    25
    }
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    26
    // could find a proper way in xpath to reverse()
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    27
    |     ].reverse(),
819b0bdfa705 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    28
}
3556
5d73bed497de SVGHMI: Warn at build time when SVG refers to non-existing widget types.
Edouard Tisserant
parents: 3354
diff changeset
    29
5d73bed497de SVGHMI: Warn at build time when SVG refers to non-existing widget types.
Edouard Tisserant
parents: 3354
diff changeset
    30
widget_class("TextList");