7 * @class Roo.bootstrap.DocumentViewer
8 * @extends Roo.bootstrap.Component
9 * Bootstrap DocumentViewer class
10 * @cfg {Number} thumbWidth default 300
11 * @cfg {Number} thumbHeight default 300
14 * Create a new DocumentViewer
15 * @param {Object} config The config object
18 Roo.bootstrap.DocumentViewer = function(config){
19 Roo.bootstrap.DocumentViewer.superclass.constructor.call(this, config);
24 * Fire after initEvent
25 * @param {Roo.bootstrap.DocumentViewer} this
32 Roo.extend(Roo.bootstrap.DocumentViewer, Roo.bootstrap.Component, {
37 getAutoCreate : function()
41 cls : 'roo-document-viewer',
45 cls : 'roo-document-viewer-body',
49 cls : 'roo-document-viewer-thumb',
50 style : 'width: ' + this.thumbWidth + 'px; height: ' + this.thumbHeight + 'px;'
56 cls : 'roo-document-viewer-footer',
59 cls : 'btn-group btn-group-justified roo-document-viewer-btn-group',
67 cls : 'btn btn-default roo-document-viewer-trash',
68 html : '<i class="fa fa-trash"></i>'
81 initEvents : function()
84 this.bodyEl = this.el.select('.roo-document-viewer-body', true).first();
85 this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
87 this.thumbEl = this.el.select('.roo-document-viewer-thumb', true).first();
88 this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
90 this.footerEl = this.el.select('.roo-document-viewer-footer', true).first();
91 this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
93 this.trashBtn = this.el.select('.roo-document-viewer-trash', true).first();
94 this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
98 // window.addEventListener("resize", function() { _this.resize(); } );
100 this.bodyEl.on('click', this.onClick, this);
102 this.trashBtn.on('click', this.onTrash, this);
104 this.fireEvent('initial', this);
111 this.setThumbBoxPosition();
114 setThumbBoxPosition : function()
116 var x = Math.ceil((this.bodyEl.getWidth() - this.thumbEl.getWidth()) / 2 );
117 var y = Math.ceil((this.bodyEl.getHeight() - this.thumbEl.getHeight()) / 2);
119 this.thumbEl.setLeft(x);
120 this.thumbEl.setTop(y);