public Board(SpiderView spiderView) { this.SpiderView = spiderView; this.Stylesheet = (this.SpiderView).Stylesheet; this.Click += Board_Click; this.MouseUp += Board_MouseUp; this.MouseClick += Board_MouseClick; this.MinimumSize = new Size(640, 480); this.MouseDown += Board_MouseDown; InitializeComponent(); this.DragDrop += Board_DragDrop; this.DragOver += Board_DragOver; this.Paint += Board_Paint; this.Resize += Board_Resize; this.DragEnter += Board_DragEnter; this.Block = Stylesheet.Blocks["Body"]; tmrDraw = new Timer(); tmrDraw.Tick += tmrDraw_Tick; tmrDraw.Interval = 100; tmrDraw.Start(); this.MouseMove += Board_MouseMove; spiderView.Scripting.RegisterFunction("getInput", new lua_delegate_get_input(lua_get_input), this); // Register some other goodies here::? spiderView.Scripting.RegisterFunction("getWebResource", new lua_delegate_download_http(lua_download_http), this); spiderView.Scripting.RegisterFunction("sendToWeb", new lua_delegate_send_http_request(lua_send_http_request), this); spiderView.Scripting.RegisterFunction("json", new get_obj(get_json), this); this.MouseDoubleClick += Board_MouseDoubleClick; this.KeyDown += Board_KeyDown; Timer t = new Timer(); t.Tick += t_Tick; }
public SpiderView(SpiderHost host) { this.Host = host; this.Scripting = new Scripting.LuaInterpreter(this); this.Preprocessor = new Preprocessor.LuaMako(this); this.Scripting.RegisterFunction("refresh", GetType().GetMethod("refresh"), this); this.timer = new Timer(); InitializeComponent(); this.tabBar = new TabBar(this); this.deck = new Panel(); tabBar.Dock = DockStyle.Top; tabBar.Height = 23; this.Controls.Add(deck); this.Controls.Add(tabBar); deck.Dock = DockStyle.Fill; this.tabBar.Dock = DockStyle.Top; Block = Stylesheet.Blocks["Body"]; this.BackColor = Block.BackColor; this.ForeColor = Block.ForeColor; this.tabBar.TabChange += tabBar_TabChange; this.timer.Tick += timer_Tick; this.timer.Interval = 1000; this.Click += SpiderView_Click; }
public void Slice(Bitmap bitmap) { // Get tab bar var tabTitle = new Block(this, bitmap.GetPixel(1, 0), bitmap.GetPixel(1, 0), bitmap.GetPixel(4, 0), bitmap.GetPixel(1, 0)); this.Blocks.Add("infobar::info", new Block(this, sliceBitmap(bitmap, new Rectangle(187, 98, 90 ,30)), Color.Black, Color.White, Color.Black)); this.blocks["infobar::info"].Height = 30; this.blocks["infobar::info"].Padding.Left = 10; this.blocks["infobar::info"].Padding.Top = 10; this.blocks.Add(".adivider", new Block(this, bitmap.GetPixel(15, 0), bitmap.GetPixel(16, 0), bitmap.GetPixel(16, 0), bitmap.GetPixel(16, 0))); this.blocks.Add(".h1", new Block(this, Color.Transparent, bitmap.GetPixel(16, 0), bitmap.GetPixel(16, 0), bitmap.GetPixel(16, 0))); this.blocks[".h1"].Font = new Font("Helvetica", 10); this.Blocks[".adivider"].Font = new Font("Helvetica", 13, FontStyle.Regular, GraphicsUnit.Pixel); this.blocks[".adivider"].Height = 22; this.blocks[".adivider"].Width = -1; this.blocks.Add("TabBar::title", tabTitle); tabTitle.Font = new Font("MS Sans Serif", 8f, FontStyle.Bold); this.Blocks.Add("TabBar", new Block(this, sliceBitmap(bitmap, new Rectangle(99, 1, 2, 23)), bitmap.GetPixel(1, 0), bitmap.GetPixel(4, 0), bitmap.GetPixel(0, 0))); this.Blocks.Add("TabBar::active", new Block(this, sliceBitmap(bitmap, new Rectangle(0, 1, 39, 22)), Color.Black, Color.White, bitmap.GetPixel(1, 0))); Block track = new Block(/*sliceBitmap(bitmap, new Rectangle(0, 24, 50, 23))*/this, bitmap.GetPixel(11, 0), bitmap.GetPixel(21, 0), Color.Black, Color.White); this.Blocks.Add("track", track); track.Font = new Font("MS Sans Serif", 8, FontStyle.Regular, GraphicsUnit.Pixel); this.blocks.Add("listitem", new Block(this, bitmap.GetPixel(19, 0), bitmap.GetPixel(19, 0), bitmap.GetPixel(19, 0), bitmap.GetPixel(19, 0))); var trackSelected = new Block(this, bitmap.GetPixel(6, 0), bitmap.GetPixel(5, 0), Color.Transparent, Color.Black); trackSelected.Font = new Font("MS Sans Serif", 8); this.blocks.Add("track::selected", trackSelected); var even = new Block(this, bitmap.GetPixel(0, 0), track.ForeColor, track.TextShadowColor, track.AlternateBackColor); even.Font = new Font("MS Sans Serif", 8); this.blocks.Add("track::even", even) ; track.AlternateBackColor = bitmap.GetPixel(9, 0); track.Font = new Font("MS Sans Serif", 8); this.Blocks.Add("track::playing", new Block(this, Color.Black, Color.LightGreen, Color.Black, Color.White)); this.Blocks.Add("Divider", new Block(this, sliceBitmap(bitmap, new Rectangle(0, 24, 50, 23)), Color.White, Color.Black, Color.White)); this.Blocks.Add("::selection", new Block(this, bitmap.GetPixel(6, 0), bitmap.GetPixel(5, 0), Color.Black, Color.White)); var ch = new Block(this, sliceBitmap(bitmap, new Rectangle(0, 99, 65, 19)), bitmap.GetPixel(3, 117), bitmap.GetPixel(65, 99), bitmap.GetPixel(3, 117)); ch.Font = new Font("MS Sans Serif", 8); this.Blocks.Add("columnheader", ch); this.blocks.Add("hr", new Block(this, Color.FromArgb(0, 0, 0, 0), bitmap.GetPixel(15, 1), Color.White, Color.Black)); this.Blocks.Add("ListView", new Block(this, bitmap.GetPixel(20, 0), Color.White, Color.Black, bitmap.GetPixel(8, 0))); this.Blocks.Add("Body", new Block(this, bitmap.GetPixel(0, 0), bitmap.GetPixel(1, 0), Color.Black, bitmap.GetPixel(8, 0))); this.blocks["Body"].Font = new Font("Tahoma", 8f, FontStyle.Regular); var btn = new Block(this, sliceBitmap(bitmap, new Rectangle(128, 1, 105, 20)), Color.Black, Color.White, Color.Black); var btnPressed = new Block(this, sliceBitmap(bitmap, new Rectangle(128, 22, 105, 20)), Color.Black, Color.White, Color.Black); this.blocks.Add("button", btn); this.blocks.Add(".biography", new Block(this, Color.FromArgb(255, 255, 255, 233), Color.Black, Color.White, Color.Black)); this.blocks.Add("button:active", btnPressed); btn.Font = new Font("MS Sans Serif", 8); btnPressed.Font = new Font("MS Sans Serif", 8); this.blocks.Add("backbtn", new Block(this, sliceBitmap(bitmap, new Rectangle(128, 42, 27, 20)), Color.White, Color.Black, Color.White)); this.blocks.Add("backbtn:active", new Block(this, sliceBitmap(bitmap, new Rectangle(128, 61, 27, 20)), Color.White, Color.Black, Color.White)); this.blocks.Add("backbtn:disabled", new Block(this, sliceBitmap(bitmap, new Rectangle(128, 184, 27, 20)), Color.White, Color.Black, Color.White)); this.blocks.Add("forebtn", new Block(this, sliceBitmap(bitmap, new Rectangle(155, 42, 27, 20)), Color.White, Color.Black, Color.White)); this.blocks.Add("forebtn:active", new Block(this, sliceBitmap(bitmap, new Rectangle(155, 61, 27, 20)), Color.White, Color.Black, Color.White)); this.blocks.Add("forebtn:disabled", new Block(this, sliceBitmap(bitmap, new Rectangle(155, 184, 27, 20)), Color.White, Color.Black, Color.White)); this.blocks.Add("header", new Block(this, sliceBitmap(bitmap, new Rectangle(214, 0, 92, 55)), Color.Black, Color.White, Color.Black)); this.blocks.Add("tab:divider", new Block(this, bitmap.GetPixel(123, 3), bitmap.GetPixel(97, 3), Color.Black, Color.Black)); this.blocks.Add("::sub", new Block(this, bitmap.GetPixel(17, 0), bitmap.GetPixel(17, 0), bitmap.GetPixel(17, 0), bitmap.GetPixel(17, 0))); }
public infobar(Style style) { stylesheet = style; this.InfoBlock = (Block)style.Blocks["infobar::info"].Clone(); this.Height = this.InfoBlock.Height; blinkTimer.Tick += blinkTimer_Tick; blinkTimer.Interval = 50; }
public TabBar(SpiderView spiderView) { InitializeComponent(); this.SpiderView = spiderView; this.Block = spiderView.Stylesheet.Blocks["TabBar"]; this.ActiveTabBlock = spiderView.Stylesheet.Blocks["TabBar::active"]; this.TitleBlock = spiderView.Stylesheet.Blocks["TabBar::title"]; TabDivider = spiderView.Stylesheet.Blocks["tab:divider"]; this.MouseMove += TabBar_MouseMove; this.Resize += TabBar_Resize; this.MouseClick += TabBar_MouseClick; }
public Block(String code, Block parent) { Aleros.CSS.Selector selector = new Aleros.CSS.Selector("@internal", code); this.Padding = new Padding("0"); this.Margin = new Margin("1"); foreach (Aleros.CSS.Rule rule in selector.rules) { if (rule.rule == "-alternative-background-color") { this.AlternateBackColor = ColorTranslator.FromHtml(rule.value); } else { this.AlternateBackColor = parent.BackColor; } if (rule.rule == "background" || rule.rule == "background-color") { this.BackColor = ColorTranslator.FromHtml(rule.value); } else { this.BackColor = parent.BackColor; } if (rule.rule == "font-color") { this.ForeColor = ColorTranslator.FromHtml(rule.value); } else { this.ForeColor = parent.ForeColor; } if (rule.rule == "padding") { this.Padding = new Padding(rule.value); } else { this.Padding = parent.Padding; } if (rule.rule == "margin") { this.Margin = new Margin(rule.value); } else { this.Margin = parent.Margin; } } }
public AppHeader(Style stylesheet) { InitializeComponent(); this.Stylesheet =stylesheet; this.Paint += AppHead_Paint; this.Background = Stylesheet.Blocks["header"]; this.MouseDown += AppHead_MouseDown; this.MouseClick += AppHead_MouseClick; Control backButton = new Control(this, "backbtn", new Rectangle(7, 28, 27, 21)); backButton.MouseClick += backButton_MouseClick; Control foreButton = new Control(this, "forebtn", new Rectangle(35, 28, 27, 21)); foreButton.MouseClick += foreButton_MouseClick; this.SubControls.Add(backButton); this.SubControls.Add(foreButton); }
public Board() { InitializeComponent(); this.Paint += Board_Paint; this.Stylesheet = SpiderView.Stylesheet; this.Block = (Spider.Skinning.Block)Stylesheet.Blocks["body"].Clone(); this.ForeColor = Block.ForeColor; this.ForeColor = Block.BackColor; tmrDraw = new Timer(); tmrDraw.Tick += tmrDraw_Tick; tmrDraw.Interval = 100; tmrDraw.Start(); this.MouseMove += Board_MouseMove; this.MouseDoubleClick += Board_MouseDoubleClick; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); }
public object Clone() { Block newSelector = new Block(this.Stylesheet, BackColor, ForeColor, TextShadowColor, AlternateBackColor); if (this.BackgroundImage != null) newSelector.BackgroundImage = this.BackgroundImage; newSelector.Padding = Padding; newSelector.Margin = Margin; newSelector.BackColor = BackColor; newSelector.Font = Font; newSelector.ForeColor = ForeColor; newSelector.Stylesheet = this.Stylesheet; newSelector.Width = this.Width; newSelector.Height = this.Height; return newSelector; }
private Block GetBlock(XmlElement elm) { String BlockName = elm.GetAttribute("ci"); Block sel = null; if (!this.Blocks.ContainsKey(BlockName)) { sel = new Block(); this.Blocks.Add(BlockName, sel); } switch (elm.Name) { case "color": if (elm.HasAttribute("color")) sel.ForeColor = ColorTranslator.FromHtml(elm.GetAttribute("color")); break; case "bitmap": if (elm.HasAttribute("edge") && elm.HasAttribute("file")) { Edge edge = new Edge(elm.GetAttribute("edge")); XmlNodeList subBitmaps = elm.GetElementsByTagName("subBitmap"); int i = 0; Bitmap bitmap = LoadBitmap(elm.GetAttribute("file")); foreach (XmlElement subBitmap in subBitmaps) { String BlockName2 = subBitmap.GetAttribute("ci") + (subBitmap.HasAttribute("Block") ? "|" + subBitmap.GetAttribute("Block") : ""); Block sel2 = null; if (!this.Blocks.ContainsKey(BlockName2)) { sel2 = new Block(); this.Blocks.Add(BlockName2, sel2); } else { sel2 = this.Blocks[BlockName2]; } Rectangle edge2 = new Rectangle(edge.Left, edge.Top, edge.Right, edge.Bottom); if(subBitmap.HasAttribute("width")) { int width = int.Parse(subBitmap.GetAttribute("width")); edge2 = new Rectangle(i * width, edge.Top, width, bitmap.Height); } else if (subBitmap.HasAttribute("height")) { int height = int.Parse(subBitmap.GetAttribute("height")); edge2 = new Rectangle(0, edge.Top + i *height, bitmap.Width, height); } sel2.BackgroundImage = SliceBitmap(bitmap, edge2); } } break; case "font": sel.Font = new Font(elm.GetAttribute("face"), int.Parse(elm.GetAttribute("size"))); sel.ForeColor = ColorTranslator.FromHtml(elm.GetAttribute("color")); sel.TextShadowColor = ColorTranslator.FromHtml(elm.HasAttribute("shadow_up") ? elm.GetAttribute("shadow_up") : elm.HasAttribute("shadow_down") ? elm.GetAttribute("shadow_down") : elm.HasAttribute("shadow") ? elm.GetAttribute("shadow") : ""); break; } return sel; }
public CListView(SectionView sv) { this.DoubleBuffered = true; this.Section = sv; this.DragDrop +=CListView_DragDrop; this.AllowDrop = true; this.AllowsReoreder = true; this.Block = (Block)this.Section.Board.Stylesheet.Blocks["track"].Clone(); this.HeaderBlock = (Block)this.Section.Board.Stylesheet.Blocks["columnheader"].Clone(); this.PlayingBlock = (Block)this.Section.Board.Stylesheet.Blocks["track::playing"].Clone(); this.BackColor = this.Block.BackColor; this.SelectedBlock = (Block)this.Section.Board.Stylesheet.Blocks["track::selected"].Clone(); this.AlternateBlock = (Block)this.Section.Board.Stylesheet.Blocks["track::even"].Clone(); InitializeComponent(); AlternateRows = true; this.Paint += new PaintEventHandler(CListView_Paint); this.FullRowSelect = true; // lvwColumnSorter = new MediaChrome.ListViewColumnSorter(); EngineImages = new Dictionary<string, Image>(); this.timer1 = new Timer(); this.timer1.Tick += new EventHandler(timer1_Tick); this.timer1.Interval = 150; this.timer1.Start(); this.MouseUp += CListView_MouseUp; this.MouseWheel += new MouseEventHandler(CListView_MouseWheel); this.OwnerDraw = true; this.Scroll += new ScrollEventHandler(CListView_Scroll); this.VScroll = true; }
public Block(Style parentStyle, String code, Block parent) { Aleros.CSS.Selector selector = new Aleros.CSS.Selector("@internal", code); this.Padding = new Padding("0"); this.Margin = new Margin("1"); foreach (Aleros.CSS.Rule rule in selector.rules) { if (rule.rule == "-alternative-background-color") { this.AlternateBackColor = ColorTranslator.FromHtml(rule.value); } else { this.AlternateBackColor = parent.BackColor; } if (rule.rule == "background" || rule.rule == "background-color") { try { CSSFunction func = new CSSFunction(rule.value); String imageName = func.Arguments[0]; int x = int.Parse(func.Arguments[1]); int y = int.Parse(func.Arguments[2]); int width = int.Parse(func.Arguments[3]); int height = int.Parse(func.Arguments[4]); if (func.Name == "-spider-slice-bitmap") { this.BackgroundImage = sliceBitmap((Bitmap)parentStyle.Images[imageName], new Rectangle(x, y, width, height)); } } catch (Exception e) { this.BackColor = ColorTranslator.FromHtml(rule.value); } } else { this.BackColor = parent.BackColor; } if (rule.rule == "font-color") { this.ForeColor = ColorTranslator.FromHtml(rule.value); } else { this.ForeColor = parent.ForeColor; } if (rule.rule == "padding") { this.Padding = new Padding(rule.value); } else { this.Padding = parent.Padding; } if (rule.rule == "margin") { this.Margin = new Margin(rule.value); } else { this.Margin = parent.Margin; } } }
public SPListItem(SPListView parent, String uri, String title) { this.Block = (Block)parent.Block.Clone(); this.SelectedBlock = (Block)parent.SelectedBlock.Clone(); this.DividerBlock = (Block)parent.stylesheet.Blocks["hr"].Clone(); this.ParentListView = parent; this.parent = parent; this.Uri = new Uri(uri); this.Children = new List<SPListItem>(); this.Text = title; this.SubBlock = parent.stylesheet.Blocks["::sub"]; }
public SPListItem(SPListView parent, String uri) { this.parent = parent; this.ParentListView = parent; this.Block = (Block)parent.stylesheet.Blocks["listitem"].Clone(); this.SelectedBlock = (Block)parent.SelectedBlock.Clone(); this.Uri = new Uri(uri); this.Children = new List<SPListItem>(); this.AppInstance = this.Parent.Host.LoadApp(uri.ToString()); AppInstance.Loaded += instance_Loaded; this.DividerBlock = (Block)parent.stylesheet.Blocks["hr"].Clone(); this.SubBlock = parent.stylesheet.Blocks["::sub"]; this.Text = "Loading.."; }
public void ApplyStyle(Block Block) { this.Block.ForeColor = Block.ForeColor; this.BackColor = Block.BackColor; this.Block.Font = (Font)Block.Font.Clone(); this.Block.Padding = Block.Padding; this.Width = Block.Width; this.Height = Block.Height; }
public track(Board host, XmlElement node) : base(host, node) { this.Visible = false; this.node = node; IMusicService ms = host.SpiderView.Host.MusicService; this.Visible = false; this.Track = new Track(ms, node.GetAttribute("uri").Split(':')[2]); this.Track.TrackLoaded += Track_TrackLoaded; this.Track.Element = this; this.Track.LoadAsync(this); this.Track.Name = node.GetAttribute("name"); this.Block = (Block)this.Board.Stylesheet.Blocks["track"].Clone(); this.Block.Font = new Font("MS Sans Serif", 11, FontStyle.Regular, GraphicsUnit.Pixel); this.SelectedBlock = (Block)this.Board.Stylesheet.Blocks["track::selected"].Clone(); }
public button(Board host, XmlElement node) : base(host, node) { this.Width = 105; this.Height = 20; this.Block = (Block)host.Stylesheet.Blocks["button"].Clone(); this.PressedBlock = (Block)host.Stylesheet.Blocks["button:active"].Clone(); if (node.HasAttribute("text")) { this.Text = node.GetAttribute("text"); } }