File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -531,6 +531,48 @@ class Label extends View {
531
531
532
532
class Button extends Control {
533
533
534
+ // FIXME KAZUHO circular reference
535
+ var _node = web . dom . document . createElement ( "INPUT" ) as web . HTMLInputElement ;
536
+
537
+ function constructor ( ) {
538
+ this . _node . type = "button" ;
539
+ }
540
+
541
+ function constructor ( label : string , handler : function ( : web . Event ) : void ) {
542
+ this ( ) ;
543
+ this . setLabel ( label ) ;
544
+ this . setHandler ( handler ) ;
545
+ }
546
+
547
+ function setLabel ( label : string ) : Button {
548
+ this . _node . value = label ;
549
+ return this ;
550
+ }
551
+
552
+ function getLabel ( ) : string {
553
+ return this . _node . value ;
554
+ }
555
+
556
+ function setHandler ( handler : function ( : web . Event ) : void ) : Button {
557
+ this . _node . onclick = handler ;
558
+ return this ;
559
+ }
560
+
561
+ function getHandler ( ) : function ( : web . Event ) : void {
562
+ return this . _node . onclick ;
563
+ }
564
+
565
+ override function _toElement ( ) : web . HTMLElement {
566
+ var element = super . _toElement ( ) ; // <div>
567
+
568
+ element . appendChild ( this . _node ) ;
569
+
570
+ var style = this . _node . style ;
571
+ style . width = "100%" ;
572
+
573
+ return element ;
574
+ }
575
+
534
576
}
535
577
536
578
class TextField extends Control {
You can’t perform that action at this time.
0 commit comments