svghmi/widget_customhtml.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 02 May 2021 23:01:08 +0200
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 3064 4b44d09c48a7
child 3241 fe945f1f48b7
permissions -rw-r--r--
SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
3064
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
     1
// widget_customhtml.ysl2
2944
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents:
diff changeset
     2
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3064
diff changeset
     3
widget_class("CustomHtml"){
3009
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
     4
    ||
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
     5
        frequency = 5;
3064
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
     6
        widget_size = undefined;
3009
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
     7
3056
827bf284feec Button, ToggleButton and slider updated. Error to warning when building
usveticic
parents: 3024
diff changeset
     8
        dispatch(value) {
3059
e0db3f6a5f39 Button and toggle reworked to use animate and dispatch
usveticic
parents: 3058
diff changeset
     9
            this.request_animate();
3056
827bf284feec Button, ToggleButton and slider updated. Error to warning when building
usveticic
parents: 3024
diff changeset
    10
        }
827bf284feec Button, ToggleButton and slider updated. Error to warning when building
usveticic
parents: 3024
diff changeset
    11
3059
e0db3f6a5f39 Button and toggle reworked to use animate and dispatch
usveticic
parents: 3058
diff changeset
    12
        animate(){
e0db3f6a5f39 Button and toggle reworked to use animate and dispatch
usveticic
parents: 3058
diff changeset
    13
        }
3009
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
    14
3059
e0db3f6a5f39 Button and toggle reworked to use animate and dispatch
usveticic
parents: 3058
diff changeset
    15
        init() {
3064
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    16
            this.widget_size = this.container_elt.getBBox();
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    17
            this.element.innerHTML ='<foreignObject x="'+
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    18
                this.widget_size.x+'" y="'+this.widget_size.y+
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    19
                '" width="'+this.widget_size.width+'" height="'+this.widget_size.height+'"> '+
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    20
                this.code_elt.textContent+
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    21
                ' </foreignObject>';
3059
e0db3f6a5f39 Button and toggle reworked to use animate and dispatch
usveticic
parents: 3058
diff changeset
    22
        }
3009
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
    23
    ||
3024
Edouard Tisserant
parents: 3018
diff changeset
    24
}
3009
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
    25
7c6960f09881 Reworked button widget so it uses classes.
usveticic
parents: 3004
diff changeset
    26
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3064
diff changeset
    27
widget_defs("CustomHtml") {
2976
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2961
diff changeset
    28
    param "hmi_element";
3064
4b44d09c48a7 - New widget customHtml which allows to insert block of html code
usveticic
parents: 3062
diff changeset
    29
    labels("container code");
3000
a9a45977bac0 SVGHMI: prefer apply_hmi_value() to change_hmi_value() when possible
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2976
diff changeset
    30
}