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

XInterface.GUIMenuOption


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
// ====================================================================
//  Class:  UT2K4UI.GUIMultiComponent
//
//  MenuOptions combine a label and any other component in to 1 single
//  control.  The Label is left justified, the control is right.
//
//  Written by Joe Wilcox
//  (c) 2002, Epic Games, Inc.  All Rights Reserved
// ====================================================================

class GUIMenuOption extends GUIMultiComponent
        Native;

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

var(Option) editconst  bool   bIgnoreChange;          // Don't want an OnChange event
var(Option)   bool            bValueReadOnly;         // Value of this option cannot be modified by input
var(Option)   bool            bAutoSizeCaption;       // Extend CaptionWidth if caption is too long
var(Option)   bool            bHeightFromComponent;   // Get the Height of this component from the Component
var(Option)   bool            bFlipped;               // Draw the Component to the left of the caption
var(Option)   bool            bSquare;                // Use the Height for the Width
var(Option)   bool            bVerticalLayout;        // Layout controls vertically

var(Option)   eTextAlign      LabelJustification;     // How do we justify the label
var(Option)   eTextAlign      ComponentJustification; // How do we justify the label

var(Option)   float           CaptionWidth;           // How big should the Caption be
var(Option)   float           ComponentWidth;         // How big should the Component be (-1 = 1-CaptionWidth)

var(Option) localized  string Caption;                // Caption for the label
var(Option)   string          ComponentClassName;     // Name of the component to spawn
var(Option)   string          LabelFont;              // Name of the Font for the label
var(Option)   string          LabelStyleName;         // The Style for the label

var(Option)   Color           LabelColor;             // Color for the label
var(Option) editconst noexport        GUILabel        MyLabel;                // Holds the label
var(Option) editconst noexport        GUIComponent    MyComponent;            // Holds the component

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    if (bVerticalLayout) StandardHeight *= 2;
    Super.Initcomponent(MyController, MyOwner);

    // Create the two components

    MyLabel = GUILabel(AddComponent("XInterface.GUILabel"));
    if (MyLabel==None)
    {
        log("Failed to create "@self@" due to problems creating GUILabel");
        return;
    }



    if (bFlipped)
    {
        if (LabelJustification==TXTA_Left)
            LabelJustification=TXTA_Right;

        else if (LabelJustification==TXTA_Right)
            LabelJustification=TXTA_Left;

        if (ComponentJustification==TXTA_Left)
            ComponentJustification=TXTA_Right;

        else if (ComponentJustification==TXTA_Right)
            ComponentJustification=TXTA_Left;
    }

    MyLabel.Caption     = Caption;
    if ( LabelStyleName == "" )
    {
        MyLabel.TextColor = LabelColor;
        MyLabel.TextFont = LabelFont;
    }
    else MyLabel.Style       = Controller.GetStyle(LabelStyleName,MyLabel.FontScale);
    MyLabel.FontScale   = FontScale;
    MyLabel.TextAlign   = LabelJustification;
    MyLabel.IniOption   = IniOption;
    MyLabel.bNeverScale = True;

    if (ComponentClassName == "")
        return;

    MyComponent = AddComponent(ComponentClassName);
    // Check for errors
    if (MyComponent == None)
    {
        log("Could not create requested menu component"@ComponentClassName);
        return;
    }

    SetHint(Hint);
    MyComponent.IniOption = IniOption;

    if (bHeightFromComponent && !bVerticalLayout)
        WinHeight = MyComponent.WinHeight;
    else
        MyComponent.WinHeight = WinHeight;

    MyComponent.OnChange = InternalOnChange;
    MyComponent.bTabStop = true;
    MyComponent.TabOrder = 1;
    MyComponent.bNeverScale = True;
    MyComponent.bNeverFocus = bNeverFocus;

    SetFriendlyLabel(MyLabel);
    if ( MenuState == MSAT_Disabled )
    {
        MenuState = MSAT_Blurry;
        DisableMe();
    }
}

// Used for MultiOptionLists

function SetComponentValue(coerce string NewValue, optional bool bNoChange);
function string GetComponentValue()
{
    return "";
}
// Reset component to default state
function ResetComponent()
{
    SetComponentValue(IniDefault);
}

function SetReadOnly( bool bValue )
{
    bValueReadOnly = bValue;
}

function SetHint(string NewHint)
{
    Super.SetHint(NewHint);

    MyLabel.SetHint(NewHint);
    MyComponent.SetHint(NewHint);
}

function SetCaption(string NewCaption)
{
    Caption = NewCaption;
    MyLabel.Caption = NewCaption;
}

// This is the function that the GUIMultiOptionList will call when this component has been clicked on,
// since it overrides the component's OnClick() delegate
// Return false to prevent the GUIMultiOptionList from passing the OnClick notification upwards
function bool MenuOptionClicked(GUIComponent Sender)
{
    return true;
}

function InternalOnChange(GUIComponent Sender)
{
    if (Controller != None && Controller.bCurMenuInitialized)
    {
        if ( !bIgnoreChange )
            OnChange(Self);
    }

    bIgnoreChange = False;
}

function InternalOnCreateComponent(GUIComponent NewComp, GUIComponent Sender);

function CenterMouse()
{
    if ( MyComponent != None )
        MyComponent.CenterMouse();

    else Super.CenterMouse();
}

function SetFriendlyLabel( GUILabel NewLabel )
{
    Super.SetFriendlyLabel(NewLabel);

    if ( MyComponent != None )
        MyComponent.SetFriendlyLabel(NewLabel);
}

defaultproperties
{
     bAutoSizeCaption=Wahr
     ComponentJustification=TXTA_Right
     CaptionWidth=0.500000
     ComponentWidth=-1.000000
     LabelFont="UT2MenuFont"
     LabelStyleName="TextLabel"
     LabelColor=(B=64,A=255)
     PropagateVisibility=Wahr
     OnCreateComponent=GUIMenuOption.InternalOnCreateComponent
     WinTop=0.347656
     WinLeft=0.496094
     WinWidth=0.500000
     WinHeight=0.030000
     bAcceptsInput=Wahr
     Begin Object Class=GUIToolTip Name=GUIMenuOptionToolTip
     End Object
     ToolTip=GUIToolTip'XInterface.GUIMenuOption.GUIMenuOptionToolTip'

     OnClickSound=CS_Click
     bStandardized=Wahr
     StandardHeight=0.030000
}

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.031 - Created with UnCodeX