Inheritance: Gtk.CellRenderer
コード例 #1
0
ファイル: LayersListWidget.cs プロジェクト: deckarep/Pinta
        public LayersListWidget()
        {
            SetSizeRequest (200, 300);

            SetPolicy (PolicyType.Automatic, PolicyType.Automatic);

            tree = new TreeView ();

            tree.HeadersVisible = false;
            tree.FixedHeightMode = true;
            tree.Reorderable = false;
            tree.EnableGridLines = TreeViewGridLines.None;
            tree.EnableTreeLines = false;
            tree.ShowExpanders = false;

            var crs = new CellRendererSurface (thumbnail_width, thumbnail_height);
            var col = new TreeViewColumn ("Thumbnail", crs, "surface", store_index_thumbnail);
            col.Sizing = TreeViewColumnSizing.Fixed;
            col.FixedWidth = thumbnail_column_width;
            tree.AppendColumn (col);

            col = new TreeViewColumn ("Name", new CellRendererText (), "text", store_index_name);
            col.Sizing = TreeViewColumnSizing.Fixed;
            col.Expand = true;
            col.MinWidth = name_column_min_width;
            col.MaxWidth = name_column_max_width;
            tree.AppendColumn (col);

            var crt = new CellRendererToggle ();
            crt.Activatable = true;
            crt.Toggled += LayerVisibilityToggled;

            col = new TreeViewColumn ("Visible", crt, "active", store_index_visibility);
            col.Sizing = TreeViewColumnSizing.Fixed;
            col.FixedWidth = visibility_column_width;
            tree.AppendColumn (col);

            store = new TreeStore (typeof (Cairo.ImageSurface), typeof (string), typeof (bool), typeof (Layer));

            tree.Model = store;
            tree.RowActivated += HandleRowActivated;

            Add (tree);

            PintaCore.Layers.LayerAdded += HandleLayerAddedOrRemoved;
            PintaCore.Layers.LayerRemoved += HandleLayerAddedOrRemoved;
            PintaCore.Layers.SelectedLayerChanged += HandleSelectedLayerChanged;
            PintaCore.Layers.LayerPropertyChanged += HandlePintaCoreLayersLayerPropertyChanged;

            PintaCore.History.HistoryItemAdded += HandleHistoryItemAdded;
            PintaCore.History.ActionRedone += HandleHistoryItemAdded;
            PintaCore.History.ActionUndone += HandleHistoryItemAdded;

            tree.CursorChanged += HandleLayerSelected;

            ShowAll ();
        }