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

GUI.GUIContextMenu


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
//====================================================================
//  Parent: GUI
//   Class: UT2K4UI.GUIContextMenu
//    Date: 05-01-2003
//
//  Right-click context menu.
//
//  Written by Joe Wilcox
//  (c) 2003, Epic Games, Inc.  All Rights Reserved
// ====================================================================

class GUIContextMenu extends GUIComponent;
//    native;
// MJ:  Would require work to integrate native functionality
//cpptext
//{
//    virtual void  PreDraw(UCanvas *Canvas);
//    virtual void  Draw(UCanvas* Canvas);
//    virtual void  UpdateIndex(INT MouseX, INT MouseY);    // Check to see if a mouse press affects the control
//
//    virtual UBOOL Close();
//    virtual UBOOL KeyEvent(BYTE& iKey, BYTE& State, FLOAT Delta);   // Handle key events
//}

var localized array<string>   ContextItems;                   // List of menu items
var int             ItemIndex;              // Selected item
var string          SelectionStyleName;     // Name of the Style to use
var GUIStyles       SelectionStyle;         // Holds the style
var int             ItemHeight;

delegate bool OnOpen(GUIContextMenu Sender);  // Return false to prevent menu from appearing
delegate bool OnClose(GUIContextMenu Sender);      // Return false to prevent menu from closing
delegate OnSelect(GUIContextMenu Sender, int ClickIndex);

// Return false to override default behavior
// ( here is where an item is selected & highlighted )
delegate bool OnContextHitTest(float MouseX, float MouseY);

function int AddItem(string NewItem)
{
    local int Index;

    Index = ContextItems.Length;
    ContextItems[Index] = NewItem;
    return Index;
}

function int InsertItem(string NewItem, int Index)
{
    if (Index >= ContextItems.Length)
        return AddItem(NewItem);

    if (Index <0)
        return -1;

    ContextItems.Insert(Index, 1);
    ContextItems[Index] = NewItem;
    return Index;
}

function bool RemoveItemByName(string ItemName)
{
    local int Index;
    for (Index=0;Index<ContextItems.Length;Index++)
        if (ContextItems[Index] ~= ItemName)
        {
            ContextItems.Remove(Index,1);
            return true;
        }

    return false;
}

function bool RemoveItemByIndex(int Index)
{
    if (Index>=0 && Index<ContextItems.Length)
    {
        ContextItems.Remove(Index,1);
        return true;
    }

    return false;
}

function bool ReplaceItem( int Index, string NewItem )
{
	if ( RemoveItemByIndex(Index) )
		return InsertItem(NewItem, Index) > 0;

	return false;

}

defaultproperties
{
    StyleName="ContextMenu"
    SelectionStyleName="ListSelection"
//    FontScale=FNS_Small
 //   bRequiresStyle=True
}

Overview Package Class Source Class tree Glossary
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.675 - Created with UnCodeX