aboutsummaryrefslogtreecommitdiff
path: root/Src/resources/skins/Big Bento/scripts/tabbutton.m
blob: 1662ab989a4259f0958fb6af3f8796c96e981cf0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*---------------------------------------------------
-----------------------------------------------------
Filename:	tabbutton.m
Version:	1.0

Type:		maki
Date:		28. Sep. 2007 - 13:12 
Author:		Martin Poehlmann aka Deimos
E-Mail:		martin@skinconsortium.com
Internet:	www.skinconsortium.com
		www.martin.deimos.de.vu
-----------------------------------------------------
---------------------------------------------------*/

#include <lib/std.mi>

Global GuiObject normalGrid, hoverGrid, activeGrid, footerGrid;
Global Button mousetrap;
Global Text normalText, hoverText, activeText;
Global Boolean mouseDown;

System.onScriptLoaded ()
{
	group sg = getScriptGroup();

	normalGrid = sg.getObject("bento.tabbutton.normal");
	hoverGrid = sg.getObject("bento.tabbutton.hover");
	activeGrid = sg.getObject("bento.tabbutton.active");
	normalText = sg.getObject("bento.tabbutton.normal.text");
	hoverText = sg.getObject("bento.tabbutton.hover.text");
	activeText = sg.getObject("bento.tabbutton.active.text");
	footerGrid = sg.getObject("bento.tabbutton.footer");

	mousetrap = sg.getObject("bento.tabbutton.mousetrap");
}

System.onSetXuiParam (String stringParam, String value)
{
	if ( strlower(stringParam) == "tabtext" ) 
	{
		normalText.setText(value);
		hoverText.setText(value);
		activeText.setText(value);
	}
}

mousetrap.onLeftButtonDown (int x, int y)
{
	mouseDown = 1;
	normalGrid.show();
	hoverGrid.hide();
	normalText.show();
	hoverText.hide();
}

mousetrap.onLeftButtonUp (int x, int y)
{
	mouseDown = 0;
	if (!getActivated() && isMouseOverRect()) { normalGrid.hide(); hoverGrid.show(); normalText.hide(); hoverText.show(); }
}

mousetrap.onleaveArea ()
{
	normalGrid.show(); 
	hoverGrid.hide();
	normalText.show();
	hoverText.hide();
}

mousetrap.onEnterArea ()
{
	normalGrid.hide(); hoverGrid.show(); normalText.hide(); hoverText.show();
}

mousetrap.onActivate (int activated)
{
	if (activated)
	{
		normalGrid.hide(); hoverGrid.hide(); normalText.hide(); hoverText.hide();
		activeGrid.show(); footerGrid.show(); activeText.show();
	}
	else
	{
		normalGrid.show(); hoverGrid.hide(); normalText.show(); hoverText.hide();
		activeGrid.hide(); footerGrid.hide(); activeText.hide();
	}
}