예제 #1
0
        public override void Render(List <GitFile> files)
        {
            if (files == null)
            {
                return;
            }

            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUIStyle.none, GUI.skin.verticalScrollbar);

            float statusSize = 20;

            //Render list of files
            selectedFiles = SelectableListGUI.RenderList <GitFile>(files, selectedFiles, (file, selected) =>
            {
                //Render
                EditorGUILayout.BeginHorizontal();

                GUIStyle style = new GUIStyle("Label");

                if (selected)
                {
                    style.normal.textColor = Color.blue;
                }

                //Status Icon
                if (fileStatusIcons.ContainsKey(file.status))
                {
                    GUILayout.Label(fileStatusIcons[file.status], GUILayout.Width(statusSize), GUILayout.Height(statusSize));
                }
                else
                {
                    GUILayout.Label(file.status.ToString(), GUILayout.Width(statusSize), GUILayout.Height(statusSize));
                }

                //Button
                bool pressed = GUILayout.Button(file.path, style, GUILayout.Height(statusSize));

                EditorGUILayout.EndHorizontal();
                return(pressed);
            },
                                                                   (selectedFiles, mouse) =>
            {
                //Context click
                if (mouse == 1)
                {
                    ContextOption <string> .ShowContextMenu(GitFile.GetPaths(selectedFiles), contextOptions);
                }
            });

            EditorGUILayout.EndScrollView();
        }
예제 #2
0
        public void Render(List <string> stashes)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUIStyle.none, GUI.skin.verticalScrollbar);

            //Render list of files
            selectedStashes = SelectableListGUI.RenderList <string>(stashes, selectedStashes, RenderStash, (selectedStashes, mouse) =>
            {
                //Context click
                if (mouse == 1)
                {
                    ContextOption <string> .ShowContextMenu(selectedStashes, contextOptions);
                }
            }, false);

            EditorGUILayout.EndScrollView();
        }
예제 #3
0
        public void Render(List <Commit> commits)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUIStyle.none, GUI.skin.verticalScrollbar);

            //Render list of files
            selectedCommits = SelectableListGUI.RenderList <Commit>(commits, selectedCommits, RenderCommit,
                                                                    (selectedCommits, mouse) =>
            {
                //Context click
                if (mouse == 1)
                {
                    ContextOption <Commit> .ShowContextMenu(selectedCommits, contextOptions);
                }
            });

            EditorGUILayout.EndScrollView();
        }