#include <windows.h>

#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"

#include "XCChart.h"

class CMyWindowDemo
{
public:
    HWINDOW m_hWindow;
	CChart m_Chart;

	XC_CChart_DecEleEventCPP(m_hWindow, m_Chart, L"ID_PICTURE_1");
	
    CMyWindowDemo()
    {
        Init();
    }
    void Init()
    {
        XC_LoadResource(L".\\Simple\\resource.res");  //加载资源文件
        HXCGUI hXCGUI=XC_LoadLayout(L".\\Simple\\main.xml"); //加载布局文件
        if(XC_IsHWINDOW(hXCGUI))
        {
            m_hWindow=(HWINDOW)hXCGUI;
            //XC_GetObjectByID(m_hWindow, 100); //获取指定ID对象
            //XC_GetObjectByName(L"name") //获取指定name对象
            //XC_ShowLayoutFrame(TRUE); //显示布局边界
			
			XWnd_AdjustLayout(m_hWindow);
            XWnd_ShowWindow(m_hWindow,SW_SHOW);

			XC_CChart_RegEleEventCPP(CMyWindowDemo, m_hWindow, L"ID_PICTURE_1");
			XC_CChart_EleMsgRepair(m_hWindow, m_Chart, L"ID_PICTURE_1");

        }else
        {
            //错误
        }

 		m_Chart.SetType(kTypePie);
		m_Chart.AddPie(3, _T("一饼"));
		m_Chart.AddPie(4, _T("二饼"));
		m_Chart.AddPie(5, _T("三饼"));
		m_Chart.SetTitle(_T("炫彩界面库画饼图"));
	};
};
	
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	XInitXCGUI(FALSE);
	CMyWindowDemo  MyWindow;
	XRunXCGUI();
	XExitXCGUI();
	return 0;
}