#include "aBefore.h" void TaBefore::Init(int x1, int y1, int aW, int aH, int OwnerX, int OwnerY, u32 aColor) { #define CH 30 //Caption Height unsigned short Left,Right, Top, Bottom, Width, Height, i; Bound.SetBySize(OwnerX + x1, OwnerY + y1, aW, aH); Left = Bound.Left +3; Top = Bound.Top+3; Width = aW - 7; Height = aH - 7; Right = Bound.Right -4; Bottom = Bound.Bottom -4; Caption.Init(Left,Top,Width, CH, 0, 0, clWhite, clMaroon); Content.Set(Left, Top+CH, Right, Bottom); Color = aColor; #undef CH Caption.Border.Color = clGray; TMyString::sFromStr("设置试用期-本机", Caption.Text); Caption.Visible = 1; CtlIndex = 0; OnActive = 0; } void TaBefore::RenderBackGround(void) { RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color); } void TaBefore::RenderBackGround(unsigned int aClr) { RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, aClr); } void TaBefore::DrawSelf(void) { unsigned int x, y, x2, y2, w, h; VertLineRender(Bound.Left, Bound.Top, Bound.Height -1, 0xFFFFFFFF); VertLineRender(Bound.Right -1, Bound.Top +1, Bound.Height -2, 0xFF808080); VertLineRender(Bound.Right, Bound.Top, Bound.Height, 0xFF404040); HorizLineRender(Bound.Left, Bound.Top, Bound.Width - 1, 0xFFFFFFFF); HorizLineRender(Bound.Left +1, Bound.Bottom -1, Bound.Width - 2, 0xFF808080); HorizLineRender(Bound.Left, Bound.Bottom, Bound.Width, 0xFF404040); x = Bound.Left +2 ; x2 = Bound.Right -2; y = Bound.Top +2; y2 = Bound.Bottom - 2; w = Bound.Width -4; h = Bound.Height - 4; VertLineRender (x, y, h-1, 0xFF808080); HorizLineRender (x, y, w-1, 0xFF808080); VertLineRender (x+1, y+1, h-2, 0xFF404040); HorizLineRender (x+1, y+1, w-2, 0xFF404040); VertLineRender (x2-1, y+1, h-2, 0xFFD4D0C8); HorizLineRender (x+1, y2-1, w-2, 0xFFD4D0C8); VertLineRender (x2, y, h, 0xFFFFFFFF); HorizLineRender (x, y2, w, 0xFFFFFFFF); } void TaBefore::Show(void) { RenderBackGround(); DrawSelf(); Caption.Show(); } void TaBefore::FullRedraw(int Prm) { if(Prm == 0){ RenderBackGround(); DrawSelf(); Caption.Show(); aPanel->Show(); }else if(Prm == 1){ RectFillRender(GuiRedrawDataList[1][0], GuiRedrawDataList[1][1], GuiRedrawDataList[1][2], GuiRedrawDataList[1][3], Color); aPanel->Show(); //if(IsPermission)PmsIntervene4Gui.ReDraw4GuiRecall(); } } //______________________________________________________________________________________________________________________________ void TaBefore::Check4Selected(void) { unsigned int i; for(i=0; i<3;i++)aPanel->Edit[i].Selected = 0; for(i=0; i<1;i++)aPanel->Btn[i].Selected = 0; if(1){ switch(CtlIndex){ case 0: aPanel->Edit[0].Selected = 1; break; case 1: aPanel->Edit[1].Selected = 1; break; case 2: aPanel->Edit[2].Selected = 1; break; case 3: aPanel->Btn[0].Selected = 1; break; default: break; } } } //_____________________________________________________________________________________________________________________________ TGuiMsgReturn TaBefore::KeyIn(unsigned char aKey) { TGuiMsgReturn aMsg = guiMsgNone; TGuiMsgReturn MBoxMsg = guiMsgNone; int iVal; switch(aKey){ case VK_DELETE: case VK_0: case VK_1: case VK_2: case VK_3: case VK_4: case VK_5: case VK_6: case VK_7: case VK_8: case VK_9: case VK_LEFT: case VK_RIGHT: if(CtlIndex <3){ if(aPanel->Edit[CtlIndex].Enable){ aPanel->Edit[CtlIndex].KeyIn(aKey); aPanel->Edit[CtlIndex].ReDraw(); } } break; case VK_UP: if(CtlIndex >0){ CtlIndex--; Check4Selected(); aPanel->ReDrawItems(); } break; case VK_DOWN: if(CtlIndex <3){ CtlIndex++; Check4Selected(); aPanel->ReDrawItems(); } break; case VK_TAB: break; case VK_EXECUTE: //Save Data Here if(CtlIndex == 4){ } break; case VK_RETURN: aMsg = guiMsgReturn; break; } return aMsg; } void TaBefore::InitPanel(void) { int x,y,x2,y2,i; y = y+6; aPanel->Init(130,120,540,200,0,0,clFrmFace, bvRaised); aPanel->Caption.Init(131,121, 540-3 ,32,0,0,clFrmFace,clFrmFace); x = aPanel->Bound.Left; y = aPanel->Bound.Top; aPanel->SText[0].Init(6,7,102,30,x,y,clNearBlack,clFrmFace); aPanel->SText[1].Init(6,39,102,30,x,y,clNearBlack,clFrmFace); aPanel->SText[2].Init(6,71,102,30,x,y,clNearBlack,clFrmFace); TMyString::sFromStr("实施许可码1", aPanel->SText[0].Text); TMyString::sFromStr("实施许可码2", aPanel->SText[1].Text); TMyString::sFromStr("试用延长天数 1~60", aPanel->SText[2].Text); aPanel->Edit[0].Init(230,7,306,30,x,y,clNearBlack,clNearWhite); aPanel->Edit[1].Init(230,39,306,30,x,y,clNearBlack,clNearWhite); aPanel->Edit[2].Init(230,71,306,30,x,y,clNearBlack,clNearWhite); for(i=0; i<3;i++){ aPanel->Edit[i].Enable = 1; aPanel->Edit[i].Visible = 1; aPanel->Edit[i].SetInputMaskEn(); aPanel->Edit[i].Str.FromStr("20"); } aPanel->Edit[0].Str.FromStr("1"); aPanel->Edit[1].Str.FromStr("1"); aPanel->Edit[2].Str.FromStr("10"); aPanel->Edit[0].SetMaxLen(24); aPanel->Edit[1].SetMaxLen(24); aPanel->Edit[2].SetMaxLen(2); aPanel->Edit[0].SetPstTail(); aPanel->Edit[1].SetPstTail(); aPanel->Edit[2].SetPstTail(); aPanel->Btn[0].Init(146,150,200,36,x,y,clNearBlack,clFrmFace); aPanel->Btn[0].Caption.FromStr(" 执行设置 "); for(i=0; i<1;i++){ aPanel->Btn[i].Enable = 1; aPanel->Btn[i].Visible = 1; aPanel->Btn[i].SetCaptionLeftSpacing(2); aPanel->Btn[i].SelectedColor = clBlue; } aPanel->Caption.Visible = 1; aPanel->Show(); Check4Selected(); aPanel->ReDrawItems(); }