#include "CtlPanelLite.h" #include "Runtime.h" void TCtlPanelLite::Init(int aX, int aY, int aW, int aH, int OwnerX, int OwnerY, u32 aColor, TBvStyle aBevelOuter){ unsigned short Left,Right,Top,Bottom,i; Bound.SetBySize(aX+OwnerX, aY+OwnerY, aW, aH); Color = aColor; BevelOuter = aBevelOuter; if(BevelOuter == bvRaised){ Left = Bound.Left + 1; Right = Bound.Right - 2; Top = Bound.Top + 1; Bottom = Bound.Bottom - 2; }else{ Left = Bound.Left + 2; Right = Bound.Right - 2; Top = Bound.Top + 2; Bottom = Bound.Bottom - 2; } Caption.Init(Left, Top, Right-Left+1, 32, 0, 0, clNearWhite, clMedBlue); Content.Set(Left,Top+32,Right,Bottom); VScrollBarBox.Set(780,80,800,400); VScrollBar.Color = 0xFF007777; FixColColor = clMaroon; FixColTextColor = clNearWhite; TextColor = clNearBlack; SelectedColor = clBlue; SelectedTextColor = clNearWhite; Caption.Visible = 0; for(i=0;i<4;i++){ SText[i].Enable = 0; Edit[i].Enable = 0; Btn[i].Enable = 0; SText[i].Visible = 0; Edit[i].Visible = 0; Btn[i].Visible = 0; SText[i].Selected = 0; Edit[i].Selected = 0; Btn[i].Selected = 0; } } void TCtlPanelLite::DrawSelf(void) { unsigned int i; if (BevelOuter == bvLowered){ VertLineRender(Bound.Left, Bound.Top, Bound.Height-1, 0xFF808080); HorizLineRender(Bound.Left, Bound.Top, Bound.Width-1, 0xFF808080); VertLineRender(Bound.Left+1, Bound.Top+1, Bound.Height-2, 0xFF404040); HorizLineRender(Bound.Left+1, Bound.Top+1, Bound.Width-2, 0xFF404040); VertLineRender(Bound.Right-1, Bound.Top+1, Bound.Height-2, 0xFFD4D0C8); HorizLineRender(Bound.Left+1, Bound.Bottom-1, Bound.Width-2, 0xFFD4D0C8); VertLineRender(Bound.Right, Bound.Top, Bound.Height, 0xFFFFFFFF); HorizLineRender(Bound.Left, Bound.Bottom, Bound.Width, 0xFFFFFFFF); }else if(BevelOuter == bvRaised){ 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); } //Fill Rect Box RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color); if(Caption.Visible)Caption.Show(); for(i=0; i<4; i++)if(SText[i].Visible)SText[i].Show(); for(i=0; i<4; i++)if(Edit[i].Visible)Edit[i].Show(); for(i=0; i<4; i++)if(Btn[i].Visible)Btn[i].Show(); } void TCtlPanelLite::DrawVertScrollBar(void) { } void TCtlPanelLite::Show(void) { DrawSelf(); } void TCtlPanelLite::ReDrawItems(void) { unsigned int i; if(Caption.Visible)Caption.Show(); for(i=0; i<4; i++)if(SText[i].Visible)SText[i].Show(); for(i=0; i<4; i++)if(Edit[i].Visible)Edit[i].Show(); for(i=0; i<4; i++)if(Btn[i].Visible)Btn[i].Show(); } void TCtlPanelLite::ReDrawEdit(void) { unsigned int i; for(i=0; i<4; i++)if(Edit[i].Visible)Edit[i].Show(); } void TCtlPanelLite::SetEditMode(unsigned int aMode) { } void TCtlPanelLite::Clear(void) { } void TCtlPanelLite::GuiLoginIIShow() { Init(150, 120, 500, 150, 0, 0, clFrmFace, bvRaised); Caption.Visible = 1; if(LanguageEnCn==0)Caption.SetText("II¼¶µÇ¼,ÇëÊäÈëÃÜÂë", 24); else Caption.SetText("Level 2 Permission Password", 24); Caption.TextColor = clNearWhite; Edit[0].Init(30, 60, 446, 32, 150, 120, 2 , clFrmFace); DrawSelf(); ShowWhat = dGuiLoginII; Edit[0].TextClear(); Edit[0].Enable = 1; Edit[0].Selected = 1; Edit[0].SetMaxLen(16); Edit[0].SetTextShowMaskByAsterisk(); Edit[0].Show(); } void TCtlPanelLite::GuiLoginIIIShow() { Init(150, 120, 500, 150, 0, 0, clFrmFace, bvRaised); Caption.Visible = 1; if(LanguageEnCn==0)Caption.SetText("III¼¶µÇ¼,ÇëÊäÈëÃÜÂë", 24); else Caption.SetText("Level 3 Permission Password", 24); Caption.TextColor = clNearWhite; Edit[0].Init(30, 60, 446, 32, 150, 120, 2 , clFrmFace); DrawSelf(); ShowWhat = dGuiLoginIII; Edit[0].TextClear(); Edit[0].Enable = 1; Edit[0].Selected = 1; Edit[0].SetMaxLen(16); Edit[0].SetTextShowMaskByAsterisk(); Edit[0].Show(); } void TCtlPanelLite::GuiLoginPasswdErrShow() { if(LanguageEnCn==0)Caption.SetText("ÃÜÂë´íÎó !", 24); else Caption.SetText("Incorrect Password", 24); Caption.TextColor = clRed; Caption.Show(); } TGuiMsgReturn TCtlPanelLite::GuiLoginII_KeyIn(unsigned char aKey) { TGuiMsgReturn aGMR = guiMsgNone; Edit[0].KeyIn(aKey); if(aKey == VK_EXECUTE){ //go anyway if(1){ aGMR = guiMsgOkAndReturn; } } if(aKey == VK_RETURN)aGMR = guiMsgReturn; return aGMR; } TGuiMsgReturn TCtlPanelLite::GuiLoginIII_KeyIn(unsigned char aKey) { TGuiMsgReturn aGMR = guiMsgNone; Edit[0].KeyIn(aKey); if(aKey == VK_EXECUTE){ //go anyway if(1){ aGMR = guiMsgOkAndReturn; } } if(aKey == VK_RETURN)aGMR = guiMsgReturn; return aGMR; }