📄 button.c
字号:
}
else
{
if(button->m_iiInActiveImage.szImageName != NULL)
{
LoadBitmap (hdc, &bitmap, button->m_iiInActiveImage.szImageName);
FillBoxWithBitmap(hdc,x,y,w,h,&bitmap);
UnloadBitmap (&bitmap);
}
}
EndPaint(hWnd,hdc);
}
void ExposureButton(Button* button)
{
int rim = 0;
eFace_Style style;
int status = button->isdown;
if(status)
rim = button->m_riActiveRect .m_eFrameThick;
else
rim = button->m_riInActiveRect .m_eFrameThick;
if(status)
style = button->m_riActiveRect.m_eFaceStyle;
else
style = button->m_riInActiveRect.m_eFaceStyle;
ExposureButtonDrawFrame(button,rim);
if(!(button->m_riActiveRect.m_ulFaceColor & 0xff000000) && !(button->m_riInActiveRect.m_ulFaceColor & 0xff000000))
{
switch(style)
{
case S2D:
{
ExposureButtonDrawFace(button,rim);
}
break;
case S3D:
{
ExposureButtonDraw3D(button,rim);
ExposureButtonDrawFace(button,rim+2);
}
break;
case SHADED:
{
ExposureButtonDrawShade(button,rim);
}
break;
default:
break;
}
}
// bitmap. ExposureButtonBitmap(button);
ExposureButtonDrawLabel(button);
return ;
}
void ExecButtonDownButton(Button* button)
{
ButtonDownButton(button );
FlushWindows(button->m_grButtonID);
ButtonDownDisposal(button);
}
void ExecButtonUpButton(Button* button)
{
ButtonUpButton(button );
FlushWindows(button->m_grButtonID);
ButtonUpDisposal(button);
}
void ButtonDownButton(Button* button )
{
if(debug_flag) printf("ButtonDownButton WID : %d FEEDBACK TYPE : %d !\n",button->m_grButtonID,button->m_eFeedbackType); if(FEED_NONE == button-> m_eFeedbackType ||FEED_MOMENTARY == button-> m_eFeedbackType)
button->isdown = 1;
else if(FEED_TOGGLE == button-> m_eFeedbackType)
button ->isdown = !button ->isdown;
else if(FEED_INTERLOCK == button-> m_eFeedbackType)
button->isdown = 1;
else if(FEED_DURATION == button-> m_eFeedbackType)
button->isdown = 1;
}void ButtonDownButtonTools(Button* button ){ if(debug_flag) printf("ButtonDownButtonTools WID : %d !\n",button->m_grButtonID); if(button->isdown == 0) button->isdown = 1;
}void ButtonUpButtonTools(Button* button )
{
if(debug_flag) printf("ButtonUpButtonTools WID : %d !\n",button->m_grButtonID); if(button->isdown == 1) button->isdown = 0;
}
void ButtonUpButton(Button* button )
{
if(FEED_NONE == button-> m_eFeedbackType ||FEED_MOMENTARY == button-> m_eFeedbackType)
button->isdown = 0;
}
void ButtonDownDisposal (Button* button) // down disposal.
{
Page* target_page;
Page* page_p;
Page* OwnPage;
ButtonList buttonlist ;
PageList pagelist;
target_page = NULL; // target page.
OwnPage=NULL;
if(!button)
return ;
OwnPage=button->own_page; page_p = g_list; //
target_page = button->target_page;
// show & hide sub page.
if(button->m_nID == 0)
goto NEXT_POS;
if(button->m_szGroupID)
{
buttonlist = OwnPage->m_blButtonList;
while(buttonlist)
{
Button* button_trav;
button_trav = (Button*)buttonlist->button_p;
if(button_trav->m_szGroupID && !stricmp(button->m_szGroupID,button_trav->m_szGroupID))
{
Page* subpage;
printf("button_trav->m_nID : %d button->m_nID : %d !\n",button_trav->m_nID,button->m_nID); if(button_trav->m_nID !=button->m_nID)
{
ButtonUpButtonTools(button_trav);
FlushWindows(button_trav->m_grButtonID);
} else { ButtonDownButtonTools(button_trav); FlushWindows(button_trav->m_grButtonID); } subpage = button_trav->sub_page;
if(subpage && subpage->m_nID!=0 && subpage->m_szGroupID && !stricmp(subpage->m_szGroupID,button->m_szGroupID))
Show_page(subpage,subpage->m_nID == button->m_nID,TRUE,NULL);
}
buttonlist = buttonlist->next;
}
}
else
{
if(button->sub_page)
{
Page* subpage = (Page*)button->sub_page;
if(subpage && subpage->m_nID == button->m_nID)
{
if(!target_page)
Show_page(subpage,TRUE,TRUE,NULL);
else
{
if(subpage->m_eFeedbackType == FEED_DURATION)
Show_page(subpage,TRUE,FALSE,(void*)target_page);
else
Show_page(subpage,TRUE,FALSE,NULL);
} }
}
}
NEXT_POS:
pagelist = OwnPage->m_plPageList;
while(pagelist)
{
Page* subpage = (Page*)pagelist->page_p;
if(subpage->m_nID == 0 || subpage->m_szGroupID == 0)
{
if(subpage->m_bStatus & 0x10)
Show_page(subpage,1,0,0);
}
pagelist=pagelist->next ;
}
return ;
}
void ButtonUpDisposal (Button* button)
{
Page* target_page = 0;
Page* page_p;
Page* OwnPage;
ButtonList buttonlist;
if(!button )
return ;
OwnPage=button->own_page;
page_p = g_list;
target_page = button->target_page;
if(target_page != NULL)
{
if(button->m_eFeedbackType !=FEED_DURATION)
{
if(OwnPage) Show_page(OwnPage,FALSE,TRUE,NULL); Show_page(target_page,TRUE,TRUE,NULL);
}
buttonlist = target_page->m_blButtonList;
while(buttonlist)
{
Button* button_trav = (Button*)buttonlist->button_p;
if(button_trav && button_trav->m_nReturn )
button_trav->target_page = OwnPage;
if(button ->m_szGroupID && button_trav && button_trav->m_szGroupID && !stricmp(button->m_szGroupID,button_trav->m_szGroupID))
{
if(button->m_nID && button_trav->m_nID)
{
if(button->m_nID !=button_trav->m_nID)
{
ButtonUpButtonTools(button_trav);
FlushWindows(button_trav->m_grButtonID);
}
else
{
ButtonDownButtonTools(button_trav);
FlushWindows(button_trav->m_grButtonID);
}
}
}
buttonlist = buttonlist->next;
}
}
return ;
}
BOOL CreatePageButton2(const char* objstring,int type)
{
BOOL nReturn;
int Position_left,Position_top,Position_right,Position_bottom;
int eShape, eBackStyle;
char* AcText_szContent, *AcText_LOG_FONT;
int AcText_bFring,AcText_eLocation;
unsigned long AcText_dwTextColor;
char* InAcText_szContent, *InAcText_LOG_FONT;
int InAcText_bFring,InAcText_eLocation;
unsigned long InAcText_dwTextColor,AcRect_dwFaceColor,AcRect_dwFrameColor;
int AcRect_eFrameThick, AcRect_eFaceStyle;
int AcRect_TopLeft_x,AcRect_TopLeft_y,AcRect_BottomRight_x,AcRect_BottomRight_y;
unsigned long InAcRect_dwFaceColor,InAcRect_dwFrameColor;
int InAcRect_eFrameThick,InAcRect_eFaceStyle;
int InAcRect_TopLeft_x,InAcRect_TopLeft_y,InAcRect_BottomRight_x,InAcRect_BottomRight_y;
char* AcImage_ImageName;
unsigned long AcImage_dwForeColor,AcImage_dwBackColor;
unsigned char AcImage_bStatus;
unsigned long AcImage_dwTransparenceColor;
char* InAcImage_ImageName;
unsigned long InAcImage_dwForeColor,InAcImage_dwBackColor;
unsigned char InAcImage_bStatus;
unsigned long InAcImage_dwTransparenceColor;
long AcLockRect_left,AcLockRect_top,AcLockRect_right,AcLockRect_bottom,InAcLockRect_left,InAcLockRect_top,InAcLockRect_right,InAcLockRect_bottom;
int nID;
char* nFlipPageIndex ;
int xReturn;
char* groupid;
unsigned int Comm_Type;
int feedback_type,m_ndelay;
char* sys_cmd_string,*usr_cmd_string,*sys_rev_string,*usr_rev_string;
int sys_cmd_string_len,usr_cmd_string_len,sys_rev_string_len,usr_rev_string_len;
int page_no;
int len;
int nRisus,nActiveFrameSytle,nActiveFrameContrans,nInActiveFrameSytle,nInActiveFrameContrans;
int stylemore;
_INDEX index;
int pos =OBJECT_LEN;
nReturn = TRUE;
len = 0;
// init
AcText_szContent=0;
AcText_LOG_FONT=0;
InAcText_szContent=0;
InAcText_LOG_FONT=0;
AcImage_ImageName=0;
InAcImage_ImageName=0;
nFlipPageIndex=0;
groupid=0;
sys_cmd_string=0;
usr_cmd_string=0;
sys_rev_string=0;
usr_rev_string=0;
nRisus = 0;
nActiveFrameSytle = 0;
nActiveFrameContrans = 0;
nInActiveFrameSytle = 0;
nInActiveFrameContrans = 0;
// position left.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
Position_left = GetLongVal(objstring,&pos);
// Position top
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
Position_top = GetLongVal(objstring,&pos);
// Position right
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
Position_right = GetLongVal(objstring,&pos);
// Position bottom
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
Position_bottom = GetLongVal(objstring,&pos);
//eShape eShape
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
eShape = GetLongVal(objstring,&pos);
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
eBackStyle = GetLongVal(objstring,&pos);
index = GetIndexInformation(objstring,&pos);
if(index._Type!=1) {
nReturn = FALSE;
goto FAILED;
}
AcText_szContent = GetStringVal(objstring,index._Length,&pos,0);
// assert(AcText_szContent);
index = GetIndexInformation(objstring,&pos);
if(index._Type!=1) {
nReturn = FALSE;
goto FAILED;
}
AcText_LOG_FONT = GetStringVal(objstring,index._Length,&pos,0);
// assert(AcText_LOG_FONT);
// active text fring information.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcText_bFring = GetLongVal(objstring,&pos);
// active text location.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcText_eLocation = GetLongVal(objstring,&pos);
// active text color.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcText_dwTextColor = GetLongVal(objstring,&pos);
index = GetIndexInformation(objstring,&pos);
if(index._Type!=1) {
nReturn = FALSE;
goto FAILED;
}
InAcText_szContent = GetStringVal(objstring,index._Length,&pos,0);
// assert(InAcText_szContent);
// inactive text font.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=1) {
nReturn = FALSE;
goto FAILED;
}
InAcText_LOG_FONT = GetStringVal(objstring,index._Length,&pos,0);
// assert(InAcText_LOG_FONT);
// inactive text fring.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
InAcText_bFring = GetLongVal(objstring,&pos);
// inactive text location.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
InAcText_eLocation = GetLongVal(objstring,&pos);
// inactive text color.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
InAcText_dwTextColor = GetLongVal(objstring,&pos);
// active frame face color.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcRect_dwFaceColor = GetLongVal(objstring,&pos);
// active frame frame color.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcRect_dwFrameColor = GetLongVal(objstring,&pos);
// active frame frame thick.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcRect_eFrameThick = GetLongVal(objstring,&pos);
// active frame face style.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0) {
nReturn = FALSE;
goto FAILED;
}
AcRect_eFaceStyle = GetLongVal(objstring,&pos);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -