void AddLanguageMenuItems(Xwt.Menu menu, SolutionTemplate template)
 {
     foreach (string language in template.AvailableLanguages.OrderBy(item => item))
     {
         var menuItem = new Xwt.MenuItem(language);
         menuItem.Accessible.Label = LanguageCellRenderer.GetAccessibleLanguageName(language);
         menuItem.Clicked         += (o, e) => {
             languageCellRenderer.SelectedLanguage = language;
             controller.SelectedLanguage           = language;
             templatesTreeView.QueueDraw();
             ShowSelectedTemplate();
         };
         menu.Items.Add(menuItem);
     }
 }
Ejemplo n.º 2
0
        TreeViewColumn CreateTemplateListTreeViewColumn()
        {
            var column = new TreeViewColumn();

            templateTextRenderer                   = new GtkTemplateCellRenderer();
            templateTextRenderer.Xpad              = 14;
            templateTextRenderer.Ypad              = 0;
            templateTextRenderer.Ellipsize         = Pango.EllipsizeMode.End;
            templateTextRenderer.CellBackgroundGdk = templateListBackgroundColor;

            column.PackStart(templateTextRenderer, true);
            column.AddAttribute(templateTextRenderer, "markup", column: 0);

            column.SetCellDataFunc(templateTextRenderer, SetTemplateTextCellData);

            languageCellRenderer = new LanguageCellRenderer();
            languageCellRenderer.CellBackgroundGdk = templateListBackgroundColor;

            column.PackEnd(languageCellRenderer, false);
            column.SetCellDataFunc(languageCellRenderer, SetLanguageCellData);
            return(column);
        }