www.gusucode.com > VC++高仿迅雷7漂亮界面开源源码-源码程序 > VC++高仿迅雷7漂亮界面开源源码-源码程序/code/LEinGUI/EXP3FRAME.cpp
//Download by http://www.NewXing.com // EXP3FRAME.cpp: implementation of the CEXP3FRAME class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "CLAYUIEXP3.h" #include "EXP3FRAME.h" #include "CLAYUIEXP3Dlg.h" #include "../clayui/ui_control/CLAYUI_RadioBox.h" #include "XLframe.h" #include "../clayui/UI_ANIMATION/CLAYUI_ROTATE_ANIM.h" #include "../clayui/UI_ANIMATION/CLAYUI_ALPHA_ANIM.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CEXP3FRAME::CEXP3FRAME() { } CEXP3FRAME::~CEXP3FRAME() { } void CEXP3FRAME::LoadFromMem(BYTE *filebuffer, DWORD filesize, BOOL isMemMgr) { CLAYUI_BFRAME::LoadFromMem(filebuffer, filesize, isMemMgr); //设置左边的标签 int i; char str[10]; sprintf(str, "t%d", 1); CLAYUI_RadioBox* radio = dynamic_cast<CLAYUI_RadioBox*>(GetChildFrame(str)); if(radio) { for(i = 2; i < 13; i ++) { sprintf(str, "t%d", i); CLAYUI_RadioBox* radio1 = dynamic_cast<CLAYUI_RadioBox*>(GetChildFrame(str)); if(radio1) radio->SetRelativeRadio(radio1); if(i == 12) radio1->SetCheck(1); if(i == 2) radio1->SetText(L"垂直翻转"); else if(i == 3) radio1->SetText(L"水平翻转"); } } int num = m_framelist.m_spritenum; CLAYUI_FRAME* frame = GetChildByIndex(num - 1); frame->Enable(FALSE); CLAYUI_BFRAME* clipframe = new CLAYUI_BFRAME(); clipframe->InitBFrame(GetParent(), this, m_draw, 0); AddCustomFrame(0, "clipframe", 189 - 50, 113 - 81, 353, 327, 100, clipframe); clipframe->SetClip(1, 0, 0, 353, 327); BYTE* filebuf1 = NULL; DWORD filesize1 = 0; CFile file; CString framename = "xlframe1.ci"; if(file.Open(m_exepath + framename, CFile::modeRead)) { filesize1 = file.GetLength(); filebuf1 = new BYTE[filesize1]; file.Read(filebuf1, filesize1); file.Close(); CXLframe* xlframe = new CXLframe(); xlframe->InitBFrame(m_gitemframe, this, m_draw, FALSE); xlframe->LoadFromMem(filebuf1, filesize1, FALSE); delete [] filebuf1; clipframe->AddCustomFrame(0, framename.GetBuffer(0), 0, 0, 353, 327, 100, xlframe); //xlframe->SetClip(1, 0, 0, 353, 327); xlframe->SetIs3D(1); //exp3frame->ScaleTo(0.6, 0.6, 1); xlframe->SetOri((353 / 2) << 16, (327 / 2) << 16, -(353 / 2) << 16); } m_curxlframe = framename; } void CEXP3FRAME::UserAction(CLAYUI_MSGINFO *msginfo, int x, int y, DWORD msg) { //退出 if(msg == CLAYUI_LCLICK && (msginfo->GetFrame(this) == GetChildFrame("x") || msginfo->GetFrame(this) == GetChildFrame("ok") || msginfo->GetFrame(this) == GetChildFrame("ok_1"))) { ((CCLAYUIEXP3Dlg*)m_dlg)->m_isquit = TRUE; } CLAYUI_BFRAME* clipframe = (CLAYUI_BFRAME*)GetChildFrame("clipframe"); //加载分页 if(msg == CLAYUI_LCLICK && msginfo->GetFrame(this) == GetChildFrame("t2")) { CLAYUI_ROTATE_ANIM* rotate = (CLAYUI_ROTATE_ANIM*)GetParent()->GetAnimation("rot0"); rotate->Init(0, 0, 180, 0, 0, 0, 600, GetParent()); rotate->SetTarget(this); rotate->SetMoveType(CLAYUI_MOVETYPE::CLAYUI_MOVE_Linear, CLAYUI_MOVETYPE::CLAYUI_MOVE_EASEOUT); rotate->Play(); } if(msg == CLAYUI_LCLICK && msginfo->GetFrame(this) == GetChildFrame("t3")) { CLAYUI_ROTATE_ANIM* rotate = (CLAYUI_ROTATE_ANIM*)GetParent()->GetAnimation("rot0"); rotate->Init(0, 0, 0, 0, 180, 0, 600, GetParent()); rotate->SetTarget(this); rotate->SetMoveType(CLAYUI_MOVETYPE::CLAYUI_MOVE_Linear, CLAYUI_MOVETYPE::CLAYUI_MOVE_EASEOUT); rotate->Play(); } if(msg == CLAYUI_LCLICK && (msginfo->GetFrame(this) == GetChildFrame("t12") || msginfo->GetFrame(this) == GetChildFrame("t1"))) { CString framename; if(msginfo->GetFrame(this) == GetChildFrame("t12")) framename = "xlframe1.ci"; if(msginfo->GetFrame(this) == GetChildFrame("t1")) framename = "xlframe2.ci"; if(framename != m_curxlframe) { //销毁前一个xlframe CLAYUI_FRAME* frame = clipframe->GetChildFrame(m_curxlframe.GetBuffer(0)); frame->SetIdname("deledxl"); frame->Enable(FALSE); CLAYUI_ROTATE_ANIM* rotate1 = (CLAYUI_ROTATE_ANIM*)GetAnimation("dier0"); if(rotate1) { rotate1->End(); rotate1->SetTarget(frame); rotate1->Init(0, 0, 0, 0, 0, -90, 1000, this); } else { rotate1 = new CLAYUI_ROTATE_ANIM(); rotate1->Init(0, 0, 0, 0, 0, -90, 1000, this); rotate1->SetTarget(frame); rotate1->SetIdname("dier0"); AddAnimation(rotate1); } rotate1->SetMoveType(CLAYUI_MOVETYPE::CLAYUI_MOVE_Sinusoidal, CLAYUI_MOVETYPE::CLAYUI_MOVE_EASEOUT); rotate1->SetFinishDelete(1); rotate1->Play(); CLAYUI_ALPHA_ANIM* alpha1 = (CLAYUI_ALPHA_ANIM*)GetAnimation("diea0"); if(alpha1) { alpha1->End(); alpha1->SetTarget(frame); alpha1->Init(frame, 0, 1000, this); } else { alpha1 = new CLAYUI_ALPHA_ANIM(); alpha1->Init(frame, 0, 1000, this); alpha1->SetTarget(frame); alpha1->SetIdname("diea0"); AddAnimation(alpha1); } alpha1->Play(); int num = m_framelist.m_spritenum; BYTE* filebuf = NULL; DWORD filesize = 0; CFile file; if(file.Open(m_exepath + framename, CFile::modeRead)) { filesize = file.GetLength(); filebuf = new BYTE[filesize]; file.Read(filebuf, filesize); file.Close(); CXLframe* xlframe = new CXLframe(); xlframe->InitBFrame(m_gitemframe, this, m_draw, FALSE); xlframe->LoadFromMem(filebuf, filesize, FALSE); delete [] filebuf; clipframe->AddCustomFrame(0, framename.GetBuffer(0), 0, 0, 353, 327, 100, xlframe); xlframe->SetIs3D(1); //exp3frame->ScaleTo(0.6, 0.6, 1); xlframe->SetOri((353 / 2) << 16, (327 / 2) << 16, -(353 / 2) << 16); CLAYUI_ROTATE_ANIM* rotate = (CLAYUI_ROTATE_ANIM*)GetAnimation("r0"); if(rotate) { rotate->SetTarget(xlframe); rotate->End(); rotate->Init(0, 0, 0, 0, 90, 0, 1000, this); } else { rotate = new CLAYUI_ROTATE_ANIM(); rotate->Init(0, 0, 0, 0, 90, 0, 1000, this); rotate->SetTarget(xlframe); rotate->SetIdname("r0"); AddAnimation(rotate); } rotate->SetMoveType(CLAYUI_MOVETYPE::CLAYUI_MOVE_Sinusoidal, CLAYUI_MOVETYPE::CLAYUI_MOVE_EASEOUT); rotate->Play(); } m_curxlframe = framename; } } }