make textlist fire more events

This commit is contained in:
rlx 2011-01-15 23:26:20 +00:00
parent 64e383ea4b
commit 19d680c1d9
3 changed files with 48 additions and 18 deletions

View file

@ -370,8 +370,8 @@ Miscellaneous
*/ */
.OxThemeClassic .OxTooltip { .OxThemeClassic .OxTooltip {
border: 1px solid rgba(128, 128, 128, 0.75); border: 1px solid rgba(128, 128, 128, 0.96);
background: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.96);
color: rgba(128, 128, 128, 1); color: rgba(128, 128, 128, 1);
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); -moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);

View file

@ -340,8 +340,8 @@ Miscellaneous
*/ */
.OxThemeModern .OxTooltip { .OxThemeModern .OxTooltip {
border: 1px solid rgba(128, 128, 128, 0.75); border: 1px solid rgba(128, 128, 128, 0.96);
background: rgba(0, 0, 0, 0.75); background: rgba(0, 0, 0, 0.96);
color: rgba(128, 128, 128, 1); color: rgba(128, 128, 128, 1);
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); -moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);

View file

@ -1374,6 +1374,7 @@ requires
if (theme) { if (theme) {
$('img').each(function() { $('img').each(function() {
var $this = $(this); var $this = $(this);
if (!$this.attr('src')) return; // fixme: remove, should't be neccessary
$this.attr({ $this.attr({
src: $this.attr('src').replace( src: $this.attr('src').replace(
'/ox.ui.' + theme + '/', '/ox.ui.' + arg + '/' '/ox.ui.' + theme + '/', '/ox.ui.' + arg + '/'
@ -7376,7 +7377,7 @@ requires
$.extend(self, { $.extend(self, {
columnPositions: [], columnPositions: [],
defaultColumnWidths: $.map(self.options.columns, function(v) { defaultColumnWidths: $.map(self.options.columns, function(v) {
return v.width; return v.defaultWidth || v.width;
}), }),
itemHeight: 16, itemHeight: 16,
page: 0, page: 0,
@ -7387,6 +7388,12 @@ requires
return v.visible ? v : null; return v.visible ? v : null;
}) })
}); });
// fixme: there might be a better way than passing both visible and position
self.options.columns.forEach(function(v) {
if (!Ox.isUndefined(v.position)) {
self.visibleColumns[v.position] = v;
}
})
$.extend(self, { $.extend(self, {
columnWidths: $.map(self.visibleColumns, function(v, i) { columnWidths: $.map(self.visibleColumns, function(v, i) {
return v.width; return v.width;
@ -7488,7 +7495,7 @@ requires
function addColumn(id) { function addColumn(id) {
//Ox.print('addColumn', id); //Ox.print('addColumn', id);
var column, var column, ids,
index = 0; index = 0;
$.each(self.options.columns, function(i, v) { $.each(self.options.columns, function(i, v) {
if (v.visible) { if (v.visible) {
@ -7531,6 +7538,7 @@ requires
} }
}); });
} }
triggerColumnChangeEvent();
} }
function clickColumn(id) { function clickColumn(id) {
@ -7587,27 +7595,40 @@ requires
.appendTo(that.$head.$content.$element); .appendTo(that.$head.$content.$element);
if (self.options.columnsResizable) { if (self.options.columnsResizable) {
$resize.addClass('OxResizable') $resize.addClass('OxResizable')
// fixme: make these their own named functions
.mousedown(function(e) { .mousedown(function(e) {
var startWidth = self.columnWidths[i], var startWidth = self.columnWidths[i],
startX = e.clientX; startX = e.clientX;
$window.mousemove(function(e) { $window.mousemove(function(e) {
var x = e.clientX, var width = getWidth(e);
width = Ox.limit( resizeColumn(v.id, width);
startWidth - startX + x,
self.options.columnWidth[0],
self.options.columnWidth[1]
);
resizeColumn(v.id, width);
}); });
$window.one('mouseup', function() { $window.one('mouseup', function(e) {
var width = getWidth(e);
resizeColumn(v.id, width);
that.triggerEvent('columnresize', {
id: v.id,
width: width
});
$window.unbind('mousemove'); $window.unbind('mousemove');
}); });
function getWidth(e) {
return Ox.limit(
startWidth - startX + e.clientX,
self.options.columnWidth[0],
self.options.columnWidth[1]
);
}
}) })
// fixme: never use doubleclick, mousedown will fire too
// make working click dblclick and drag Ox.Element events
.dblclick(function() { .dblclick(function() {
Ox.print('dblclick') var width = self.defaultColumnWidths[getColumnIndexById(v.id)];
resizeColumn( resizeColumn(v.id, width);
v.id, self.defaultColumnWidths[getColumnIndexById(v.id)] that.triggerEvent('columnresize', {
); id: v.id,
width: width
});
}); });
} }
$left = $('<div>').addClass('OxLeft').appendTo($resize); $left = $('<div>').addClass('OxLeft').appendTo($resize);
@ -7719,6 +7740,7 @@ requires
cursor: 'pointer' cursor: 'pointer'
}); });
that.$body.clearCache(); that.$body.clearCache();
triggerColumnChangeEvent();
} }
function getCell(id, key) { function getCell(id, key) {
@ -7865,6 +7887,14 @@ requires
} }
} }
function triggerColumnChangeEvent() {
that.triggerEvent('columnchange', {
ids: $.map(self.visibleColumns, function(v, i) {
return v.id;
})
});
}
function updateOrder(id) { function updateOrder(id) {
var pos = getColumnPositionById(id); var pos = getColumnPositionById(id);
//Ox.print(id, pos) //Ox.print(id, pos)