48 if (config.hasOwnProperty("widthmax")) { |
48 if (config.hasOwnProperty("widthmax")) { |
49 this.widthmax = config.widthmax; |
49 this.widthmax = config.widthmax; |
50 } |
50 } |
51 |
51 |
52 if (config.hasOwnProperty("layoutManager")) { |
52 if (config.hasOwnProperty("layoutManager")) { |
53 this.layoutManager = config.layoutManager; |
53 this.layoutManager = config.layoutManager; |
54 } |
54 } |
55 if (typeof this.selector != "undefined" && typeof Popcorn != "undefined") { |
55 if (typeof this.selector != "undefined") { |
56 var _id = this._id; |
56 this.selector.addClass("Ldt-TraceMe").addClass("Ldt-Widget"); |
57 this.selector.bind("click mouseover mouseout dragstart dragstop", function(_e) { |
|
58 var _data = { |
|
59 "type": _e.type, |
|
60 "x": _e.clientX, |
|
61 "y": _e.clientY, |
|
62 "widget": _id, |
|
63 "target_name": _e.target.localName, |
|
64 "target_id": _e.target.id, |
|
65 "target_class": _e.target.className, |
|
66 "text": _e.target.textContent.trim(), |
|
67 "title": _e.target.title, |
|
68 "value": _e.target.value |
|
69 }; |
|
70 Popcorn.trigger('IriSP.Widget.MouseEvents', _data); |
|
71 }) |
|
72 } |
57 } |
73 |
58 |
74 }; |
59 }; |
|
60 |
|
61 // This functions checks for configuration options |
|
62 |
|
63 IriSP.Widget.prototype.checkOption = function(_name, _default) { |
|
64 this[_name] = ( |
|
65 typeof this._config[_name] != "undefined" |
|
66 ? this._config[_name] |
|
67 : ( |
|
68 (typeof IriSP.widgetsDefaults[this._config.type] != "undefined" && IriSP.widgetsDefaults[this._config.type][_name] != "undefined") |
|
69 ? IriSP.widgetsDefaults[this._config.type][_name] |
|
70 : ( |
|
71 typeof _default != "undefined" |
|
72 ? _default |
|
73 : null |
|
74 ) |
|
75 ) |
|
76 ) |
|
77 } |
75 |
78 |
76 /** |
79 /** |
77 * This method responsible of drawing a widget on screen. |
80 * This method responsible of drawing a widget on screen. |
78 */ |
81 */ |
79 IriSP.Widget.prototype.draw = function() { |
82 IriSP.Widget.prototype.draw = function() { |