Skip to content
This repository

LinkImage #23

Open
wants to merge 2 commits into from

1 participant

Damian Kołakowski
Damian Kołakowski

LinkImage which we discussed on UKI's forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Nov 22, 2010
damian Added LinkImage widget. c7a34ac
damian Added sources for LinkImage c1061f9
This page is out of date. Refresh to see the latest.

Showing 2 changed files with 42 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  src/uki-view.js
  2. +40 0 src/uki-view/view/linkimage.js
3  src/uki-view.js
... ... @@ -1,5 +1,6 @@
1 1 include('uki-view/view/box.js');
2 2 include('uki-view/view/image.js');
  3 +include('uki-view/view/linkimage.js');
3 4 include('uki-view/view/button.js');
4 5 include('uki-view/view/checkbox.js');
5 6 include('uki-view/view/radio.js');
@@ -12,4 +13,4 @@ include('uki-view/view/splitPane.js');
12 13 include('uki-view/view/scrollPane.js');
13 14 include('uki-view/view/popup.js');
14 15 include('uki-view/view/flow.js');
15   -include('uki-view/view/toolbar.js');
  16 +include('uki-view/view/toolbar.js');
40 src/uki-view/view/linkimage.js
... ... @@ -0,0 +1,40 @@
  1 +
  2 +/**
  3 + * Image view which opens given link in new window.
  4 + *
  5 + *
  6 + * @author damian kolakowski
  7 + * @name uki.view.LinkImage
  8 + * @class
  9 + * @extends uki.view.Base
  10 + */
  11 +uki.view.declare('uki.view.LinkImage', uki.view.Base, function() {
  12 +
  13 + this.typeName = function() { return 'uki.view.LinkImage'; };
  14 +
  15 + /**
  16 + * Read or write redirect url.
  17 + * @function
  18 + * @name uki.view.Image#href
  19 + */
  20 + uki.delegateProp(this, 'href', '_a')
  21 +
  22 + /**
  23 + * Read or write image's source.
  24 + * @function
  25 + * @name uki.view.Image#src
  26 + */
  27 + uki.delegateProp(this, 'src', '_img')
  28 +
  29 + this._createDom = function() {
  30 + // <a target='_blank' href="this._href"><img style='width:100%;height:100%;' src="this._src"/></a>
  31 + this._a = uki.createElement('a', this.defaultCss);
  32 + this._a.setAttribute('target','_blank');
  33 + this._a.href = this._href;
  34 + this._img = uki.createElement('img', this.defaultCss);
  35 + this._img.src = this._src;
  36 + this._img.style.cssText += 'width:100%;height:100%;'
  37 + this._a.appendChild(this._img);
  38 + this._dom = this._a;
  39 + };
  40 +});

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.