Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

XInterface.GUIPage


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
// ====================================================================
//  Class:  UT2K4UI.GUIPage
//
//  GUIPages are the base for a full page menu.  They contain the
//  Control stack for the page.
//
//  Written by Joe Wilcox
//  (c) 2002, Epic Games, Inc.  All Rights Reserved
// ====================================================================

class GUIPage extends GUIMultiComponent
    Native  Abstract;

// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)


var()                           bool                    bRenderWorld;       // False - don't render anything behind this menu / True - render normally (everything)
var()                           bool                    bPauseIfPossible;   // Should this menu pause the game if possible
var()                           bool                    bCheckResolution;   // obsolete
var()                           bool                    bCaptureInput;      // Whether to allow input to be passed to pages lower on the menu stack.

var()                           bool                    bRequire640x480;    // Does this menu require at least 640x480
var()                           bool                    bPersistent;        // If set, page is saved across open/close/reopen.
var()                           bool                    bDisconnectOnOpen;  // Should this menu for a disconnect when opened.
var()                           bool                    bAllowedAsLast;     // If this is true, closing this page will not bring up the main menu
var()                           bool                    bRestorable;        // When the GUIController receives a call to CloseAll(), should it reopen this page the next time main is opened?

var() noexport editconst       GUIPage                  ParentPage;         // The page that exists before this one
var()                           Material                Background;         // The background image for the menu
var()                           Color                   BackgroundColor;    // The color of the background
var()                           Color                   InactiveFadeColor;  // Color Modulation for Inactive Page
var()                           Sound                   OpenSound;          // Sound to play when opened
var()                           Sound                   CloseSound;         // Sound to play when closed
var() noexport editconst
    editconstarray const array<GUIComponent>            Timers;             // List of components with Active Timers
                                                                            // if last on the stack.

var()                           EMenuRenderStyle        BackgroundRStyle;

// Delegates
delegate OnOpen()
{
    if ( Controller != None && Controller.bSnapCursor )
        CenterMouse();
}

delegate OnReOpen();
delegate OnClose(optional bool bCancelled);

delegate bool OnCanClose(optional Bool bCancelled)
{
    return true;
}

event Closed(GUIComponent Sender, bool bCancelled)
{
    Super.Closed(Sender, bCancelled);
    OnClose(bCancelled);
}

//=================================================
// PlayOpenSound / PlayerClosedSound

function PlayOpenSound()
{
    PlayerOwner().PlayOwnedSound(OpenSound,SLOT_Interface,1.0);
}

function PlayCloseSound()
{
    PlayerOwner().PlayOwnedSound(CloseSound,SLOT_Interface,1.0);
}


//=================================================
// InitComponent is responsible for initializing all components on the page.

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    Super.InitComponent(MyController, MyOwner);
    FocusFirst(none);
}

//=================================================
// CheckResolution - Tests to see if this menu requires a resoltuion of at least 640x480 and if so, switches

function CheckResolution(bool Closing, GUIController InController)
{
    local string CurrentRes;
    local string Xstr, Ystr;
    local int ResX, ResY;

    if ( InController == None )
        return;

    if ( InController.ResX == 0 || InController.ResY == 0 )
    {
        CurrentRes = PlayerOwner().ConsoleCommand("GETCURRENTRES");
        if ( Divide(CurrentRes, "x", Xstr, Ystr) )
        {
            ResX = int(Xstr);
            ResY = int(Ystr);
        }
    }

    else
    {
        ResX = InController.ResX;
        ResY = InController.ResY;
        CurrentRes = InController.ResX $ "x" $ InController.ResY;
    }

    if (!Closing)
    {
        if ( InController != None && ResX < 640 && ResY < 480 && bRequire640x480 )
        {
            if ( InController.bModAuthor )
                log(Name$".CheckResolution() - menu requires 640x480.  Currently at "$CurrentRes,'ModAuthor');

            InController.GameResolution = CurrentRes;
            Console(InController.Master.Console).DelayedConsoleCommand("TEMPSETRES 640x480");
        }

        return;

    }

    if ( !bRequire640x480 || InController.GameResolution == "" )
        return;

    if ( CurrentRes != InController.GameResolution )
    {
        if ( !InController.NeedsMenuResolution() )
        {
            if ( InController.bModAuthor )
                log(Name$".CheckResolution() - restoring menu resolution to standard value:"@InController.GameResolution,'ModAuthor');
            Console(InController.Master.Console).DelayedConsoleCommand("SETRES"@InController.GameResolution);
            InController.GameResolution = "";
        }

        else if ( InController.bModAuthor )
            log(Name$".CheckResolution() - not restoring resolution to standard value: ParentMenu would abort.",'ModAuthor');
    }
}

event ChangeHint(string NewHint)
{
    SetHint(NewHint);
}

event SetFocus(GUIComponent Who)
{
    if (Who==None)
        return;

    Super.SetFocus(Who);
}

event HandleParameters(string Param1, string Param2);   // Should be subclassed
function bool GetRestoreParams( out string Param1, out string Param2 ); // Params will be used when page is reopened

// Should be subclassed - general purpose function to workaround menuclass dependancy
// Not called from anywhere - call it only if you need it
function HandleObject( Object Obj, optional Object OptionalObj_1, optional Object OptionalObj_2 );
function string GetDataString() { return ""; }
function SetDataString(string Str);

// If !bPersistent, return true for GUIController to close this menu at level change
// If bPersistent, return true to be removed from persistent stack at level change (will also be closed if open)
function bool NotifyLevelChange()
{
    LevelChanged();
    return true;
}

event Free()            // This control is no longer needed
{
    local int i;

    if ( !bPersistent )
    {
        for ( i = 0; i < Timers.Length; i++ )
            Timers[i]=None;

        Super.Free();
    }
}

final function bool IsOpen()
{
    if ( Controller == None )
        return false;

    return Controller.FindMenuIndex(Self) != -1;
}

function bool AllowOpen(string MenuClass)
{
    return true;
}

defaultproperties
{
     bCaptureInput=Wahr
     bRequire640x480=Wahr
     BackgroundColor=(B=255,G=255,R=255,A=255)
     InactiveFadeColor=(B=64,G=64,R=64,A=255)
     BackgroundRStyle=MSTY_Normal
     RenderWeight=0.000100
     bTabStop=Falsch
     bAcceptsInput=Wahr
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:46.000 - Creation time: Mo 16.4.2007 11:20:48.078 - Created with UnCodeX