From c7a34ac5f2d92d138f9bb20f6198c7c343251322 Mon Sep 17 00:00:00 2001 From: damian Date: Mon, 22 Nov 2010 22:49:14 +0100 Subject: [PATCH 1/2] Added LinkImage widget. --- src/uki-view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uki-view.js b/src/uki-view.js index 8339ef5..b222379 100644 --- a/src/uki-view.js +++ b/src/uki-view.js @@ -1,5 +1,6 @@ include('uki-view/view/box.js'); include('uki-view/view/image.js'); +include('uki-view/view/linkimage.js'); include('uki-view/view/button.js'); include('uki-view/view/checkbox.js'); include('uki-view/view/radio.js'); @@ -12,4 +13,4 @@ include('uki-view/view/splitPane.js'); include('uki-view/view/scrollPane.js'); include('uki-view/view/popup.js'); include('uki-view/view/flow.js'); -include('uki-view/view/toolbar.js'); \ No newline at end of file +include('uki-view/view/toolbar.js'); From c1061f96478ba5855ede66ad93b999376c99ea09 Mon Sep 17 00:00:00 2001 From: damian Date: Mon, 22 Nov 2010 22:52:07 +0100 Subject: [PATCH 2/2] Added sources for LinkImage --- src/uki-view/view/linkimage.js | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/uki-view/view/linkimage.js diff --git a/src/uki-view/view/linkimage.js b/src/uki-view/view/linkimage.js new file mode 100644 index 0000000..e6a6ab5 --- /dev/null +++ b/src/uki-view/view/linkimage.js @@ -0,0 +1,40 @@ + +/** + * Image view which opens given link in new window. + * + * + * @author damian kolakowski + * @name uki.view.LinkImage + * @class + * @extends uki.view.Base + */ +uki.view.declare('uki.view.LinkImage', uki.view.Base, function() { + + this.typeName = function() { return 'uki.view.LinkImage'; }; + + /** + * Read or write redirect url. + * @function + * @name uki.view.Image#href + */ + uki.delegateProp(this, 'href', '_a') + + /** + * Read or write image's source. + * @function + * @name uki.view.Image#src + */ + uki.delegateProp(this, 'src', '_img') + + this._createDom = function() { + // + this._a = uki.createElement('a', this.defaultCss); + this._a.setAttribute('target','_blank'); + this._a.href = this._href; + this._img = uki.createElement('img', this.defaultCss); + this._img.src = this._src; + this._img.style.cssText += 'width:100%;height:100%;' + this._a.appendChild(this._img); + this._dom = this._a; + }; +});