Exemple #1
0
        internal DialogBoxForm(string title, Control content, Size exactSize, DialogSizeHint sizeHint, bool allowResize)
        {
            InitializeComponent();
            Text = title;

            _content = content;

            // important - if we do not set a minimum size, the full content may not be displayed
            _content.MinimumSize = _content.Size;
            _content.Dock        = DockStyle.Fill;

            // adjust size of client area
            this.ClientSize = exactSize != Size.Empty ? exactSize : SizeHintHelper.TranslateHint(sizeHint, _content.Size);

            if (allowResize)
            {
                FormBorderStyle = FormBorderStyle.Sizable;
                MinimumSize     = base.SizeFromClientSize(_content.Size);
            }

            _contentPanel.Controls.Add(_content);

            // Resize the dialog if size of the underlying content changed
            _content.SizeChanged += OnContentSizeChanged;
        }
Exemple #2
0
		internal DialogBoxForm(string title, Control content, Size exactSize, DialogSizeHint sizeHint, bool allowResize)
		{
			InitializeComponent();
			Text = title;

			_content = content;

			// important - if we do not set a minimum size, the full content may not be displayed
			_content.MinimumSize = _content.Size;
			_content.Dock = DockStyle.Fill;

			// adjust size of client area
			this.ClientSize = exactSize != Size.Empty ? exactSize : SizeHintHelper.TranslateHint(sizeHint, _content.Size);

			if (allowResize)
			{
				FormBorderStyle = FormBorderStyle.Sizable;
				MinimumSize = base.SizeFromClientSize(_content.Size);
			}

			_contentPanel.Controls.Add(_content);

			// Resize the dialog if size of the underlying content changed
			_content.SizeChanged += OnContentSizeChanged;
		}
Exemple #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="args"></param>
 /// <param name="workspace"></param>
 protected internal WorkspaceDialogBox(DialogBoxCreationArgs args, Workspace workspace)
     : base(args)
 {
     _workspace = workspace;
     _host      = new Host(this, args.Component);
     _size      = args.Size;
     _sizeHint  = args.SizeHint;
 }
Exemple #4
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="args"></param>
		/// <param name="workspace"></param>
		protected internal WorkspaceDialogBox(DialogBoxCreationArgs args, Workspace workspace)
			: base(args)
		{
			_workspace = workspace;
			_host = new Host(this, args.Component);
			_size = args.Size;
			_sizeHint = args.SizeHint;
		}
Exemple #5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="args">Creation args for the dialog box.</param>
        /// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the dialog box.</param>
        protected internal DialogBox(DialogBoxCreationArgs args, DesktopWindow desktopWindow)
            : base(args)
        {
            _component       = args.Component;
            _dialogSize      = args.SizeHint;
            _size            = args.Size;
            _allowUserResize = args.AllowUserResize;
            _desktopWindow   = desktopWindow;

            _host = new Host(this, _component);
        }
Exemple #6
0
		/// <summary>
		/// Translates the specified size hint into an absolute size.
		/// </summary>
		/// <param name="hint"></param>
		/// <param name="defaultSize"></param>
		/// <returns></returns>
		public static Size TranslateHint(DialogSizeHint hint, Size defaultSize)
		{
			switch (hint)
			{
				case DialogSizeHint.Small:
					return new Size(320, 240);
				case DialogSizeHint.Medium:
					return new Size(640, 480);
				case DialogSizeHint.Large:
					return new Size(800, 600);
				default:
					return defaultSize;
			}
		}
Exemple #7
0
        /// <summary>
        /// Translates the specified size hint into an absolute size.
        /// </summary>
        /// <param name="hint"></param>
        /// <param name="defaultSize"></param>
        /// <returns></returns>
        public static Size TranslateHint(DialogSizeHint hint, Size defaultSize)
        {
            switch (hint)
            {
            case DialogSizeHint.Small:
                return(new Size(320, 240));

            case DialogSizeHint.Medium:
                return(new Size(640, 480));

            case DialogSizeHint.Large:
                return(new Size(800, 600));

            default:
                return(defaultSize);
            }
        }
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="title"></param>
		/// <param name="content"></param>
		/// <param name="exactSize"></param>
		/// <param name="sizeHint"></param>
		private WorkspaceDialogBoxForm(string title, Control content, Size exactSize, DialogSizeHint sizeHint)
		{
			InitializeComponent();
			this.Text = title;

			_content = content;

			// important - if we do not set a minimum size, the full content may not be displayed
			_content.MinimumSize = _content.Size;
			_content.Dock = DockStyle.Fill;

			// adjust size of client area to its ideal size
			var contentSize = exactSize != Size.Empty ? exactSize : SizeHintHelper.TranslateHint(sizeHint, _content.Size);
			this.ClientSize = contentSize;// +new Size(0, 4);

			// record the ideal size for future reference
			_idealSize = this.Size;

			_contentPanel.Controls.Add(_content);
		}
Exemple #9
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="args">Creation args for the dialog box.</param>
        /// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the dialog box.</param>
        protected internal DialogBox(DialogBoxCreationArgs args, DesktopWindow desktopWindow)
            :base(args)
        {
            _component = args.Component;
            _dialogSize = args.SizeHint;
            _size = args.Size;
        	_allowUserResize = args.AllowUserResize;
            _desktopWindow = desktopWindow;

			_host = new Host(this, _component);
		}
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="component">The component to be hosted in the dialog.</param>
		/// <param name="title">The title to assign to the dialog.</param>
		/// <param name="name">The name/identifier of the dialog.</param>
		/// <param name="sizeHint">The size hint for the dialog.</param>
		public DialogBoxCreationArgs(IApplicationComponent component, [param : Localizable(true)] string title, string name, DialogSizeHint sizeHint)
			: base(title, name)
		{
			_component = component;
			_sizeHint = sizeHint;
		}
Exemple #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="component">The component to be hosted in the dialog.</param>
 /// <param name="title">The title to assign to the dialog.</param>
 /// <param name="name">The name/identifier of the dialog.</param>
 /// <param name="sizeHint">The size hint for the dialog.</param>
 public DialogBoxCreationArgs(IApplicationComponent component, string title, string name, DialogSizeHint sizeHint)
     :base(title, name)
 {
     _component = component;
     _sizeHint = sizeHint;
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="content"></param>
        /// <param name="exactSize"></param>
        /// <param name="sizeHint"></param>
        private WorkspaceDialogBoxForm(string title, Control content, Size exactSize, DialogSizeHint sizeHint)
        {
            InitializeComponent();
            this.Text = title;

            _content = content;

            // important - if we do not set a minimum size, the full content may not be displayed
            _content.MinimumSize = _content.Size;
            _content.Dock        = DockStyle.Fill;

            // adjust size of client area to its ideal size
            var contentSize = exactSize != Size.Empty ? exactSize : SizeHintHelper.TranslateHint(sizeHint, _content.Size);

            this.ClientSize = contentSize;            // +new Size(0, 4);

            // record the ideal size for future reference
            _idealSize = this.Size;

            _contentPanel.Controls.Add(_content);
        }
Exemple #13
0
		internal DialogBoxForm(string title, Control content, Size exactSize, DialogSizeHint sizeHint)
			: this(title, content, exactSize, sizeHint, false) {}
Exemple #14
0
 internal DialogBoxForm(string title, Control content, Size exactSize, DialogSizeHint sizeHint)
     : this(title, content, exactSize, sizeHint, false)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="component">The component to be hosted in the dialog.</param>
 /// <param name="title">The title to assign to the dialog.</param>
 /// <param name="name">The name/identifier of the dialog.</param>
 /// <param name="sizeHint">The size hint for the dialog.</param>
 public DialogBoxCreationArgs(IApplicationComponent component, string title, string name, DialogSizeHint sizeHint)
     : base(title, name)
 {
     _component = component;
     _sizeHint  = sizeHint;
 }
Exemple #16
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="component">The component to be hosted in the dialog.</param>
 /// <param name="title">The title to assign to the dialog.</param>
 /// <param name="name">The name/identifier of the dialog.</param>
 /// <param name="sizeHint">The size hint for the dialog.</param>
 public DialogBoxCreationArgs(IApplicationComponent component, [param: Localizable(true)] string title, string name, DialogSizeHint sizeHint)
     : base(title, name)
 {
     _component = component;
     _sizeHint  = sizeHint;
 }