Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# GUI.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

    // ====================================================================
    //  Class:  GUI.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
    // ====================================================================
    /*=============================================================================
    	In Game GUI Editor System V1.0
    	2003 - Irrational Games, LLC.
    	* Dan Kaplan
    =============================================================================*/
    #if !IG_GUI_LAYOUT
    #error This code requires IG_GUI_LAYOUT to be defined due to extensive revisions of the origional code. [DKaplan]
    #endif
    /*===========================================================================*/

    class GUIMenuOption extends GUIMultiComponent
            HideCategories(Menu,Object)
    		Native;

    cpptext
    {
    		void PreDraw(UCanvas* Canvas);
    	void UpdateComponent(UCanvas* Canvas);
    }

    var(GUIMenuOption) config string			ComponentClassName "Name of the component to spawn";
    var(GUIMenuOption) config localized string	Caption "Caption for the label";
    //var(GUIMenuOption) config string			LabelFont "Name of the Font for the label";
    //var(GUIMenuOption) config Color			LabelColor "Color for the label";
    var(GUIMenuOption) config string			LabelStyle "Name of the GUIStyle for the label";
    var(GUIMenuOption) config bool			bHeightFromComponent "Get the Height of this component from the Component";
    var(GUIMenuOption) config float			CaptionWidth "How big should the Caption be";
    var(GUIMenuOption) config float			ComponentWidth "How big should the Component be (-1 = 1-CaptionWidth)";
    var(GUIMenuOption) config bool			bFlipped "Draw the Component to the left of the caption";
    var(GUIMenuOption) config eTextAlign		LabelJustification "How do we justify the label";
    var(GUIMenuOption) config eTextAlign		ComponentJustification "How do we justify the label";
    var(GUIMenuOption) config bool			bSquare "Use the Height for the Width";
    var(GUIMenuOption) config bool			bVerticalLayout "Layout controls vertically";

    var			GUILabel		MyLabel;				// Holds the label
    var			GUIComponent	MyComponent;			// Holds the component

    function OnConstruct(GUIController MyController)
    {
        Super.OnConstruct(MyController);

        MyLabel = GUILabel(AddComponent("GUI.GUILabel", self.Name$"_Label"));
        MyComponent = AddComponent(ComponentClassName, self.Name$"_"$ComponentClassName);
    }

    function InitComponent(GUIComponent MyOwner)
    {
    	MyLabel.StyleName 	= LabelStyle;

    	Super.InitComponent(MyOwner);

    	// Create the two components

    	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.SetCaption( Caption );
    //	MyLabel.TextFont 	= LabelFont;
    //	MyLabel.TextColor	= LabelColor;
    	MyLabel.TextAlign   = LabelJustification;

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

    	MyComponent.SetHint(Hint);

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

    	MyComponent.OnChange = InternalOnChange;

        MyComponent.bTabStop = true;
        MyComponent.TabOrder = 1;
    }

    function InternalOnChange(GUIComponent Sender)
    {
    	OnChange(self);
    }

    defaultproperties
    {
    	bHeightFromComponent=true
    	CaptionWidth=0.5
    	ComponentWidth=-1
    	WinWidth=0.500000
    	WinHeight=0.060000
    	WinLeft=0.496094
    	WinTop=0.347656
    //	LabelFont="MenuFont"
    //	LabelColor=(R=255,G=255,B=255,A=255)
    	bFlipped=false
    	LabelJustification=TXTA_Left
    	ComponentJustification=TXTA_Right
    	bSquare=false
        bTabStop=true
    	PropagateVisibility=true

    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 16:02:10.000 - Creation time: st 23.5.2018 00:10:43.840 - Created with UnCodeX