コード例 #1
0
        public ResxEditorWidget(ResxEditorView view)
        {
            openDialog   = new OpenFileDialog();
            resxNodeList = new Dictionary <string, ResXDataNode>();
            editorView   = view;

            stringDialog = new EditStringDialog();

            typeMenuAudioItem            = new MenuItem("Audio");
            typeMenuAudioItem.Activated += DropDownEventHandler;

            typeMenuFileItem            = new MenuItem("Files");
            typeMenuFileItem.Activated += DropDownEventHandler;

            typeMenuIconItem            = new MenuItem("Icons");
            typeMenuIconItem.Activated += DropDownEventHandler;

            typeMenuImageItem            = new MenuItem("Images");
            typeMenuImageItem.Activated += DropDownEventHandler;

            typeMenuOtherItem            = new MenuItem("Other");
            typeMenuOtherItem.Activated += DropDownEventHandler;

            typeMenuStringItem            = new MenuItem("Strings");
            typeMenuStringItem.Activated += DropDownEventHandler;

            // Menus
            typeMenu = new Menu()
            {
                typeMenuStringItem,
                typeMenuAudioItem,
                typeMenuFileItem,
                typeMenuIconItem,
                typeMenuImageItem,
                typeMenuOtherItem
            };

            // MenuToolButtons
            typeToolButton = new MenuToolButton(null, "Strings")
            {
                Menu = typeMenu
            };

            addButton          = new ToolButton(null, "Add");
            addButton.Clicked += AddButtonEventHandler;

            editButton          = new ToolButton(null, "Edit");
            editButton.Clicked += EditButtonEventHandler;

            removeButton          = new ToolButton(null, "Remove");
            removeButton.Clicked += RemoveButtonEventHandler;

            // Toolbars
            mainToolbar = new Toolbar()
            {
                addButton, editButton, removeButton, typeToolButton
            };

            // ListStores
            audioListStore  = new ListStore(typeof(string), typeof(string), typeof(string));
            fileListStore   = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iconListStore   = new ListStore(typeof(Pixbuf), typeof(string), typeof(string));
            imageListStore  = new ListStore(typeof(Pixbuf), typeof(string), typeof(string), typeof(string));
            otherListStore  = new ListStore(typeof(string), typeof(string), typeof(string));
            stringListStore = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string));

            // TreeViews
            audioTreeView = new TreeView(audioListStore);
            audioTreeView.Selection.Mode = SelectionMode.Multiple;
            audioTreeView.AppendColumn("ResourceName", new CellRendererText(), "text", 0).Resizable = true;
            audioTreeView.AppendColumn("FileSize", new CellRendererText(), "text", 1).Resizable     = true;
            audioTreeView.AppendColumn("Comment", new CellRendererText(), "text", 2).Resizable      = true;

            fileTreeView = new TreeView(fileListStore);
            fileTreeView.Selection.Mode = SelectionMode.Multiple;
            fileTreeView.AppendColumn("ResourceName", new CellRendererText(), "text", 0).Resizable  = true;
            fileTreeView.AppendColumn("FileSize", new CellRendererText(), "text", 1).Resizable      = true;
            fileTreeView.AppendColumn("FileName/Path", new CellRendererText(), "text", 2).Resizable = true;
            fileTreeView.AppendColumn("Comment", new CellRendererText(), "text", 3).Resizable       = true;

            iconTreeView = new TreeView(iconListStore);
            iconTreeView.Selection.Mode = SelectionMode.Multiple;
            iconTreeView.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0).Resizable     = true;
            iconTreeView.AppendColumn("ResourceName", new CellRendererText(), "text", 1).Resizable = true;
            iconTreeView.AppendColumn("Comment", new CellRendererText(), "text", 2).Resizable      = true;

            imageTreeView = new TreeView(imageListStore);
            imageTreeView.Selection.Mode = SelectionMode.Multiple;
            imageTreeView.AppendColumn("Image", new CellRendererPixbuf(), "pixbuf", 0).Resizable    = true;
            imageTreeView.AppendColumn("ResourceName", new CellRendererText(), "text", 1).Resizable = true;
            imageTreeView.AppendColumn("Size", new CellRendererText(), "text", 2).Resizable         = true;
            imageTreeView.AppendColumn("Comment", new CellRendererText(), "text", 3).Resizable      = true;

            otherTreeView = new TreeView(otherListStore);
            otherTreeView.Selection.Mode = SelectionMode.Multiple;
            otherTreeView.AppendColumn("ResourceName", new CellRendererText(), "text", 0).Resizable = true;
            otherTreeView.AppendColumn("Type", new CellRendererText(), "text", 1).Resizable         = true;
            otherTreeView.AppendColumn("Comment", new CellRendererText(), "text", 2).Resizable      = true;

            stringTreeView = new TreeView(stringListStore);
            stringTreeView.Selection.Mode = SelectionMode.Multiple;
            stringTreeView.AppendColumn("ResourceName", new CellRendererText(), "text", 0).Resizable = true;
            stringTreeView.AppendColumn("Length", new CellRendererText(), "text", 1).Resizable       = true;
            stringTreeView.AppendColumn("Value", new CellRendererText(), "text", 2).Resizable        = true;
            stringTreeView.AppendColumn("Comment", new CellRendererText(), "text", 3).Resizable      = true;

            // SetUp
            Build();
            scrolledWindow.Add(stringTreeView);
            verticalBox.Add(mainToolbar);
            Box.BoxChild boxChild = ((Box.BoxChild)verticalBox[mainToolbar]);
            boxChild.Position = 0;
            boxChild.Expand   = false;
            typeMenu.ShowAll();
            ShowAll();
        }