void Initialize (OpenFileDialogData data)
		{
			SuspendLayout ();
			
			Point location = new Point (10, 5); // start location for controls.
			int padding = 5;
			int height = padding * 2; // initial/minimum height.
			
			int labelWidth = GetMaxLabelWidth (data.ShowEncodingSelector, data.ShowViewerSelector);
			
			if (data.ShowEncodingSelector) {
				encodingLabel = new Label () {
					Text = GettextCatalog.GetString (EncodingText),
					Location = location,
					AutoSize = true
				};
				
				encodingBox = new EncodingBox (data.Action != Gtk.FileChooserAction.Save) {
					Location = new Point (labelWidth + 20, location.Y),
					Width = DialogWidth - (labelWidth + 20 + padding),
					SelectedEncodingId = data.Encoding,
					Enabled = false
				};
				
				Controls.AddRange (new Control [] { encodingLabel, encodingBox });
								
				location.Y = encodingLabel.Bottom + padding;
				height += encodingBox.Height + padding;
			}
			
			if (data.ShowViewerSelector && FileDialog is OpenFileDialog) {
				viewerLabel = new Label () {
					Text = GettextCatalog.GetString (ViewerText),
					Location = location,
					AutoSize = true
				};
				
				viewerBox = new ComboBox () {
					Location = new Point (labelWidth + 20, location.Y),
					Width = DialogWidth - (labelWidth + 20 + padding),
					DropDownStyle = ComboBoxStyle.DropDownList,
					Enabled = false
				};
				
				location.Y = viewerBox.Bottom + padding;
				height += viewerBox.Height + padding;
				
				if (IdeApp.Workspace.IsOpen) {
					closeSolutionBox = new CheckBox () {
						Text = GettextCatalog.GetString ("Close current workspace"),
						Location = location,
						AutoSize = true,
						Checked = true,
						Enabled = false
					};
					
					height += closeSolutionBox.Height + padding;
				}
				
				if (encodingBox != null) {
					viewerBox.SelectedIndexChanged += delegate {
						int idx = viewerBox.SelectedIndex;
						encodingBox.Enabled = !(idx == 0 && currentViewers [0] == null);	
					};
				}
				
				Controls.AddRange (new Control [] { viewerLabel, viewerBox });
				if (closeSolutionBox != null)
					Controls.Add (closeSolutionBox);
			}
			
			AutoScaleDimensions = new SizeF (6F, 13F);
			AutoScaleMode = AutoScaleMode.Font;
			Size = new Size (DialogWidth, height);
			
			ResumeLayout ();
		}
        // We are required to compute the needed height to contain our controls
        // *before* the dialog is shown, thus we do it here as well as the vertical layout.
        // The X coords for our controls are set as soon as we get access to the native
        // dialog's controls, which happens to be when the OnShown event is fired.
        void Initialize(OpenFileDialogData data)
        {
            SuspendLayout();

            int padding = 6;
            int y       = padding;

            labelsWidth = GetMaxLabelWidth(data.ShowEncodingSelector, data.ShowViewerSelector);

            if (data.ShowEncodingSelector)
            {
                encodingLabel = new Label()
                {
                    Text     = GettextCatalog.GetString(EncodingText),
                    Top      = y,
                    AutoSize = true
                };

                encodingBox = new EncodingBox(data.Action != Gtk.FileChooserAction.Save)
                {
                    Top = y,
                    SelectedEncodingId = data.Encoding,
                };

                Controls.AddRange(new Control [] { encodingLabel, encodingBox });

                y += Math.Max(encodingLabel.Height, encodingBox.Height) + padding;
            }

            if (data.ShowViewerSelector && FileDialog is OpenFileDialog)
            {
                viewerLabel = new Label()
                {
                    Text     = GettextCatalog.GetString(ViewerText),
                    Top      = y,
                    AutoSize = true
                };

                viewerBox = new ComboBox()
                {
                    Top           = y,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Enabled       = false
                };

                y += Math.Max(viewerLabel.Height, viewerBox.Height) + padding;

                if (IdeApp.Workspace.IsOpen)
                {
                    closeSolutionBox = new CheckBox()
                    {
                        Text     = GettextCatalog.GetString("Close current workspace"),
                        Top      = y,
                        AutoSize = true,
                        Checked  = true,
                        Enabled  = false
                    };

                    y += closeSolutionBox.Height + padding;
                }

                if (encodingBox != null)
                {
                    viewerBox.SelectedIndexChanged += delegate {
                        int idx = viewerBox.SelectedIndex;
                        encodingBox.Enabled = !(idx == 0 && currentViewers [0] == null);
                    };
                }

                Controls.AddRange(new Control [] { viewerLabel, viewerBox });
                if (closeSolutionBox != null)
                {
                    Controls.Add(closeSolutionBox);
                }
            }

            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            ClientSize          = new Size(ClientSize.Width, y);

            ResumeLayout();
        }
		// We are required to compute the needed height to contain our controls
		// *before* the dialog is shown, thus we do it here as well as the vertical layout.
		// The X coords for our controls are set as soon as we get access to the native
		// dialog's controls, which happens to be when the OnShown event is fired.
		void Initialize (OpenFileDialogData data)
		{
			SuspendLayout ();

			int padding = 6;
			int y = padding;
			
			labelsWidth = GetMaxLabelWidth (data.ShowEncodingSelector, data.ShowViewerSelector);
			
			if (data.ShowEncodingSelector) {
				encodingLabel = new Label () {
					Text = GettextCatalog.GetString (EncodingText),
					Top = y,
					AutoSize = true
				};
				
				encodingBox = new EncodingBox (data.Action != Gtk.FileChooserAction.Save) {
					Top = y,
					SelectedEncodingId = data.Encoding != null ? data.Encoding.CodePage : 0,
				};
				encodingBox.Anchor = AnchorStyles.Left | AnchorStyles.Right;
				
				Controls.AddRange (new Control [] { encodingLabel, encodingBox });

				y += Math.Max (encodingLabel.Height, encodingBox.Height) + padding;
			}
			
			if (data.ShowViewerSelector && FileDialog is OpenFileDialog) {
				viewerLabel = new Label () {
					Text = GettextCatalog.GetString (ViewerText),
					Top = y,
					AutoSize = true
				};
				
				viewerBox = new ComboBox () {
					Top = y,
					DropDownStyle = ComboBoxStyle.DropDownList,
					Enabled = false
				};
				viewerBox.Anchor = AnchorStyles.Left | AnchorStyles.Right;
				
				y += Math.Max (viewerLabel.Height, viewerBox.Height) + padding;
				
				if (IdeApp.Workspace.IsOpen) {
					closeSolutionBox = new CheckBox () {
						Text = GettextCatalog.GetString ("Close current workspace"),
						Top = y,
						AutoSize = true,
						Checked = true,
						Enabled = false
					};
					
					y += closeSolutionBox.Height + padding;
				}
				
				if (encodingBox != null) {
					viewerBox.SelectedIndexChanged += delegate {
						int idx = viewerBox.SelectedIndex;
						encodingBox.Enabled = !(idx == 0 && currentViewers [0] == null);	
					};
				}
				
				Controls.AddRange (new Control [] { viewerLabel, viewerBox });
				if (closeSolutionBox != null)
					Controls.Add (closeSolutionBox);
			}
			
			AutoScaleDimensions = new SizeF (6F, 13F);
			AutoScaleMode = AutoScaleMode.Font;
			ClientSize = new Size (ClientSize.Width, y);
			
			ResumeLayout ();
		}