コード例 #1
0
        public RunConfigurationsList()
        {
            listStore           = new Xwt.ListStore(configCol, configNameCol, configIconCol);
            list                = new Xwt.ListView(listStore);
            list.HeadersVisible = false;

            var imgCell = new ImageCellView {
                ImageField = configIconCol
            };
            var textCell = new TextCellView {
                MarkupField = configNameCol
            };

            list.Columns.Add(GettextCatalog.GetString("Name"), imgCell, textCell);

            Content = list;

            list.SelectionChanged += (s, o) => SelectionChanged?.Invoke(this, o);
            list.RowActivated     += (s, o) => RowActivated?.Invoke(this, o);
        }
コード例 #2
0
ファイル: ItemCollection.cs プロジェクト: git-thinh/limada
 public ItemCollection()
 {
     store = new ListStore(labelField, dataField);
 }
コード例 #3
0
        public DefaultFontSelectorBackend()
        {
            families = Font.AvailableFontFamilies.ToList();
            families.Sort();

            storeFonts               = new ListStore(dfamily, dfamilymarkup);
            listFonts.DataSource     = storeFonts;
            listFonts.HeadersVisible = false;
            listFonts.Columns.Add("Font", new TextCellView()
            {
                TextField = dfamily, MarkupField = dfamilymarkup
            });
            listFonts.MinWidth = 150;

            foreach (var family in families)
            {
                var row = storeFonts.AddRow();
                storeFonts.SetValues(row, dfamily, family, dfamilymarkup, "<span font=\"" + family + " " + (listFonts.Font.Size) + "\">" + family + "</span>");
            }

            storeFace               = new ListStore(dfaceName, dfaceMarkup, dfaceFont);
            listFace.DataSource     = storeFace;
            listFace.HeadersVisible = false;
            listFace.Columns.Add("Style", new TextCellView()
            {
                TextField = dfaceName, MarkupField = dfaceMarkup
            });
            listFace.MinWidth = 60;
            //listFace.HorizontalScrollPolicy = ScrollPolicy.Never;

            foreach (var size in DefaultFontSizes)
            {
                listSize.Items.Add(size);
            }

            spnSize.Digits         = 1;
            spnSize.MinimumValue   = 1;
            spnSize.MaximumValue   = 800;
            spnSize.IncrementValue = 1;
            PreviewText            = "The quick brown fox jumps over the lazy dog.";

            spnSize.ValueChanged += (sender, e) => {
                if (DefaultFontSizes.Contains(spnSize.Value))
                {
                    var row = Array.IndexOf(DefaultFontSizes, spnSize.Value);
                    listSize.ScrollToRow(row);
                    listSize.SelectRow(row);
                }
                else
                {
                    listSize.UnselectAll();
                }
                SetFont(selectedFont.WithSize(spnSize.Value));
            };

            SelectedFont = Font.SystemFont;
            UpdateFaceList(selectedFont);              // family change not connected at this point, update manually


            listFonts.SelectionChanged += (sender, e) => {
                if (listFonts.SelectedRow >= 0)
                {
                    var newFont = selectedFont.WithFamily(storeFonts.GetValue(listFonts.SelectedRow, dfamily));
                    UpdateFaceList(newFont);
                    SetFont(newFont);
                }
            };

            listFace.SelectionChanged += (sender, e) => {
                if (listFace.SelectedRow >= 0)
                {
                    SetFont(storeFace.GetValue(listFace.SelectedRow, dfaceFont).WithSize(selectedFont.Size));
                }
            };

            listSize.SelectionChanged += (sender, e) => {
                if (listSize.SelectedRow >= 0 && Math.Abs(DefaultFontSizes [listSize.SelectedRow] - spnSize.Value) > double.Epsilon)
                {
                    spnSize.Value = DefaultFontSizes[listSize.SelectedRow];
                }
            };

            VBox familyBox = new VBox();

            familyBox.PackStart(new Label("Font:"));
            familyBox.PackStart(listFonts, true);

            VBox styleBox = new VBox();

            styleBox.PackStart(new Label("Style:"));
            styleBox.PackStart(listFace, true);

            VBox sizeBox = new VBox();

            sizeBox.PackStart(new Label("Size:"));
            sizeBox.PackStart(spnSize);
            sizeBox.PackStart(listSize, true);

            HBox fontBox = new HBox();

            fontBox.PackStart(familyBox, true);
            fontBox.PackStart(styleBox, true);
            fontBox.PackStart(sizeBox);

            VBox mainBox = new VBox();

            mainBox.MinWidth  = 350;
            mainBox.MinHeight = 300;
            mainBox.PackStart(fontBox, true);
            mainBox.PackStart(new Label("Preview:"));
            mainBox.PackStart(previewText);

            Content = mainBox;
        }
コード例 #4
0
ファイル: ItemCollection.cs プロジェクト: d5nguyenvan/xwt
 internal ItemCollection()
 {
     store = new ListStore(labelField, dataField);
 }