Ejemplo n.º 1
0
        public EditorDesktop()
        {
            _project = Plugins.Container.ResolveNamed<GameObject>("Project");
            _project.Expanded = true;
            GuiHost.SetSkin(EditorSkin.CreateSkin());

            //Setup Tooltip
            var tt = new SimpleTooltip();
            tt.Delay = 2000;
            this.TooltipControl = tt;

            //Left Frame
            _frameLeft = this.AddFrame("frame", Width, 600, DockStyle.Left);
            _frameLeft.Opacity = 0.8f;

            var _toolbarFrame = _frameLeft.AddFrame(Width, 24, DockStyle.Top);

            _saveButton = _toolbarFrame.AddButton("save", 2, 2, 20, 20);
            _saveButton.Tooltip = Properties.Resources.SaveButtonToolTip;
            _saveButton.MouseClick += SaveButton_MouseClick;
            _loadButton = _toolbarFrame.AddButton("load", 24, 2, 20, 20);
            _loadButton.Tooltip = Properties.Resources.LoadButtonToolTip;
            _loadButton.MouseClick += LoadButton_MouseClick;

            _gameObjectDropDown = _toolbarFrame.AddDropDownList(46, 2, Width - 88);
            _gameObjectDropDown.SelectedItemChanged += GameObjectDropDown_SelectedItemChanged;
            _addGameObject = _toolbarFrame.AddDropDownButton(Width - 42, 2, DropDownButtonType.Plus);
            _addGameObject.Tooltip = Resources.AddGameObject;
            _addGameObject.MouseClick += AddGameObject_MouseClick;
            _removeGameObject = _toolbarFrame.AddDropDownButton(Width - 22, 2, DropDownButtonType.Minus);
            _removeGameObject.Tooltip = Resources.RemoveGameObject;
            _removeGameObject.MouseClick += RemoveGameObject_MouseClick;

            _splitContainer = _frameLeft.AddSplitContainer(Orientation.Vertical);

            _gameObjectTree = _splitContainer.SplitFrame1.AddTreeView(2, 42, 246, 330);
            _gameObjectTree.Dock = DockStyle.Fill;
            _gameObjectTree.SelectedNodeChanged += GameObjectTree_SelectedNodeChanged;

            var componentFrame = _splitContainer.SplitFrame2.AddFrame(0, 20, DockStyle.Top);
            _componentsDropDown = componentFrame.AddDropDownList(2, 2, Width - 44);
            _componentsDropDown.SelectedItemChanged += ComponentsDropDown_SelectedItemChanged;
            _addComponent = componentFrame.AddDropDownButton(Width - 42, 2, DropDownButtonType.Plus);
            _addComponent.Enabled = false;
            _addComponent.MouseClick += AddComponent_MouseClick;
            _removeComponent = componentFrame.AddDropDownButton(Width - 22, 2, DropDownButtonType.Minus);
            _removeComponent.Enabled = false;
            _removeComponent.MouseClick += RemoveComponent_MouseClick;

            _inspectorPanel = _splitContainer.SplitFrame2.AddStackPanel();

            RefreshGameObjectTree();
            RefreshGameObjectList();
            GameObjectTree_SelectedNodeChanged(this, null);
        }
Ejemplo n.º 2
0
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Debug.LogWarning("found existing instance of TooltipManager, deleting this instance");
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Ejemplo n.º 3
0
        void CreateGui()
        {
            Point cursorSize = new Point(32, 32);
            Point halfSize = cursorSize / 2;

            AddCursor(Cursors.Default, new Cursor { Texture = "cursors\\Arrow.png", Size = cursorSize, HotSpot = Point.Zero });
            AddCursor(Cursors.Link, new Cursor { Texture = "cursors\\Link.png", Size = cursorSize, HotSpot = Point.Zero });
            AddCursor(Cursors.Move, new Cursor { Texture = "cursors\\Move.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.Select, new Cursor { Texture = "cursors\\Select.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeNS, new Cursor { Texture = "cursors\\SizeNS.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeWE, new Cursor { Texture = "cursors\\SizeWE.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.HSplit, new Cursor { Texture = "cursors\\SizeNS.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.VSplit, new Cursor { Texture = "cursors\\SizeWE.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeNESW, new Cursor { Texture = "cursors\\SizeNESW.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeNWSE, new Cursor { Texture = "cursors\\SizeNWSE.png", Size = cursorSize, HotSpot = halfSize });

            TooltipControl = new SimpleTooltip();
            TooltipControl.Offset = new Point(50, 50);

            bottom = new Frame();
            bottom.Size = new Point(14, 14);
            bottom.Dock = DockStyle.Bottom;
            bottom.Style = "button";
            Desktop.Controls.Add(bottom);

            Frame center = new Frame();
            center.Dock = DockStyle.Fill;
            //Desktop.Controls.Add(center);

            actionbar1 = new ActionBar();
            actionbar2 = new ActionBar();
            statusbar = new StatusBar();
            inventory = new Inventory();
            skillbook = new Skillbook();
            chatwindow = new ChatWindow();
            charsheet = new CharacterSheet();

            center.Controls.Add(actionbar1);
            center.Controls.Add(actionbar2);
            center.Controls.Add(statusbar);

            chatwindow.Show(Desktop);
            //minimap.Show(Desktop);
            //inventory.Show(Desktop);
            //charsheet.Show(Desktop);
            //skillbook.Show(Desktop);
        }
Ejemplo n.º 4
0
    private void Start()
    {
        if (GetComponent <SimpleTooltip>() != null)
        {
            simpleTooltip = GetComponent <SimpleTooltip>();
        }

        if (simpleTooltip != null)
        {
            if (enable)
            {
                simpleTooltip.infoLeft = enableString;
            }
            else
            {
                simpleTooltip.infoLeft = disableString;
            }
        }
    }
Ejemplo n.º 5
0
        private void CreateGui()
        {
            TooltipControl        = new SimpleTooltip();
            TooltipControl.Offset = new Point(50, 50);

            _top       = new Frame();
            _top.Size  = new Point(24, 24);
            _top.Dock  = DockStyle.Top;
            _top.Style = "button";
            Desktop.Controls.Add(_top);

            _bottom       = new Frame();
            _bottom.Size  = new Point(14, 14);
            _bottom.Dock  = DockStyle.Bottom;
            _bottom.Style = "button";
            Desktop.Controls.Add(_bottom);

            var center = new Frame();

            center.Dock = DockStyle.Fill;
            Desktop.Controls.Add(center);

            Actionbar1 = new ActionBar();
            Actionbar2 = new ActionBar();
            Statusbar  = new StatusBar();
            Minimap    = new MiniMap();
            Inventory  = new Inventory();
            Skillbook  = new Skillbook();
            Chatwindow = new ChatWindow();
            Charsheet  = new CharacterSheet();

            center.Controls.Add(Actionbar1);
            center.Controls.Add(Actionbar2);
            center.Controls.Add(Statusbar);

            Chatwindow.Show(Desktop);
            Minimap.Show(Desktop);
            Inventory.Show(Desktop);
            Charsheet.Show(Desktop);
            Skillbook.Show(Desktop);
        }
Ejemplo n.º 6
0
        public SampleDesktop()
        {
            var skin = new Skin();

            var baseStyle = new ControlStyle();

            baseStyle.Tiling                  = TextureMode.Grid;
            baseStyle.Grid                    = new Margin(3);
            baseStyle.Texture                 = "button_hot.dds";
            baseStyle.Default.Texture         = "button_default.dds";
            baseStyle.Pressed.Texture         = "button_down.dds";
            baseStyle.SelectedPressed.Texture = "button_down.dds";
            baseStyle.Focused.Texture         = "button_down.dds";
            baseStyle.SelectedFocused.Texture = "button_down.dds";
            baseStyle.Selected.Texture        = "button_down.dds";
            baseStyle.SelectedHot.Texture     = "button_down.dds";

            var itemStyle = new ControlStyle(baseStyle)
            {
                TextPadding = new Margin(8, 0, 8, 0),
                TextAlign   = Alignment.MiddleLeft
            };

            var buttonStyle = new ControlStyle(baseStyle)
            {
                TextPadding = new Margin(0),
                TextAlign   = Alignment.MiddleCenter
            };

            var tooltipStyle = new ControlStyle(buttonStyle);

            tooltipStyle.TextPadding = new Margin(8);
            tooltipStyle.TextAlign   = Alignment.TopLeft;

            var inputStyle = new ControlStyle();

            inputStyle.Texture         = "input_default.dds";
            inputStyle.Hot.Texture     = "input_focused.dds";
            inputStyle.Focused.Texture = "input_focused.dds";
            inputStyle.TextPadding     = new Margin(8);
            inputStyle.Tiling          = TextureMode.Grid;
            inputStyle.Focused.Tint    = ColorInt.Rgba(1, 0, 0, 1);
            inputStyle.Grid            = new Margin(3);

            var windowStyle = new ControlStyle
            {
                Tiling  = TextureMode.Grid,
                Grid    = new Margin(9),
                Texture = "window.dds"
            };

            var frameStyle = new ControlStyle();

            frameStyle.Tiling      = TextureMode.Grid;
            frameStyle.Grid        = new Margin(4);
            frameStyle.Texture     = "frame.dds";
            frameStyle.TextPadding = new Margin(8);

            var vscrollTrackStyle = new ControlStyle();

            vscrollTrackStyle.Tiling  = TextureMode.Grid;
            vscrollTrackStyle.Grid    = new Margin(3);
            vscrollTrackStyle.Texture = "vscroll_track.dds";

            var vscrollButtonStyle = new ControlStyle();

            vscrollButtonStyle.Tiling          = TextureMode.Grid;
            vscrollButtonStyle.Grid            = new Margin(3);
            vscrollButtonStyle.Texture         = "vscroll_button.dds";
            vscrollButtonStyle.Hot.Texture     = "vscroll_button_hot.dds";
            vscrollButtonStyle.Pressed.Texture = "vscroll_button_down.dds";

            var vscrollUp = new ControlStyle();

            vscrollUp.Default.Texture = "vscrollUp_default.dds";
            vscrollUp.Hot.Texture     = "vscrollUp_hot.dds";
            vscrollUp.Pressed.Texture = "vscrollUp_down.dds";
            vscrollUp.Focused.Texture = "vscrollUp_hot.dds";

            var hscrollTrackStyle = new ControlStyle();

            hscrollTrackStyle.Tiling  = TextureMode.Grid;
            hscrollTrackStyle.Grid    = new Margin(3);
            hscrollTrackStyle.Texture = "hscroll_track.dds";

            var hscrollButtonStyle = new ControlStyle();

            hscrollButtonStyle.Tiling          = TextureMode.Grid;
            hscrollButtonStyle.Grid            = new Margin(3);
            hscrollButtonStyle.Texture         = "hscroll_button.dds";
            hscrollButtonStyle.Hot.Texture     = "hscroll_button_hot.dds";
            hscrollButtonStyle.Pressed.Texture = "hscroll_button_down.dds";

            var hscrollUp = new ControlStyle();

            hscrollUp.Default.Texture = "hscrollUp_default.dds";
            hscrollUp.Hot.Texture     = "hscrollUp_hot.dds";
            hscrollUp.Pressed.Texture = "hscrollUp_down.dds";
            hscrollUp.Focused.Texture = "hscrollUp_hot.dds";

            var checkButtonStyle = new ControlStyle();

            checkButtonStyle.Default.Texture        = "checkbox_default.dds";
            checkButtonStyle.Hot.Texture            = "checkbox_hot.dds";
            checkButtonStyle.Pressed.Texture        = "checkbox_down.dds";
            checkButtonStyle.Checked.Texture        = "checkbox_checked.dds";
            checkButtonStyle.CheckedFocused.Texture = "checkbox_checked_hot.dds";
            checkButtonStyle.CheckedHot.Texture     = "checkbox_checked_hot.dds";
            checkButtonStyle.CheckedPressed.Texture = "checkbox_down.dds";

            var comboLabelStyle = new ControlStyle();

            comboLabelStyle.TextPadding     = new Margin(10, 0, 0, 0);
            comboLabelStyle.Default.Texture = "combo_default.dds";
            comboLabelStyle.Hot.Texture     = "combo_hot.dds";
            comboLabelStyle.Pressed.Texture = "combo_down.dds";
            comboLabelStyle.Focused.Texture = "combo_hot.dds";
            comboLabelStyle.Tiling          = TextureMode.Grid;
            comboLabelStyle.Grid            = new Margin(3, 0, 0, 0);

            var comboButtonStyle = new ControlStyle();

            comboButtonStyle.Default.Texture = "combo_button_default.dds";
            comboButtonStyle.Hot.Texture     = "combo_button_hot.dds";
            comboButtonStyle.Pressed.Texture = "combo_button_down.dds";
            comboButtonStyle.Focused.Texture = "combo_button_hot.dds";

            var multilineStyle = new ControlStyle();

            multilineStyle.TextAlign   = Alignment.TopLeft;
            multilineStyle.TextPadding = new Margin(8);

            var labelStyle = new ControlStyle();

            labelStyle.TextPadding       = new Margin(8, 0, 8, 0);
            labelStyle.TextAlign         = Alignment.MiddleLeft;
            labelStyle.TextColor         = ColorInt.Rgba(.8f, .8f, .8f, 1);
            labelStyle.BackColor         = ColorInt.Rgba(1, 1, 1, .125f);
            labelStyle.Default.BackColor = 0;

            skin.Add("item", itemStyle);
            skin.Add("textbox", inputStyle);
            skin.Add("button", buttonStyle);
            skin.Add("window", windowStyle);
            skin.Add("frame", frameStyle);
            skin.Add("checkBox", checkButtonStyle);
            skin.Add("comboLabel", comboLabelStyle);
            skin.Add("comboButton", comboButtonStyle);
            skin.Add("vscrollTrack", vscrollTrackStyle);
            skin.Add("vscrollButton", vscrollButtonStyle);
            skin.Add("vscrollUp", vscrollUp);
            skin.Add("hscrollTrack", hscrollTrackStyle);
            skin.Add("hscrollButton", hscrollButtonStyle);
            skin.Add("hscrollUp", hscrollUp);
            skin.Add("multiline", multilineStyle);
            skin.Add("tooltip", tooltipStyle);
            skin.Add("label", labelStyle);

            Skin = skin;
            //Gui.SetSkin(skin);

            var cursorSize = new Point(32, 32);
            var halfSize   = cursorSize / 2;

            //skin.Cursors.Add(Cursors.Default, new Cursor { Texture = "cursors\\Arrow.png", Size = cursorSize, HotSpot = Point.Zero });
            //skin.Cursors.Add(Cursors.Link, new Cursor { Texture = "cursors\\Link.png", Size = cursorSize, HotSpot = Point.Zero });
            //skin.Cursors.Add(Cursors.Move, new Cursor { Texture = "cursors\\Move.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.Select, new Cursor { Texture = "cursors\\Select.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.SizeNS, new Cursor { Texture = "cursors\\SizeNS.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.SizeWE, new Cursor { Texture = "cursors\\SizeWE.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.HSplit, new Cursor { Texture = "cursors\\SizeNS.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.VSplit, new Cursor { Texture = "cursors\\SizeWE.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.SizeNESW, new Cursor { Texture = "cursors\\SizeNESW.png", Size = cursorSize, HotSpot = halfSize });
            //skin.Cursors.Add(Cursors.SizeNWSE, new Cursor { Texture = "cursors\\SizeNWSE.png", Size = cursorSize, HotSpot = halfSize });

            TooltipControl = new SimpleTooltip();

            var window1 = new SampleWindow();

            window1.Size          = new Point(440, 340);
            window1.Position      = new Point(40, 40);
            window1.Titlebar.Text = "Anchoring, [color=FfFfFf00]DropDown, Modal Dialog[/color]";
            window1.Resizable     = true;
            window1.Parent        = this;

            var label1 = new Label();

            label1.Text        = "username:"******"textbox"
            };

            textbox1.Text     = "username";
            textbox1.Size     = new Point(222, 35);
            textbox1.Position = new Point(180, 100);
            textbox1.Style    = "textbox";
            textbox1.Parent   = window1;
            textbox1.Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            var label2 = new Label();

            label2.Text     = "password:"******"textbox"
            };

            textbox2.PasswordChar = char.Parse("*");
            textbox2.IsPassword   = true;
            textbox2.Text         = "password";
            textbox2.Size         = new Point(222, 35);
            textbox2.Position     = new Point(180, 140);
            textbox2.Style        = "textbox";
            textbox2.Parent       = window1;
            textbox2.Anchor       = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            var button = new Button();

            button.Size     = new Point(157, 35);
            button.Position = new Point(437 - 192, 346 - 52);
            button.Text     = "login";
            button.Style    = "button";
            button.Parent   = window1;
            button.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
            //button.Cursor = Cursors.Link;
            button.MouseClick += button_OnMouseClick;

            var combo = new DropDownList();

            combo.Size                                  = new Point(222, 35);
            combo.Position                              = new Point(180, 180);
            combo.Parent                                = window1;
            combo.Label.Style                           = "comboLabel";
            combo.Button.Style                          = "comboButton";
            combo.Listbox.Margin                        = new Margin(0, 6, 0, 0);
            combo.Listbox.Style                         = "frame";
            combo.Listbox.ClipFrame.Margin              = new Margin(8, 8, 8, 8);
            combo.Listbox.Scrollbar.Margin              = new Margin(0, 4, 4, 4);
            combo.Listbox.Scrollbar.Size                = new Point(14, 10);
            combo.Listbox.Scrollbar.ButtonUp.Style      = "vscrollUp";
            combo.Listbox.Scrollbar.ButtonUp.Size       = new Point(10, 20);
            combo.Listbox.Scrollbar.ButtonDown.Style    = "vscrollUp";
            combo.Listbox.Scrollbar.ButtonDown.Size     = new Point(10, 20);
            combo.Listbox.Scrollbar.Slider.Margin       = new Margin(0, 2, 0, 2);
            combo.Listbox.Scrollbar.Slider.Style        = "vscrollTrack";
            combo.Listbox.Scrollbar.Slider.Button.Style = "vscrollButton";
            combo.Anchor                                = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            for (var i = 0; i < 10; i++)
            {
                var item = new ListBoxItem();
                item.Text   = "listboxitem";
                item.Size   = new Point(100, 35);
                item.Margin = new Margin(0, 0, 0, 4);
                item.Style  = "item";

                //if (i == 3)
                //    item.Selected = true;

                combo.Items.Add(item);

                // if (i == 3)
                //     combo.SelectedItem = item;
                if (i == 3)
                {
                    item.Selected = true;
                }
            }

            var box = new CheckBox();

            box.Size         = new Point(157, 26);
            box.Position     = new Point(180, 220);
            box.Text         = "remember me";
            box.Parent       = window1;
            box.Button.Style = "checkBox";
            box.Button.Size  = new Point(26, 26);
            //box.Button.Cursor = Cursors.Link;

            var window2 = new SampleWindow();

            window2.Size          = new Point(440, 340);
            window2.Position      = new Point(500, 40);
            window2.Titlebar.Text = "SplitContainer, TreeView, ListBox";
            window2.Resizable     = true;
            window2.Parent        = this;

            var split = new SplitContainer();

            split.Dock              = DockStyle.Fill;
            split.Parent            = window2;
            split.SplitButton.Style = "button";
            split.SplitFrame1.Size  = new Point(10, 10);
            split.SplitFrame2.Size  = new Point(30, 10);

            var listbox1 = new ListBox();

            listbox1.Margin                        = new Margin(2);
            listbox1.Dock                          = DockStyle.Fill;
            listbox1.Scrollbar.Size                = new Point(14, 10);
            listbox1.Scrollbar.Slider.Style        = "vscrollTrack";
            listbox1.Scrollbar.Slider.Button.Style = "vscrollButton";
            listbox1.Scrollbar.ButtonUp.Style      = "vscrollUp";
            listbox1.Scrollbar.ButtonUp.Size       = new Point(10, 20);
            listbox1.Scrollbar.ButtonDown.Style    = "vscrollUp";
            listbox1.Scrollbar.ButtonDown.Size     = new Point(10, 20);
            listbox1.Scrollbar.Slider.Margin       = new Margin(0, 2, 0, 2);
            listbox1.Multiselect                   = true;
            listbox1.MaxSelected                   = 4;
            listbox1.Parent                        = split.SplitFrame2;

            for (var i = 0; i < 30; i++)
            {
                var item = new ListBoxItem();
                item.Text    = "listboxitem";
                item.Size    = new Point(100, 26);
                item.Margin  = new Margin(0, 0, 0, 1);
                item.Style   = "label";
                item.Tooltip =
                    "This is a multine tooltip.\nThe second line begins here.\n[color=ff00ee55]The third line is even colored.[/color]";
                listbox1.Items.Add(item);
            }

            var treeview = new TreeView();

            treeview.Dock                          = DockStyle.Fill;
            treeview.Margin                        = new Margin(2);
            treeview.Parent                        = split.SplitFrame1;
            treeview.Scrollbar.Size                = new Point(14, 10);
            treeview.Scrollbar.Slider.Style        = "vscrollTrack";
            treeview.Scrollbar.Slider.Button.Style = "vscrollButton";
            treeview.Scrollbar.ButtonUp.Style      = "vscrollUp";
            treeview.Scrollbar.ButtonUp.Size       = new Point(10, 20);
            treeview.Scrollbar.ButtonDown.Style    = "vscrollUp";
            treeview.Scrollbar.ButtonDown.Size     = new Point(10, 20);
            treeview.Scrollbar.Slider.Margin       = new Margin(0, 2, 0, 2);
            treeview.Indent                        = 10;

            for (var i = 0; i < 30; i++)
            {
                var node = new TreeNodeLabel();
                node.Label.Text      = "node level 1";
                node.Label.TextAlign = Alignment.MiddleLeft;
                node.Label.Style     = "label";
                node.Button.Size     = new Point(14, 14);
                node.Size            = new Point(100, 26);
                node.Tooltip         = node.Label.Text;
                node.Style           = "label";
                treeview.Nodes.Add(node);

                for (var i2 = 0; i2 < 3; i2++)
                {
                    var sub1 = new TreeNodeLabel();
                    sub1.Size            = new Point(100, 35);
                    sub1.Label.TextAlign = Alignment.MiddleLeft;
                    sub1.Label.Style     = "label";
                    sub1.Button.Size     = new Point(14, 14);
                    sub1.Size            = new Point(100, 26);
                    sub1.Label.Text      = "node level 2";
                    sub1.Tooltip         = sub1.Label.Text;
                    sub1.Style           = "label";
                    node.Nodes.Add(sub1);

                    for (var i3 = 0; i3 < 3; i3++)
                    {
                        var sub2 = new TreeNodeLabel();
                        sub2.Label.Text      = "node level 3";
                        sub2.Label.TextAlign = Alignment.MiddleLeft;
                        sub2.Label.Style     = "label";
                        sub2.Button.Size     = new Point(14, 14);
                        sub2.Size            = new Point(100, 26);
                        sub2.Tooltip         = sub2.Label.Text;
                        sub2.Style           = "label";
                        sub1.Nodes.Add(sub2);
                    }
                }
            }

            var window3 = new SampleWindow();

            window3.Size          = new Point(440, 340);
            window3.Position      = new Point(40, 400);
            window3.Resizable     = true;
            window3.Titlebar.Text = "Custom Control (Inheritance)";
            window3.Parent        = this;

            var chatbox = new ChatBox();

            chatbox.Dock = DockStyle.Fill;
            window3.Controls.Add(chatbox);

            chatbox.Style         = "frame";
            chatbox.Input.Style   = "textbox";
            chatbox.Input.Margin  = new Margin(8, 0, 8, 8);
            chatbox.Output.Margin = new Margin(8, 8, 8, 8);
            //chatbox.Output.Style = "textbox";
            chatbox.Scrollbar.Margin              = new Margin(0, 8, 8, 8);
            chatbox.Scrollbar.Size                = new Point(14, 10);
            chatbox.Scrollbar.Slider.Style        = "vscrollTrack";
            chatbox.Scrollbar.Slider.Button.Style = "vscrollButton";
            chatbox.Scrollbar.ButtonUp.Style      = "vscrollUp";
            chatbox.Scrollbar.ButtonUp.Size       = new Point(10, 20);
            chatbox.Scrollbar.ButtonDown.Style    = "vscrollUp";
            chatbox.Scrollbar.ButtonDown.Size     = new Point(10, 20);
            chatbox.Scrollbar.Slider.Margin       = new Margin(0, 2, 0, 2);

            var window4 = new SampleWindow();

            window4.Size          = new Point(440, 340);
            window4.Position      = new Point(500, 400);
            window4.Resizable     = true;
            window4.Titlebar.Text = "TabControl, TextAlign";
            window4.Parent        = this;

            var tabcontrol = new TabControl();

            tabcontrol.ButtonFrame.Style = "item";
            tabcontrol.Dock   = DockStyle.Fill;
            tabcontrol.Parent = window4;

            for (var i = 0; i < 6; i++)
            {
                var tabPage = new TabPage();
                //tabPage.Style = "frame";
                tabPage.Margin         = new Margin(0, -1, 0, 0);
                tabPage.Button.Style   = "button";
                tabPage.Button.Text    = "page" + i;
                tabPage.Button.Tooltip = "Click to change active tab";
                tabPage.Button.Margin  = new Margin(0, 0, -1, 0);
                tabcontrol.TabPages.Add(tabPage);

                var lbl = new Label();
                lbl.Dock     = DockStyle.Fill;
                lbl.Parent   = tabPage;
                lbl.TextWrap = true;
                lbl.Text     =
                    "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\r\n nonumy eirmod tempor invidunt ut labore [color=ff0088ff][url=testurl]click \r\n meh![/url][/color] et dolore magna aliquyam erat, sed diam voluptua.\r\n At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
                lbl.Style         = "multiline";
                lbl.BbCodeEnabled = true;
                lbl.LinkClicked  += lbl_OnLinkClicked;
            }

            var window5 = new SampleWindow();

            window5.Size          = new Point(440, 340);
            window5.Position      = new Point(960, 40);
            window5.Resizable     = true;
            window5.Titlebar.Text = "Panel, TextBox";
            window5.Parent        = this;

            var panel = new Panel();

            panel.Style  = "frame";
            panel.Dock   = DockStyle.Fill;
            panel.Parent = window5;

            panel.ClipFrame.Margin = new Margin(8);
            panel.ClipFrame.Style  = "textbox";

            panel.VScroll.Margin              = new Margin(0, 8, 8, 8);
            panel.VScroll.Size                = new Point(14, 10);
            panel.VScroll.Slider.Style        = "vscrollTrack";
            panel.VScroll.Slider.Button.Style = "vscrollButton";
            panel.VScroll.ButtonUp.Style      = "vscrollUp";
            panel.VScroll.ButtonUp.Size       = new Point(10, 20);
            panel.VScroll.ButtonDown.Style    = "vscrollUp";
            panel.VScroll.ButtonDown.Size     = new Point(10, 20);
            panel.VScroll.Slider.Margin       = new Margin(0, 2, 0, 2);

            panel.HScroll.Margin              = new Margin(8, 0, 8, 8);
            panel.HScroll.Size                = new Point(10, 14);
            panel.HScroll.Slider.Style        = "hscrollTrack";
            panel.HScroll.Slider.Button.Style = "hscrollButton";
            panel.HScroll.ButtonUp.Style      = "hscrollUp";
            panel.HScroll.ButtonUp.Size       = new Point(20, 10);
            panel.HScroll.ButtonDown.Style    = "hscrollUp";
            panel.HScroll.ButtonDown.Size     = new Point(20, 10);
            panel.HScroll.Slider.Margin       = new Margin(2, 0, 2, 0);

            for (var i = 0; i < 10; i++)
            {
                var label = new Label();
                label.Text     = "label control:";
                label.Size     = new Point(100, 35);
                label.Position = new Point(10, 10 + 45 * i);
                panel.Content.Controls.Add(label);

                var txt = new TextBox();
                txt.Text      = "lorem ipsum";
                txt.Size      = new Point(222, 35);
                txt.Position  = new Point(110, 10 + 45 * i);
                txt.Style     = "textbox";
                txt.AllowDrop = true;
                txt.TabIndex  = 1 + i;
                txt.DragDrop += txt_OnDragDrop;
                txt.GotFocus += txt_OnGotFocus;
                panel.Content.Controls.Add(txt);
            }

            var window6 = new SampleWindow();

            window6.Size          = new Point(440, 340);
            window6.Position      = new Point(960, 400);
            window6.Resizable     = true;
            window6.Titlebar.Text = "Misc";
            window6.Parent        = this;

            var rnd    = new Random();
            var models = new List <MyData>();

            for (var i = 0; i < 32; i++)
            {
                var data = new MyData();
                data.Name   = rnd.Next().ToString();
                data.Date   = DateTime.Now.AddMilliseconds(rnd.Next());
                data.Rating = rnd.Next();
                models.Add(data);
            }

            var olv = new ListView();

            olv.Dock = DockStyle.Fill;
            olv.Columns.Add(new ListView.Column {
                Text = "Name", Aspect = "Name", Width = 120, MinWidth = 48
            });
            olv.Columns.Add(new ListView.Column {
                Text = "Date", Aspect = "Date", Width = 120, MinWidth = 48
            });
            olv.Columns.Add(new ListView.Column {
                Text = "Rating", Aspect = "Rating", Width = 120, MinWidth = 48
            });
            olv.StretchLastColumn = true;
            olv.FullRowSelect     = true;

            olv.CreateHeader = delegate(object sender, ListView.FormatHeaderEventArgs args)
            {
                var header = new Button
                {
                    Dock      = DockStyle.Fill,
                    Text      = args.Column.Text,
                    AllowDrop = true
                };

                header.MouseClick += delegate
                {
                    if (args.Column.Aspect == "Name")
                    {
                        olv.Sort <MyData>((a, b) => a.Name.CompareTo(b.Name));
                    }
                    else if (args.Column.Aspect == "Date")
                    {
                        olv.Sort <MyData>((a, b) => a.Date.CompareTo(b.Date));
                    }
                    else if (args.Column.Aspect == "Rating")
                    {
                        olv.Sort <MyData>((a, b) => a.Rating.CompareTo(b.Rating));
                    }
                };

                header.MouseDrag += delegate(Control snd, MouseEventArgs e)
                {
                    var drag = new Label();
                    drag.Size     = snd.Size;
                    drag.Position = snd.Location;
                    drag.Style    = snd.Style;
                    drag.Text     = ((Button)snd).Text;

                    snd.DoDragDrop(drag);
                };

                header.DragLeave += delegate(Control snd, DragDropEventArgs e) { snd.Tint = -1; };
                header.DragEnter += delegate(Control snd, DragDropEventArgs e)
                {
                    if (e.Source is Button)
                    {
                        snd.Tint = ColorInt.Rgba(0, 1, 0, 1);
                    }
                    else
                    {
                        snd.Tint = ColorInt.Rgba(1, 0, 0, 1);
                        e.Cancel = true;
                    }
                };

                header.DragDrop += delegate(Control snd, DragDropEventArgs e) { snd.Tint = -1; };

                return(header);
            };

            olv.CreateCell = delegate(object sender, ListView.FormatCellEventArgs args)
            {
                var text = olv.GetAspectValue(args.Model, args.Column);

                var cell = new Button
                {
                    Size      = new Point(26, 26),
                    Style     = "label",
                    Dock      = DockStyle.Top,
                    Text      = text,
                    Tooltip   = text,
                    AllowDrop = true
                };

                cell.DragResponse += delegate(Control snd, DragDropEventArgs e) { snd.State = ControlState.Hot; };

                return(cell);
            };

            olv.SetObjects(models);

            window6.Controls.Add(olv);
        }
 public void OnShow(SimpleTooltip p0)
 {
     // do ur stuff here
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
        public SampleDesktop()
        {
            #region cursors

            Point cursorSize = new Point(32, 32);
            Point halfSize = cursorSize / 2;

            AddCursor(Cursors.Default, new Cursor { Texture = "cursors\\Arrow.png", Size = cursorSize, HotSpot = Point.Zero });
            AddCursor(Cursors.Link, new Cursor { Texture = "cursors\\Link.png", Size = cursorSize, HotSpot = Point.Zero });
            AddCursor(Cursors.Move, new Cursor { Texture = "cursors\\Move.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.Select, new Cursor { Texture = "cursors\\Select.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeNS, new Cursor { Texture = "cursors\\SizeNS.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeWE, new Cursor { Texture = "cursors\\SizeWE.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.HSplit, new Cursor { Texture = "cursors\\SizeNS.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.VSplit, new Cursor { Texture = "cursors\\SizeWE.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeNESW, new Cursor { Texture = "cursors\\SizeNESW.png", Size = cursorSize, HotSpot = halfSize });
            AddCursor(Cursors.SizeNWSE, new Cursor { Texture = "cursors\\SizeNWSE.png", Size = cursorSize, HotSpot = halfSize });

            #endregion

            #region styles

            ControlStyle baseStyle = new ControlStyle();
            baseStyle.Tiling = TextureMode.Grid;
            baseStyle.Grid = new Margin(3);
            baseStyle.Texture = "button_hot.dds";
            baseStyle.Default.Texture = "button_default.dds";
            baseStyle.Pressed.Texture = "button_down.dds";
            baseStyle.SelectedPressed.Texture = "button_down.dds";
            baseStyle.Focused.Texture = "button_down.dds";
            baseStyle.SelectedFocused.Texture = "button_down.dds";
            baseStyle.Selected.Texture = "button_down.dds";
            baseStyle.SelectedHot.Texture = "button_down.dds";

            ControlStyle itemStyle = new ControlStyle(baseStyle);
            itemStyle.TextPadding = new Margin(10, 0, 0, 0);
            itemStyle.TextAlign = Alignment.MiddleLeft;

            ControlStyle buttonStyle = new ControlStyle(baseStyle);
            buttonStyle.TextPadding = new Margin(0);
            buttonStyle.TextAlign = Alignment.MiddleCenter;

            ControlStyle tooltipStyle = new ControlStyle(buttonStyle);
            tooltipStyle.TextPadding = new Margin(8);
            tooltipStyle.TextAlign = Alignment.TopLeft;

            ControlStyle inputStyle = new ControlStyle();
            inputStyle.Texture = "input_default.dds";
            inputStyle.Hot.Texture = "input_focused.dds";
            inputStyle.Focused.Texture = "input_focused.dds";
            inputStyle.TextPadding = new Margin(8);
            inputStyle.Tiling = TextureMode.Grid;
            inputStyle.Focused.Tint = ColorInt.RGBA(1, 0, 0, 1);
            inputStyle.Grid = new Margin(3);

            ControlStyle windowStyle = new ControlStyle();
            windowStyle.Tiling = TextureMode.Grid;
            windowStyle.Grid = new Margin(9);
            windowStyle.Texture = "window.dds";

            ControlStyle frameStyle = new ControlStyle();
            frameStyle.Tiling = TextureMode.Grid;
            frameStyle.Grid = new Margin(4);
            frameStyle.Texture = "frame.dds";
            frameStyle.TextPadding = new Margin(8);

            ControlStyle vscrollTrackStyle = new ControlStyle();
            vscrollTrackStyle.Tiling = TextureMode.Grid;
            vscrollTrackStyle.Grid = new Margin(3);
            vscrollTrackStyle.Texture = "vscroll_track.dds";

            ControlStyle vscrollButtonStyle = new ControlStyle();
            vscrollButtonStyle.Tiling = TextureMode.Grid;
            vscrollButtonStyle.Grid = new Margin(3);
            vscrollButtonStyle.Texture = "vscroll_button.dds";
            vscrollButtonStyle.Hot.Texture = "vscroll_button_hot.dds";
            vscrollButtonStyle.Pressed.Texture = "vscroll_button_down.dds";

            ControlStyle vscrollUp = new ControlStyle();
            vscrollUp.Default.Texture = "vscrollUp_default.dds";
            vscrollUp.Hot.Texture = "vscrollUp_hot.dds";
            vscrollUp.Pressed.Texture = "vscrollUp_down.dds";
            vscrollUp.Focused.Texture = "vscrollUp_hot.dds";

            ControlStyle hscrollTrackStyle = new ControlStyle();
            hscrollTrackStyle.Tiling = TextureMode.Grid;
            hscrollTrackStyle.Grid = new Margin(3);
            hscrollTrackStyle.Texture = "hscroll_track.dds";

            ControlStyle hscrollButtonStyle = new ControlStyle();
            hscrollButtonStyle.Tiling = TextureMode.Grid;
            hscrollButtonStyle.Grid = new Margin(3);
            hscrollButtonStyle.Texture = "hscroll_button.dds";
            hscrollButtonStyle.Hot.Texture = "hscroll_button_hot.dds";
            hscrollButtonStyle.Pressed.Texture = "hscroll_button_down.dds";

            ControlStyle hscrollUp = new ControlStyle();
            hscrollUp.Default.Texture = "hscrollUp_default.dds";
            hscrollUp.Hot.Texture = "hscrollUp_hot.dds";
            hscrollUp.Pressed.Texture = "hscrollUp_down.dds";
            hscrollUp.Focused.Texture = "hscrollUp_hot.dds";

            ControlStyle checkButtonStyle = new ControlStyle();
            checkButtonStyle.Default.Texture = "checkbox_default.dds";
            checkButtonStyle.Hot.Texture = "checkbox_hot.dds";
            checkButtonStyle.Pressed.Texture = "checkbox_down.dds";
            checkButtonStyle.Checked.Texture = "checkbox_checked.dds";
            checkButtonStyle.CheckedFocused.Texture = "checkbox_checked_hot.dds";
            checkButtonStyle.CheckedHot.Texture = "checkbox_checked_hot.dds";
            checkButtonStyle.CheckedPressed.Texture = "checkbox_down.dds";

            ControlStyle comboLabelStyle = new ControlStyle();
            comboLabelStyle.TextPadding = new Margin(10, 0, 0, 0);
            comboLabelStyle.Default.Texture = "combo_default.dds";
            comboLabelStyle.Hot.Texture = "combo_hot.dds";
            comboLabelStyle.Pressed.Texture = "combo_down.dds";
            comboLabelStyle.Focused.Texture = "combo_hot.dds";
            comboLabelStyle.Tiling = TextureMode.Grid;
            comboLabelStyle.Grid = new Margin(3, 0, 0, 0);

            ControlStyle comboButtonStyle = new ControlStyle();
            comboButtonStyle.Default.Texture = "combo_button_default.dds";
            comboButtonStyle.Hot.Texture = "combo_button_hot.dds";
            comboButtonStyle.Pressed.Texture = "combo_button_down.dds";
            comboButtonStyle.Focused.Texture = "combo_button_hot.dds";

            ControlStyle labelStyle = new ControlStyle();
            labelStyle.TextAlign = Alignment.TopLeft;
            labelStyle.TextPadding = new Margin(8);

            Skin skin = new Skin();

            skin.Styles.Add("item", itemStyle);
            skin.Styles.Add("textbox", inputStyle);
            skin.Styles.Add("button", buttonStyle);
            skin.Styles.Add("window", windowStyle);
            skin.Styles.Add("frame", frameStyle);
            skin.Styles.Add("checkBox", checkButtonStyle);
            skin.Styles.Add("comboLabel", comboLabelStyle);
            skin.Styles.Add("comboButton", comboButtonStyle);
            skin.Styles.Add("vscrollTrack", vscrollTrackStyle);
            skin.Styles.Add("vscrollButton", vscrollButtonStyle);
            skin.Styles.Add("vscrollUp", vscrollUp);
            skin.Styles.Add("hscrollTrack", hscrollTrackStyle);
            skin.Styles.Add("hscrollButton", hscrollButtonStyle);
            skin.Styles.Add("hscrollUp", hscrollUp);
            skin.Styles.Add("multiline", labelStyle);
            skin.Styles.Add("tooltip", tooltipStyle);

            GuiHost.SetSkin(skin);

            #endregion

            #region main

            TooltipControl = new SimpleTooltip();

            #region sample window 1 - Anchoring, DropDown, Modal Dialog

            SampleWindow window1 = new SampleWindow();
            window1.Size = new Squid.Point(440, 340);
            window1.Position = new Squid.Point(40, 40);
            window1.Titlebar.Text = "Anchoring, [color=ffffff00]DropDown, Modal Dialog[/color]";
            window1.Resizable = true;
            window1.Parent = this;

            Label label1 = new Label();
            label1.Text = "username:"******"textbox" };
            textbox1.Text = "username";
            textbox1.Size = new Squid.Point(222, 35);
            textbox1.Position = new Squid.Point(180, 100);
            textbox1.Style = "textbox";
            textbox1.Parent = window1;
            textbox1.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            Label label2 = new Label();
            label2.Text = "password:"******"textbox" };
            textbox2.PasswordChar = char.Parse("*");
            textbox2.IsPassword = true;
            textbox2.Text = "password";
            textbox2.Size = new Squid.Point(222, 35);
            textbox2.Position = new Squid.Point(180, 140);
            textbox2.Style = "textbox";
            textbox2.Parent = window1;
            textbox2.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            Button button = new Button();
            button.Size = new Squid.Point(157, 35);
            button.Position = new Squid.Point(437 - 192, 346 - 52);
            button.Text = "login";
            button.Style = "button";
            button.Parent = window1;
            button.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            button.Cursor = Cursors.Link;
            button.MouseClick += button_OnMouseClick;

            DropDownList combo = new DropDownList();
            combo.Size = new Squid.Point(222, 35);
            combo.Position = new Squid.Point(180, 180);
            combo.Parent = window1;
            combo.Label.Style = "comboLabel";
            combo.Button.Style = "comboButton";
            combo.Listbox.Margin = new Margin(0, 6, 0, 0);
            combo.Listbox.Style = "frame";
            combo.Listbox.ClipFrame.Margin = new Margin(8, 8, 8, 8);
            combo.Listbox.Scrollbar.Margin = new Margin(0, 4, 4, 4);
            combo.Listbox.Scrollbar.Size = new Squid.Point(14, 10);
            combo.Listbox.Scrollbar.ButtonUp.Style = "vscrollUp";
            combo.Listbox.Scrollbar.ButtonUp.Size = new Squid.Point(10, 20);
            combo.Listbox.Scrollbar.ButtonDown.Style = "vscrollUp";
            combo.Listbox.Scrollbar.ButtonDown.Size = new Squid.Point(10, 20);
            combo.Listbox.Scrollbar.Slider.Margin = new Margin(0, 2, 0, 2);
            combo.Listbox.Scrollbar.Slider.Style = "vscrollTrack";
            combo.Listbox.Scrollbar.Slider.Button.Style = "vscrollButton";
            combo.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            for (int i = 0; i < 10; i++)
            {
                ListBoxItem item = new ListBoxItem();
                item.Text = "listboxitem";
                item.Size = new Squid.Point(100, 35);
                item.Margin = new Margin(0, 0, 0, 4);
                item.Style = "item";

                //if (i == 3)
                //    item.Selected = true;

                combo.Items.Add(item);

                // if (i == 3)
                //     combo.SelectedItem = item;
                if (i == 3)
                    item.Selected = true;
            }

            CheckBox box = new CheckBox();
            box.Size = new Squid.Point(157, 26);
            box.Position = new Squid.Point(180, 220);
            box.Text = "remember me";
            box.Parent = window1;
            box.Button.Style = "checkBox";
            box.Button.Size = new Squid.Point(26, 26);
            box.Button.Cursor = Cursors.Link;

            #endregion

            #region sample window 2 - SplitContainer, TreeView, ListBox

            SampleWindow window2 = new SampleWindow();
            window2.Size = new Squid.Point(440, 340);
            window2.Position = new Squid.Point(500, 40);
            window2.Titlebar.Text = "SplitContainer, TreeView, ListBox";
            window2.Resizable = true;
            window2.Parent = this;

            SplitContainer split = new SplitContainer();
            split.Dock = DockStyle.Fill;
            split.Parent = window2;
            split.SplitButton.Style = "button";
            split.SplitFrame1.Size = new Point(10, 10);
            split.SplitFrame2.Size = new Point(30, 10);

            Squid.Panel pnl = new Squid.Panel();
            pnl.Dock = Squid.DockStyle.Fill;
            pnl.ClipFrame.Margin = new Squid.Margin(8);
            pnl.ClipFrame.Style = "textbox";

            pnl.VScroll.Margin = new Squid.Margin(0, 8, 8, 8);
            pnl.VScroll.Size = new Squid.Point(14, 10);
            pnl.VScroll.Slider.Style = "vscrollTrack";
            pnl.VScroll.Slider.Button.Style = "vscrollButton";
            pnl.VScroll.ButtonUp.Style = "vscrollUp";
            pnl.VScroll.ButtonUp.Size = new Squid.Point(10, 20);
            pnl.VScroll.ButtonDown.Style = "vscrollUp";
            pnl.VScroll.ButtonDown.Size = new Squid.Point(10, 20);
            pnl.VScroll.Slider.Margin = new Squid.Margin(0, 2, 0, 2);
            pnl.Parent = split.SplitFrame2;

            ListBox listbox1 = new ListBox();
            listbox1.Dock = DockStyle.Fill;
            listbox1.Size = new Squid.Point(200, 290);
            listbox1.Style = "frame";
            listbox1.ClipFrame.Margin = new Margin(8, 8, 8, 8);
            listbox1.Scrollbar.Margin = new Margin(0, 8, 8, 8);
            listbox1.Scrollbar.Size = new Squid.Point(14, 10);
            listbox1.Scrollbar.Slider.Style = "vscrollTrack";
            listbox1.Scrollbar.Slider.Button.Style = "vscrollButton";
            listbox1.Scrollbar.ButtonUp.Style = "vscrollUp";
            listbox1.Scrollbar.ButtonUp.Size = new Squid.Point(10, 20);
            listbox1.Scrollbar.ButtonDown.Style = "vscrollUp";
            listbox1.Scrollbar.ButtonDown.Size = new Squid.Point(10, 20);
            listbox1.Scrollbar.Slider.Margin = new Margin(0, 2, 0, 2);
            listbox1.Parent = split.SplitFrame2;
            listbox1.Multiselect = true;
            listbox1.MaxSelected = 4;
            listbox1.Scrollbar.Steps = 30;

            for (int i = 0; i < 30; i++)
            {
                ListBoxItem item = new ListBoxItem();
                item.Text = "listboxitem";
                item.Size = new Squid.Point(100, 70);
                item.Margin = new Margin(0, 0, 0, 4);
                item.Style = "item";
                //item.AutoSize = AutoSize.Vertical;
                item.Tooltip = "This is a multine tooltip.\nThe second line begins here.\n[color=ff00ee55]The third line is even colored.[/color]";
                item.MouseEnter += item_OnMouseEnter;
                item.MouseLeave += item_OnMouseLeave;
                listbox1.Items.Add(item);
            }

            TreeView treeview = new TreeView();
            treeview.Size = new Squid.Point(200, 330);
            treeview.Dock = DockStyle.Fill;
            treeview.Style = "frame";
            treeview.Parent = split.SplitFrame1;
            treeview.ClipFrame.Margin = new Margin(8, 8, 8, 8);
            treeview.Scrollbar.Margin = new Margin(0, 8, 8, 8);
            treeview.Scrollbar.Size = new Squid.Point(14, 10);
            treeview.Scrollbar.Slider.Style = "vscrollTrack";
            treeview.Scrollbar.Slider.Button.Style = "vscrollButton";
            treeview.Scrollbar.ButtonUp.Style = "vscrollUp";
            treeview.Scrollbar.ButtonUp.Size = new Squid.Point(10, 20);
            treeview.Scrollbar.ButtonDown.Style = "vscrollUp";
            treeview.Scrollbar.ButtonDown.Size = new Squid.Point(10, 20);
            treeview.Scrollbar.Slider.Margin = new Margin(0, 2, 0, 2);
            treeview.Indent = 10;

            for (int i = 0; i < 30; i++)
            {
                TreeNodeLabel node = new TreeNodeLabel();
                node.Button.Style = "item";
                node.Label.Text = "node level 1";
                node.Size = new Squid.Point(100, 35);
                //node.Margin = new Margin(0, 0, 0, 4);
                node.Style = "item";
                node.Tooltip = node.Label.Text;
                treeview.Nodes.Add(node);

                for (int i2 = 0; i2 < 3; i2++)
                {
                    TreeNodeLabel sub1 = new TreeNodeLabel();
                    sub1.Button.Style = "item";
                    sub1.Label.Text = "node level 2";
                    sub1.Size = new Squid.Point(100, 35);
                    //sub1.Margin = new Margin(8, 0, 0, 4);
                    sub1.Style = "item";
                    sub1.Tooltip = sub1.Label.Text;
                    node.Nodes.Add(sub1);

                    for (int i3 = 0; i3 < 3; i3++)
                    {
                        TreeNodeLabel sub2 = new TreeNodeLabel();
                        sub2.Button.Style = "item";
                        sub2.Label.Text = "node level 3";
                        sub2.Size = new Squid.Point(100, 35);
                        //sub2.Margin = new Margin(16, 0, 0, 4);
                        sub2.Style = "item";
                        sub2.Tooltip = sub2.Label.Text;
                        sub1.Nodes.Add(sub2);
                    }
                }
            }

            #endregion

            #region sample window 3 - Custom Control (Inheritance)

            SampleWindow window3 = new SampleWindow();
            window3.Size = new Point(440, 340);
            window3.Position = new Point(40, 400);
            window3.Resizable = true;
            window3.Titlebar.Text = "Custom Control (Inheritance)";
            window3.Parent = this;

            ChatBox chatbox = new ChatBox();
            chatbox.Dock = DockStyle.Fill;
            window3.Controls.Add(chatbox);

            chatbox.Style = "frame";
            chatbox.Input.Style = "textbox";
            chatbox.Input.Margin = new Margin(8, 0, 8, 8);
            chatbox.Output.Margin = new Margin(8, 8, 8, 8);
            chatbox.Scrollbar.Margin = new Margin(0, 8, 8, 8);
            chatbox.Scrollbar.Size = new Squid.Point(14, 10);
            chatbox.Scrollbar.Slider.Style = "vscrollTrack";
            chatbox.Scrollbar.Slider.Button.Style = "vscrollButton";
            chatbox.Scrollbar.ButtonUp.Style = "vscrollUp";
            chatbox.Scrollbar.ButtonUp.Size = new Squid.Point(10, 20);
            chatbox.Scrollbar.ButtonDown.Style = "vscrollUp";
            chatbox.Scrollbar.ButtonDown.Size = new Squid.Point(10, 20);
            chatbox.Scrollbar.Slider.Margin = new Margin(0, 2, 0, 2);

            #endregion

            #region sample window 4 - TabControl, TextAlign

            SampleWindow window4 = new SampleWindow();
            window4.Size = new Point(440, 340);
            window4.Position = new Point(500, 400);
            window4.Resizable = true;
            window4.Titlebar.Text = "TabControl, TextAlign";
            window4.Parent = this;

            TabControl tabcontrol = new TabControl();
            tabcontrol.Dock = DockStyle.Fill;
            tabcontrol.Parent = window4;

            for (int i = 0; i < 6; i++)
            {
                TabPage tabPage = new TabPage();
                tabPage.Style = "frame";
                tabPage.Margin = new Margin(0, -1, 0, 0);
                tabPage.Button.Style = "button";
                tabPage.Button.Text = "page" + i;
                tabPage.Button.Tooltip = "Click to change active tab";
                tabPage.Button.Margin = new Margin(0, 0, -1, 0);
                tabcontrol.TabPages.Add(tabPage);

                Label lbl = new Label();
                lbl.Dock = DockStyle.Fill;
                lbl.Parent = tabPage;
                lbl.TextWrap = true;
                lbl.Text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\r\n nonumy eirmod tempor invidunt ut labore [color=ff0088ff][url=testurl]click \r\n meh![/url][/color] et dolore magna aliquyam erat, sed diam voluptua.\r\n At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
                lbl.Style = "multiline";
                lbl.BBCodeEnabled = true;
                lbl.LinkClicked += lbl_OnLinkClicked;
            }

            #endregion

            #region sample window 5 - Panel, TextBox

            SampleWindow window5 = new SampleWindow();
            window5.Size = new Point(440, 340);
            window5.Position = new Point(960, 40);
            window5.Resizable = true;
            window5.Titlebar.Text = "Panel, TextBox";
            window5.Parent = this;

            Panel panel = new Panel();
            panel.Style = "frame";
            panel.Dock = DockStyle.Fill;
            panel.Parent = window5;

            panel.ClipFrame.Margin = new Margin(8);
            panel.ClipFrame.Style = "textbox";

            panel.VScroll.Margin = new Margin(0, 8, 8, 8);
            panel.VScroll.Size = new Squid.Point(14, 10);
            panel.VScroll.Slider.Style = "vscrollTrack";
            panel.VScroll.Slider.Button.Style = "vscrollButton";
            panel.VScroll.ButtonUp.Style = "vscrollUp";
            panel.VScroll.ButtonUp.Size = new Squid.Point(10, 20);
            panel.VScroll.ButtonDown.Style = "vscrollUp";
            panel.VScroll.ButtonDown.Size = new Squid.Point(10, 20);
            panel.VScroll.Slider.Margin = new Margin(0, 2, 0, 2);

            panel.HScroll.Margin = new Margin(8, 0, 8, 8);
            panel.HScroll.Size = new Squid.Point(10, 14);
            panel.HScroll.Slider.Style = "hscrollTrack";
            panel.HScroll.Slider.Button.Style = "hscrollButton";
            panel.HScroll.ButtonUp.Style = "hscrollUp";
            panel.HScroll.ButtonUp.Size = new Squid.Point(20, 10);
            panel.HScroll.ButtonDown.Style = "hscrollUp";
            panel.HScroll.ButtonDown.Size = new Squid.Point(20, 10);
            panel.HScroll.Slider.Margin = new Margin(2, 0, 2, 0);

            for (int i = 0; i < 10; i++)
            {
                Label label = new Label();
                label.Text = "label control:";
                label.Size = new Point(100, 35);
                label.Position = new Point(10, 10 + 45 * i);
                panel.Content.Controls.Add(label);

                TextBox txt = new TextBox();
                txt.Text = "lorem ipsum";
                txt.Size = new Squid.Point(222, 35);
                txt.Position = new Point(110, 10 + 45 * i);
                txt.Style = "textbox";
                txt.AllowDrop = true;
                txt.TabIndex = 1 + i;
                txt.DragDrop += txt_OnDragDrop;
                txt.GotFocus += txt_OnGotFocus;
                panel.Content.Controls.Add(txt);
            }

            #endregion

            #region sample window 6 - ListView

            SampleWindow window6 = new SampleWindow();
            window6.Size = new Point(440, 340);
            window6.Position = new Point(960, 400);
            window6.Resizable = true;
            window6.Titlebar.Text = "Misc";
            window6.Parent = this;

            Random rnd = new Random();
            List<MyData> models = new List<MyData>();
            for (int i = 0; i < 32; i++)
            {
                MyData data = new MyData();
                data.Name = rnd.Next().ToString();
                data.Date = DateTime.Now.AddMilliseconds(rnd.Next());
                data.Rating = rnd.Next();
                models.Add(data);
            }

            ListView olv = new ListView();
            olv.Dock = DockStyle.Fill;
            olv.Columns.Add(new ListView.Column { Text = "Name", Aspect = "Name", Width = 120 });
            olv.Columns.Add(new ListView.Column { Text = "Date", Aspect = "Date", Width = 120 });
            olv.Columns.Add(new ListView.Column { Text = "Rating", Aspect = "Rating", Width = 120 });
            olv.StretchLastColumn = false;
            olv.FullRowSelect = true;

            olv.CreateHeader = delegate(object sender, ListView.FormatHeaderEventArgs args)
            {
                Button header = new Button
                {
                    Dock = DockStyle.Fill,
                    Text = args.Column.Text,
                    AllowDrop = true
                };

                header.MouseClick += delegate(Control snd, MouseEventArgs e)
                {
                    if (args.Column.Aspect == "Name")
                        olv.Sort<MyData>((a, b) => a.Name.CompareTo(b.Name));
                    else if (args.Column.Aspect == "Date")
                        olv.Sort<MyData>((a, b) => a.Date.CompareTo(b.Date));
                    else if (args.Column.Aspect == "Rating")
                        olv.Sort<MyData>((a, b) => a.Rating.CompareTo(b.Rating));
                };

                header.MouseDrag += delegate(Control snd, MouseEventArgs e)
                {
                    Label drag = new Label();
                    drag.Size = snd.Size;
                    drag.Position = snd.Location;
                    drag.Style = snd.Style;
                    drag.Text = ((Button)snd).Text;

                    DoDragDrop(drag);
                };

                header.DragDrop += delegate(Control snd, DragDropEventArgs e)
                {

                };

                return header;
            };

            olv.CreateCell = delegate(object sender, ListView.FormatCellEventArgs args)
            {
                return new Button
                {
                    Size = new Point(28, 28),
                    Dock = DockStyle.Top,
                    Text = olv.GetAspectValue(args.Model, args.Column),
                    Tooltip = args.Column.Text
                };
            };

            olv.SetObjects(models);

            window6.Controls.Add(olv);

            #endregion

            #endregion
        }