Dim UseNum
Dim UseStatus
Dim StatusIco
Dim Path
Dim strQQMailTip
Dim UseNumWidth
Dim CurrentWidth
Dim barflag
Dim ShowStatus
Dim foldbottom
Dim bMsgInside

sub Window_OnInit()	
	Window.GetScriptVersion "1.0" 	
	StatusIcon = "Offline.ico"
	UseStatus = "(离线)"
	Path = "NewSkins\\QQ2004\\"
	UseNum = "0"
	'strQQMailTip = "您没有新邮件"
	barflag = 0
End sub

sub Window_OnSize(cx,cy)
	Window.LockPaint()
	CurrentWidth = cx
	CurrentHeight = cy

    '顶部标题栏
   	
    TitleMiddle.left =TitleLeft.width
    TitleMiddle.width = cx - TitleLeft.width - TitleRight.width
	TitleRight.left = cx - 110
	TitleBtns1.left = cx - 60

	'中间部分

	title.width = cx
              sysleftline.height = cy - 20
	sysrightline.height = cy - 20
	sysrightline.left = cx - 3

	NewPanels.left = cx
	BarFrame.left = NewPanels.left + NewPanels.width - 3

	BarFrame.top = 60
	BarFrame.left = 3
	BarFrame.width = cx - 3 - BarFrame.left 
	BarFrame.height = cy - 21 - BarFrame.top
    CellBGCenter.width = BarFrame.width
    CellBGCenter.height = BarFrame.height - 2

if barflag = 1 then
	Bar1.width = BarFrame.width - 30
else
	Bar1.width = BarFrame.width
end if

	Bar1.height = BarFrame.height - 3
	BottomFrameLeft.top = cy - 23
	BottomFrameRight.top=BottomFrameLeft.top
	BottomFrameMid.top=BottomFrameLeft.top
	BottomFrameRight.left = cx - 32
	BottomFrameMid.left = BottomFrameLeft.width
	BottomFrameMid.width =BottomFrameRight.left - (BottomFrameLeft.left +BottomFrameLeft.width)

	'昵称 + 头像 + 邮箱

	name.left = cx - 88
	name1.left = name.left
	QZone.left = name.left
	MyQQNum.left = name.left
	
	StatusPicbro.left = cx - 36
	StatusPic.left = cx - 35

	MyQQNum.value = UseNum
	QQMailTip.label = strQQMailTip
	QQMailTip.top = 39
	QQHosting.top = 39
	QQMailTip.left = cx - 92
	QQHosting.left = QQMailTip.left + 25

    '顶部左边两个大按钮

	GameBtn.top = 28
	FriendbarBtn.top = GameBtn.top
	NetDiskbarBtn.top = GameBtn.top

	GameBtn.left = 36
	FriendbarBtn.left = 5
	NetDiskbarBtn.left = 5

	'下面快捷按钮

	QQMain.top = cy - 20
	SysMsgBtn.top = QQMain.top
	ChatRoomBtn.top = QQMain.top
	searchBtn.Top = QQMain.top
	PanelselectBtn.Top = QQMain.top - 1
	QQMain.Left = 8
	SysMsgBtn.left = QQMain.left + QQmain.width + 8
	ChatRoomBtn.left = SysMsgBtn.left + SysMsgBtn.width + 3
	searchBtn.left = SysMsgBtn.left + SysMsgBtn.width + 24
	PanelselectBtn.left = cx - 20


	Window.UnLockPaint()

end sub

'标题栏按钮

sub close1_onClick()
	Window.ExeCommand 1,3
end sub

sub min1_onClick()
	Window.ExeCommand 4,7
end sub

sub color_onClick()
	Window.ExeCommand 1,2
end sub

'6个快捷按钮

Sub Window_onClick(code, Name)
	Window.LockPaint()
	IF Name = "FriendBar" THEN	
		FriendBarBtn.visible = false
		NetDiskBarBtn.visible = true
	ELSE
		
		FriendBarBtn.visible = true
		NetDiskBarBtn.visible = false

	END IF
	Window.ExeCommand code,CStr(Name)
	Window.UnLockPaint()
End sub

'头像和状态按钮

sub StatusPic_onClick()
	s = CStr(StatusPic.Left)&"."&CStr(StatusPic.Top + StatusPic.height)
	Window.ExeCommand 6,s
end Sub

sub StatusPic_onMouseMove(nX,nY)
	s = CStr(StatusPic.Left) & "." & CStr(StatusPic.Top) & "." & CStr(StatusPic.width) & "." & CStr(StatusPic.height)
	Window.ExeCommand 20,s
end Sub

sub StatusPic_onMouseLeave()
	s = CStr(StatusPic.Left) & "." & CStr(StatusPic.Top) & "." & CStr(StatusPic.width) & "." & CStr(StatusPic.height)
	Window.ExeCommand 21,s
end Sub

'QQ邮箱和我的秘书

Sub QQMailTip_onClick()
	Window.ExeCommand 7,1	
End Sub

Sub QQHosting_onClick()
	Window.ExeCommand 15,1	
End Sub

'隐藏名字显示QQ号和QZone

	name.visible = True
sub name_onClick()
	Window.LockPaint()
	name.visible = False
	name1.visible = False
	Window.UnLockPaint()
end sub
name1.visible = True
sub name1_onClick()
	Window.LockPaint()
	name.visible = False
	name1.visible = False
	Window.UnLockPaint()
end sub

Sub QZone_onClick()
	Window.ExeCommand 16,1	
End Sub

'顶部左边两个大按钮

Sub GameBtn_onClick()
	Window.ExeCommand 4,5
end sub

sub FriendBarBtn_onClick()
	Window_onClick 2,"FriendBar"
end sub

sub NetDiskBarBtn_onClick()
	Window_onClick 2,"NetDiskBar" 
end sub

'下面快捷按钮组

sub QQMain_onClick()
	s = CStr(QQMain.Left)&"."&CStr(QQMain.Top)
	Window.ExeCommand 5,s
end sub

sub searchBtn_onClick()
	Window.ExeCommand 4,3
end sub

sub ChatRoomBtn_onClick()
	Window.ExeCommand 4,1
end sub

sub SysMsgBtn_onClick()
	Window.ExeCommand 4,6
end sub

Sub PanelselectBtn_onClick()
        Window.ExeCommand 4,9
End Sub

'处理QQ程序发来的事件
Sub Window_OnNotify(code ,var)
	if code = 1 then
		'设置当前的Uin
			UseNum = var
	   		MyQQNum.value = UseNum 
			
	elseif code = 2 then
		'闪系统消息按钮 var 为1是开始闪。为2是停止
		if(var = 1) then
			SysMsgBtn.StopFlash
			SysMsgBtn.Flash 30
		else
			SysMsgBtn.StopFlash
		end if
	elseif code = 3 then
		'闪状态按钮 var 为0,1,2,3是对应的ico。为4表示停止
		if var = 0 then
			StatusPic.ico = "Online.ico"		
		elseif var = 1 Then
			StatusPic.ico = "leave.ico"		
		elseif var = 2 Then
			StatusPic.ico = "invisible.ico"		
		elseif var = 3 Then
			StatusPic.ico = "Offline.ico"		
		elseif var = 4 then
			StatusPic.Ico = StatusIco	
		end if
	elseif code = 4 then
		'设置那个Bar在最前
		'Window_onClick 2,Var
	elseif code = 5 then
		'设置当前的状态。
		Window.LockPaint

		if var = 10 Then	
			UseStatus = "在线"		
			StatusIco = "Online.ico"
		elseif var = 20 Then
			UseStatus = "离线"			
			StatusIco = "Offline.ico"
		elseif var = 30 Then	
			UseStatus = "离开"		
			StatusIco = "leave.ico"
		elseif var = 40 Then	
			UseStatus = "隐身"		
			StatusIco = "invisible.ico"	
		end if
		Window.UnLockPaint()
		StatusPic.ico = StatusIco

	   	MyQQNum.Value = UseNum 
		 
	elseif code  = 6 then
		'设置Skin的起始路径
		Path = Var

	elseif code = 100 then
		'改变QQMail的提示
		strQQMailTip = CStr(var) + "/"
		QQMailTip.label = strQQMailTip	
	elseif code = 101 then
		QQHosting.label = CStr(var)
	elseif code = 10 then
		if(var = 1) then
			PaymentBtn.SetLighting(true)
		else
			PaymentBtn.SetLighting(false)
		end If
	ElseIf code = 25 Then
		' 皮肤推送
		if(var = 1) then
			ColoBtn.SetLighting(true)
		else
			ColoBtn.SetLighting(false)
		end If
	end if
end sub

'Mod by Nicky 2005.4.10