public HotkeyBox() { CanMove = false; AcceptMouseInput = true; AcceptKeyboardInput = true; Width = 210; Height = 20; ResizePic pic; Add ( pic = new ResizePic(0x0BB8) { Width = 150, Height = Height, AcceptKeyboardInput = true } ); pic.MouseUp += LabelOnMouseUp; Add ( _label = new HoveredLabel (string.Empty, false, 1, 0x0021, 0x0021, 150, 1, FontStyle.Italic, TEXT_ALIGN_TYPE.TS_CENTER) { Y = 5 } ); _label.MouseUp += LabelOnMouseUp; Add ( _buttonOK = new Button((int)ButtonState.Ok, 0x0481, 0x0483, 0x0482) { X = 152, ButtonAction = ButtonAction.Activate } ); Add ( _buttonCancel = new Button((int)ButtonState.Cancel, 0x047E, 0x0480, 0x047F) { X = 182, ButtonAction = ButtonAction.Activate } ); WantUpdateSize = false; IsActive = false; }
private void AddSubMacro(MacroObject obj) { if (obj == null || obj.Code == 0) { return; } switch (obj.SubMenuType) { case 1: int count = 0; int offset = 0; Macro.GetBoundByCode(obj.Code, ref count, ref offset); string[] names = new string[count]; for (int i = 0; i < count; i++) { names[i] = _allSubHotkeysNames[i + offset]; } Combobox sub = new Combobox(20, Height, 180, names, (int)obj.SubCode - offset, 300); sub.OnOptionSelected += (senderr, ee) => { Macro.GetBoundByCode(obj.Code, ref count, ref offset); MacroSubType subType = (MacroSubType)(offset + ee); obj.SubCode = subType; }; Add(sub); Height += sub.Height; break; case 2: ResizePic background = new ResizePic(0x0BB8) { X = 16, Y = Height, Width = 240, Height = 60 }; Add(background); StbTextBox textbox = new StbTextBox(0xFF, 80, 236, true, FontStyle.BlackBorder) { X = background.X + 4, Y = background.Y + 4, Width = background.Width - 4, Height = background.Height - 4 }; textbox.SetText(obj.HasString() ? ((MacroObjectString)obj).Text : string.Empty); textbox.TextChanged += (sss, eee) => { if (obj.HasString()) { ((MacroObjectString)obj).Text = ((StbTextBox)sss).Text; } }; Add(textbox); WantUpdateSize = true; Height += background.Height; break; } _control._databox.ReArrangeChildren(); }