public KeyControl(KeyRebindTab parent, BoundKeyFunction function) { Function = function; var name = new Label { Text = Loc.GetString( $"ui-options-function-{CaseConversion.PascalToKebab(function.FunctionName)}"), HorizontalExpand = true, HorizontalAlignment = HAlignment.Left }; BindButton1 = new BindButton(parent, this, StyleBase.ButtonOpenRight); BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft); ResetButton = new Button { Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = { StyleBase.ButtonCaution } }; var hBox = new BoxContainer { Orientation = LayoutOrientation.Horizontal, Children = { new Control { MinSize = (5, 0) },
public BindButton(KeyRebindTab tab, KeyControl keyControl, string styleClass) { _tab = tab; KeyControl = keyControl; Button = new Button { StyleClasses = { styleClass } }; UpdateText(); AddChild(Button); Button.OnPressed += args => { tab.RebindButtonPressed(this); }; Button.OnKeyBindDown += ButtonOnOnKeyBindDown; MinSize = (200, 0); }