- spinner.zip
- CustomControls
- bin
- calendar
- css
- img
- ui-bg_flat_0_aaaaaa_40x100.png
- ui-bg_flat_75_ffffff_40x100.png
- ui-bg_glass_55_fbf9ee_1x400.png
- ui-bg_glass_65_ffffff_1x400.png
- ui-bg_glass_75_dadada_1x400.png
- ui-bg_glass_75_e6e6e6_1x400.png
- ui-bg_glass_95_fef1ec_1x400.png
- ui-bg_highlight-soft_75_cccccc_1x100.png
- ui-icons_222222_256x240.png
- ui-icons_2e83ff_256x240.png
- ui-icons_454545_256x240.png
- ui-icons_888888_256x240.png
- ui-icons_cd0a0a_256x240.png
- js
- colorpicker
- css
- img
- colorpicker_overlay.png
- colorpicker_select.gif
- custom_background.png
- custom_cancel.png
- custom_hex.png
- custom_hsb_b.png
- custom_hsb_h.png
- custom_hsb_s.png
- custom_indic.gif
- custom_rgb_b.png
- custom_rgb_g.png
- custom_rgb_r.png
- custom_submit.png
- js
- elrte
- css
- img
- elrte-toolbar.png
- pixel.gif
- js
- lang
- obj
- Debug
- DesignTimeResolveAssemblyReferences.cache
- DesignTimeResolveAssemblyReferencesInput.cache
- ResGen.read.1.tlog
- ResGen.write.1.tlog
- TempPE
- VisualJS.Web.Forms.SliderControl.resources
- WebControls.csproj.FileListAbsolute.txt
- WebControls.dll
- WebControls.pdb
- x86
- Debug
- DesignTimeResolveAssemblyReferencesInput.cache
- ResGen.read.1.tlog
- ResGen.write.1.tlog
- TempPE
- VisualJS.Web.Forms.SliderControl.resources
- WebControls.csproj.FileListAbsolute.txt
- WebControls.dll
- WebControls.pdb
- Properties
- slider
- css
- img
- arrows.png
- bullets.png
- loading.gif
- js
- spinner
- css
- img
- ui-bg_diagonals-thick_18_b81900_40x40.png
- ui-bg_diagonals-thick_20_666666_40x40.png
- ui-bg_flat_10_000000_40x100.png
- ui-bg_glass_100_f6f6f6_1x400.png
- ui-bg_glass_100_fdf5ce_1x400.png
- ui-bg_glass_65_ffffff_1x400.png
- ui-bg_gloss-wave_35_f6a828_500x100.png
- ui-bg_highlight-soft_100_eeeeee_1x100.png
- ui-bg_highlight-soft_75_ffe45c_1x100.png
- ui-icons_222222_256x240.png
- ui-icons_228ef1_256x240.png
- ui-icons_ef8c08_256x240.png
- ui-icons_ffd27a_256x240.png
- ui-icons_ffffff_256x240.png
- js
- Web
- WebControls.csproj
- WebControls.csproj.user
- SpinnerTest
- VisualJSSetup_1.042.zip
- spinner-noexe.zip
|
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using VisualJS.Kernel.Controls;
using VisualJS.Service;
using VisualJS.Kernel;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace VisualJS.Web.Forms
{
[ToolboxItem(true)]
[ToolboxBitmap(typeof(System.Windows.Forms.ComboBox))]
[Description("VisualJS ImageDropDown Control")]
public class ImageDropDown : ComboBox
{
public ImageDropDown()
: base("ImageDropDown")
{
Items = new ImageDropDownItems(this);
this.OnCommit = Resources;
}
private void Resources()
{
VisualJS.Kernel.Settings.ActivateJQuery = true;
if (ComponentRegister.Register(typeof(ImageDropDown)))
{
Assembly appAsm = Assembly.GetExecutingAssembly();
ComponentRegister.RegisterFolder(appAsm, "WebControls.dropdown");
ComponentRegister.Merge(
new string[] { "WebControls.dropdown.js.jquery.dd.js", "WebControls.dropdown.js.dropdown.js" },
"WebControls.dropdown.js",
"js",
Encoding.UTF8);
string CSS = ComponentRegister.GetText("WebControls.dropdown.css.dropdown.css", Encoding.UTF8);
string[] resNames = appAsm.GetManifestResourceNames();
foreach (string resName in resNames)
{
if (resName.StartsWith("WebControls.dropdown.img"))
{
string fileName = resName.Replace("WebControls.dropdown.img.", "");
CSS = CSS.Replace(
"img/" + fileName, "[$$VisualJSResourceTarget$$]?name=" + resName + "&type=image");
}
}
ComponentRegister.SetText("WebControls.dropdown.css.dropdown.css", CSS, Encoding.UTF8);
}
this.ClientLoadCheck("WebControls.dropdown.js", ClientSideDocuments.Script);
this.ClientLoadCheck("WebControls.dropdown.css.dropdown.css", ClientSideDocuments.CSS);
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new ImageDropDownItems Items;
public class ImageDropDownItems : ObjectCollection, IList
{
internal ImageDropDown owner_box;
internal List<object> items = new List<object>();
public ImageDropDownItems(ImageDropDown owner)
: base(owner)
{
owner_box = owner;
}
internal ImageItem Convert(object item)
{
ImageItem iitem;
if (item.GetType() == typeof(string) || item.GetType() == typeof(double)
|| item.GetType() == typeof(long) || item.GetType() == typeof(char) || item.GetType() == typeof(int)
|| item.GetType() == typeof(decimal) || item.GetType() == typeof(bool)
|| item.GetType() == typeof(float)) iitem = new ImageItem(item.ToString());
else if (item.GetType() == typeof(ImageItem)) iitem = (ImageItem)item;
else throw new Exception("This value type is not supported by ImageDropDown component");
return iitem;
}
public new Int32 Add(object item)
{
ImageItem iitem = Convert(item);
return Add(iitem);
}
internal void ItemAdding(ref ImageItem item)
{
owner_box.SetMethod("AddItem", new object[] { new Kernel.JSON(PokeIn.JSON.ClassTo(item)) });
}
public Int32 Add(ImageItem item)
{
int index;
lock (items)
{
items.Add(item);
index = items.Count - 1;
}
ItemAdding(ref item);
return index;
}
public new void Remove(object item)
{
int pos;
lock (items)
{
pos = items.IndexOf(item);
if (pos >= 0) items.RemoveAt(pos);
}
if (pos >= 0)
{
owner_box.SetMethod("RemoveAt", new object[] { pos });
}
}
public void Remove(ImageItem item)
{
Remove((object)item);
}
public new void RemoveAt(int index)
{
lock (items)
{
items.RemoveAt(index);
}
owner_box.SetMethod("RemoveAt", new object[] { index });
}
public new void Clear()
{
lock (items)
{
items.Clear();
}
owner_box.SetMethod("ClearItems", null);
}
public new void AddRange(object[] _items)
{
foreach (object item in _items)
{
Add(item);
}
}
public void AddRange(ImageItem[] _items)
{
foreach (ImageItem item in _items)
{
Add(item);
}
}
internal new void Insert(Int32 index, object item)
{
Insert(index, Convert(item));
}
public void Insert(Int32 index, ImageItem item)
{
lock (items)
{
items.Insert(index, item);
}
owner_box.SetMethod("InsertItem", new object[] { index, new Kernel.JSON(PokeIn.JSON.ClassTo(item)) });
}
public new ImageItem this[int index]
{
get
{
return (ImageItem)base[index];
}
}
}
public class ImageItem
{
internal string i_text = "", i_image = " ";
internal bool i_enabled = true;
public ImageItem(string title, string imageURL, bool enabled)
{
i_image = imageURL;
i_text = title;
i_enabled = enabled;
}
public ImageItem(string title, string imageURL)
{
i_image = imageURL;
i_text = title;
}
public ImageItem(string title)
{
i_text = title;
}
public bool Enabled
{
get
{
return i_enabled;
}
}
public string Text
{
get
{
return i_text;
}
}
public string ImageURL
{
get
{
return i_image;
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.