private void Init() { labelInfo = new LabelGadget(this, $"Tile {mapX}/{mapY}"); layerBox = new BoxGadget(this, Orientation.Horizontal); var tileBox = new BoxGadget(this, Orientation.Horizontal); image = new ImageGadget(tileBox) { FixedHeight = 200, FixedWidth = 200 }; table = new TableGadget(tileBox) { RowHeight = 64, EvenColumns = false, SelectedCellChangedEvent = (o, i) => { ChangeTile(); } }; var colImg = table.AddColumn("Img", 64); var colIdx = table.AddColumn("Id", 64); var colName = table.AddColumn("Name", 200); var butBox = new BoxGadget(this, Orientation.Horizontal, Alignment.Fill, 10, 10); new ButtonGadget(butBox, "Ok") { GadgetUpEvent = (o, i) => { Apply(); mapScreen.HideEditor(); } }; new ButtonGadget(butBox, "Cancel") { GadgetUpEvent = (o, i) => { mapScreen.HideEditor(); } }; }
private void Sinatra() { var form = new Form(); form.MarginHeight = 2; form.MarginWidth = 2; this.Children.Add(form); var cs = new LeftControls[] { new LeftControls("エンジン\n(--engine)", WgtEngine), new LeftControls("カラム名行\n(--column-names-row)", WgtColumn), new LeftControls("データ開始行\n(--data-start-row)", WgtDataRow), new LeftControls("seedファイルの拡張子\n(--seed-extension)", WgtSeedExtension), new LeftControls("yamlのフォーマット\n(--format)", WgtFormat), }; var vb6 = new Delegaty[] { (X) => { var msc = new SimpleCheckBox(); deleteCheckBox = new ToggleButtonGadget(); deleteCheckBox.LabelString = "変換元にないデータを削除する\n(--delete)"; deleteCheckBox.Set = Options.delete ? ToggleButtonState.Set : ToggleButtonState.Unset; deleteCheckBox.ValueChangedEvent += (x, y) => { Options.delete = deleteCheckBox.Set == ToggleButtonState.Set; }; msc.Children.Add(deleteCheckBox); return(msc); }, (X) => { var msc = new SimpleCheckBox(); calcFormulasCheckBox = new ToggleButtonGadget(); calcFormulasCheckBox.LabelString = "yml→xlsx変換時に数式キャッシュを再計算\n(--calc-formulas)"; calcFormulasCheckBox.Set = Options.calcFormulas ? ToggleButtonState.Set : ToggleButtonState.Unset; calcFormulasCheckBox.ValueChangedEvent += (x, y) => { Options.calcFormulas = deleteCheckBox.Set == ToggleButtonState.Set; }; msc.Children.Add(calcFormulasCheckBox); return(msc); } }; var rc = new RowColumn(); rc.Packing = Packing.Column; rc.NumColumns = cs.Length + 1; rc.Orientation = Orientation.Horizontal; rc.IsAligned = true; rc.EntryAlignment = Alignment.End; form.Children.Add(rc); foreach (var c in cs) { var l = new LabelGadget(); l.LabelString = c.Label; rc.Children.Add(l); if (null != c.Delegaty) { var x = c.Delegaty(rc); rc.Children.Add(x); } } rc.TopAttachment = AttachmentType.Form; rc.LeftAttachment = AttachmentType.Form; var rd = new RowColumn(); rd.NumColumns = vb6.Length + 1; rd.Orientation = Orientation.Vertical; rd.IsAligned = true; rd.EntryAlignment = Alignment.End; form.Children.Add(rd); foreach (var c in vb6) { var x = c(rd); rd.Children.Add(x); } rd.TopAttachment = AttachmentType.Widget; rd.TopWidget = rc; var vb5 = new LeftControls[] { new LeftControls("yml分割設定\n--subdivide", (x) => { return(WgtText(x, out subdivideTextBox, Options.subdivide)); }), new LeftControls("このテーブルのみ変換\n--only", (x) => { return(WgtText(x, out onlyTextBox, Options.only)); }), new LeftControls("このテーブルを無視\n--ignore", (x) => { return(WgtText(x, out ignoreTextBox, Options.ignore)); }), new LeftControls("優先シート\n--primary", (x) => { return(WgtText(x, out primaryTextBox, Options.primary)); }), new LeftControls("ymlとシート名の対応\n--mapping", (x) => { return(WgtText(x, out mappingTextBox, Options.mapping)); }), new LeftControls("エイリアスシート名\n--alias", (x) => { return(WgtText(x, out aliasTextBox, Options.alias)); }), new LeftControls("このカラム名を無視\n--ignore-columns", (x) => { return(WgtText(x, out ignoreColumnsTextBox, Options.ignoreColumns)); }), new LeftControls("YAML扱いするカラム\n--yaml-columns", (x) => { return(WgtText(x, out yamlColumnsTextBox, Options.yamlColumns)); }), }; var re = new Form(); re.FractionBase = vb5.Length; form.Children.Add(re); re.TopAttachment = AttachmentType.Widget; re.TopWidget = rd; re.BottomAttachment = AttachmentType.Form; re.RightAttachment = AttachmentType.Form; for (int i = 0; i < vb5.Length; ++i) { var c = vb5[i]; var frx = new Form(); frx.LeftAttachment = AttachmentType.Position; frx.LeftPosition = i; frx.RightAttachment = AttachmentType.Position; frx.RightPosition = i + 1; frx.TopAttachment = frx.BottomAttachment = AttachmentType.Form; var k = new Label(); k.LabelString = c.Label; frx.Children.Add(k); var t = c.Delegaty(re); frx.Children.Add(t); re.Children.Add(frx); t.TopAttachment = AttachmentType.Widget; t.TopWidget = k; t.LeftAttachment = t.RightAttachment = t.BottomAttachment = AttachmentType.Form; } var buttonBase = new RowColumn(); buttonBase.TopAttachment = AttachmentType.Form; buttonBase.RightAttachment = AttachmentType.Form; buttonBase.Orientation = Orientation.Horizontal; form.Children.Add(buttonBase); okButton = new PushButton(); okButton.LabelString = "保存"; okButton.ShowAsDefault = true; okButton.Alignment = Alignment.Center; okButton.ActivateEvent += (z, p) => { SaveOptions(); this.Destroy(); }; buttonBase.Children.Add(okButton); discardButton = new PushButton(); discardButton.TopAttachment = AttachmentType.Widget; discardButton.TopWidget = okButton; discardButton.RightAttachment = AttachmentType.Form; discardButton.LabelString = "取消"; discardButton.Alignment = Alignment.Center; discardButton.ActivateEvent += (x, y) => { this.Destroy(); }; buttonBase.Children.Add(discardButton); // 読み取り専用 if (!Changable) { deleteCheckBox.Sensitive = calcFormulasCheckBox.Sensitive = yamlColumnsTextBox.Sensitive = ignoreColumnsTextBox.Sensitive = mappingTextBox.Sensitive = aliasTextBox.Sensitive = ignoreTextBox.Sensitive = onlyTextBox.Sensitive = primaryTextBox.Sensitive = formatComboBox.Sensitive = subdivideTextBox.Sensitive = dataStartRowNumericUpDown.Sensitive = engineComboBox.Sensitive = okButton.Sensitive = seedExtensionTextBox.Sensitive = columnNamesRowNumericUpDown.Sensitive = false; } }
private void PropDemo() { if (propWindow == null) { propWindow = new Window(screen, "Prop Demo") { LeftEdge = 30, TopEdge = 30, CloseGadget = true, DepthGadget = true, SizeGadget = true, WindowCloseEvent = (o, i) => { screen.CloseWindow(propWindow); propWindow = null; } }; new LabelGadget(propWindow, "Proportional Gadgets") { Frame = true }; new PropGadget(propWindow) { HorizBody = 0x1111 }; new PropGadget(propWindow) { HorizBody = 0x5555 }; new PropGadget(propWindow) { FreeHoriz = true, FreeVert = true, HorizBody = 0x1111, VertBody = 0x1111 }; new ScrollbarGadget(propWindow) { Max = 100, VisibleAmount = 10, Increment = 10 }; new ScrollbarGadget(propWindow) { Max = 100, VisibleAmount = 10, Increment = 10, ArrowPlace = ArrowPlace.LeftTop }; new ScrollbarGadget(propWindow) { Max = 100, VisibleAmount = 10, Increment = 10, ArrowPlace = ArrowPlace.Split }; new ScrollbarGadget(propWindow) { Max = 100, VisibleAmount = 10, Increment = 10, ArrowPlace = ArrowPlace.None }; progBar = new ProgressbarGadget(propWindow) { Max = 100, Value = 50, ShowPercent = true }; progBar2 = new ProgressbarGadget(propWindow) { Max = 1000, Value = 50, ShowPart = true }; var sl = new LabelGadget(propWindow, "Level"); new SliderGadget(propWindow, Orientation.Horizontal) { Min = 1, Max = 16, Value = 3, LabelFormat = "Level {0}", LabelGadget = sl }; } screen.ShowWindow(propWindow); screen.WindowToFront(propWindow); screen.ActivateWindow(propWindow); }