Example #1
0
        public ShuffListBox(int x, int y, Number width, Number height,List<ShuffListItem> items=null )
        {
            var but = jQuery.Select("<div style='position:absolute;'></div>");
            Element = but;

            X = x;
            Y = y;
            Width = width;
            Height = height;
            Visible = true;
            Items =items?? new List<ShuffListItem>();

            var theme = "getTheme()".eval();
            ExtensionMethods.me(but).jqxListBox(new {source = Items, width = (int) width, height = (int) height, theme = theme});

            Window.SetTimeout(() => {
                                  but.GetElement(0).Style.Left = X + "px";
                                  but.GetElement(0).Style.Top = Y + "px";
                              },
                              2000);

            but.Bind("select",
                     (e) => {
                         var item = ExtensionMethods.Cast<ShuffListItem>((object) ( e.me().args.item ));

                         SelectedItem = item;

                         if (OnClick != null)
                             OnClick(item);
                     });

            Update();
        }
Example #2
0
        public ShuffCodeEditor(int x, int y, Number width, Number height, string text)
        {
            dynamic fmw = width;
            dynamic fmh = height;
            if (!fmw)
                width = "100%";
            if (!fmh)
                height = "100%";

            var divs = jQuery.Select("<div style='width:" + width + "; height:" + height + "'> </div>");

            var fm = jQuery.FromHtml("<textarea id='code' name='code' class='CodeMirror-fullscreen ' style=''></textarea>");
            divs.Append(fm);
            Element = divs;

            codeMirror = new CodeMirrorInformation {
                                                           element = (TextAreaElement) fm.GetElement(0)
                                                   };

            codeMirror.element.Value = Text = text;

            LineNumbers = true;
            X = x;
            Y = y;
            Width = width;
            Height = height;
            Visible = true;
            SizeChanged += (e) => {
                               Window.Alert(e.Width + " " + e.Height);
                               jQuery.FromElement(codeMirror.element).Width(e.Width);
                               jQuery.FromElement(codeMirror.element).Height(e.Height);
                           };
        }
Example #3
0
        public ShuffButton(int x, int y, Number width, Number height, DelegateOrValue<string> text, ShuffUIEvent<ButtonClickedEvent> click)
        {
            Element = jQuery.Select("<div></div>");
            Element.CSS("position", "absolute");

            Text = text;

            Text.StaticValueChanges += (value) => { Element.Text(value); };

            Element.Text(Text);
            X = x;
            Y = y;
            Width = width;
            Height = height;
            Visible = true;
            WidgetExtensions.Button(Element);
            Element.Click(a => click(new ButtonClickedEvent(a.ClientX, a.ClientY)));

            ImportedExtensionMethods.DisableSelection(Element);
        }
Example #4
0
 public ShuffElement()
 {
     myWidth = 0;
     myHeight = 0;
     BindEvents();
 }
Example #5
0
        internal void BindEvents()
        {
            SizeChanged += (e) => {
                               if (( (dynamic) e.Width )) {
                                   myWidth = e.Width;
                                   Element.CSS("width", e.Width);
                               }
                               if (( (dynamic) e.Height )) {
                                   myHeight = e.Height;

                                   Element.CSS("height", e.Height);
                               }
                           };
            ParentSizeChanged += (e) => {
                                     switch (Dock) {
                                         case DockStyle.None:
                                             break;
                                         case DockStyle.Fill:
                                             Width = e.Width;
                                             Height = e.Height;
                                             break;
                                         case DockStyle.FillWidth:
                                             Width = e.Width;
                                             break;
                                         case DockStyle.FillHeight:
                                             Height = e.Height;
                                             break;
                                     }
                                 };
            PositionChanged += (e) => {
                                   Element.CSS("left", e.X + "px");
                                   Element.CSS("top", e.Y + "px");
                               };

            VisibleChanged += (e) => Element.CSS("display", e.Visible ? "block" : "none");

            ParentChanged += ( (e) => {
                                   Parent = e.Parent;

                                   if (Parent == null)
                                       Element.Remove();
                                   else
                                       Parent.Element.Append(Element);
                               } );
            BindCustomEvents();
        }