DO NOT DOWNLOAD. DOWNLOAD LATEST STABLE FROM RELEASE TAB
Added Image Cropper datatype [TFS Changeset #55169]
This commit is contained in:
47
components/editorControls/imagecropper/SmartListBox.cs
Normal file
47
components/editorControls/imagecropper/SmartListBox.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace umbraco.editorControls.imagecropper
|
||||
{
|
||||
public class SmartListBox : ListBox
|
||||
{
|
||||
//Moves the selected items up one level
|
||||
public void MoveUp()
|
||||
{
|
||||
|
||||
for (int i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (Items[i].Selected)//identify the selected item
|
||||
{
|
||||
//swap with the top item(move up)
|
||||
if (i > 0 && !Items[i - 1].Selected)
|
||||
{
|
||||
ListItem bottom = Items[i];
|
||||
Items.Remove(bottom);
|
||||
Items.Insert(i - 1, bottom);
|
||||
Items[i - 1].Selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Moves the selected items one level down
|
||||
public void MoveDown()
|
||||
{
|
||||
int startindex = Items.Count - 1;
|
||||
for (int i = startindex; i > -1; i--)
|
||||
{
|
||||
if (Items[i].Selected)//identify the selected item
|
||||
{
|
||||
//swap with the lower item(move down)
|
||||
if (i < startindex && !Items[i + 1].Selected)
|
||||
{
|
||||
ListItem bottom = Items[i];
|
||||
Items.Remove(bottom);
|
||||
Items.Insert(i + 1, bottom);
|
||||
Items[i + 1].Selected = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user