//选择内容 设置粗体 BOOL CALLBACK OnEventBtnClick_select_bold(HELE hEle,HELE hEventEle) { if(hEle != hEventEle) return FALSE; bBold2=~bBold2; if(bBold2) XBtn_SetText(hBold2,L"B√"); else XBtn_SetText(hBold2,L"B"); OnFontChangT2(); //字体改变 return TRUE; }
//默认设置 粗体 BOOL CALLBACK OnEventBtnClick_default_bold(HELE hEle,HELE hEventEle) { if(hEle != hEventEle) return FALSE; bBold=~bBold; if(bBold) XBtn_SetText(hBold,L"B√"); else XBtn_SetText(hBold,L"B"); OnFontChangT(); //字体改变 return TRUE; }
//选择内容 设置 下划线 BOOL CALLBACK OnEventBtnClick_select_underline(HELE hEle,HELE hEventEle) { if(hEle != hEventEle) return FALSE; bUnderline2=~bUnderline2; if(bUnderline2) XBtn_SetText(hUnderline2,L"&U√"); else XBtn_SetText(hUnderline2,L"&U"); OnFontChangT2(); //字体改变 return TRUE; }
//选择内容 设置 斜体 BOOL CALLBACK OnEventBtnClick_select_italic(HELE hEle,HELE hEventEle) { if(hEle != hEventEle) return FALSE; bItalic2=~bItalic2; if(bItalic2) XBtn_SetText(hItalic2,L"/√"); else XBtn_SetText(hItalic2,L"/"); OnFontChangT2(); //字体改变 return TRUE; }
//默认设置 下划线 BOOL CALLBACK OnEventBtnClick_default_underline(HELE hEle,HELE hEventEle) { if(hEle != hEventEle) return FALSE; bUnderline=~bUnderline; if(bUnderline) XBtn_SetText(hUnderline,L"&U√"); else XBtn_SetText(hUnderline,L"&U"); OnFontChangT(); //字体改变 return TRUE; }
//默认设置 斜体 BOOL CALLBACK OnEventBtnClick_default_italic(HELE hEle,HELE hEventEle) { if(hEle != hEventEle) return FALSE; bItalic=~bItalic; if(bItalic) XBtn_SetText(hItalic,L"/√"); else XBtn_SetText(hItalic,L"/"); OnFontChangT(); //字体改变 return TRUE; }
int OnListBoxSelect(int iItem,BOOL *pbHandled) { if(m_iIndex_prev>=0) { //获取模板中(itemID=1)按钮 HELE hButton=(HELE)XListBox_GetTemplateObject(m_hListBox,m_iIndex_prev,1); if(XC_IsHXCGUI(hButton,XC_BUTTON)) XBtn_SetText(hButton,L"-未选择-"); } m_iIndex_prev=iItem; if(iItem>=0) { //获取模板中(itemID=1)按钮 HELE hButton=(HELE)XListBox_GetTemplateObject(m_hListBox,iItem,1); if(XC_IsHXCGUI(hButton,XC_BUTTON)) XBtn_SetText(hButton,L"-被选择-"); } *pbHandled=TRUE; return 0; }
int OnListBoxTemplateCreateEnd(listBox_item_i* pItem,BOOL *pbHandled) { //获取模板中(itemID=1)按钮 HELE hButton=(HELE)XListBox_GetTemplateObject(m_hListBox,pItem->index,1); if(XC_IsHXCGUI(hButton,XC_BUTTON)) { XBtn_SetCheck(hButton,XListBox_GetItemData(m_hListBox,pItem->index)); XBtn_SetText(hButton,L"初始化"); //注册按钮点击事件 XEle_RegEventCPP1(hButton,XE_BUTTON_CHECK,&CMyWindowListBox::OnButtonCheck); } *pbHandled=TRUE; return 0; }
void Btn_Init(HELE hEle,int x,int y,int cx,int cy,int eleType,wchar_t *pTitle,HXCGUI hParent) { Ele_Init(hEle,x,y,cx,cy,eleType,hParent); AddTypeDebug(hEle,XC_BUTTON); BUTTON(hEle)->textFlag= DT_VCENTER | DT_SINGLELINE | DT_CENTER | DT_END_ELLIPSIS; XEle_EnableFocus(hEle,TRUE); XBtn_SetText(hEle,pTitle); XEle_RegisterMessage(hEle,XM_PAINT,Btn_OnDraw); XEle_RegisterMessage(hEle,XM_LBUTTONDOWN,Btn_OnLButtonDown); XEle_RegisterMessage(hEle,XM_LBUTTONUP,Btn_OnLButtonUp); XEle_RegisterEvent(hEle,XE_KEYDOWN,Btn_OnEventKeyDown); XEle_RegisterEvent(hEle,XE_MOUSESTAY,Btn_OnEventMouseStay); XEle_RegisterEvent(hEle,XE_MOUSELEAVE,Btn_OnEventMouseLeave); XEle_RegisterEvent(hEle,XE_SETFOCUS,Btn_OnEventSetFocus); XEle_RegisterEvent(hEle,XE_KILLFOCUS,Btn_OnEventKillFocus); XEle_RegisterEvent(hEle,XE_DESTROY,Btn_OnDestroy); XEle_RegisterMessage(hEle,XM_MOUSEMOVE,Btn_OnMouseMove); }