Index: Core/Common/src/Core.Common.Gui/Forms/ControlHelper.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/ControlHelper.cs (.../ControlHelper.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/ControlHelper.cs (.../ControlHelper.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -25,21 +25,53 @@
namespace Core.Common.Gui.Forms
{
+ ///
+ /// Helper methods related to instances.
+ ///
public static class ControlHelper
{
+ ///
+ /// Sends the specified message to a window or windows. The
+ /// function calls the window procedure for the specified window and does not
+ /// return until the window procedure has processed the message.
+ ///
+ /// A handle to the window whose window procedure will receive
+ /// the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message
+ /// is sent to all top-level windows in the system, including disabled or invisible
+ /// unowned windows, overlapped windows, and pop-up windows; but the message is not
+ /// sent to child windows. Message sending is subject to UIPI. The thread of a
+ /// process can send messages only to message queues of threads in processes of
+ /// lesser or equal integrity level.
+ /// The message to be sent. For lists of the system-provided
+ /// messages, see .
+ /// Additional message-specific information.
+ /// Additional message-specific information.
+ ///
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
+ ///
+ /// Causes a window to use a different set of visual style information than its class normally uses.
+ ///
+ /// Handle to the window whose visual style information is to be changed.
+ /// Pointer to a string that contains the application
+ /// name to use in place of the calling application's name. If this parameter is null,
+ /// the calling application's name is used.
+ /// Pointer to a string that contains a semicolon-separated
+ /// list of CLSID names to use in place of the actual list passed by the window's
+ /// class. If this parameter is null, the ID list from the calling class is used.
+ ///
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
public static extern int SetWindowTheme(IntPtr hWnd, string textSubAppName, string textSubIdList);
///
- /// Call this method on a view if you want to trigger data binding. For example when switching between views, closing a
- /// view or when performing a save.
+ /// Call this method on a view if you want to trigger data binding. For example
+ /// when switching between views, closing a view or when performing a save.
///
- /// control to unfocus / trigger validation
- /// If 'true', it messes with switch to another control/tab, but it is required
- /// if you close a view or want the current view to commit any changes.
+ /// Control to unfocus / trigger validation.
+ /// If true, it messes with switch
+ /// to another control/tab, but it is required if you close a view or want the
+ /// current view to commit any changes.
public static void UnfocusActiveControl(IContainerControl containerControl, bool notSwitchingToOtherControl = false)
{
if (containerControl == null)
@@ -60,9 +92,5 @@
containerControl.ActiveControl = null; //unfocus current control, to force binding to happen
}
-
- // Import GetFocus() from user32.dll
- [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Winapi)]
- internal static extern IntPtr GetFocus();
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/IProjectExplorer.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/IProjectExplorer.cs (.../IProjectExplorer.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/IProjectExplorer.cs (.../IProjectExplorer.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -19,13 +19,20 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using Core.Common.Base.Data;
using Core.Common.Controls.TreeView;
using Core.Common.Controls.Views;
namespace Core.Common.Gui.Forms
{
+ ///
+ /// View to show the contents of a instance.
+ ///
public interface IProjectExplorer : IView
{
+ ///
+ /// Gets the internal .
+ ///
TreeViewControl TreeViewControl { get; }
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/IPropertyGrid.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/IPropertyGrid.cs (.../IPropertyGrid.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/IPropertyGrid.cs (.../IPropertyGrid.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -19,13 +19,20 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Core.Common.Controls;
using Core.Common.Controls.Views;
namespace Core.Common.Gui.Forms
{
+ ///
+ /// View that displays the properties for a given data object.
+ ///
public interface IPropertyGrid : IView
{
+ ///
+ /// Gets the object properties corresponding to a data object.
+ ///
+ /// The source data.
+ /// The object that shows the properties.
object GetObjectProperties(object sourceData);
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/IRibbonCommandHandler.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/IRibbonCommandHandler.cs (.../IRibbonCommandHandler.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/IRibbonCommandHandler.cs (.../IRibbonCommandHandler.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -26,7 +26,8 @@
namespace Core.Common.Gui.Forms
{
///
- /// Implemented in the gui plugin, used to extend ribbon control.
+ /// Interface declaring member for providing a control, commands used by that
+ /// Ribbon control and controller methods.
///
public interface IRibbonCommandHandler
{
@@ -36,21 +37,22 @@
IEnumerable Commands { get; }
///
- /// Gets Ribbon control implementation in the gui plugin. Gui will merge it with the existing ribbon.
+ /// Gets control.
///
Ribbon GetRibbonControl();
///
- /// Called by the gui when ribbon items need to be validated (e.g. enable/disable).
+ /// Updates/Validates the ribbon elements, such as enabled state.
///
void ValidateItems();
///
- /// Called when context changes (like selection, active window.).
+ /// Indicates if this command handler requires a particular contextual tab of a
+ /// contextual group to be shown or not.
///
- ///
- ///
- /// Return false when contextual tab is not used.
+ /// Name of the contextual group.
+ /// Name of the tab.
+ /// Returns true if tab should be shown, false otherwise.
bool IsContextualTabVisible(string tabGroupName, string tabName);
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/RichTextFile.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/RichTextFile.cs (.../RichTextFile.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/RichTextFile.cs (.../RichTextFile.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -22,7 +22,7 @@
namespace Core.Common.Gui.Forms
{
///
- /// Very light class to give an entity to rich-text file. Currently used for RTF files.
+ /// Object that refers to an .rtf file.
///
public class RichTextFile
{
Index: Core/Common/src/Core.Common.Gui/Forms/RichTextView.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/RichTextView.cs (.../RichTextView.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/RichTextView.cs (.../RichTextView.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -25,6 +25,9 @@
namespace Core.Common.Gui.Forms
{
+ ///
+ ///
+ ///
public partial class RichTextView : UserControl, IView
{
private RichTextFile richTextFile;
Index: Core/Common/src/Core.Common.Gui/Forms/SelectItemDialog.Designer.cs
===================================================================
diff -u -r59df4f03c40f731cb7f7c017e574143537a7e8a8 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/SelectItemDialog.Designer.cs (.../SelectItemDialog.Designer.cs) (revision 59df4f03c40f731cb7f7c017e574143537a7e8a8)
+++ Core/Common/src/Core.Common.Gui/Forms/SelectItemDialog.Designer.cs (.../SelectItemDialog.Designer.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -45,7 +45,7 @@
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOk.Name = "buttonOk";
this.buttonOk.UseVisualStyleBackColor = true;
- this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
+ this.buttonOk.Click += new System.EventHandler(this.ButtonOkClick);
//
// buttonCancel
//
@@ -82,7 +82,7 @@
this.listViewItemTypes.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listViewItemTypes.UseCompatibleStateImageBehavior = false;
this.listViewItemTypes.View = System.Windows.Forms.View.Tile;
- this.listViewItemTypes.DoubleClick += new System.EventHandler(this.listViewItemTypes_DoubleClick);
+ this.listViewItemTypes.DoubleClick += new System.EventHandler(this.ListViewItemTypesDoubleClick);
//
// imageList
//
@@ -101,7 +101,6 @@
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOk);
this.Name = "SelectItemDialog";
- this.Validating += new System.ComponentModel.CancelEventHandler(this.NewDataDialog_Validating);
this.ResumeLayout(false);
this.PerformLayout();
Index: Core/Common/src/Core.Common.Gui/Forms/SelectItemDialog.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/SelectItemDialog.cs (.../SelectItemDialog.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/SelectItemDialog.cs (.../SelectItemDialog.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -20,16 +20,25 @@
// All rights reserved.
using System;
-using System.ComponentModel;
using System.Drawing;
+using System.Linq;
using System.Windows.Forms;
+
using Core.Common.Controls.Dialogs;
using Core.Common.Gui.Properties;
namespace Core.Common.Gui.Forms
{
+ ///
+ /// Dialog that can be used to ask the user to select from a collection of options.
+ ///
public partial class SelectItemDialog : DialogBase
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The dialog parent for which this dialog should be
+ /// shown on top.
public SelectItemDialog(IWin32Window dialogParent) : base(dialogParent, Resources.plus, 320, 220)
{
InitializeComponent();
@@ -45,14 +54,21 @@
ControlHelper.SendMessage(Handle, 0x127, 0x30001, 0);
}
+ ///
+ /// Gets the data object corresponding to the item selected by the user or null if
+ /// no selection was made.
+ ///
public object SelectedItemTag
{
get
{
- return SelectedItem.Tag;
+ return SelectedItem != null ? SelectedItem.Tag : null;
}
}
+ ///
+ /// Gets the name of the selected item or null if no selection was made.
+ ///
public string SelectedItemTypeName
{
get
@@ -61,6 +77,13 @@
}
}
+ ///
+ /// Adds an option element to the dialog.
+ ///
+ /// The name of the element.
+ /// The category of the element.
+ /// The image of the element.
+ /// The data corresponding to the element.
public void AddItemType(string name, string category, Image image, object tag)
{
if (!ContainsCategory(category))
@@ -76,20 +99,6 @@
listViewItemTypes.Items[listViewItemTypes.Items.Count - 1].Tag = tag;
}
- protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
- {
- if (keyData == Keys.Down)
- {
- //return true;
- }
- if (keyData == Keys.Up)
- {
- //return true;
- }
-
- return base.ProcessCmdKey(ref msg, keyData);
- }
-
protected override Button GetCancelButton()
{
return buttonCancel;
@@ -99,18 +108,12 @@
{
get
{
- if (listViewItemTypes.SelectedIndices.Count > 1)
- {
- throw new InvalidOperationException(Resources.SelectItemDialog_SelectedItem_Number_of_selected_items_must_be_1);
- }
-
if (listViewItemTypes.SelectedIndices.Count == 0)
{
return null;
}
int selectedIndex = listViewItemTypes.SelectedIndices[0];
-
return listViewItemTypes.Items[selectedIndex];
}
}
@@ -122,20 +125,12 @@
private bool ContainsCategory(string category)
{
- foreach (ListViewGroup listViewGroup in listViewItemTypes.Groups)
- {
- if (listViewGroup.Header == category)
- {
- return true;
- }
- }
-
- return false;
+ return listViewItemTypes.Groups
+ .Cast()
+ .Any(listViewGroup => listViewGroup.Header == category);
}
- private void NewDataDialog_Validating(object sender, CancelEventArgs e) {}
-
- private void buttonOk_Click(object sender, EventArgs e)
+ private void ButtonOkClick(object sender, EventArgs e)
{
if (SelectedItem == null)
{
@@ -144,7 +139,7 @@
}
}
- private void listViewItemTypes_DoubleClick(object sender, EventArgs e)
+ private void ListViewItemTypesDoubleClick(object sender, EventArgs e)
{
buttonOk.PerformClick();
}
Index: Core/Common/src/Core.Common.Gui/Forms/SelectViewDialog.Designer.cs
===================================================================
diff -u -ra600b08ffb5dac8164691824fe6dc7f4e96814d0 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/SelectViewDialog.Designer.cs (.../SelectViewDialog.Designer.cs) (revision a600b08ffb5dac8164691824fe6dc7f4e96814d0)
+++ Core/Common/src/Core.Common.Gui/Forms/SelectViewDialog.Designer.cs (.../SelectViewDialog.Designer.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -57,9 +57,9 @@
this.listBox.FormattingEnabled = true;
this.listBox.Name = "listBox";
this.listBox.Sorted = true;
- this.listBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.listBox_DrawItem);
- this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged);
- this.listBox.DoubleClick += new System.EventHandler(this.listBox_DoubleClick);
+ this.listBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ListBoxDrawItem);
+ this.listBox.SelectedIndexChanged += new System.EventHandler(this.ListBoxSelectedIndexChanged);
+ this.listBox.DoubleClick += new System.EventHandler(this.ListBoxDoubleClick);
//
// label1
//
@@ -71,7 +71,7 @@
resources.ApplyResources(this.checkBoxDefault, "checkBoxDefault");
this.checkBoxDefault.Name = "checkBoxDefault";
this.checkBoxDefault.UseVisualStyleBackColor = true;
- this.checkBoxDefault.CheckedChanged += new System.EventHandler(this.checkBoxDefault_CheckedChanged);
+ this.checkBoxDefault.CheckedChanged += new System.EventHandler(this.CheckBoxDefaultCheckedChanged);
//
// SelectViewDialog
//
Index: Core/Common/src/Core.Common.Gui/Forms/SelectViewDialog.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/src/Core.Common.Gui/Forms/SelectViewDialog.cs (.../SelectViewDialog.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Core/Common/src/Core.Common.Gui/Forms/SelectViewDialog.cs (.../SelectViewDialog.cs) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -28,10 +28,18 @@
namespace Core.Common.Gui.Forms
{
+ ///
+ /// Dialog for selecting a view for a given piece of data.
+ ///
public partial class SelectViewDialog : DialogBase
{
private IList items;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The dialog parent for which this dialog should be
+ /// shown on top.
public SelectViewDialog(IWin32Window dialogParent) : base(dialogParent, Resources.arrow_000_medium_question_mark, 350, 200)
{
InitializeComponent();
@@ -44,6 +52,9 @@
listBox.ItemHeight = (int) itemSize.Height;
}
+ ///
+ /// Gets or sets the items to select from.
+ ///
public IList Items
{
get
@@ -58,6 +69,9 @@
}
}
+ ///
+ /// Gets or sets the selected item.
+ ///
public string SelectedItem
{
get
@@ -70,20 +84,23 @@
}
}
+ ///
+ /// Gets or sets the name of the default view for the data.
+ ///
public string DefaultViewName { get; set; }
protected override Button GetCancelButton()
{
return buttonCancel;
}
- private void listBox_DoubleClick(object sender, EventArgs e)
+ private void ListBoxDoubleClick(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
- private void listBox_DrawItem(object sender, DrawItemEventArgs e)
+ private void ListBoxDrawItem(object sender, DrawItemEventArgs e)
{
string itemAsString = listBox.Items[e.Index].ToString();
Font lbFont = listBox.Font;
@@ -113,13 +130,13 @@
e.DrawFocusRectangle();
}
- private void listBox_SelectedIndexChanged(object sender, EventArgs e)
+ private void ListBoxSelectedIndexChanged(object sender, EventArgs e)
{
checkBoxDefault.Checked = (listBox.SelectedItem != null &&
listBox.SelectedItem.ToString() == DefaultViewName);
}
- private void checkBoxDefault_CheckedChanged(object sender, EventArgs e)
+ private void CheckBoxDefaultCheckedChanged(object sender, EventArgs e)
{
string previousName = DefaultViewName;
if (listBox.SelectedItem.ToString() == DefaultViewName)
Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj
===================================================================
diff -u -re4ee8a21ab07f3446dc417e50574b6bc6106f460 -r652b03cb8115830641e05bffb356bcf5779bc9f0
--- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision e4ee8a21ab07f3446dc417e50574b6bc6106f460)
+++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -116,6 +116,8 @@
+
+
Index: Core/Common/test/Core.Common.Gui.Test/Forms/RichTextFileTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Gui.Test/Forms/RichTextFileTest.cs (revision 0)
+++ Core/Common/test/Core.Common.Gui.Test/Forms/RichTextFileTest.cs (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -0,0 +1,41 @@
+using Core.Common.Gui.Forms;
+
+using NUnit.Framework;
+
+namespace Core.Common.Gui.Test.Forms
+{
+ [TestFixture]
+ public class RichTextFileTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Setup
+
+ // Call
+ var file = new RichTextFile();
+
+ // Assert
+ Assert.IsNull(file.Name);
+ Assert.IsNull(file.FilePath);
+ }
+
+ [Test]
+ public void SimpleProperties_SetNewValue_GetNewlySetValue()
+ {
+ // Setup
+ var file = new RichTextFile();
+
+ const string newName = "";
+ const string newPath = "";
+
+ // Call
+ file.Name = newName;
+ file.FilePath = newPath;
+
+ // Assert
+ Assert.AreEqual(newName, file.Name);
+ Assert.AreEqual(newPath, file.FilePath);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Gui.Test/Forms/RichTextViewTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Gui.Test/Forms/RichTextViewTest.cs (revision 0)
+++ Core/Common/test/Core.Common.Gui.Test/Forms/RichTextViewTest.cs (revision 652b03cb8115830641e05bffb356bcf5779bc9f0)
@@ -0,0 +1,26 @@
+using System.Windows.Forms;
+
+using Core.Common.Controls.Views;
+using Core.Common.Gui.Forms;
+
+using NUnit.Framework;
+
+namespace Core.Common.Gui.Test.Forms
+{
+ [TestFixture]
+ public class RichTextViewTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ using (var view = new RichTextView())
+ {
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
+ Assert.IsNull(view.Data);
+ }
+ }
+ }
+}
\ No newline at end of file