void AddEvents() { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _locker.MouseEvent.onMouseOver += (sender, args) => { _lockerTooltip.Show(); }; _locker.MouseEvent.onMouseOut += (sender, args) => { _lockerTooltip.Hide(); }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _locker.MouseEvent.onMouseClick += (sender, args) => { _locker.Selected = !_locker.Selected; Owner.Locked = _locker.Selected; Owner.Editable = !Owner.Locked; }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _layoutCBG.SetSelected(_grid); _grid.MouseEvent.onMouseClick += (sender, args) => { _layoutCBG.SetSelected(_grid); MainWindow.RemoveContainer(); MainWindow.RootContainer = UIFactory <UIObject, IContainer> .CreateContainer(MainWindow.RootContainer, new Grid(), MainWindow._mainBatch); MainWindow.AddContainer(); MainWindow.RootContainer.Show(); }; _free.MouseEvent.onMouseClick += (sender, args) => { _layoutCBG.SetSelected(_free); MainWindow.RemoveContainer(); MainWindow.RootContainer = UIFactory <UIObject, IContainer> .CreateContainer(MainWindow.RootContainer, new Frame("FrameEditorTX", DrawPriority.NORMAL), MainWindow._mainBatch); MainWindow.AddContainer(); MainWindow.RootContainer.Show(); }; _vertical.MouseEvent.onMouseClick += (sender, args) => { _layoutCBG.SetSelected(_vertical); MainWindow.RemoveContainer(); MainWindow.RootContainer = UIFactory <UIObject, IContainer> .CreateContainer(MainWindow.RootContainer, new VerticalStack(), MainWindow._mainBatch); MainWindow.AddContainer(); MainWindow.RootContainer.Show(); }; _horizontal.MouseEvent.onMouseClick += (sender, args) => { _layoutCBG.SetSelected(_horizontal); MainWindow.RemoveContainer(); MainWindow.RootContainer = UIFactory <UIObject, IContainer> .CreateContainer(MainWindow.RootContainer, new HorizontalStack(), MainWindow._mainBatch); MainWindow.AddContainer(); MainWindow.RootContainer.Show(); }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _onClickConfirm.MouseEvent.onMouseClick += (sender, args) => { _onClickConfirm.Selected = true; }; _onOverConfirm.MouseEvent.onMouseClick += (sender, args) => { _onOverConfirm.Selected = true; }; _onOutConfirm.MouseEvent.onMouseClick += (sender, args) => { _onOutConfirm.Selected = true; }; _okClickConfirm.MouseEvent.onMouseClick += (sender, args) => { // TODO: _onClickConfirm.Hide(); _events.Hide(); }; _cancelClickConfirm.MouseEvent.onMouseClick += (sender, args) => { _onClickConfirm.Clear(); _onClickConfirm.Hide(); _events.Hide(); }; _okOverConfirm.MouseEvent.onMouseClick += (sender, args) => { // TODO: _onOverConfirm.Hide(); _events.Hide(); }; _cancelOverConfirm.MouseEvent.onMouseClick += (sender, args) => { _onOverConfirm.Clear(); _onOverConfirm.Hide(); _events.Hide(); }; _okOutConfirm.MouseEvent.onMouseClick += (sender, args) => { // TODO: _onOutConfirm.Hide(); _events.Hide(); }; _cancelOutConfirm.MouseEvent.onMouseClick += (sender, args) => { _onOutConfirm.Clear(); _onOutConfirm.Hide(); _events.Hide(); }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _events.MouseEvent.onMouseClick += (sender, args) => { _events.Show(); _onClickConfirm.Hide(); _onOverConfirm.Hide(); _onOutConfirm.Hide(); }; _events.AddNewItem("OnClick", () => { UIObject item = _events["OnClick"]; _onClickConfirm.Show(); _onOverConfirm.Hide(); _onOutConfirm.Hide(); }); _events.AddNewItem("MouseOver", () => { UIObject item = _events["MouseOver"]; _onOverConfirm.Show(); _onClickConfirm.Hide(); _onOutConfirm.Hide(); }); _events.AddNewItem("MouseOut", () => { UIObject item = _events["MouseOut"]; _onOutConfirm.Show(); _onClickConfirm.Hide(); _onOverConfirm.Hide(); }); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _showhide.MouseEvent.onMouseClick += (sender, args) => { if (_showhide.Selected) { Owner.Active = false; } else { Owner.Active = true; } }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _search.MouseEvent.onMouseClick += (sender, args) => { _search.Selected = true; }; _search.KeyboardEvents.onKeyReleased += (sender, args) => { if (Singleton.Input.KeyReleased(Keys.Back)) { MainWindow.Selection.Hide(); } else { if (Singleton.Input.KeyReleased(Singleton.Input.CurrentKey)) { if (_search.Text.Length >= 3) { string pattern = @".*(?=" + _search.Text + ")+"; Regex reg = new Regex(pattern, RegexOptions.IgnoreCase); var objectsFound = MainWindow.RootContainer.Slots.Where(t => reg.Match(t.Item.Name).Success).ToList(); if (objectsFound.Count > 0) { var owner = objectsFound.Last().Item; MainWindow.Selection.Position = owner.Position; Point rightBarPosition = new Point(owner.Right, owner.Top); Point leftBarPosition = new Point(owner.Left, owner.Top); Point topBarPosition = new Point(owner.Left, owner.Top); Point bottomBarPosition = new Point(owner.Left, owner.Bottom); MainWindow.Selection.UpdatePosition(rightBarPosition, leftBarPosition, topBarPosition, bottomBarPosition); MainWindow.Selection.UpdateSize(owner); _search.Clear(); _search.SimulateInput(owner.Name); MainWindow.Selection.Show(); } } } } }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
void AddPanelProperties() { ///////////////////////////////////// Default Panel Properties //////////////////////////////////////////////////// ////////////////////////////////////////////// Start //////////////////////////////////////////////////////////////// _grid = new CheckBox("PropertyPanelCheckboxTX", OverlayOption.CHECKBOX, DrawPriority.LOW); _free = new CheckBox("PropertyPanelCheckboxTX", OverlayOption.CHECKBOX, DrawPriority.LOW); _vertical = new CheckBox("PropertyPanelCheckboxTX", OverlayOption.CHECKBOX, DrawPriority.LOW); _horizontal = new CheckBox("PropertyPanelCheckboxTX", OverlayOption.CHECKBOX, DrawPriority.LOW); _search = new TextBox("PropertyPanelTextboxTX", "PropertyPanelTextboxPointerTX", TextBoxType.TEXT, DrawPriority.HIGHEST); _events = new ComboBox("PropertyPanelEvtCBTX", "PropertyPanelEvtCBBGTX", DrawPriority.LOWEST); _showhide = new CheckBox("PropertyPanelCheckboxTX", OverlayOption.CHECKBOX, DrawPriority.HIGHEST); _locker = new CheckBox("PropertyPanelCheckboxTX", OverlayOption.CHECKBOX, DrawPriority.HIGHEST); _onClickConfirm = new TextBoxConfirmAction(); _onOverConfirm = new TextBoxConfirmAction(); _onOutConfirm = new TextBoxConfirmAction(); _onClickConfirm.Priority = DrawPriority.LOWEST; _onOverConfirm.Priority = DrawPriority.LOWEST; _onOutConfirm.Priority = DrawPriority.LOWEST; _onOverConfirm.Initialize(); _onClickConfirm.Initialize(); _onOutConfirm.Initialize(); _okClickConfirm = new Button("TextboxPickerConfirmTX", OverlayOption.NORMAL, DrawPriority.LOWEST); _cancelClickConfirm = new Button("TextboxPickerCancelTX", OverlayOption.NORMAL, DrawPriority.LOWEST); _okOverConfirm = new Button("TextboxPickerConfirmTX", OverlayOption.NORMAL, DrawPriority.LOWEST); _cancelOverConfirm = new Button("TextboxPickerCancelTX", OverlayOption.NORMAL, DrawPriority.LOWEST); _okOutConfirm = new Button("TextboxPickerConfirmTX", OverlayOption.NORMAL, DrawPriority.LOWEST); _cancelOutConfirm = new Button("TextboxPickerCancelTX", OverlayOption.NORMAL, DrawPriority.LOWEST); _showhideLb = new Label("Show/Hide:"); _lockLb = new Label("Lock:"); _showhideLb.TextFont = Singleton.Font.GetFont(FontManager.FontType.LUCIDA_CONSOLE); _lockLb.TextFont = Singleton.Font.GetFont(FontManager.FontType.LUCIDA_CONSOLE); _lockerTooltip = new ToolTip(_locker); _lockerTooltip.Initialize(); _lockerTooltip.Text = "Tick this option\nTo lock the Item in place,\nAnd enable live actions\n(scale, show/hide etc)!"; _properties.Add(_grid, new Point(141, 38)); _properties.Add(_free, new Point(182, 38)); _properties.Add(_vertical, new Point(226, 38)); _properties.Add(_horizontal, new Point(275, 38)); _properties.Add(_search, new Point(4, 55)); _showhideLb.Setup(); _lockLb.Setup(); _properties.Add(_onClickConfirm, new Point(-100, 140)); _properties.Add(_onOverConfirm, new Point(-100, 170)); _properties.Add(_onOutConfirm, new Point(-100, 195)); _properties.Add(_events, new Point(171, 118)); int lbWidth = (int)_showhideLb.TextSize.X; _properties.Add(_showhideLb, new Point(168 - lbWidth, 488)); _properties.Add(_showhide, new Point(171, 488)); lbWidth = (int)_lockLb.TextSize.X; _properties.Add(_lockLb, new Point(168 - lbWidth, 339)); _properties.Add(_locker, new Point(171, 339)); _layoutCBG.AddRange(_grid, _free, _vertical, _horizontal); ////////////////////////////////////////////// End //////////////////////////////////////////////////////////////// Initialize(); _events.AddName("Mouse Events", Color.White, Singleton.Font.GetFont(FontManager.FontType.GEORGIA)); _okClickConfirm.Initialize(); _cancelClickConfirm.Initialize(); _okOverConfirm.Initialize(); _cancelOverConfirm.Initialize(); _okOutConfirm.Initialize(); _cancelOutConfirm.Initialize(); _okClickConfirm.Setup(); _cancelClickConfirm.Setup(); _okOverConfirm.Setup(); _cancelOverConfirm.Setup(); _okOutConfirm.Setup(); _cancelOutConfirm.Setup(); _onClickConfirm.AddButton(_okClickConfirm); _onClickConfirm.AddButton(_cancelClickConfirm); _onOverConfirm.AddButton(_okOverConfirm); _onOverConfirm.AddButton(_cancelOverConfirm); _onOutConfirm.AddButton(_okOutConfirm); _onOutConfirm.AddButton(_cancelOutConfirm); _onClickConfirm.Hide(); _onOverConfirm.Hide(); _onOutConfirm.Hide(); }