Exemplo n.º 1
0
void BorderImage_draw(entity me)
{
	//print(vtos(me.borderVec), "\n");

	if(me.src)
		draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
	if(me.fontSize > 0)
	{
		vector ro, rf, df;
		if(me.isNexposeeTitleBar)
		{
			// me.parent.Nexposee_animationFactor 0 (small) or 1 (full)
			// default values are for 1
			ro = me.realOrigin;
			rf = me.realFontSize;
			df = draw_fontscale;
			me.realOrigin = ro * me.parent.Nexposee_animationFactor + me.realOrigin_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
			me.realFontSize = rf * me.parent.Nexposee_animationFactor + me.realFontSize_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
			draw_fontscale = globalToBoxSize(boxToGlobalSize(df, me.realFontSize), rf);
		}

		SUPER(BorderImage).draw(me);

		if(me.isNexposeeTitleBar)
		{
			// me.Nexposee_animationState 0 (small) or 1 (full)
			// default values are for 1
			me.realOrigin = ro;
			me.realFontSize = rf;
			draw_fontscale = df;
		}
	}
};
Exemplo n.º 2
0
void ListBox_draw(entity me)
{
	float i;
	vector absSize, fillSize;
	vector oldshift, oldscale;
	if(me.pressed == 2)
		me.mouseDrag(me, me.dragScrollPos); // simulate mouseDrag event
	me.updateControlTopBottom(me);
	fillSize_x = (1 - me.controlWidth);
	if(me.alphaBG)
		draw_Fill('0 0 0', '0 1 0' + fillSize, me.colorBG, me.alphaBG);
	if(me.controlWidth)
	{
		draw_VertButtonPicture(eX * (1 - me.controlWidth), strcat(me.src, "_s"), eX * me.controlWidth + eY, me.color2, 1);
		if(me.nItems * me.itemHeight > 1)
		{
			vector o, s;
			o = eX * (1 - me.controlWidth) + eY * me.controlTop;
			s = eX * me.controlWidth + eY * (me.controlBottom - me.controlTop);
			if(me.pressed == 1)
				draw_VertButtonPicture(o, strcat(me.src, "_c"), s, me.colorC, 1);
			else if(me.focused)
				draw_VertButtonPicture(o, strcat(me.src, "_f"), s, me.colorF, 1);
			else
				draw_VertButtonPicture(o, strcat(me.src, "_n"), s, me.color, 1);
		}
	}
	draw_SetClip();
	oldshift = draw_shift;
	oldscale = draw_scale;
	absSize = boxToGlobalSize(me.size, eX * (1 - me.controlWidth) + eY * me.itemHeight);
	for(i = floor(me.scrollPos / me.itemHeight); i < me.nItems; ++i)
	{
		float y;
		y = i * me.itemHeight - me.scrollPos;
		if(y >= 1)
			break;
		draw_shift = boxToGlobal(eY * y, oldshift, oldscale);
		draw_scale = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), oldscale);
		me.drawListBoxItem(me, i, absSize, (me.selectedItem == i));
	}
	draw_ClearClip();
}
Exemplo n.º 3
0
float mouseReleaseListBox(entity me, vector pos)
{
	vector absSize;
	if(me.pressed == 1)
	{
		// slider dragging mode
		// in that case, nothing happens on releasing
	}
	else if(me.pressed == 2)
	{
		me.pressed = 3; // do that here, so setSelected can know the mouse has been released
		// item dragging mode
		// select current one one last time...
		me.setSelected(me, floor((me.scrollPos + pos_y) / me.itemHeight));
		// and give it a nice click event
		if(me.nItems > 0)
		{
			absSize = boxToGlobalSize(me.size, eX * (1 - me.controlWidth) + eY * me.itemHeight);
			me.clickListBoxItem(me, me.selectedItem, globalToBox(pos, eY * (me.selectedItem * me.itemHeight - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.itemHeight));
		}
	}
	me.pressed = 0;
	return 1;
}
Exemplo n.º 4
0
	me.sortButton5.forcePressed = (field == SLIST_FIELD_NUMHUMANS);
	me.selectedItem = 0;
	if(me.selectedServer)
		strunzone(me.selectedServer);
	me.selectedServer = string_null;
	me.refreshServerList(me, 0);
}
void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin, float theSize, string theTitle, void(entity, entity) theFunc)
{
	vector originInLBSpace, sizeInLBSpace;
	originInLBSpace = eY * (-me.itemHeight);
	sizeInLBSpace = eY * me.itemHeight + eX * (1 - me.controlWidth);

	vector originInDialogSpace, sizeInDialogSpace;
	originInDialogSpace = boxToGlobal(originInLBSpace, me.Container_origin, me.Container_size);
	sizeInDialogSpace = boxToGlobalSize(sizeInLBSpace, me.Container_size);

	btn.Container_origin_x = originInDialogSpace_x + sizeInDialogSpace_x * theOrigin;
	btn.Container_size_x   =                         sizeInDialogSpace_x * theSize;
	btn.setText(btn, theTitle);
	btn.onClick = theFunc;
	btn.onClickEntity = me;
	btn.resized = 1;
}
void XonoticServerList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
	SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);

	me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
	me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
	me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
Exemplo n.º 5
0
void BorderImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
	me.isNexposeeTitleBar = 0;
	if(me.zoomedOutTitleBar)
		if(me.parent.parent.instanceOfNexposee)
			if(me.parent.instanceOfDialog)
				if(me == me.parent.frame)
					me.isNexposeeTitleBar = 1;
	if(me.isNexposeeTitleBar)
	{
		vector scrs;
		scrs = eX * conwidth + eY * conheight;
		SUPER(BorderImage).resizeNotify(me, relOrigin, relSize, boxToGlobal(me.parent.Nexposee_smallOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_smallSize, scrs));
		me.realOrigin_y = me.realFontSize_y * me.zoomedOutTitleBarPosition;
		me.realOrigin_Nexposeed = me.realOrigin;
		me.realFontSize_Nexposeed = me.realFontSize;
	}
	SUPER(BorderImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
	me.borderVec_x = me.borderHeight / absSize_x;
	me.borderVec_y = me.borderHeight / absSize_y;
	me.realOrigin_y = 0.5 * (me.borderVec_y - me.realFontSize_y);
	if(me.closeButton)
	{
		// move the close button to the right place
		me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec_x);
		me.closeButton.Container_size = me.borderVec;
		me.closeButton.color = me.color;
		me.closeButton.colorC = me.color;
		me.closeButton.colorF = me.color;
	}
}