Ejemplo n.º 1
0
 static public TreeViewColumnLocalized AppendColumn(this TreeView treeview, TreeViewColumnLocalized column, CellRenderer renderer, string attr, int modelcolumn)
 {
     treeview.AppendColumn(column);
     column.PackStart(renderer, true);
     column.AddAttribute(renderer, attr, modelcolumn);
     return(column);
 }
        public LocalizationEditor()
        {
            this.Build();

            TreeViewColumn keyColumn = new TreeViewColumnLocalized()
            {
                Title = "Key", Sizing = TreeViewColumnSizing.Fixed, FixedWidth = 150, SortColumnId = keyIndex
            };
            TreeViewColumn usValueColumn = new TreeViewColumnLocalized()
            {
                Title = "US name", Sizing = TreeViewColumnSizing.Fixed, FixedWidth = 150, SortColumnId = usValueIndex
            };
            TreeViewColumn localValueColumn = new TreeViewColumnLocalized()
            {
                Title = "Current name", Sizing = TreeViewColumnSizing.Autosize, SortColumnId = localValueIndex
            };

            treeview1.AppendColumn(keyColumn);
            treeview1.AppendColumn(usValueColumn);
            treeview1.AppendColumn(localValueColumn);

            Gtk.CellRendererText keyCell        = new Gtk.CellRendererText();
            Gtk.CellRendererText usValueCell    = new Gtk.CellRendererText();
            Gtk.CellRendererText localValueCell = new Gtk.CellRendererText();

            localValueCell.Editable = true;
            localValueCell.Edited  += new EditedHandler(localValueCell_Edited);

            keyColumn.PackStart(keyCell, true);
            usValueColumn.PackStart(usValueCell, true);
            localValueColumn.PackStart(localValueCell, true);

            keyColumn.AddAttribute(keyCell, "text", keyIndex);
            usValueColumn.AddAttribute(usValueCell, "text", usValueIndex);
            localValueColumn.AddAttribute(localValueCell, "text", localValueIndex);

            // Create a model that will hold the content, assign the model to the TreeView
            listStore       = new Gtk.ListStore(typeof(Localization.Node), typeof(string), typeof(string), typeof(string));
            treeview1.Model = listStore;
            treeview1.GetColumn(0).Click(); // enable sorting 1st column ascending as default

            button1.Clicked += (sender, e) =>
            {
                ComponentManager.Localization.WriteChangedResourceFiles();
                UpdateChangeCount();
            };

            buttonTranslate.Clicked    += new EventHandler(buttonTranslate_Clicked);
            buttonTranslateAll.Clicked += new EventHandler(buttonTranslateAll_Clicked);
        }
Ejemplo n.º 3
0
        public ComponentList()
        {
            this.Build();
            this.Name = "Component List";

            Gtk.TreeViewColumn componentColumn = new TreeViewColumnLocalized()
            {
                Title = "Component", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 200
            };
            Gtk.TreeViewColumn instanceCountColumn = new TreeViewColumnLocalized()
            {
                Title = "Instances", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 50
            };
            Gtk.TreeViewColumn descriptionColumn = new TreeViewColumnLocalized()
            {
                Title = "Description", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 300
            };

            // Add the columns to the TreeView
            treeview1.AppendColumn(instanceCountColumn);
            treeview1.AppendColumn(componentColumn);
            treeview1.AppendColumn(descriptionColumn);

            // Create the text cells that will display the content
            Gtk.CellRendererText componentsCell = new Gtk.CellRendererText();
            componentColumn.PackStart(componentsCell, true);

            Gtk.CellRendererText instanceCountCell = new Gtk.CellRendererText();
            instanceCountColumn.PackStart(instanceCountCell, true);

            Gtk.CellRendererText descriptionCell = new Gtk.CellRendererText();
            descriptionColumn.PackStart(descriptionCell, true);

            componentColumn.AddAttribute(componentsCell, "text", TypenameIndex);
            instanceCountColumn.AddAttribute(instanceCountCell, "text", InstanceCountIndex);
            descriptionColumn.AddAttribute(descriptionCell, "text", DescriptionIndex);

            // Create a model that will hold some value, assign the model to the TreeView
            listStore       = new Gtk.ListStore(typeof(ComponentFactoryInformation), typeof(int), typeof(string), typeof(string));
            treeview1.Model = listStore;

            treeview1.Selection.Changed += HandleCursorChanged; // do not use treeview1.CursorChanged
        }
Ejemplo n.º 4
0
        public Activities()
        {
            this.Build();

            Gtk.TreeViewColumn columnName = new TreeViewColumnLocalized()
            {
                Title = "Activity", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 100
            };
            Gtk.TreeViewColumn columnDesc = new TreeViewColumnLocalized()
            {
                Title = "Description", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 200
            };
            Gtk.TreeViewColumn columnStatus = new TreeViewColumnLocalized()
            {
                Title = "Status", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 100
            };

            treeview1.AppendColumn(columnName);
            treeview1.AppendColumn(columnDesc);
            treeview1.AppendColumn(columnStatus);

            Gtk.CellRendererText     rendererName   = new Gtk.CellRendererText();
            Gtk.CellRendererText     rendererDesc   = new Gtk.CellRendererText();
            Gtk.CellRendererProgress rendererStatus = new Gtk.CellRendererProgress();

            columnName.PackStart(rendererName, true);
            columnDesc.PackStart(rendererDesc, true);
            columnStatus.PackStart(rendererStatus, true);

            columnName.AddAttribute(rendererName, "text", COLUMN_NAME);
            columnDesc.AddAttribute(rendererDesc, "text", COLUMN_DESCRIPTION);
            columnStatus.AddAttribute(rendererStatus, "value", COLUMN_STATUS);

            listStore                    = new Gtk.ListStore(typeof(JobInfo), typeof(string), typeof(string), typeof(int));
            treeview1.Model              = listStore;
            treeview1.Selection.Changed += HandleCursorChanged; // do not use treeview1.CursorChanged
        }