#pragma once

//演示QQ2009
#define WINDOW_WIDTH   250 //窗口宽度
#define WINDOW_HEIGHT  600 //窗口高度

struct xc_image_res  //图片资源
{
    HIMAGE image_bk;
    HIMAGE hImageLogo;

    HIMAGE close_leave;
    HIMAGE close_stay;
    HIMAGE close_down;

    HIMAGE max_leave;
    HIMAGE max_stay;
    HIMAGE max_down;

    HIMAGE min_leave;
    HIMAGE min_stay;
    HIMAGE min_down;

    HIMAGE weather;

    HIMAGE face_leave;
    HIMAGE face_stay;

    HIMAGE userstate_leave;
    HIMAGE userstate_stay;
    HIMAGE userstate_down;

    HIMAGE button_leave;
    HIMAGE button_stay;
    HIMAGE button_down;

    HIMAGE searchedit;

    HIMAGE search;
    HIMAGE icon1;
    HIMAGE icon2;
    HIMAGE icon3;
    HIMAGE icon7;
    HIMAGE icon8;
    HIMAGE icon9;
    HIMAGE icon10;
    HIMAGE icon11;
    HIMAGE icon15;
    HIMAGE icon16;

    HIMAGE mainMenu_leave;
    HIMAGE mainMenu_stay;

    HIMAGE hideleftpanel_leave;
    HIMAGE hideleftpanel_stay;

    HIMAGE tabLeft_leave;
    HIMAGE tabLeft_stay;
    HIMAGE tabLeft_down;

    HIMAGE leftpane;
    HIMAGE tab1;
    HIMAGE tab2;
    HIMAGE tab3;

    HIMAGE talkLabel_leave;
    HIMAGE talkLabel_stay;
    HIMAGE talkLabel_down;

    HIMAGE talktbico1;
    HIMAGE talktbico2;
    HIMAGE talktbico3;

    HIMAGE imp_shrink;
    HIMAGE imp_expand;
    HIMAGE imp_icon_1;
    HIMAGE imp_icon_2;
    HIMAGE imp_icon_3;
    HIMAGE imp_icon_4;
    HIMAGE imp_icon_5;
    HIMAGE imp_icon_6;

    HIMAGE scroll_thumb_leave;
    HIMAGE scroll_thumb_down;

    HIMAGE scroll_up_leave;
    HIMAGE scroll_up_down;

    HIMAGE scroll_down_leave;
    HIMAGE scroll_down_down;

};

class DemoCPlus : public CXEventMsg
{
public:
    DemoCPlus(void);
    ~DemoCPlus(void);
    void CreateWnd();

    void LoadImageRes();

    void HandleButton_Close(HELE hClose);
    void HandleButton_Max(HELE hMax);
    void HandleButton_Min(HELE hMin);
    void CreateWeatherButton(HWINDOW hWindow);
    void HandleButton_Face(HELE hFace);
    void HandleButton_UserState(HELE hUserState);
    void HandleButton_UserSign(HELE hUserSign);
    void HandleEdit_Search(HELE hSearch);
    HELE CreateToolButton(HWINDOW hWindow,int x,int y,int cx,int cy);
    HELE CreateToolSearchButton(HWINDOW hWindow);
    void HandleCreateToolButton(HWINDOW hWindow);
    void HandleCreateMainMenuButton(HWINDOW hWindow);
    HELE HandleCreateLeftPaneButton(HELE hPic,int x,int y,int cx,int cy);
    void HandleCreateLeftPane(HWINDOW hWindow);
    void HandleCreateMainTab(HWINDOW hWindow);

    HMENUX CreatePlayerCombox();

    bool OnWndNCEndDrawWindow(HWINDOW hWindow,HDC hdc);
    bool OnWndSize(HWINDOW hWindow,UINT flags,SIZE *pSize);
    bool OnWndDestroy(HWINDOW hWindow) ;
    bool OnFriendsLButtonUp(HELE hEle, POINT *pPt) ;
    bool OnFriendsRButtonUp(HELE hEle, POINT *pPt) ;

    bool EleRButtonDown(HELE hEle,UINT flags,POINT *pPt);

    BOOL My_MenuSelect(HWINDOW hWindow,int id);  //菜单选择

private:
    xc_image_res image_res;
    HWINDOW hWindow;
    HELE hWeather;
    HELE hUserSign;
    HELE hButtonSkin;
    HELE hButtonMsg;
    HELE hTree;
    HELE hTabBar;
    HELE hButtonHidePane;
    HELE hButtonMainMenu;
    HELE hButtonTool1;
    HELE hButtonTool2;
    HELE hButtonTool3;
    HELE hButtonTool4;
    HELE hButtonTool5;
    HELE hButtonTool6;
    HELE hLeftPane;
    HELE hSearchEdit;
    HELE hComboBox;
    HMENUX hMenu;
    int group1;
    int group2;
};
#include "stdafx.h"
#include "DemoCPlus.h"

DemoCPlus::DemoCPlus(void)
{
    hMenu = NULL;
}

DemoCPlus::~DemoCPlus(void)
{
}

void DemoCPlus::LoadImageRes()
{
    image_res.image_bk=XImage_LoadZipAdaptive(L,,,);
    image_res.hImageLogo=XImage_LoadZip(L"qqImage.zip",L"qqImage/logo2009.png");

    image_res.close_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/close_leave.png");
    image_res.close_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/close_stay.png");
    image_res.close_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/close_down.png");

    image_res.max_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/max_leave.png");
    image_res.max_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/max_stay.png");
    image_res.max_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/max_down.png");

    image_res.min_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/min_leave.png");
    image_res.min_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/min_stay.png");
    image_res.min_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/min_down.png");

    image_res.weather=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/weather.png");

    image_res.face_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/face_leave.png");
    image_res.face_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/face_stay.png");

    image_res.userstate_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/userstate_leave.png");
    image_res.userstate_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/userstate_stay.png");
    image_res.userstate_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/userstate_down.png");

    image_res.button_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button_leave.png");
    image_res.button_stay=XImage_LoadZipAdaptive(L,,,);
    image_res.button_down=XImage_LoadZipAdaptive(L,,,);

    image_res.searchedit=XImage_LoadZipAdaptive(L,,,);

    image_res.search=XImage_LoadZip(L"qqImage.zip",L"qqImage/17.png");

    image_res.icon1=XImage_LoadZip(L"qqImage.zip",L"qqImage/1.png");
    image_res.icon2=XImage_LoadZip(L"qqImage.zip",L"qqImage/2.png");
    image_res.icon3=XImage_LoadZip(L"qqImage.zip",L"qqImage/3.png");
    image_res.icon7=XImage_LoadZip(L"qqImage.zip",L"qqImage/7.png");
    image_res.icon8=XImage_LoadZip(L"qqImage.zip",L"qqImage/8.png");
    image_res.icon9=XImage_LoadZip(L"qqImage.zip",L"qqImage/9.png");
    image_res.icon10=XImage_LoadZip(L"qqImage.zip",L"qqImage/10.png");
    image_res.icon11=XImage_LoadZip(L"qqImage.zip",L"qqImage/11.png");
    image_res.icon15=XImage_LoadZip(L"qqImage.zip",L"qqImage/15.png");
    image_res.icon16=XImage_LoadZip(L"qqImage.zip",L"qqImage/16.png");

    image_res.mainMenu_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/mainMenu.png");
    image_res.mainMenu_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/mainMenu_stay.png");

    image_res.hideleftpanel_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/hideleftpanel_leave.png");
    image_res.hideleftpanel_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/hideleftpanel_stay.png");

    image_res.tabLeft_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/tabLeft_leave.png");
    image_res.tabLeft_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/tabLeft_stay.png");
    image_res.tabLeft_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/tabLeft_down.png");

    image_res.leftpane=XImage_LoadZip(L,true);
    image_res.tab1=XImage_LoadZip(L"qqImage.zip",L"qqImage/tab1.png");
    image_res.tab2=XImage_LoadZip(L"qqImage.zip",L"qqImage/tab2.png");
    image_res.tab3=XImage_LoadZip(L"qqImage.zip",L"qqImage/tab3.png");

    image_res.talkLabel_leave=XImage_LoadZip(L,true);
    image_res.talkLabel_stay=XImage_LoadZip(L,true);
    image_res.talkLabel_down=XImage_LoadZip(L,true);

    image_res.talktbico1=XImage_LoadZip(L"qqImage.zip",L"qqImage/talktbico1.png");
    image_res.talktbico2=XImage_LoadZip(L"qqImage.zip",L"qqImage/talktbico2.png");
    image_res.talktbico3=XImage_LoadZip(L"qqImage.zip",L"qqImage/talktbico3.png");

    image_res.imp_shrink=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_shrink.png");
    image_res.imp_expand=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_expand.png");
    image_res.imp_icon_1=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_1.png");
    image_res.imp_icon_2=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_2.png");
    image_res.imp_icon_3=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_3.png");
    image_res.imp_icon_4=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_4.png");
    image_res.imp_icon_5=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_5.png");
    image_res.imp_icon_6=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_6.png");

    image_res.scroll_thumb_leave=XImage_LoadZipAdaptive(L,,,);
    image_res.scroll_thumb_down=XImage_LoadZipAdaptive(L,,,);

    image_res.scroll_up_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_up_leave.png");
    image_res.scroll_up_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_up_Down.png");

    image_res.scroll_down_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_down_leave.png");
    image_res.scroll_down_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_down_down.png");
}

void DemoCPlus::HandleButton_Close( HELE hClose )
{
    XEle_SetBkTransparent(hClose,true);
    XEle_EnableFocus(hClose,false);
    RECT rc={,,,};
    XEle_SetRect(hClose,&rc);
    XBtn_SetImageLeave(hClose,image_res.close_leave);
    XBtn_SetImageStay(hClose,image_res.close_stay);
    XBtn_SetImageDown(hClose,image_res.close_down);
}

void DemoCPlus::HandleButton_Max( HELE hMax )
{
    XEle_EnableFocus(hMax,false);
    RECT rc={,,,};
    XEle_SetRect(hMax,&rc);
    XBtn_SetImageLeave(hMax,image_res.max_leave);
    XBtn_SetImageStay(hMax,image_res.max_stay);
    XBtn_SetImageDown(hMax,image_res.max_down);
}

void DemoCPlus::HandleButton_Min( HELE hMin )
{
    XEle_SetBkTransparent(hMin,true);
    XEle_EnableFocus(hMin,false);
    RECT rc={,,,};
    XEle_SetRect(hMin,&rc);
    XBtn_SetImageLeave(hMin,image_res.min_leave);
    XBtn_SetImageStay(hMin,image_res.min_stay);
    XBtn_SetImageDown(hMin,image_res.min_down);
}

void DemoCPlus::CreateWeatherButton( HWINDOW hWindow )
{
    hWeather=XBtn_Create(WINDOW_WIDTH--,,,,NULL,hWindow);
    XBtn_EnableCursorHand(hWeather,true);
    XEle_SetBkTransparent(hWeather,true);
    XBtn_SetImageLeave(hWeather,image_res.weather);
    XBtn_SetImageStay(hWeather,image_res.weather);
    XBtn_SetImageDown(hWeather,image_res.weather);
}

void DemoCPlus::HandleButton_Face( HELE hFace )
{
    XEle_SetBkTransparent(hFace,true);
    XEle_EnableFocus(hFace,false);
    XBtn_SetImageLeave(hFace,image_res.face_leave);
    XBtn_SetImageStay(hFace,image_res.face_stay);
    XBtn_SetImageDown(hFace,image_res.face_stay);
}

void DemoCPlus::HandleButton_UserState( HELE hUserState )
{
    XEle_SetBkTransparent(hUserState,true);
    XEle_EnableFocus(hUserState,false);
    XBtn_SetImageLeave(hUserState,image_res.userstate_leave);
    XBtn_SetImageStay(hUserState,image_res.userstate_stay);
    XBtn_SetImageDown(hUserState,image_res.userstate_down);
}

void DemoCPlus::HandleButton_UserSign( HELE hUserSign )
{
    XEle_SetBkTransparent(hUserSign,true);
    XEle_EnableFocus(hUserSign,false);
    XBtn_SetTextAlign(hUserSign,DT_SINGLELINE | DT_VCENTER);

    XBtn_SetImageLeave(hUserSign,image_res.button_leave);
    XBtn_SetImageStay(hUserSign,image_res.button_stay);
    XBtn_SetImageDown(hUserSign,image_res.button_down);
}

void DemoCPlus::HandleEdit_Search( HELE hSearch )
{
    XSView_SetSpacing(hSearch,,,,);
    XEle_EnableBorder(hSearch,false);
    //    XSView_SetImage(hSearch,image_res.searchedit);
    XEdit_SetImageLeave(hSearch,image_res.searchedit);
    XEdit_SetImageStay(hSearch,image_res.searchedit);
}

HELE DemoCPlus::CreateToolButton( HWINDOW hWindow,int x,int y,int cx,int cy )
{
    HELE hButton=XBtn_Create(x,y,cx,cy,NULL,hWindow);
    XEle_SetBkTransparent(hButton,true);
    XEle_EnableFocus(hButton,false);

    XBtn_SetImageLeave(hButton,image_res.button_leave);
    XBtn_SetImageStay(hButton,image_res.button_stay);
    XBtn_SetImageDown(hButton,image_res.button_down);

    return hButton;
}

HELE DemoCPlus::CreateToolSearchButton( HWINDOW hWindow )
{
    hButtonTool6=XBtn_Create(,WINDOW_HEIGHT-,,,NULL,hWindow);
    XEle_SetBkTransparent(hButtonTool6,true);
    XEle_EnableFocus(hButtonTool6,false);

    XBtn_SetImageLeave(hButtonTool6,image_res.button_leave);
    XBtn_SetImageStay(hButtonTool6,image_res.button_stay);
    XBtn_SetImageDown(hButtonTool6,image_res.button_down);

    XBtn_SetText(hButtonTool6,L"Search");
    XBtn_SetIcon(hButtonTool6,image_res.search);
    return hButtonTool6;
}

void DemoCPlus::HandleCreateToolButton( HWINDOW hWindow )
{
    HELE hButton=CreateToolButton(hWindow,,,,);
    XBtn_SetIcon(hButton,image_res.icon1);

    hButton=CreateToolButton(hWindow,,,,);
    XBtn_SetIcon(hButton,image_res.icon2);

    hButton=CreateToolButton(hWindow,,,,);
    XBtn_SetIcon(hButton,image_res.icon3);
    ////////////////////
    hButtonSkin=CreateToolButton(hWindow,WINDOW_WIDTH--,,,);
    XBtn_SetIcon(hButtonSkin,image_res.icon8);

    hButtonMsg=CreateToolButton(hWindow,WINDOW_WIDTH---,,,);
    XBtn_SetIcon(hButtonMsg,image_res.icon7);

    //////////////////////
    hButtonTool1=CreateToolButton(hWindow,,WINDOW_HEIGHT-,,);
    XBtn_SetIcon(hButtonTool1,image_res.icon9);

    hButtonTool2=CreateToolButton(hWindow,,WINDOW_HEIGHT-,,);
    XBtn_SetIcon(hButtonTool2,image_res.icon10);

    hButtonTool3=CreateToolButton(hWindow,,WINDOW_HEIGHT-,,);
    XBtn_SetIcon(hButtonTool3,image_res.icon11);
    /////////////////////////
    hButtonTool4=CreateToolButton(hWindow,,WINDOW_HEIGHT-,,);
    XBtn_SetIcon(hButtonTool4,image_res.icon15);

    hButtonTool5=CreateToolButton(hWindow,,WINDOW_HEIGHT-,,);
    XBtn_SetIcon(hButtonTool5,image_res.icon16);

    CreateToolSearchButton(hWindow);
}

void DemoCPlus::HandleCreateMainMenuButton( HWINDOW hWindow )
{
    hButtonMainMenu=XBtn_Create(,WINDOW_HEIGHT-,,,NULL,hWindow);
    XEle_SetBkTransparent(hButtonMainMenu,true);
    XEle_EnableFocus(hButtonMainMenu,false);
    XBtn_SetImageLeave(hButtonMainMenu,image_res.mainMenu_leave);
    XBtn_SetImageStay(hButtonMainMenu,image_res.mainMenu_stay);
    XBtn_SetImageDown(hButtonMainMenu,image_res.mainMenu_stay);

    //隐藏左侧工具条面板按钮
    hButtonHidePane=XBtn_Create(,WINDOW_HEIGHT-,,,NULL,hWindow);
    XEle_SetBkTransparent(hButtonHidePane,true);
    XEle_EnableFocus(hButtonHidePane,false);
    XBtn_SetImageLeave(hButtonHidePane,image_res.hideleftpanel_leave);
    XBtn_SetImageStay(hButtonHidePane,image_res.hideleftpanel_stay);
    XBtn_SetImageDown(hButtonHidePane,image_res.hideleftpanel_stay);
}

HELE DemoCPlus::HandleCreateLeftPaneButton( HELE hPic,int x,int y,int cx,int cy )
{
    HELE hButton=XBtn_Create(x,y,cx,cy,NULL,hPic);
    XEle_SetBkTransparent(hButton,true);
    XEle_EnableFocus(hButton,false);

    XBtn_SetImageLeave(hButton,image_res.tabLeft_leave);
    XBtn_SetImageStay(hButton,image_res.tabLeft_stay);
    XBtn_SetImageDown(hButton,image_res.tabLeft_down);
    XBtn_SetImageCheck(hButton,image_res.tabLeft_stay);

    return hButton;
}

void DemoCPlus::HandleCreateLeftPane( HWINDOW hWindow )
{
    hLeftPane=XPic_Create(,,,WINDOW_HEIGHT---,hWindow);
    XPic_SetImage(hLeftPane,image_res.leftpane);

    HELE hButton=HandleCreateLeftPaneButton(hLeftPane,,,,);
    XBtn_SetIcon(hButton,image_res.tab1);
    hButton=HandleCreateLeftPaneButton(hLeftPane,,,,);
    XBtn_SetIcon(hButton,image_res.tab2);
    hButton=HandleCreateLeftPaneButton(hLeftPane,,,,);
    XBtn_SetIcon(hButton,image_res.tab3);
}

void DemoCPlus::HandleCreateMainTab( HWINDOW hWindow )
{
    hTabBar=XTabBar_Create(,,WINDOW_WIDTH--,,hWindow);
    XEle_SetBkColor(hTabBar,RGB(,,));
    XTabBar_AddLabel(hTabBar,L"");
    XTabBar_AddLabel(hTabBar,L"");
    XTabBar_AddLabel(hTabBar,L"");
    XTabBar_EnableTile(hTabBar,true);
    /////////////////////////////////////
    HELE hButton=XTabBar_GetLabel(hTabBar,);
    XEle_EnableFocus(hButton,false);
    XBtn_SetIcon(hButton,image_res.talktbico1);

    XBtn_SetImageLeave(hButton,image_res.talkLabel_leave);
    XBtn_SetImageStay(hButton,image_res.talkLabel_stay);
    XBtn_SetImageDown(hButton,image_res.talkLabel_down);
    XBtn_SetImageCheck(hButton,image_res.talkLabel_down);

    ///////////////////////////////
    hButton=XTabBar_GetLabel(hTabBar,);
    XEle_EnableFocus(hButton,false);
    XBtn_SetIcon(hButton,image_res.talktbico2);

    XBtn_SetImageLeave(hButton,image_res.talkLabel_leave);
    XBtn_SetImageStay(hButton,image_res.talkLabel_stay);
    XBtn_SetImageDown(hButton,image_res.talkLabel_down);
    XBtn_SetImageCheck(hButton,image_res.talkLabel_down);
    /////////////////////////////////
    hButton=XTabBar_GetLabel(hTabBar,);
    XEle_EnableFocus(hButton,false);
    XBtn_SetIcon(hButton,image_res.talktbico3);

    XBtn_SetImageLeave(hButton,image_res.talkLabel_leave);
    XBtn_SetImageStay(hButton,image_res.talkLabel_stay);
    XBtn_SetImageDown(hButton,image_res.talkLabel_down);
    XBtn_SetImageCheck(hButton,image_res.talkLabel_down);

    //好友列表
    hTree=XTree_Create(,,WINDOW_WIDTH--,WINDOW_HEIGHT---,hWindow);
    XTabBar_SetBindEle(hTabBar,,hTree);
    XSView_SetSpacing(hTree,,,,);
    XTree_EnableLine(hTree,false);
    XTree_EnableButton(hTree,false);
    XTree_SetIndentation(hTree,);
    XTree_SetItemHeight(hTree,);
    XTree_SetSpacingLeft(hTree,);

    HXCGUI hImageList1=XImageList_Create(,);
    XImageList_AddImage(hImageList1,image_res.imp_shrink);
    XImageList_AddImage(hImageList1,image_res.imp_expand);

    XImageList_AddImage(hImageList1,image_res.imp_icon_1);
    XImageList_AddImage(hImageList1,image_res.imp_icon_2);
    XImageList_AddImage(hImageList1,image_res.imp_icon_3);
    XImageList_AddImage(hImageList1,image_res.imp_icon_4);
    XImageList_AddImage(hImageList1,image_res.imp_icon_5);
    XImageList_AddImage(hImageList1,image_res.imp_icon_6);

    XTree_SetImageList(hTree,hImageList1);
    group1=XTree_InsertItem(hTree,L);
    group2=XTree_InsertItem(hTree,L);

    XTree_InsertItem(hTree,L);
    wchar_t name[]={};
    ;i<;i++)
    {
        swprintf(name,L"炫彩好友-%d",i);
        XTree_InsertItem(hTree,name,group1, i%+);
    }

    ;i<;i++)
    {
        swprintf(name,L"炫彩好友-%d",i);
        XTree_InsertItem(hTree,name,group2, i%+);
    }

    HELE hScrollBar=XSView_GetVScrollBar(hTree);
    XSBar_SetImageLeaveSlider(hScrollBar,image_res.scroll_thumb_leave);
    XSBar_SetImageStaySlider(hScrollBar,image_res.scroll_thumb_leave);
    XSBar_SetImageDownSlider(hScrollBar,image_res.scroll_thumb_down);

    XSBar_SetImageLeaveUp(hScrollBar,image_res.scroll_up_leave);
    XSBar_SetImageStayUp(hScrollBar,image_res.scroll_up_leave);
    XSBar_SetImageDownUp(hScrollBar,image_res.scroll_up_down);

    XSBar_SetImageLeaveDown(hScrollBar,image_res.scroll_down_leave);
    XSBar_SetImageStayDown(hScrollBar,image_res.scroll_down_leave);
    XSBar_SetImageDownDown(hScrollBar,image_res.scroll_down_down);

    XCGUI_RegEleMessage(hTree,XM_MOUSEDBCLICK,&DemoCPlus::OnFriendsLButtonUp);

    XCGUI_RegEleMessage(hTree,XM_RBUTTONDOWN,&DemoCPlus::EleRButtonDown);
}

bool DemoCPlus::OnWndNCEndDrawWindow( HWINDOW hWindow,HDC hdc )
{
    XDraw_HImage(hdc,image_res.hImageLogo,,);

    SetBkMode(hdc,TRANSPARENT);
    TextOut(hdc,,,L);

    return false;
}

bool DemoCPlus::OnWndSize( HWINDOW hWindow,UINT flags,SIZE *pSize )
{
    RECT rc={pSize->cx--,,pSize->cx-,};
    XEle_SetRect(hWeather,&rc);

    rc.left=;
    rc.top=;
    rc.right=pSize->cx-;
    rc.bottom=;
    XEle_SetRect(hUserSign,&rc);

    rc.left=pSize->cx--;
    rc.top=;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonSkin,&rc);

    rc.left=pSize->cx---;
    rc.top=;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonMsg,&rc);

    rc.left=;
    rc.top=;
    rc.right=pSize->cx-;
    rc.bottom=rc.top+;
    XEle_SetRect(hTabBar,&rc);

    rc.left=;
    rc.top=;
    rc.right=pSize->cx-;
    rc.bottom=pSize->cy--;
    XEle_SetRect(hTree,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonHidePane,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonMainMenu,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonTool1,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonTool2,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonTool3,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonTool4,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonTool5,&rc);

    rc.left=;
    rc.top=pSize->cy-;
    rc.right=rc.left+;
    rc.bottom=rc.top+;
    XEle_SetRect(hButtonTool6,&rc);

    rc.left=;
    rc.top=;
    rc.right=;
    rc.bottom=pSize->cy--;
    XEle_SetRect(hLeftPane,&rc);

    rc.left=;
    rc.top=;
    rc.right=pSize->cx-;
    rc.bottom=rc.top+;
    XEle_SetRect(hSearchEdit,&rc);
    return false;
}

bool DemoCPlus::OnWndDestroy( HWINDOW hWindow )
{
    if(image_res.hImageLogo)
        XImage_Destroy(image_res.hImageLogo);
    return false;
}

bool DemoCPlus::OnFriendsLButtonUp( HELE hEle, POINT *pPt )
{
    int id=XTree_HitTest(hEle,pPt);
    if(group1==id || group2==id)
    {
        if(XTree_IsExpand(hEle,id))
        {
            XTree_SetItemImage(hTree,id,);
            XTree_Expand(hEle,id,false);
        }
        else
        {
            XTree_SetItemImage(hTree,id,);
            XTree_Expand(hEle,id,true);
        }
    }
    else
    {
        wchar_t* lpText = XTree_GetItemText(hTree,id);
        MessageBox(,lpText,,);
    }
    return false;
}

void DemoCPlus::CreateWnd()
{
    int style=XC_SY_DEFAULT&~XC_SY_DRAW_CAPTION_ICON;
    style&=~XC_SY_DRAW_CAPTION_TITLE;
    //创建窗口
    hWindow = XWnd_CreateWindow(,,WINDOW_WIDTH,WINDOW_HEIGHT,L"炫彩界面库-窗口",NULL,style);
    XWnd_EnableDragWindow(hWindow,true);
    XWnd_SetBorderSize(hWindow,,,,);
    XWnd_SetRoundSize(hWindow,);
    XWnd_SetCaptionHeight(hWindow,);
    XWnd_SetMinWidth(hWindow,);
    XWnd_SetMinHeight(hWindow,);

    XWnd_EnableBorderStrokeInner(hWindow,false);
    XWnd_EnableBorderStrokeOuter(hWindow,false);

    LoadImageRes(); //加载图片资源

    //窗口背景图片
    XWnd_SetImageNC(hWindow,image_res.image_bk);

    //关闭按钮
    HELE hClose=XWnd_GetButtonClose(hWindow);
    HandleButton_Close(hClose);

    //最大化按钮
    HELE hMax=XWnd_GetButtonMax(hWindow);
    HandleButton_Max(hMax);

    //最小化按钮
    HELE hMin=XWnd_GetButtonMin(hWindow);
    HandleButton_Min(hMin);

    //天气
    CreateWeatherButton(hWindow);

    //头像
    HELE hFace=XBtn_Create(,,,,NULL,hWindow);
    XBtn_EnableCursorHand(hFace,true);
    HandleButton_Face(hFace);

    //状态
    HELE hUserState=XBtn_Create(,,,,NULL,hWindow);
    HandleButton_UserState(hUserState);

    //签名
    hUserSign=XBtn_Create(,,WINDOW_WIDTH--,,L"签名:www.xcgui.com",hWindow);
    HandleButton_UserSign(hUserSign);

    //搜索框
    hSearchEdit=XEdit_Create(,,WINDOW_WIDTH-,,hWindow);
    HandleEdit_Search(hSearchEdit);

    //创建工具按钮
    HandleCreateToolButton(hWindow);

    //主菜单按钮
    HandleCreateMainMenuButton(hWindow);

    //创建左边工具面板
    HandleCreateLeftPane(hWindow);

    //tab页
    HandleCreateMainTab(hWindow);

    hMenu = CreatePlayerCombox();

    XWnd_Adjust(hWindow);

    //XCGUI_RegWndNCMessage(hWindow,XWM_NCENDPAINT,&DemoCPlus::OnWndNCEndDrawWindow);
    //XCGUI_RegWndMessage(hWindow,WM_SIZE,&DemoCPlus::OnWndSize);
    //XCGUI_RegWndMessage(hWindow,WM_DESTROY,&DemoCPlus::OnWndDestroy);

    XCGUI_RegWndMessage(hWindow, XWM_MENUSELECT, &DemoCPlus::My_MenuSelect);

    XWnd_ShowWindow(hWindow,SW_SHOW);
}

bool DemoCPlus::EleRButtonDown( HELE hEle,UINT flags,POINT *pPt )
{
    int id = XTree_HitTest(hEle,pPt);

    if(group1!= id && group2 != id)
    {
         POINT pt=*pPt;
         RECT rc;
         XListBox_GetItemRect(hEle,,&rc);

        XEle_PointToNCWnd(hEle,&pt);

        HWINDOW hWindow = XEle_GetHWindow(hEle);
        ClientToScreen(XWnd_GetHWnd(hWindow),&pt);

        XMenu_Popup(hMenu,XWnd_GetHWnd(hWindow),pt.x,pt.y);
    }
    return false;
}

HMENUX DemoCPlus::CreatePlayerCombox()
{
    HMENUX hMenu = XMenu_Create();
    XMenu_AddItem(hMenu,,L"添加");
    XMenu_AddItem(hMenu,,L"重命名");
    XMenu_AddItem(hMenu,,L"删除");
    XMenu_SetAutoDestroy(hMenu, false);
    return hMenu;
}

BOOL DemoCPlus::My_MenuSelect( HWINDOW hWindow,int id )
{
    wchar_t lID[];
    wsprintf(lID, L"item%d",id);
    //XTRACE("菜单ID=%d\n",id);
    MessageBox(,lID,,);

    return false;
}

int APIENTRY _tWinMain(HINSTANCE hInstance,  HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    XInitXCGUI();

    DemoCPlus lDemo;
    lDemo.CreateWnd();

    XRunXCGUI();
    ;
}

ok 暂时先这样 但是这个select相应事件 居然是相对于wnd全局的,真尼玛不给力!

弹窗相应menu点击事件的更多相关文章

  1. Android ---------高德卫星地图绘制多个点和点的点击事件自定义弹窗

    最近开发中,遇到一个多个点绘制,并实现点击事件,出现自定义窗口显示相关信息等功能,所以写了这篇博客. 从后台请求数据,得到多个经纬度,然后绘制在地图上,并实现点击,出现相关信息(自定义弹框实现) 先来 ...

  2. Android笔记——Button点击事件几种写法

    Button点击事件:大概可以分为以下几种: 匿名内部类 定义内部类,实现OnClickListener接口 定义的构造方法 用Activity实现OnClickListener接口 指定Button ...

  3. iOS开发小技巧 - label中的文字添加点击事件

    Label中的文字添加点击事件 GitHub地址:https://github.com/lyb5834/YBAttributeTextTapAction 以前老师讲过类似的功能,自己懒得回头看了,找了 ...

  4. 解决label点击事件触发两次问题

    问题描述: 通常,为了用户体验,我们点击单选框或者复选框后面文字,即可选中当前项.代码如下: <label> <input type="radio" name=& ...

  5. 在Activity中响应ListView内部按钮的点击事件

    最近交流群里面有人问到一个问题:如何在Activity中响应ListView内部按钮的点击事件,不要在Adapter中响应? 对于这个问题,我最初给他的解答是,在Adapter中定义一个回调接口,在A ...

  6. Android菜鸟成长记4-button点击事件

    Button 1.button按钮的创建 一般来说,在我们新建一个Android项目的时候,会有会默认有一个activity_main.xml的文件 如果你在新建项目的时候,把Create Activ ...

  7. Android按钮的四种点击事件

    本文记录一下按钮的四种点击事件 第一种 public class MainActivity extends Activity { @Override protected void onCreate(B ...

  8. Android--按钮点击事件

    Android中Button的点击事件非常简单,主要是一个内部类的问题 在界面上存在两个按钮和一个文本框,点击不同按钮的时候文本框中显示不同按钮的文字信息 <?xml version=" ...

  9. Android监听Button和ImageButton控件的点击事件

    一.onClick事件 Button和ImageButton都有一个onClick事件,通过自身的.setOnClickListener(OnClickListener)方法添加点击事件 所有的控件都 ...

随机推荐

  1. ubuntu同步系统时间命令

      *设置时区的命令 sudo tzselect 然后一步步选择就行 *同步时间的命令 sudo ntpdate ntp.ubuntu.com

  2. #define的一些

    // 生成一个字符串 #define NSString(...) [NSString stringWithFormat:__VA_ARGS__]

  3. Linux添加软件连接方法

    这是linux中一个非常重要命令,请大家一定要熟悉.它的功能是为某一个文件或目录在另外一个位置建立一个同步的链接,类似Windows下的超级链接. 这个命令最常用的参数是-s,具体用法是:sudo l ...

  4. Viewpager实现网络图片的轮播

    //主意:里面用到了第三方的Xutils.jar包和Imageloader.jar包还用到了访问网络,所以要加网络权限 <uses-permission android:name="a ...

  5. idea 远程调试

    Idea 远程在线测试 描述:在window下开发,部署到Linux服务器上,往往会遇到在windows下正常运行,在Linux服务器下异常,这是需要本地调试远程代码: 操作步骤: 一.代码已知 保证 ...

  6. vue全局变量的使用

    新建一个VUE文件,声明一个变量,并且把它export. 在main.js中引入,并声明. 在其他地方使用,直接this就可以了.

  7. javascript 之 第七章第一节(递归)

    先举例: function factorial(num) { ) { return num; } else { ); } } //输出120 //进一步去思考有名字的函数,且名字不会有变化的情况下,这 ...

  8. js - 伪数组转化为数组的几种方法整理(更新中...)

    伪数组:无法调用数组的方法,但是有length属性,又可以索引获取内部项的数据结构. 比如:arguments.getElementsByTagName等一系列dom获取的NodeList对象,他们 ...

  9. Python dict get items pop update

    一.get方法 dict = {'k1':1,'k2':2} dict.get('k1') 1 dict.get('k2') 2 dict.get('k3') None dict.get('k3',' ...

  10. Python数据分析--Pandas知识点(二)

    本文主要是总结学习pandas过程中用到的函数和方法, 在此记录, 防止遗忘. Python数据分析--Pandas知识点(一) 下面将是在知识点一的基础上继续总结. 13. 简单计算 新建一个数据表 ...