aboutsummaryrefslogtreecommitdiff
path: root/Src/resources/skins/Big Bento/scripts/gen_dropbox.m
blob: c5834017fc5c91bda9e628ce75d3755c553c7c55 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <lib/std.mi>

#define GUID_DROPBOX "{E2E4AD32-D87B-4B9E-BF58-46A1336DDC8F}"
#define GUID_DROPBOX_ "{E2E4AD32-D87B-4b9e-BF58-46A1336DDC8F}"
#define USE_BIG_HACK

Global Frame dualwnd;
Global Group sui_window;
Global Group dropbox;

Global Timer box_tmr;
Global windowholder dropbox_wdh;

Global Container main;

Global int MIN_WIDTH;

System.onScriptLoaded ()
{
	dualwnd = getScriptGroup().findObject("wdh.ml.dualwnd");
	sui_window = getScriptGroup().getParentLayout().findObject("sui.content");
	dropbox = dualwnd.findObject("wdh.ml.dualwnd.dropbox");
	dropbox_wdh = dropbox.findObject("wdh");

	main = dropbox.getParentLayout().getContainer();

	//showWindow(GUID_DROPBOX, "", false);

	MIN_WIDTH = stringToInteger(dualwnd.getXmlParam("minwidth"));
	dualwnd.setXmlParam("resizable", "0");
	dualwnd.setPosition(0);

	box_tmr = new Timer;
	box_tmr.setDelay(1);
}

System.onScriptUnloading ()
{
	delete box_tmr;
	
	int w = dualwnd.getPosition();
	if (w >= MIN_WIDTH)
	{
		setPrivateInt(getSkinName(), "gen_dropbox_poppler", w);			
	}
}
#ifdef 0
Global Boolean gettingclosed;

System.onGetCancelComponent (String guid, boolean goingvisible)
{
	
	if (guid != GUID_DROPBOX)
	{
		return FALSE;
	}

        if (goingvisible && !gettingclosed)
	{
		box_tmr.start();
		return TRUE;
	}
	else
	{
		if (gettingclosed)
		{
			gettingclosed = false;
		}
		else
		{
			
			/*int w = dualwnd.getPosition();
			if (w >= MIN_WIDTH)
			{
				setPrivateInt(getSkinName(), "gen_dropbox_poppler", w);			
			}
			dualwnd.setXmlParam("resizable", "0");
			dualwnd.setPosition(0);*/			
		}
		

	}
	

	RETURN FALSE;
}

box_tmr.onTimer ()
{
	box_tmr.stop();
	int w = getPrivateInt(getSkinName(), "gen_dropbox_poppler", 200);
	if (w < MIN_WIDTH)
		w = MIN_WIDTH;
		
	dualwnd.setXmlParam("resizable", "1");

	System.showWindow("{6B0EDF80-C9A5-11D3-9F26-00C04F39FFC6}", "", 0);
	//sui_window.sendAction("opentab", "ml", 0,0,0,0);

	dualwnd.setPosition(w);
	dropbox.hide();
	dropbox_wdh.hide();
	//dropbox_wdh.setXMLParam("hold", "");
	dropbox_wdh.show();
	//dropbox_wdh.setXMLParam("hold", "@all@");
	dropbox.show();
}

#ifdef USE_BIG_HACK

sui_window.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
{
	if (action == "callback")
	{
		if (param == "onbeforehidesui")
		{
			/*//dualwnd.setPosition(0);
			//dropbox.findObject("wdh").setXmlParam("relatw", "0");
			//dropbox.findObject("wdh").setXmlParam("w", "0");
			int i = dualwnd.getLeft() + dualwnd.getWidth();
			dualwnd.setShaded(dualwnd.clientToScreenX(dualwnd.getLeft() +dualwnd.getWidth()),dualwnd.clientToScreenX(dualwnd.getLeft() + dualwnd.getWidth()-dualwnd.getPosition()-4));
			debugInt(dualwnd.clientToScreenX(dualwnd.getLeft() +dualwnd.getWidth()));*/
			dropbox.hide();
gettingclosed = true;
			//dualwnd.setPosition(0);
		}
		else if (param == "onshowsui")
		{
			//dualwnd.setPosition(200);		
		}		
	}
}

main.onBeforeSwitchToLayout (Layout oldlayout, Layout newlayout)
{
	if (newLayout.getID() == "shade")
	{
dropbox.hide();
gettingclosed = true;
	}
	
}

#endif
#endif