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

@@ -2,7 +2,7 @@ mexui.util.createControlConstructor('TabPanel', true, function(window, x, y, w,
{
mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('TabPanel', styles));
mexui.Entity.ControlWithEntries.call(this, false, false);
this.activeTabIndex = 0;
});
@@ -13,7 +13,7 @@ mexui.util.linkBaseControlStyles('TabPanel', {
backgroundColour: toColour(240, 20, 20, 200),
borderColour: toColour(120, 20, 20, 225),
textColour: toColour(0, 0, 0, 255),
hover:
{
backgroundColour: toColour(240, 20, 20, 150),
@@ -29,24 +29,24 @@ mexui.Control.TabPanel.prototype.onMouseDown = function(e)
if(e.button == 0)
{
var pos = this.getScreenPosition();
var tabX = pos.x;
for(var i in this.axis.x.entries)
{
var tab = this.axis.x.entries[i];
var tabPos = new Vec2(tabX, pos.y);
var tabSize = new Vec2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
if(mexui.util.isCursorInRectangle(tabPos, tabSize))
{
tab.setActive();
break;
}
tabX += tabSize.x;
}
/*
var tab = this.axis.x.getEntryByCursor();
if(tab)
@@ -59,22 +59,22 @@ mexui.Control.TabPanel.prototype.onMouseDown = function(e)
mexui.Control.TabPanel.prototype.render = function()
{
var pos = this.getScreenPosition();
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
var tabX = pos.x;
for(var i in this.axis.x.entries)
{
var tab = this.axis.x.entries[i];
var tabPos = new Vec2(tabX, pos.y);
var tabSize = new Vec2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
mexui.native.drawRectangle(tabPos, tabSize, this.getStyles('tab'));
mexui.native.drawText(tabPos, tabSize, tab.text, this.getStyles('tab'));
tabX += tabSize.x;
}
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'));
};