class GUIQuestionPage extends GUIPage; var GUILabel lMessage; var Material MessageIcon; // Like Warning/Question/Exclamation var localized array ButtonNames; // Buttons Names: Ok, Cancel, Retry, Continue, Yes, No, Abort, Ignore. Clamped [0,7]. var array Buttons; var GUIButton DefaultButton, CancelButton; delegate OnButtonClick(byte bButton); delegate bool NewOnButtonClick(byte bButton) { return true; } function InitComponent(GUIController pMyController, GUIComponent MyOwner) { Super.Initcomponent(pMyController, MyOwner); lMessage=GUILabel(Controls[1]); ParentPage.InactiveFadeColor=class'Canvas'.static.MakeColor(128,128,128,255); } function bool InternalOnPreDraw(Canvas C) { local float XL, YL; local int i; local array MsgArray; // Organize the layout for the Label and the Buttons Top if (lMessage.TextFont != "") C.Font = Controller.GetMenuFont(lMessage.TextFont).GetFont(C.SizeX); C.TextSize("W", XL, YL); C.WrapStringToArray(lMessage.Caption, MsgArray, lMessage.ActualWidth(), "|"); YL *= MsgArray.Length; if (lMessage.Style != None) YL += lMessage.Style.BorderOffsets[1] + lMessage.Style.BorderOffsets[3]; // transform YL to a % lMessage.WinHeight = (YL +1 )/ C.SizeY; WinHeight = (YL + Buttons[0].ActualHeight() + 60) / C.SizeY ; WinTop = (C.SizeY - ActualHeight())/2; lMessage.WinTop = WinTop + 20; for (i = 0; i= ButtonNames.Length ) { log("GUIQuestionPage.AddButton() button mask was larger than button name array!"); return None; } btn = GUIButton(AddComponent("XInterface.GUIButton")); if ( btn == None ) return None; btn.Tag = idesc; btn.TabOrder = Components.Length; btn.Caption = ButtonNames[cnt]; btn.OnClick = ButtonClick; Buttons[Buttons.Length] = btn; return btn; } function LayoutButtons(byte ActiveButton) { local int i; local float left, colw, btnw; // Simply center the button(s) colw = 1/(Buttons.Length + 1); btnw = colw * 0.66; left = colw - btnw/2; for (i = 0; i 0 ) Buttons.Remove(0,Buttons.Length); RemapComponents(); } defaultproperties { OnPreDraw=InternalOnPreDraw Begin Object Class=GUIImage Name=imgBack Image=Texture'InterfaceArt_tex.Menu.changeme_texture' //Material'InterfaceContent.Menu.SquareBoxA' ImageStyle=ISTY_Stretched WinTop=0.0 WinLeft=0.0 WinHeight=1.0 WinWidth=1.0 bScaleToParent=true bBoundToParent=true End Object Begin Object Class=GUILabel Name=lblQuestion WinTop=0.2 WinLeft=0.1 WinHeight=0.4 WinWidth=0.8 bMultiLine=true End Object Controls(0)=imgBack Controls(1)=lblQuestion bCaptureInput=True bRequire640x480=False bRenderWorld=True WinTop=0.25 WinHeight=0.5 BackgroundColor=(R=64,G=64,B=64,A=255) BackgroundRStyle=MSTY_Alpha ButtonNames(0)="Ok" ButtonNames(1)="Cancel" ButtonNames(2)="Retry" ButtonNames(3)="Continue" ButtonNames(4)="Yes" ButtonNames(5)="No" ButtonNames(6)="Abort" ButtonNames(7)="Ignore" // if add more buttonnames, make sure to expand size of array declaration }