コード例 #1
0
        public FileDialog(string AWildCard, string ATitle, string InputName, StdDlg.StdDialogOptions AOptions, byte HistoryId)
            : base(new Rect(15, 1, 64, 20), ATitle)
        {
            Options |= OptionFlags.ofCentered;
            WildCard = AWildCard;
            Rect R = new Rect(3, 3, 31, 4);

            FileName          = new FileInputLine(R, 79);
            FileName.GrowMode = GrowModes.gfGrowHiX;
            FileName.Data     = WildCard;
            Insert(FileName);
            R = new Rect(2, 2, 3 + Drivers.CStrLen(InputName), 3);
            View Control = new Label(R, InputName, FileName);

            Insert(Control);
            R                = new Rect(31, 3, 34, 4);
            Control          = new History.History(R, FileName, HistoryId);
            Control.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoX;
            Insert(Control);
            R       = new Rect(3, 14, 34, 15);
            Control = new ScrollBar(R);
            Insert(Control);
            R                 = new Rect(3, 6, 34, 14);
            FileList          = new FileList(R, (ScrollBar)Control);
            FileList.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowHiY;

            Insert(FileList);
            R       = new Rect(2, 5, 8, 6);
            Control = new Label(R, "~F~iles", FileList);
            Insert(Control);

            R = new Rect(35, 3, 46, 5);
            Button.ButtonFlags Opt = Button.ButtonFlags.Default;
            if ((AOptions & StdDialogOptions.fdOpenButton) != 0)
            {
                View V = new Button(R, "~O~pen", StdDialog.cmFileOpen, Opt);
                V.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoX;
                Insert(V);
                Opt    = Button.ButtonFlags.Normal;
                R.A.Y += 3;
                R.B.Y += 3;
            }
            if ((AOptions & StdDialogOptions.fdReplaceButton) != 0)
            {
                View V = new Button(R, "~R~eplace", StdDialog.cmFileReplace, Opt);
                V.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoX;
                Insert(V);
                Opt    = Button.ButtonFlags.Normal;
                R.A.Y += 3;
                R.B.Y += 3;
            }
            if ((AOptions & StdDialogOptions.fdClearButton) != 0)
            {
                View V = new Button(R, "~C~lear", StdDialog.cmFileClear, Opt);
                V.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoX;
                Insert(V);
                R.A.Y += 3;
                R.B.Y += 3;
            }
            View VV = new Button(R, "Cancel", cmCancel, Opt);

            VV.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoX;
            Insert(VV);
            R.A.Y += 3;
            R.B.Y += 3;
            if ((AOptions & StdDialogOptions.fdHelpButton) != 0)
            {
                View V = new Button(R, "Help", cmHelp, Button.ButtonFlags.Normal);
                V.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoX;
                Insert(V);
                R.A.Y += 3;
                R.B.Y += 3;
            }
            R                = new Rect(1, 16, 48, 18);
            Control          = new FileInfoPane(R);
            Control.GrowMode = GrowModes.gfGrowHiX | GrowModes.gfGrowLoY | GrowModes.gfGrowHiY;
            Insert(Control);

            SelectNext(false);

            if ((AOptions & StdDialogOptions.fdNoLoadDir) == 0)
            {
                ReadDirectory();
            }
        }