Ejemplo n.º 1
0
        public override void AddedToContainer()
        {
            const int buttonMinSize = 50;

            selector = new FileSelector();
            selector.Initialize(null, file);
            AddDrawBox(selector);
            selector.Width  = 200;
            selector.Height = 100;

            cancelButton = new ResizableButton();
            cancelButton.Initialize(null, file);
            AddDrawBox(cancelButton);
            cancelButton.Title = "Cancel";
            cancelButton.FitToText();
            cancelButton.Width = Math.Max(cancelButton.Width, buttonMinSize);
            cancelButton.X     = 0;
            cancelButton.Y     = selector.Height + 3;

            okButton = new ResizableButton();
            okButton.Initialize(null, file);
            AddDrawBox(okButton);
            switch (OperationType)
            {
            case OperationTypes.Open:
                okButton.Title = "Open";
                break;

            case OperationTypes.Save:
                okButton.Title = "Save";
                break;

            case OperationTypes.Select:
                okButton.Title = "Select";
                break;
            }
            okButton.FitToText();
            okButton.Width = Math.Max(okButton.Width, buttonMinSize);
            okButton.X     = selector.Width - cancelButton.Width;
            okButton.Y     = selector.Height + 3;

            Wrap();

            selector.Alignment     = DrawBoxAlignment.GetFull();
            okButton.Alignment     = DrawBoxAlignment.GetRightBottom();
            cancelButton.Alignment = DrawBoxAlignment.GetLeftBottom();

            okButton.Click     += new DefaultEvent(okButton_Click);
            cancelButton.Click += new DefaultEvent(cancelButton_Click);
        }