Dim UserNum
Dim UserStatus
Dim Path
Dim strQQMailTip
Dim ShowStatus
Dim foldbottom
Dim bMsgInside
Dim CurrentWidth
Dim CurrentHeight
'注释
Sub Window_OnInit()	
	Window.GetScriptVersion "1.0" 	
	UserStatus = "(离线)"
	Path = "NewSkins\\2007\\"
	ShowStatus = 1
	UserNum = "0"
	If 1 = ShowStatus Then
		 UserNum = UserNum + UserStatus
	End If
	strQQMailTip = ""
End Sub
Sub Window_OnSize(cx,cy)
	Window.LockPaint()
	CurrentWidth = cx
	CurrentHeight = cy
	'背景	
	BackgroundRB.left  = cx - 12 
	BackgroundRB.top = cy - 110 
	BackgroundLB.top = cy - 110 
	BackgroundRT.left  = cx - 79 
	BackgroundRT2.left  = cx - 151 
	BackgroundL.height = cy - 141
	BackgroundR.left  = cx - 35 
	BackgroundR.height = cy - 84
	BackgroundT.width = cx - 143
	BackgroundT2.width = cx - 209 
	BackgroundB.top = cy - 110 
	BackgroundB.width = cx - 35 
	BackgroundC.width = cx - 19 
	BackgroundC.height = cy - 141 
	
	'好友列表中间空白部分
	FolderBackgroundLT.top = 81
	FolderBackgroundRT.top = 81 
	FolderBackgroundT.top = 81 
	FolderBackgroundL.top = 81
	FolderBackgroundR.top = 81
'这个地方很重要	cx - 35		
	
    FolderBackgroundT.width = cx - 35 	
    FolderBackgroundB.width = cx - 35 
	'好友列表中间空白部分宽度
	FolderBackgroundC.left=4 
	FolderBackgroundC.top=82
	FolderBackgroundC.width = cx - 37 
	FolderBackgroundC.height = cy - 142
	'标题栏
	ToolBarBackgroundC.top = cy - 62 
	ToolBarBackgroundC.width = cx - 30 
	ToolBarBackgroundL.top = ToolBarBackgroundC.top 
	ToolBarBackgroundR.left = cx - 15 
	ToolBarBackgroundR.top = ToolBarBackgroundC.top 		
'顶头三个按钮
	CloseButton.left = cx - 21 
    ColorButton.left = cx - 38 
	MinButton.left = cx - 55 
'标题
	QQCaption.width = MinButton.left - 65
'下面的按钮顶部
	MenuButton.top = cy - 29
	ChatRoomButton.top = cy - 25
	GameButton.top = cy - 25 
	MsgManagerButton.top = cy - 25 
	MobileMsgButton.top = cy - 25
	SearchButton.top = cy - 25 
'下面的按钮宽度排列	
	ChatRoomButton.left=MenuButton.left+68
	GameButton.LEFT=ChatRoomButton.left+20
	MobileMsgButton.LEFT=GameButton.left+20
	MsgManagerButton.LEFT=MobileMsgButton.left+20
	SearchButton.LEFT=MsgManagerButton.LEFT+20
	'Bar1.height = cy - 70 这个地方决定好友列表下方的高度	
	Bar1.LockPaint()
	Bar1.top = 80
	Bar1.width = cx - 8
	Bar1.height = cy - 114
	Bar1.left=4
	Bar1.UnLockPaint()
	'侧边栏
NewPanels.left=3
NewPanels.top = 0
NewPanels.width=0 
NewPanels.height=0
 	StatusWeather.left = cx - 43
	Container_Up.top = 25
	Container_Up.left = StatusButton.left + StatusButton.width
	Container_Up.width = cx - Container_Up.left - StatusWeather.width - 10
	Container_Up.height = 68
	Container_Down.top = cy - 65
	Container_Down.left = 0
	Container_Down.width = cx
	Container_Down.height = 65
	FolderBackgroundRB.left  = cx - 5 
	FolderBackgroundRB.top = cy - foldbottom 
	FolderBackgroundLB.top = cy - foldbottom 
	FolderBackgroundRT.left  = cx - 5 
	FolderBackgroundL.height = cy - 132 
	FolderBackgroundR.left  = cx - 5 
	FolderBackgroundR.height = cy - 141 
	FolderBackgroundB.top = cy - foldbottom 
	QQNumber.width = QQNumber.textlength
	QQStatus.left  = QQNumber.left + QQNumber.width
	QQStatus.width = QQStatus.textlength
	MainSearchDlg.UnLockPaint()
	MailButton.label = strQQMailTip
    Window.UnLockPaint()
End Sub
'上面的三个按钮
Sub MinButton_onClick()
	Window.ExeCommand 1,2
End Sub
Sub CloseButton_onClick()
	Window.ExeCommand 1,3
End Sub
Sub ColorButton_onClick()
     Window.ExeCommand 4,7
End Sub
'六个Bar按钮
Sub Window_onClick(code, Name)
	Window.LockPaint()
	Window.DisableBar CStr(Name)
	Window.ExeCommand code,CStr(Name)
	Window.UnLockPaint()
End Sub
'顶部的按钮组 
Sub StatusButton_onClick()
	s = CStr(StatusButton.Left + StatusButton.width - 10)&"."&CStr(StatusButton.Top + StatusButton.height - 8)
	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
Sub StatusPic_onClick()
	Window.ExeCommand 60,2
End Sub
sub StatusWeather_onMouseMove(nX,nY)
	s = CStr(StatusWeather.Left) & "." & CStr(StatusWeather.Top) & "." & CStr(StatusWeather.width) & "." & CStr(StatusWeather.height)
	Window.ExeCommand 31,s
end Sub
sub StatusWeather_onMouseLeave()
	s = CStr(StatusWeather.Left) & "." & CStr(StatusWeather.Top) & "." & CStr(StatusWeather.width) & "." & CStr(StatusWeather.height)
	Window.ExeCommand 30,s
end Sub
Sub StatusWeather_onClick()
	Window.ExeCommand 61,0
End Sub

sub PaymentButton_onClick()
	Window.ExeCommand 4,8
end Sub

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


'下面的按钮组 
Sub GameButton_onClick()
	Window.ExeCommand 4,5
End Sub
Sub ChatRoomButton_onClick()
	Window.ExeCommand 4,1
End Sub
Sub PanelButton_onClick()
	Window.ExeCommand 4,9
End Sub
Sub MobileMsgButton_onClick()
	Window.ExeCommand 4,2
End Sub
Sub MenuButton_onClick()
	s = CStr(Int(MenuButton.Left - 3))&"."&CStr(MenuButton.Top)
	Window.ExeCommand 5,s
End Sub
Sub MsgManagerButton_onClick()
	Window.ExeCommand 4,6
End Sub
Sub SearchButton_onClick()
	Window.ExeCommand 4,3
End Sub
Sub ScrollUpButton_OnClick()
        Window.ExeCommand 17,1
End Sub
Sub ScrollDownButton_OnClick()
        Window.ExeCommand 18,1
End Sub
Sub PanelMngButton_OnClick()
	Window.ExeCommand 19,1
End Sub
'处理QQ程序发来的事件
Sub Window_OnNotify(code ,var)
	If code = 1 Then
		'设置当前的Uin
		UserNum = var
		If 0 = ShowStatus Then
			QQNumber.value = UserNum 
		Else
		   	QQNumber.value = UserNum 
			QQStatus.value = UserStatus
		End If			
	ElseIf code = 2 Then
		'闪系统消息按钮 var 为1是开始闪。为2是停止
		If(var = 1) Then
			MsgManagerButton.StopFlash
			MsgManagerButton.Flash 30
		Else
			MsgManagerButton.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
		'设置当前的状态。
		if var = 10 Then	
			UserStatus = "(在线)"		
			StatusIco = "StatusPic.ico"
		elseif var = 20 Then
			UserStatus = "(离线)"			
			StatusIco = "StatusPic1.ico"
		elseif var = 30 Then	
			UserStatus = "(离开)"		
			StatusIco = "StatusPic2.ico"
		elseif var = 40 Then	
			UserStatus = "(隐身)"		
			StatusIco = "StatusPic3.ico"			
		end If
		StatusPic.ico = StatusIco
		If 0 = ShowStatus Then
			QQNumber.value = UserNum 
		Else
		   	QQNumber.value = UserNum 
			QQStatus.value = UserStatus
		End If
	ElseIf code  = 6 Then
		'设置Skin的起始路径
		Path = Var
	ElseIf code = 100 Then
		'改变QQMail的提示
		if( var = 0 ) then
		    strQQMailTip = "(" + "0" + ")"
		else
		    strQQMailTip = "(" + CStr(var) + ")"
		end if
		MailButton.label = strQQMailTip		
	ElseIf code = 10 then
		if(var = 1) then
			PaymentButton.SetLighting(true)
		else
			PaymentButton.SetLighting(false)
		end If
	ElseIf code = 20 Then
			QQStatus.left  = QQNumber.left + QQNumber.width
			QQStatus.width = QQStatus.textlength
			
	ElseIf code = 25 Then
		' 皮肤推送
		if(var = 1) then
			ColorButton.SetLighting(true)
		else
			ColorButton.SetLighting(false)
		end If
	ElseIf code = 31 then
		if(var = 1) then
			MainSearchDlg.bInside = TRUE
		else
			MainSearchDlg.bInside = FALSE
		end If	
	ElseIf code = 51 Then
		StrCaption = var
		QQCaption.value = StrCaption	
	
	End If	
End Sub