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

UBrowser.UBrowserOpenCW


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
class UBrowserOpenCW expands UWindowDialogClientWindow;

var UWindowComboControl OpenCombo;
var localized string    OpenText;
var localized string    OpenHelp;

var config string       OpenHistory[10];

function Created()
{
    local float EditWidth;
    local int i;
    local Color TC;

    Super.Created();

    EditWidth = WinWidth - 140;
    OpenCombo = UWindowComboControl(CreateControl(class'UWindowComboControl', 20, 20, EditWidth, 1));
    OpenCombo.SetText(OpenText);
    OpenCombo.SetHelpText(OpenHelp);
    OpenCombo.SetFont(F_Normal);
    OpenCombo.SetEditable(True);
    for (i=0; i<10; i++)
        if (OpenHistory[i] != "")
            OpenCombo.AddItem(OpenHistory[i]);
}

function BeforePaint(Canvas C, float X, float Y)
{
    local float EditWidth;
    local float XL, YL;

    C.Font = Root.Fonts[OpenCombo.Font];
    TextSize(C, OpenCombo.Text, XL, YL);

    EditWidth = WinWidth - 50;

    OpenCombo.WinLeft = (WinWidth - EditWidth) / 2;
    OpenCombo.WinTop = (WinHeight-OpenCombo.WinHeight) / 2;
    OpenCombo.SetSize(EditWidth, OpenCombo.WinHeight);
    OpenCombo.EditBoxWidth = OpenCombo.WinWidth - XL - 20;

    Super.BeforePaint(C, X, Y);
}

function Notify(UWindowDialogControl C, byte E)
{
    Super.Notify(C, E);

    if((C == OpenCombo && E == DE_EnterPressed) ||
       (C == UBrowserOpenWindow(ParentWindow).OKButton && E == DE_Click))
        OpenURL();
}

function OpenURL()
{
    local int i;
    local bool HistoryItem;
    local UWindowComboListItem Item;
    local string URL;

    URL = OpenCombo.GetValue();
    if(URL == "")
    {
        OpenCombo.BringToFront();
        return;
    }
    
    for (i=0; i<10; i++)
    {
        if (OpenHistory[i] ~= URL)
            HistoryItem = True;
    }
    if (!HistoryItem)
    {
        OpenCombo.InsertItem(URL);
        while(OpenCombo.List.Items.Count() > 10)
            OpenCombo.List.Items.Last.Remove();

        Item = UWindowComboListItem(OpenCombo.List.Items.Next);
        for (i=0; i<10; i++)
        {
            if(Item != None)
            {
                OpenHistory[i] = Item.Value;
                Item = UWindowComboListItem(Item.Next);
            }
            else
                OpenHistory[i] = "";
        }           
    }
    SaveConfig();

    OpenCombo.ClearValue();
    GetParent(class'UWindowFramedWindow').Close();
    UBrowserMainWindow(ParentWindow.OwnerWindow).OpenURL(URL);
}

defaultproperties
{
     OpenText="Open:"
     OpenHelp="Enter a standard URL, or select one from the URL history.  Press Enter to activate."
     OpenHistory(0)="212.68.149.83:7777?password=ska"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 19.5.2005 19:42:12.000 - Creation time: Fr 7.6.2013 13:16:10.749 - Created with UnCodeX