Exemplo n.º 1
0
        protected override void UpdateInternal()
        {
            Manager.NativeManager.PushItemWidth(-1);

            // Address bar
            {
                if (Manager.NativeManager.Button("↑") &&
                    !String.IsNullOrEmpty(currentPath))
                {
                    UpdateFileList(Path.GetDirectoryName(currentPath));
                }

                Manager.NativeManager.SameLine();

                // Display current directory
                if (Manager.NativeManager.InputText("", (currentPath != null) ? currentPath : ""))
                {
                    string path = Manager.NativeManager.GetInputTextResult();
                    UpdateFileList(path);
                }
            }

            Manager.NativeManager.Separator();

            // Display all files
            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i];

                // Todo: ファイルタイプに適したアイコンを割り当てる

                string caption = Path.GetFileName(item.FilePath);
                if (Manager.NativeManager.Selectable(caption, i == selectedIndex, swig.SelectableFlags.AllowDoubleClick))
                {
                    selectedIndex = i;

                    if (Manager.NativeManager.IsMouseDoubleClicked(0))
                    {
                        DoubleClick();
                    }
                }

                // D&D
                DragAndDrops.UpdateImageSrc(item.FilePath);
            }

            Manager.NativeManager.PopItemWidth();
        }
Exemplo n.º 2
0
        protected override void UpdateInternal()
        {
            Manager.NativeManager.PushItemWidth(-1);

            // Address bar
            {
                // Back directory (BS shortcut key)
                if (Manager.NativeManager.IsWindowFocused() &&
                    Manager.NativeManager.IsKeyPressed(Manager.NativeManager.GetKeyIndex(swig.Key.Backspace)) &&
                    !String.IsNullOrEmpty(currentPath))
                {
                    UpdateFileListWithProjectPath(currentPath);
                }

                // Back directory
                if (Manager.NativeManager.Button("↑") &&
                    !String.IsNullOrEmpty(currentPath))
                {
                    UpdateFileListWithProjectPath(currentPath);
                }

                Manager.NativeManager.SameLine();

                // Display current directory
                if (Manager.NativeManager.InputText("", (currentPath != null) ? currentPath : ""))
                {
                    string path = Manager.NativeManager.GetInputTextResult();
                    UpdateFileList(path);
                }
            }

            Manager.NativeManager.Separator();

            // Display all files
            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i];

                swig.ImageResource image = null;

                if (item.Type == FileType.Directory)
                {
                    image = Images.GetIcon("FileViewer_Directory");
                }
                if (item.Type == FileType.EffekseerProject)
                {
                    image = Images.GetIcon("FileViewer_EffekseerProj");
                }
                if (item.Type == FileType.Image)
                {
                    image = item.Image;
                }
                if (item.Type == FileType.Other)
                {
                }

                {
                    float iconSize = Manager.NativeManager.GetTextLineHeight();
                    Manager.NativeManager.Image(image, iconSize, iconSize);
                }

                Manager.NativeManager.SameLine();

                string caption = Path.GetFileName(item.FilePath);
                if (Manager.NativeManager.Selectable(caption, i == selectedIndex, swig.SelectableFlags.AllowDoubleClick))
                {
                    selectedIndex = i;

                    if (Manager.NativeManager.IsMouseDoubleClicked(0) ||
                        Manager.NativeManager.IsKeyDown(Manager.NativeManager.GetKeyIndex(swig.Key.Enter)))
                    {
                        OnFilePicked();
                    }
                }

                // File Context Menu
                string menuId = "###FileViewerFilePopupMenu" + i;
                if (Manager.NativeManager.BeginPopupContextItem(menuId))
                {
                    selectedIndex = i;
                    if (Manager.NativeManager.MenuItem(menuOpenFile))
                    {
                        OnFilePicked();
                    }
                    Manager.NativeManager.Separator();

                    if (Manager.NativeManager.MenuItem(menuShowInFileManager))
                    {
                        ShowInFileManager();
                    }
                    Manager.NativeManager.EndPopup();
                }

                // D&D
                DragAndDrops.UpdateImageSrc(item.FilePath);
            }

            Manager.NativeManager.PopItemWidth();
        }
Exemplo n.º 3
0
        protected override void UpdateInternal()
        {
            Manager.NativeManager.PushItemWidth(-1);

            // Address bar
            {
                if (Manager.NativeManager.Button("↑") &&
                    !String.IsNullOrEmpty(currentPath))
                {
                    UpdateFileListWithProjectPath(currentPath);
                }

                Manager.NativeManager.SameLine();

                // Display current directory
                if (Manager.NativeManager.InputText("", (currentPath != null) ? currentPath : ""))
                {
                    string path = Manager.NativeManager.GetInputTextResult();
                    UpdateFileList(path);
                }
            }

            Manager.NativeManager.Separator();

            // Display all files
            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i];

                swig.ImageResource image = null;

                if (item.Type == FileType.Directory)
                {
                    image = Images.GetIcon("FileViewer_Directory");
                }
                if (item.Type == FileType.EffekseerProject)
                {
                    image = Images.GetIcon("FileViewer_EffekseerProj");
                }
                if (item.Type == FileType.Image)
                {
                    image = item.Image;
                }
                if (item.Type == FileType.Other)
                {
                }

                Manager.NativeManager.Image(image, 32, 32);

                Manager.NativeManager.SameLine();

                string caption = Path.GetFileName(item.FilePath);
                if (Manager.NativeManager.Selectable(caption, i == selectedIndex, swig.SelectableFlags.AllowDoubleClick))
                {
                    selectedIndex = i;

                    if (Manager.NativeManager.IsMouseDoubleClicked(0))
                    {
                        DoubleClick();
                    }
                }

                // D&D
                DragAndDrops.UpdateImageSrc(item.FilePath);
            }

            Manager.NativeManager.PopItemWidth();
        }