MexUI stuff

This commit is contained in:
Vortrex
2022-05-15 22:26:31 -05:00
parent c81f511448
commit 4b7f05a482
42 changed files with 423 additions and 398 deletions

View File

@@ -30,54 +30,54 @@ mexui.util.linkBaseControlStyles('Grid', {
mexui.Control.Grid.prototype.render = function()
{
var pos = this.getScreenPosition();
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
var startX = pos.x;
var maxColumnHeight = 0;
for(var i in this.axis.x.entries)
{
var column = this.axis.x.entries[i];
mexui.native.drawText(new Vec2(startX, pos.y), new Vec2(column.width, column.height), column.text, this.getStyles('header'));
startX += column.width;
mexui.native.drawAALine(new Vec2(startX, pos.y), new Vec2(startX, pos.y + this.size.y), this.getStyles('column'));
if(column.height > maxColumnHeight)
{
maxColumnHeight = column.height;
}
}
var startY = pos.y + maxColumnHeight;
mexui.native.drawAALine(new Vec2(pos.x, startY), new Vec2(pos.x + this.size.x, startY), this.getStyles('row'));
for(var i=this.axis.y.getEntryStartIndex(),j=this.axis.y.getEntryEndIndex(); i<j; i++)
{
var row = this.axis.y.entries[i];
if(!row)
break;
startX = pos.x;
for(var i2 in row.cells)
{
var column = this.axis.x.entries[i2];
var cell = row.cells[i2];
var cellText = cell.text;
var styles = this.getEntryStyles([[cell,'main'], [row,'main'], [this,'row'], [this,'cell']]);
mexui.native.drawRectangle(new Vec2(startX, startY), new Vec2(column.width, column.height), styles);
mexui.native.drawText(new Vec2(startX, startY), new Vec2(column.width, column.height), cellText, styles);
startX += column.width;
}
startY += row.rowHeight;
mexui.native.drawAALine(new Vec2(pos.x, startY), new Vec2(pos.x + this.size.x, startY), this.getStyles('row'));
}
if(this.isFocused())
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
};
@@ -104,7 +104,7 @@ mexui.Control.Grid.prototype.row = function(cellsData, styles)
cells[i] = new mexui.Component.Entry(this, 1, cellsData[i] + '');
}
}
var entry = new mexui.Entry.GridRow(this, cells, styles);
this.axis.y.addEntry(entry);
return entry;
@@ -127,3 +127,4 @@ mexui.Control.Grid.prototype.getAllEntriesLength = function(axisIndex)
return this.axis.y.getAllEntriesLength2();
}
};