X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_gui.pas;h=04b8d76a1cc6b79e6c508c3236005e2d2e5a1758;hb=94a927ca673a2d8af4b8449d434f3c70f38b11c1;hp=2ead3bbbb06a9e0bf0bd7c8cbae0b5eb2d626919;hpb=d160acc56accd31347254c723f71a7413b6bdb30;p=d2df-sdl.git diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas index 2ead3bb..04b8d76 100644 --- a/src/game/g_gui.pas +++ b/src/game/g_gui.pas @@ -268,6 +268,7 @@ type FMiddleID: DWORD; FOnChangeEvent: TOnChangeEvent; FOnEnterEvent: TOnEnterEvent; + FInvalid: Boolean; procedure SetText(Text: string); public constructor Create(FontID: DWORD); @@ -283,6 +284,7 @@ type property Text: string read FText write SetText; property Color: TRGB read FColor write FColor; property Font: TFont read FFont write FFont; + property Invalid: Boolean read FInvalid write FInvalid; end; TGUIKeyRead = class(TGUIControl) @@ -2219,6 +2221,7 @@ begin FMaxLength := 0; FWidth := 0; + FInvalid := false; g_Texture_Get(EDIT_LEFT, FLeftID); g_Texture_Get(EDIT_RIGHT, FRightID); @@ -2228,6 +2231,7 @@ end; procedure TGUIEdit.Draw; var c, w, h: Word; + r, g, b: Byte; begin inherited; @@ -2237,9 +2241,13 @@ begin for c := 0 to FWidth-1 do e_Draw(FMiddleID, FX+8+c*16, FY, 0, True, False); - FFont.Draw(FX+8, FY, FText, FColor.R, FColor.G, FColor.B); + r := FColor.R; + g := FColor.G; + b := FColor.B; + if FInvalid then begin r := 128; g := 128; b := 128; end; + FFont.Draw(FX+8, FY, FText, r, g, b); - if FWindow.FActiveControl = Self then + if (FWindow.FActiveControl = self) then begin FFont.GetTextSize(Copy(FText, 1, FCaretPos), w, h); h := e_CharFont_GetMaxHeight(FFont.ID);