From bc572ad9b8e4dcaa073b9029a7ea541f8e5851a3 Mon Sep 17 00:00:00 2001 From: charliewin <815074529@qq.com> Date: Sun, 28 Jun 2015 15:57:30 +0800 Subject: [PATCH] =?UTF-8?q?2015=E5=B9=B46=E6=9C=8828=E6=97=A5charliewin?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A7=E4=BB=B6=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?Demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 增加控件UIAnimation,UIAnimationTabLayout 2. 增加“视频广告过滤大师安装向导”Demo --- .gitignore | 4 +- Demos/ADMonSetup/ADMonSetup.cpp | 65 ++++++++ Demos/ADMonSetup/ADMonSetup.h | 3 + Demos/ADMonSetup/ADMonSetup.ico | Bin 0 -> 23558 bytes Demos/ADMonSetup/ADMonSetup.rc | 150 ++++++++++++++++++ Demos/ADMonSetup/ADMonSetup.vcxproj | 118 ++++++++++++++ Demos/ADMonSetup/ADMonSetup.vcxproj.filters | 62 ++++++++ Demos/ADMonSetup/MainWnd.cpp | 145 +++++++++++++++++ Demos/ADMonSetup/MainWnd.h | 33 ++++ Demos/ADMonSetup/ReadMe.txt | 55 +++++++ Demos/ADMonSetup/Resource.h | 31 ++++ Demos/ADMonSetup/small.ico | Bin 0 -> 23558 bytes Demos/ADMonSetup/stdafx.cpp | 8 + Demos/ADMonSetup/stdafx.h | 31 ++++ Demos/ADMonSetup/targetver.h | 24 +++ DuiLib.sln | 14 ++ DuiLib/Control/UIAnimation.cpp | 164 ++++++++++++++++++++ DuiLib/Control/UIAnimation.h | 83 ++++++++++ DuiLib/Core/UIDefine.h | 2 + DuiLib/Core/UIDlgBuilder.cpp | 3 + DuiLib/DuiLib.vcxproj | 4 + DuiLib/DuiLib.vcxproj.filters | 12 ++ DuiLib/Layout/UIAnimationTabLayout.cpp | 142 +++++++++++++++++ DuiLib/Layout/UIAnimationTabLayout.h | 44 ++++++ DuiLib/UIlib.h | 2 + bin/skin/ADMonSetup/DlgMain.xml | 31 ++++ bin/skin/ADMonSetup/bg.png | Bin 0 -> 14830 bytes bin/skin/ADMonSetup/noselect.png | Bin 0 -> 2827 bytes bin/skin/ADMonSetup/oneclick.png | Bin 0 -> 4863 bytes bin/skin/ADMonSetup/oneclick_dis.png | Bin 0 -> 4749 bytes bin/skin/ADMonSetup/overwrite.png | Bin 0 -> 5036 bytes bin/skin/ADMonSetup/overwrite_dis.png | Bin 0 -> 4918 bytes bin/skin/ADMonSetup/progressb.png | Bin 0 -> 2842 bytes bin/skin/ADMonSetup/progressf.png | Bin 0 -> 2843 bytes bin/skin/ADMonSetup/select.png | Bin 0 -> 2985 bytes bin/skin/ADMonSetup/sys_close.png | Bin 0 -> 3366 bytes bin/skin/ADMonSetup/sys_min.png | Bin 0 -> 2918 bytes 37 files changed, 1229 insertions(+), 1 deletion(-) create mode 100644 Demos/ADMonSetup/ADMonSetup.cpp create mode 100644 Demos/ADMonSetup/ADMonSetup.h create mode 100644 Demos/ADMonSetup/ADMonSetup.ico create mode 100644 Demos/ADMonSetup/ADMonSetup.rc create mode 100644 Demos/ADMonSetup/ADMonSetup.vcxproj create mode 100644 Demos/ADMonSetup/ADMonSetup.vcxproj.filters create mode 100644 Demos/ADMonSetup/MainWnd.cpp create mode 100644 Demos/ADMonSetup/MainWnd.h create mode 100644 Demos/ADMonSetup/ReadMe.txt create mode 100644 Demos/ADMonSetup/Resource.h create mode 100644 Demos/ADMonSetup/small.ico create mode 100644 Demos/ADMonSetup/stdafx.cpp create mode 100644 Demos/ADMonSetup/stdafx.h create mode 100644 Demos/ADMonSetup/targetver.h create mode 100644 DuiLib/Control/UIAnimation.cpp create mode 100644 DuiLib/Control/UIAnimation.h create mode 100644 DuiLib/Layout/UIAnimationTabLayout.cpp create mode 100644 DuiLib/Layout/UIAnimationTabLayout.h create mode 100644 bin/skin/ADMonSetup/DlgMain.xml create mode 100644 bin/skin/ADMonSetup/bg.png create mode 100644 bin/skin/ADMonSetup/noselect.png create mode 100644 bin/skin/ADMonSetup/oneclick.png create mode 100644 bin/skin/ADMonSetup/oneclick_dis.png create mode 100644 bin/skin/ADMonSetup/overwrite.png create mode 100644 bin/skin/ADMonSetup/overwrite_dis.png create mode 100644 bin/skin/ADMonSetup/progressb.png create mode 100644 bin/skin/ADMonSetup/progressf.png create mode 100644 bin/skin/ADMonSetup/select.png create mode 100644 bin/skin/ADMonSetup/sys_close.png create mode 100644 bin/skin/ADMonSetup/sys_min.png diff --git a/.gitignore b/.gitignore index 1f4b7047..368bc769 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ *.log *.idb *.opensdf -*.lastbuildstate \ No newline at end of file +*.lastbuildstate +*.exe +*.dll \ No newline at end of file diff --git a/Demos/ADMonSetup/ADMonSetup.cpp b/Demos/ADMonSetup/ADMonSetup.cpp new file mode 100644 index 00000000..f40dcf03 --- /dev/null +++ b/Demos/ADMonSetup/ADMonSetup.cpp @@ -0,0 +1,65 @@ +// ADMonSetup.cpp : Defines the entry point for the application. +// + +#include "stdafx.h" +#include "ADMonSetup.h" +#include "MainWnd.h" + +//#include +//#pragma comment( lib, "GdiPlus.lib" ) +//using namespace Gdiplus; + +//---------------------------------------------------------------------------------------------------------------------------------------- + +//ڴøúڴй¶ +//˳ǰ_CrtDumpMemoryLeaks();ɲ鿴ڴй¶IDţIDſΪBreakpointIJʱӦλԶϵ +inline void EnableMemLeakCheck(int Breakpoint = 0){ + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); + if(Breakpoint) + _CrtSetBreakAlloc ( 1912 ); +} + +#ifdef _DEBUG +#define new new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif +#define _CRT_SECURE_NO_DEPRECATE + +//---------------------------------------------------------------------------------------------------------------------------------------- + +int APIENTRY _tWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + EnableMemLeakCheck(); + CPaintManagerUI::SetInstance(hInstance); + CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin\\ADMonSetup")); + + //GdiplusStartupInput gdiplusStartupInput; + //ULONG_PTR gdiplusToken; + //GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + HRESULT Hr = ::CoInitialize(NULL); + if( FAILED(Hr) ) return 0; + + if( ::LoadLibrary(_T("d3d9.dll")) == NULL ) + ::MessageBox(NULL, _T(" d3d9.dll ʧܣһЩЧ޷ʾ"), _T("Ϣʾ"),MB_OK|MB_ICONWARNING); + + CMainWnd* pFrame = new CMainWnd(); + if(pFrame == NULL) + return 0; + + pFrame->Create(NULL,_T("Ƶ˴ʦװ"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 900, 600); + pFrame->CenterWindow(); + ::ShowWindow(*pFrame, SW_SHOW); + CPaintManagerUI::MessageLoop(); + + ::CoUninitialize(); + //GdiplusShutdown(gdiplusToken); + + _CrtDumpMemoryLeaks(); + return 0; +} diff --git a/Demos/ADMonSetup/ADMonSetup.h b/Demos/ADMonSetup/ADMonSetup.h new file mode 100644 index 00000000..d00d47e7 --- /dev/null +++ b/Demos/ADMonSetup/ADMonSetup.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/Demos/ADMonSetup/ADMonSetup.ico b/Demos/ADMonSetup/ADMonSetup.ico new file mode 100644 index 0000000000000000000000000000000000000000..d551aa3aaf80adf9b7760e2eb8de95a5c3e53df6 GIT binary patch literal 23558 zcmeI430zgx+QuJHKtxbe5gbu*030B5$VyGcDGSFOalkY&2LuvC5pp(7&2XNl96=@z zNXGH2`|DO#nx)3nwUq43A>_N=+wHsYe$U#6ePmShD&p^B>2uySylbs@uYIPy&-w#c zpc-6UYC)x+ErDgUwQ8BlZ7hIURRB*7exZ#T}AXG2* z=^weGT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-D!IW`F9}` zFJ#_@jJ%MQmz-@~sV+i3UdYL7B1xFE+kg*rC_sn}}eaYVo*?J*YFZ>$;!oOJ{ z{QCgB-)1FF4i?imzkPZz{4Rvr{h7I>sgUu{%LsSK%b0JUml0-1RnN;GSP!(-+jpO%JopO`B((dnpK-(&yRaUJ6F; zchnE_k$Wv1f4{oG;*T$8Vx5|ss!Wf01@yO_$nuNBLZ4Gvb)Vu6x9f7RD3t3{RPFna z@~=**zWfUs8kYPPZCSL4e)B1xT|TXnSM+U>y|{O?8%m4vtzIr_BVKg5vCP}`*3dR} z&a!{N#n>%>kU18z!$Q_q$meQ#RW3=oZ=knFmg=8&V&`qOUg~p1N&lWwnpHmPb9YW3 zw+z)kIP(xwOMAJX5{|A*v__uZdtvV;w2rOkgeCCc1i z#a5Q%Amc3IgIa3+fBIm(x&OWTs_~Un|HxNN{coH$#m{POUDev^Dy>e{FMhe1Y5iiu zZ + + + + Debug + Win32 + + + Release + Win32 + + + + {46E0954B-D9BE-48D6-8573-10B4F41E0171} + ADMonSetup + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)Bin\ + $(Configuration)\ + true + $(SolutionDir)Bin\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + EditAndContinue + + + true + Windows + MachineX86 + + + compatibility.manifest + + + + + MaxSpeed + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + + + true + Windows + true + true + MachineX86 + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demos/ADMonSetup/ADMonSetup.vcxproj.filters b/Demos/ADMonSetup/ADMonSetup.vcxproj.filters new file mode 100644 index 00000000..f26df7b2 --- /dev/null +++ b/Demos/ADMonSetup/ADMonSetup.vcxproj.filters @@ -0,0 +1,62 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {ea0e8b11-2213-437d-b626-eae832fbce7e} + + + + + Source Files + + + Source Files + + + Windows + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Windows + + + + + Resource Files + + + Resource Files + + + + + + Resource Files + + + \ No newline at end of file diff --git a/Demos/ADMonSetup/MainWnd.cpp b/Demos/ADMonSetup/MainWnd.cpp new file mode 100644 index 00000000..a2160323 --- /dev/null +++ b/Demos/ADMonSetup/MainWnd.cpp @@ -0,0 +1,145 @@ +// MainWnd.cpp + +#include "StdAfx.h" +#include "MainWnd.h" + +CMainWnd::CMainWnd() + : m_pStepTabLayout(NULL) + , m_pInstallText(NULL) + , m_pBtnOneClick(NULL) + , m_pBtnOverwrite(NULL) + , m_pProgressBar(NULL) +{ +} + +CDuiString CMainWnd::GetSkinFile() +{ + try + { + return CDuiString(_T("DlgMain.xml")); + } + catch (...) + { + throw "CMainWnd::GetSkinFile"; + } +} + +CDuiString CMainWnd::GetSkinFolder() +{ + return _T(""); +} + +LPCTSTR CMainWnd::GetWindowClassName() const +{ + try + { + return _T("Ƶ˴ʦװ"); + } + catch (...) + { + throw "CMainWnd::GetWindowClassName"; + } +} + +void CMainWnd::InitWindow() +{ + try + { + WindowImplBase::InitWindow(); + + Init(); + + } + catch (...) + { + throw "CMainWnd::Init"; + } +} + +void CMainWnd::Notify( TNotifyUI& msg ) +{ + if( msg.sType == _T("click") ) + { + if( msg.pSender == m_pBtnOneClick ) + { + InstallStart(); + return ; + } + } + + WindowImplBase::Notify(msg); +} + +void CMainWnd::OnFinalMessage( HWND hWnd ) +{ + try + { + WindowImplBase::OnFinalMessage(hWnd); + PostQuitMessage(0); + delete this; + } + catch (...) + { + throw "CMainWnd::OnFinalMessage"; + } +} + +LRESULT CMainWnd::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + LRESULT lRes = 0; + + switch (uMsg) + { + case WM_TIMER: lRes = OnTimer(uMsg, wParam, lParam, bHandled); break; + default: break; + } + + return lRes; +} + +LRESULT CMainWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + if (TIMER_ID_PROGRESS == wParam) + { + int nVal = m_pProgressBar->GetValue(); + CDuiString strPercent; + strPercent.Format(_T("ڰװ%d%%"), nVal); + m_pInstallText->SetText( strPercent ); + if (nVal > 95) + { + m_pProgressBar->SetValue(100); + InstallFinished(); + } + else + { + nVal += 5; + m_pProgressBar->SetValue(nVal); + } + } + return 0; +} + +void CMainWnd::Init() +{ + m_pStepTabLayout = static_cast(m_PaintManager.FindControl(_T("stepTabLayout"))); + m_pInstallText = static_cast(m_PaintManager.FindControl(_T("textProgress"))); + m_pBtnOneClick = static_cast(m_PaintManager.FindControl(_T("BtnOneClick"))); + m_pBtnOverwrite = static_cast(m_PaintManager.FindControl(_T("BtnOverwrite"))); + m_pProgressBar = static_cast(m_PaintManager.FindControl(_T("install"))); + + m_pProgressBar->SetValue(0); +} + +void CMainWnd::InstallStart() +{ + m_pStepTabLayout->SelectItem(1); + //m_pInstallText->SetText(_T("ڰװУԺ...")); + + SetTimer(GetHWND(), TIMER_ID_PROGRESS, 100, NULL); +} + +void CMainWnd::InstallFinished() +{ + m_pInstallText->SetText(_T("װɣ")); + KillTimer(GetHWND(), TIMER_ID_PROGRESS); +} \ No newline at end of file diff --git a/Demos/ADMonSetup/MainWnd.h b/Demos/ADMonSetup/MainWnd.h new file mode 100644 index 00000000..e0c504c7 --- /dev/null +++ b/Demos/ADMonSetup/MainWnd.h @@ -0,0 +1,33 @@ +// MainWnd.h + +#pragma once + +#define TIMER_ID_PROGRESS (1000) + +class CMainWnd : public WindowImplBase +{ +public: + CMainWnd(); + CDuiString GetSkinFolder(); + CDuiString GetSkinFile(); + LPCTSTR GetWindowClassName() const ; + + void InitWindow(); + void Notify(TNotifyUI& msg); + void OnFinalMessage(HWND hWnd); + + LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + +private: + void Init(); + void InstallStart(); + void InstallFinished(); + +private: + CAnimationTabLayoutUI *m_pStepTabLayout; + CLabelUI *m_pInstallText; + CButtonUI *m_pBtnOneClick; + CButtonUI *m_pBtnOverwrite; + CProgressUI *m_pProgressBar; +}; \ No newline at end of file diff --git a/Demos/ADMonSetup/ReadMe.txt b/Demos/ADMonSetup/ReadMe.txt new file mode 100644 index 00000000..4ad43c8e --- /dev/null +++ b/Demos/ADMonSetup/ReadMe.txt @@ -0,0 +1,55 @@ +======================================================================== + WIN32 APPLICATION : ADMonSetup Project Overview +======================================================================== + +AppWizard has created this ADMonSetup application for you. + +This file contains a summary of what you will find in each of the files that +make up your ADMonSetup application. + + +ADMonSetup.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +ADMonSetup.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +AppWizard has created the following resources: + +ADMonSetup.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +ADMonSetup.ico + This is an icon file, which is used as the application's icon (32x32). + This icon is included by the main resource file ADMonSetup.rc. + +small.ico + This is an icon file, which contains a smaller version (16x16) + of the application's icon. This icon is included by the main resource + file ADMonSetup.rc. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named ADMonSetup.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Demos/ADMonSetup/Resource.h b/Demos/ADMonSetup/Resource.h new file mode 100644 index 00000000..f1643e4d --- /dev/null +++ b/Demos/ADMonSetup/Resource.h @@ -0,0 +1,31 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ADMonSetup.rc +// + +#define IDS_APP_TITLE 103 + +#define IDR_MAINFRAME 128 +#define IDD_ADMONSETUP_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_ADMONSETUP 107 +#define IDI_SMALL 108 +#define IDC_ADMONSETUP 109 +#define IDC_MYICON 2 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/Demos/ADMonSetup/small.ico b/Demos/ADMonSetup/small.ico new file mode 100644 index 0000000000000000000000000000000000000000..d551aa3aaf80adf9b7760e2eb8de95a5c3e53df6 GIT binary patch literal 23558 zcmeI430zgx+QuJHKtxbe5gbu*030B5$VyGcDGSFOalkY&2LuvC5pp(7&2XNl96=@z zNXGH2`|DO#nx)3nwUq43A>_N=+wHsYe$U#6ePmShD&p^B>2uySylbs@uYIPy&-w#c zpc-6UYC)x+ErDgUwQ8BlZ7hIURRB*7exZ#T}AX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FAuBIr%G&-D!IW`F9}` zFJ#_@jJ%MQmz-@~sV+i3UdYL7B1xFE+kg*rC_sn}}eaYVo*?J*YFZ>$;!oOJ{ z{QCgB-)1FF4i?imzkPZz{4Rvr{h7I>sgUu{%LsSK%b0JUml0-1RnN;GSP!(-+jpO%JopO`B((dnpK-(&yRaUJ6F; zchnE_k$Wv1f4{oG;*T$8Vx5|ss!Wf01@yO_$nuNBLZ4Gvb)Vu6x9f7RD3t3{RPFna z@~=**zWfUs8kYPPZCSL4e)B1xT|TXnSM+U>y|{O?8%m4vtzIr_BVKg5vCP}`*3dR} z&a!{N#n>%>kU18z!$Q_q$meQ#RW3=oZ=knFmg=8&V&`qOUg~p1N&lWwnpHmPb9YW3 zw+z)kIP(xwOMAJX5{|A*v__uZdtvV;w2rOkgeCCc1i z#a5Q%Amc3IgIa3+fBIm(x&OWTs_~Un|HxNN{coH$#m{POUDev^Dy>e{FMhe1Y5iiu zZ + +// C RunTime Header Files +//#include +//#include +//#include +#include + +#include "..\..\DuiLib\UIlib.h" + +using namespace DuiLib; + +#ifdef _DEBUG +# pragma comment(lib, "..\\..\\Lib\\DuiLib_d.lib") +#else +# pragma comment(lib, "..\\..\\Lib\\DuiLib.lib") +#endif + + +// TODO: reference additional headers your program requires here diff --git a/Demos/ADMonSetup/targetver.h b/Demos/ADMonSetup/targetver.h new file mode 100644 index 00000000..203dfbcf --- /dev/null +++ b/Demos/ADMonSetup/targetver.h @@ -0,0 +1,24 @@ +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif diff --git a/DuiLib.sln b/DuiLib.sln index cd07d409..dc39d17c 100644 --- a/DuiLib.sln +++ b/DuiLib.sln @@ -15,6 +15,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transwnd", "Demos\transwnd\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XLGameBox", "Demos\xlgamebox\XLGameBox.vcxproj", "{0278E09B-92AA-4C18-ACB5-EEDF958395B1}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ADMonSetup", "Demos\ADMonSetup\ADMonSetup.vcxproj", "{46E0954B-D9BE-48D6-8573-10B4F41E0171}" + ProjectSection(ProjectDependencies) = postProject + {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -71,6 +76,14 @@ Global {0278E09B-92AA-4C18-ACB5-EEDF958395B1}.Release|Win32.Build.0 = Release|Win32 {0278E09B-92AA-4C18-ACB5-EEDF958395B1}.ReleaseA|Win32.ActiveCfg = Release|Win32 {0278E09B-92AA-4C18-ACB5-EEDF958395B1}.ReleaseA|Win32.Build.0 = Release|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.Debug|Win32.ActiveCfg = Debug|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.Debug|Win32.Build.0 = Debug|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.DebugA|Win32.ActiveCfg = Debug|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.DebugA|Win32.Build.0 = Debug|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.Release|Win32.ActiveCfg = Release|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.Release|Win32.Build.0 = Release|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.ReleaseA|Win32.ActiveCfg = Release|Win32 + {46E0954B-D9BE-48D6-8573-10B4F41E0171}.ReleaseA|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -81,5 +94,6 @@ Global {3EF9795D-3509-4664-8E73-8D315CC0B944} = {D01B5755-53F2-4929-B69C-75C99D151E6F} {2C0EADA2-111E-4D58-B171-B1C896D7A0DE} = {D01B5755-53F2-4929-B69C-75C99D151E6F} {0278E09B-92AA-4C18-ACB5-EEDF958395B1} = {D01B5755-53F2-4929-B69C-75C99D151E6F} + {46E0954B-D9BE-48D6-8573-10B4F41E0171} = {D01B5755-53F2-4929-B69C-75C99D151E6F} EndGlobalSection EndGlobal diff --git a/DuiLib/Control/UIAnimation.cpp b/DuiLib/Control/UIAnimation.cpp new file mode 100644 index 00000000..309467a0 --- /dev/null +++ b/DuiLib/Control/UIAnimation.cpp @@ -0,0 +1,164 @@ +#include "StdAfx.h" +#include "UIAnimation.h" +#include +#include + +namespace DuiLib { + struct CUIAnimation::Imp + { + std::vector m_arAnimations; + }; + + CUIAnimation::CUIAnimation(CControlUI* pOwner):m_pImp(new CUIAnimation::Imp()) + { + ASSERT(pOwner != NULL); + m_pControl = pOwner; + } + CUIAnimation:: ~CUIAnimation() + { + if(m_pImp) + { + delete m_pImp; + m_pImp = NULL; + } + } + BOOL CUIAnimation::StartAnimation(int nElapse, int nTotalFrame, int nAnimationID /*= 0*/, BOOL bLoop/* = FALSE*/) + { + CAnimationData* pData = GetAnimationDataByID(nAnimationID); + if( NULL != pData + || nElapse <= 0 + || nTotalFrame <= 0 + || NULL == m_pControl ) + { + ASSERT(FALSE); + return FALSE; + } + + CAnimationData* pAnimation = new CAnimationData(nElapse, nTotalFrame, nAnimationID, bLoop); + if( NULL == pAnimation ) return FALSE; + + if(m_pControl->GetManager()->SetTimer( m_pControl, nAnimationID, nElapse )) + { + m_pImp->m_arAnimations.push_back(pAnimation); + return TRUE; + } + return FALSE; + } + + void CUIAnimation::StopAnimation(int nAnimationID /*= 0*/) + { + if(m_pControl == NULL) return; + + if(nAnimationID != 0) + { + CAnimationData* pData = GetAnimationDataByID(nAnimationID); + if( NULL != pData ) + { + m_pControl->GetManager()->KillTimer( m_pControl, nAnimationID ); + m_pImp->m_arAnimations.erase(std::remove(m_pImp->m_arAnimations.begin(), m_pImp->m_arAnimations.end(), pData), m_pImp->m_arAnimations.end()); + return; + } + } + else + { + int nCount = m_pImp->m_arAnimations.size(); + for(int i=0; iGetManager()->KillTimer( m_pControl, m_pImp->m_arAnimations[i]->m_nAnimationID ); + } + m_pImp->m_arAnimations.clear(); + } + } + + BOOL CUIAnimation::IsAnimationRunning(int nAnimationID) + { + CAnimationData* pData = GetAnimationDataByID(nAnimationID); + return NULL != pData; + } + + int CUIAnimation::GetCurrentFrame(int nAnimationID/* = 0*/) + { + CAnimationData* pData = GetAnimationDataByID(nAnimationID); + if( NULL == pData ) + { + ASSERT(FALSE); + return -1; + } + return pData->m_nCurFrame; + } + + BOOL CUIAnimation::SetCurrentFrame(int nFrame, int nAnimationID/* = 0*/) + { + CAnimationData* pData = GetAnimationDataByID(nAnimationID); + if( NULL == pData) + { + ASSERT(FALSE); + return FALSE; + } + + if(nFrame >= 0 && nFrame <= pData->m_nTotalFrame) + { + pData->m_nCurFrame = nFrame; + return TRUE; + } + else + { + ASSERT(FALSE); + } + return FALSE; + } + + void CUIAnimation::OnAnimationElapse(int nAnimationID) + { + if(m_pControl == NULL) return; + + CAnimationData* pData = GetAnimationDataByID(nAnimationID); + if( NULL == pData ) return; + + int nCurFrame = pData->m_nCurFrame; + if(nCurFrame == 0) + { + OnAnimationStart(nAnimationID, pData->m_bFirstLoop); + pData->m_bFirstLoop = FALSE; + } + + OnAnimationStep(pData->m_nTotalFrame, nCurFrame, nAnimationID); + + if(nCurFrame >= pData->m_nTotalFrame) + { + OnAnimationStop(nAnimationID); + if(pData->m_bLoop) + { + pData->m_nCurFrame = 0; + } + else + { + m_pControl->GetManager()->KillTimer( m_pControl, nAnimationID ); + m_pImp->m_arAnimations.erase(std::remove(m_pImp->m_arAnimations.begin(), m_pImp->m_arAnimations.end(), pData), m_pImp->m_arAnimations.end()); + pData = NULL; + } + } + + if( NULL != pData ) + { + ++(pData->m_nCurFrame); + } + } + + CAnimationData* CUIAnimation::GetAnimationDataByID(int nAnimationID) + { + CAnimationData* pRet = NULL; + int nCount = m_pImp->m_arAnimations.size(); + for(int i=0; im_arAnimations[i]->m_nAnimationID == nAnimationID) + { + pRet = m_pImp->m_arAnimations[i]; + break; + } + } + + return pRet; + } + +} // namespace DuiLib \ No newline at end of file diff --git a/DuiLib/Control/UIAnimation.h b/DuiLib/Control/UIAnimation.h new file mode 100644 index 00000000..b735fc0a --- /dev/null +++ b/DuiLib/Control/UIAnimation.h @@ -0,0 +1,83 @@ +#ifndef __UIANIMATION_H__ +#define __UIANIMATION_H__ + +#include "UIButton.h" +#pragma once + +namespace DuiLib { + + class UILIB_API IUIAnimation + { + public: + virtual ~IUIAnimation() { NULL; } + + virtual BOOL StartAnimation(int nElapse, int nTotalFrame, int nAnimationID = 0, BOOL bLoop = FALSE) = 0; + virtual void StopAnimation(int nAnimationID = 0) = 0; + virtual BOOL IsAnimationRunning(int nAnimationID) = 0; + virtual int GetCurrentFrame(int nAnimationID = 0) = 0; + virtual BOOL SetCurrentFrame(int nFrame, int nAnimationID = 0) = 0; + + virtual void OnAnimationStep(int nTotalFrame, int nCurFrame, int nAnimationID) = 0; + virtual void OnAnimationStart(int nAnimationID, BOOL bFirstLoop) = 0; + virtual void OnAnimationStop(int nAnimationID) = 0; + + virtual void OnAnimationElapse(int nAnimationID) = 0; + }; + + class UILIB_API CAnimationData + { + public: + CAnimationData(int nElipse, int nFrame, int nID, BOOL bLoop) + { + m_bFirstLoop = TRUE; + m_nCurFrame = 0; + m_nElapse = nElipse; + m_nTotalFrame = nFrame; + m_bLoop = bLoop; + m_nAnimationID = nID; + } + + //protected: + public: + friend class CDUIAnimation; + + int m_nAnimationID; + int m_nElapse; + + int m_nTotalFrame; + int m_nCurFrame; + + BOOL m_bLoop; + BOOL m_bFirstLoop; + }; + + class UILIB_API CUIAnimation: public IUIAnimation + { + struct Imp; + public: + CUIAnimation(CControlUI* pOwner); + ~CUIAnimation(); + + virtual BOOL StartAnimation(int nElapse, int nTotalFrame, int nAnimationID = 0, BOOL bLoop = FALSE); + virtual void StopAnimation(int nAnimationID = 0); + virtual BOOL IsAnimationRunning(int nAnimationID); + virtual int GetCurrentFrame(int nAnimationID = 0); + virtual BOOL SetCurrentFrame(int nFrame, int nAnimationID = 0); + + virtual void OnAnimationStart(int nAnimationID, BOOL bFirstLoop) {}; + virtual void OnAnimationStep(int nTotalFrame, int nCurFrame, int nAnimationID) {}; + virtual void OnAnimationStop(int nAnimationID) {}; + + virtual void OnAnimationElapse(int nAnimationID); + + protected: + CAnimationData* GetAnimationDataByID(int nAnimationID); + + protected: + CControlUI* m_pControl; + Imp * m_pImp; + }; + +} // namespace DuiLib + +#endif // __UIANIMATION_H__ \ No newline at end of file diff --git a/DuiLib/Core/UIDefine.h b/DuiLib/Core/UIDefine.h index e4e7d18d..28d0f717 100644 --- a/DuiLib/Core/UIDefine.h +++ b/DuiLib/Core/UIDefine.h @@ -262,6 +262,8 @@ protected: \ #define DUI_CTR_HORIZONTALLAYOUT (_T("HorizontalLayout")) #define DUI_CTR_LISTLABELELEMENT (_T("ListLabelElement")) +#define DUI_CTR_ANIMATIONTABLAYOUT (_T("AnimationTabLayout")) + #define DUI_CTR_LISTCONTAINERELEMENT (_T("ListContainerElement")) /// diff --git a/DuiLib/Core/UIDlgBuilder.cpp b/DuiLib/Core/UIDlgBuilder.cpp index 2cdd3fdb..67eaba6f 100644 --- a/DuiLib/Core/UIDlgBuilder.cpp +++ b/DuiLib/Core/UIDlgBuilder.cpp @@ -416,6 +416,9 @@ CControlUI* CDialogBuilder::_Parse(CMarkupNode* pRoot, CControlUI* pParent, CPai if( _tcscmp(pstrClass, DUI_CTR_HORIZONTALLAYOUT) == 0 ) pControl = new CHorizontalLayoutUI; else if( _tcscmp(pstrClass, DUI_CTR_LISTLABELELEMENT) == 0 ) pControl = new CListLabelElementUI; break; + case 18: + if( _tcscmp(pstrClass, DUI_CTR_ANIMATIONTABLAYOUT) == 0 ) pControl = new CAnimationTabLayoutUI; + break; case 20: if( _tcscmp(pstrClass, DUI_CTR_LISTCONTAINERELEMENT) == 0 ) pControl = new CListContainerElementUI; break; diff --git a/DuiLib/DuiLib.vcxproj b/DuiLib/DuiLib.vcxproj index 8df8db8c..4c41fe26 100644 --- a/DuiLib/DuiLib.vcxproj +++ b/DuiLib/DuiLib.vcxproj @@ -244,8 +244,10 @@ + + Create Create @@ -308,8 +310,10 @@ + + diff --git a/DuiLib/DuiLib.vcxproj.filters b/DuiLib/DuiLib.vcxproj.filters index 26af114d..d19aa0b3 100644 --- a/DuiLib/DuiLib.vcxproj.filters +++ b/DuiLib/DuiLib.vcxproj.filters @@ -156,6 +156,12 @@ Source Files\Control + + Source Files\Control + + + Source Files\Layout + @@ -284,5 +290,11 @@ Header Files\Utils + + Header Files\Control + + + Header Files\Layout + \ No newline at end of file diff --git a/DuiLib/Layout/UIAnimationTabLayout.cpp b/DuiLib/Layout/UIAnimationTabLayout.cpp new file mode 100644 index 00000000..2a9425d3 --- /dev/null +++ b/DuiLib/Layout/UIAnimationTabLayout.cpp @@ -0,0 +1,142 @@ +#include "stdafx.h" +#include "UIAnimationTabLayout.h" + +namespace DuiLib { + CAnimationTabLayoutUI::CAnimationTabLayoutUI() : + CUIAnimation( this ), + m_bIsVerticalDirection( false ), + m_nPositiveDirection( 1 ), + m_pCurrentControl( NULL ), + m_bControlVisibleFlag( false ) + { + } + + LPCTSTR CAnimationTabLayoutUI::GetClass() const + { + return _T("AnimationTabLayoutUI"); + } + + LPVOID CAnimationTabLayoutUI::GetInterface(LPCTSTR pstrName) + { + if( _tcscmp(pstrName, _T("AnimationTabLayout")) == 0 ) + return static_cast(this); + return CTabLayoutUI::GetInterface(pstrName); + } + + bool CAnimationTabLayoutUI::SelectItem( int iIndex ) + { + if( iIndex < 0 || iIndex >= m_items.GetSize() ) return false; + if( iIndex == m_iCurSel ) return true; + if( iIndex > m_iCurSel ) m_nPositiveDirection = -1; + if( iIndex < m_iCurSel ) m_nPositiveDirection = 1; + + int iOldSel = m_iCurSel; + m_iCurSel = iIndex; + for( int it = 0; it < m_items.GetSize(); it++ ) + { + if( it == iIndex ) { + GetItemAt(it)->SetVisible(true); + GetItemAt(it)->SetFocus(); + + m_bControlVisibleFlag = false; + m_pCurrentControl = static_cast(m_items[it]); + if( NULL != m_pCurrentControl ) + m_pCurrentControl->SetVisible( false ); + AnimationSwitch(); + } + else GetItemAt(it)->SetVisible(false); + } + NeedParentUpdate(); + + if( m_pManager != NULL ) { + m_pManager->SetNextTabControl(); + m_pManager->SendNotify(this, _T("tabselect"), m_iCurSel, iOldSel); + } + return true; + } + + void CAnimationTabLayoutUI::AnimationSwitch() + { + m_rcItemOld = m_rcItem; + if( !m_bIsVerticalDirection ) + { + m_rcCurPos.top = m_rcItem.top; + m_rcCurPos.bottom = m_rcItem.bottom; + m_rcCurPos.left = m_rcItem.left - ( m_rcItem.right - m_rcItem.left ) * m_nPositiveDirection + 52 * m_nPositiveDirection; + m_rcCurPos.right = m_rcItem.right - ( m_rcItem.right - m_rcItem.left ) * m_nPositiveDirection+ 52 * m_nPositiveDirection; + } + else + { + m_rcCurPos.left = m_rcItem.left; + m_rcCurPos.right = m_rcItem.right; + m_rcCurPos.top = m_rcItem.top - ( m_rcItem.bottom - m_rcItem.top ) * m_nPositiveDirection; + m_rcCurPos.bottom = m_rcItem.bottom - ( m_rcItem.bottom - m_rcItem.top ) * m_nPositiveDirection; + } + + StopAnimation( TAB_ANIMATION_ID ); + StartAnimation( TAB_ANIMATION_ELLAPSE, TAB_ANIMATION_FRAME_COUNT, TAB_ANIMATION_ID ); + } + + void CAnimationTabLayoutUI::DoEvent(TEventUI& event) + { + if( event.Type == UIEVENT_TIMER ) + { + OnTimer( event.wParam ); + } + __super::DoEvent( event ); + } + + void CAnimationTabLayoutUI::OnTimer( int nTimerID ) + { + OnAnimationElapse( nTimerID ); + } + + void CAnimationTabLayoutUI::OnAnimationStep(INT nTotalFrame, INT nCurFrame, INT nAnimationID) + { + if( !m_bControlVisibleFlag ) + { + m_bControlVisibleFlag = true; + m_pCurrentControl->SetVisible( true ); + } + + int iStepLen = 0; + if( !m_bIsVerticalDirection ) + { + iStepLen = ( m_rcItemOld.right - m_rcItemOld.left ) * m_nPositiveDirection / nTotalFrame; + if( nCurFrame != nTotalFrame ) + { + m_rcCurPos.left = m_rcCurPos.left + iStepLen; + m_rcCurPos.right = m_rcCurPos.right +iStepLen; + } + else + { + m_rcItem = m_rcCurPos = m_rcItemOld; + } + } + else + { + iStepLen = ( m_rcItemOld.bottom - m_rcItemOld.top ) * m_nPositiveDirection / nTotalFrame; + if( nCurFrame != nTotalFrame ) + { + m_rcCurPos.top = m_rcCurPos.top + iStepLen; + m_rcCurPos.bottom = m_rcCurPos.bottom +iStepLen; + } + else + { + m_rcItem = m_rcCurPos = m_rcItemOld; + } + } + SetPos(m_rcCurPos); + } + + void CAnimationTabLayoutUI::OnAnimationStop(INT nAnimationID) + { + NeedParentUpdate(); + } + + void CAnimationTabLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) + { + if( _tcscmp(pstrName, _T("animation_direction")) == 0 && _tcscmp( pstrValue, _T("vertical")) == 0 ) m_bIsVerticalDirection = true; // pstrValue = "vertical" or "horizontal" + return CTabLayoutUI::SetAttribute(pstrName, pstrValue); + } +} // namespace DuiLib \ No newline at end of file diff --git a/DuiLib/Layout/UIAnimationTabLayout.h b/DuiLib/Layout/UIAnimationTabLayout.h new file mode 100644 index 00000000..3f7444fa --- /dev/null +++ b/DuiLib/Layout/UIAnimationTabLayout.h @@ -0,0 +1,44 @@ +#ifndef __UIANIMATIONTABLAYOUT_H__ +#define __UIANIMATIONTABLAYOUT_H__ + +#pragma once +using namespace std; +namespace DuiLib +{ + + class UILIB_API CAnimationTabLayoutUI : public CTabLayoutUI, public CUIAnimation + { + public: + CAnimationTabLayoutUI(); + + LPCTSTR GetClass() const; + LPVOID GetInterface(LPCTSTR pstrName); + + bool SelectItem( int iIndex ); + void AnimationSwitch(); + void DoEvent(TEventUI& event); + void OnTimer( int nTimerID ); + + virtual void OnAnimationStart(INT nAnimationID, BOOL bFirstLoop) {} + virtual void OnAnimationStep(INT nTotalFrame, INT nCurFrame, INT nAnimationID); + virtual void OnAnimationStop(INT nAnimationID); + + void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); + + protected: + bool m_bIsVerticalDirection; + int m_nPositiveDirection; + RECT m_rcCurPos; + RECT m_rcItemOld; + CControlUI* m_pCurrentControl; + bool m_bControlVisibleFlag; + enum + { + TAB_ANIMATION_ID = 1, + + TAB_ANIMATION_ELLAPSE = 10, + TAB_ANIMATION_FRAME_COUNT = 15, + }; + }; +} +#endif // __UIANIMATIONTABLAYOUT_H__ \ No newline at end of file diff --git a/DuiLib/UIlib.h b/DuiLib/UIlib.h index b395e6b8..b2b1dbb2 100644 --- a/DuiLib/UIlib.h +++ b/DuiLib/UIlib.h @@ -66,6 +66,8 @@ #include "Control/UIEdit.h" #include "Control/UIGifAnim.h" +#include "Control/UIAnimation.h" +#include "Layout/UIAnimationTabLayout.h" #include "Control/UIButton.h" #include "Control/UIOption.h" diff --git a/bin/skin/ADMonSetup/DlgMain.xml b/bin/skin/ADMonSetup/DlgMain.xml new file mode 100644 index 00000000..53d6feba --- /dev/null +++ b/bin/skin/ADMonSetup/DlgMain.xml @@ -0,0 +1,31 @@ + + + + + + + +