Documentation ¶
Index ¶
- type C
- type D
- type EntryFilter
- type EntryNavItem
- func (eitem *EntryNavItem) Children() []navi.NavItem
- func (eitem *EntryNavItem) ContextMenuOptions(gtx C) ([][]menu.MenuOption, bool)
- func (eitem *EntryNavItem) CreateChild(gtx C, kind NodeKind, postAction func(node *EntryNode)) error
- func (eitem *EntryNavItem) Icon() *widget.Icon
- func (eitem *EntryNavItem) IsDir() bool
- func (eitem *EntryNavItem) Kind() NodeKind
- func (eitem *EntryNavItem) Layout(gtx layout.Context, th *theme.Theme, textColor color.NRGBA) D
- func (eitem *EntryNavItem) Name() string
- func (eitem *EntryNavItem) OnCopyOrCut(gtx C, isCut bool)
- func (eitem *EntryNavItem) OnPaste(data string, removeOld bool) error
- func (eitem *EntryNavItem) OnSelect(gtx C) view.Intent
- func (eitem *EntryNavItem) Path() string
- func (eitem *EntryNavItem) Refresh()
- func (eitem *EntryNavItem) Remove() error
- func (eitem *EntryNavItem) SetMenuOptions(menuOptionFunc MenuOptionFunc)
- func (eitem *EntryNavItem) StartEditing(gtx C)
- func (eitem *EntryNavItem) Update(gtx C) error
- type EntryNode
- func (n *EntryNode) AddChild(name string, kind NodeKind) error
- func (n *EntryNode) Children() []*EntryNode
- func (n *EntryNode) Copy(nodePath string) error
- func (n *EntryNode) Delete() error
- func (n *EntryNode) FileType() string
- func (n *EntryNode) Kind() NodeKind
- func (n *EntryNode) Move(nodePath string) error
- func (n *EntryNode) Print()
- func (n *EntryNode) Refresh(filterFunc EntryFilter) error
- func (n *EntryNode) UpdateName(newName string) error
- type FileChooser
- type FileChooserDialog
- type FileExplorer
- type FileTreeNav
- type MenuOptionFunc
- type NodeKind
- type OnSelectFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type D ¶
type D = layout.Dimensions
type EntryFilter ¶
A filter is used to decide which files/folders are retained when buiding a EntryNode's children. Returning false will remove the current entry from from the children.
func AggregatedFilters ¶
func AggregatedFilters(filters ...EntryFilter) EntryFilter
type EntryNavItem ¶
type EntryNavItem struct {
// contains filtered or unexported fields
}
func NewEntryNavItem ¶
func NewEntryNavItem(rootDir string, menuOptionFunc MenuOptionFunc, onSelectFunc OnSelectFunc) (*EntryNavItem, error)
Construct a file tree object that loads files and folders from rootDir. `menuOptionFunc` is used to define the operations allowed by context menu(use right click to active it). `onSelectFunc` defines what action to take when a navigable item is clicked (files or folders).
func (*EntryNavItem) Children ¶
func (eitem *EntryNavItem) Children() []navi.NavItem
func (*EntryNavItem) ContextMenuOptions ¶
func (eitem *EntryNavItem) ContextMenuOptions(gtx C) ([][]menu.MenuOption, bool)
func (*EntryNavItem) CreateChild ¶
func (eitem *EntryNavItem) CreateChild(gtx C, kind NodeKind, postAction func(node *EntryNode)) error
Create file or subfolder under the current folder. File or subfolder is inserted at the beginning of the children.
func (*EntryNavItem) Icon ¶
func (eitem *EntryNavItem) Icon() *widget.Icon
func (*EntryNavItem) IsDir ¶
func (eitem *EntryNavItem) IsDir() bool
func (*EntryNavItem) Name ¶
func (eitem *EntryNavItem) Name() string
File or folder name of this node
func (*EntryNavItem) OnCopyOrCut ¶
func (eitem *EntryNavItem) OnCopyOrCut(gtx C, isCut bool)
func (*EntryNavItem) OnPaste ¶
func (eitem *EntryNavItem) OnPaste(data string, removeOld bool) error
read data from clipboard.
func (*EntryNavItem) Path ¶
func (eitem *EntryNavItem) Path() string
File or folder path of this node
func (*EntryNavItem) Refresh ¶
func (eitem *EntryNavItem) Refresh()
func (*EntryNavItem) Remove ¶
func (eitem *EntryNavItem) Remove() error
func (*EntryNavItem) SetMenuOptions ¶
func (eitem *EntryNavItem) SetMenuOptions(menuOptionFunc MenuOptionFunc)
func (*EntryNavItem) StartEditing ¶
func (eitem *EntryNavItem) StartEditing(gtx C)
StartEditing inits and focused on the editor to accept user input.
func (*EntryNavItem) Update ¶
func (eitem *EntryNavItem) Update(gtx C) error
type EntryNode ¶
type EntryNode struct { Path string fs.FileInfo // parent must be of folder kind. Parent *EntryNode // contains filtered or unexported fields }
func NewFileTree ¶
Create a new file tree with a relative or absolute rootDir. A filter is used to decide which files/folders are retained.
func (*EntryNode) Copy ¶
Copy copies the file at nodePath to the current folder. Copy does not replace existing files/folders, instead it returns an error indicating that case.
func (*EntryNode) Move ¶
Move moves the file at nodePath to the current folder. Move does not replace existing files/folders, instead it returns an error indicating that case.
func (*EntryNode) Refresh ¶
func (n *EntryNode) Refresh(filterFunc EntryFilter) error
Refresh reload child entries of the current entry node
func (*EntryNode) UpdateName ¶
Update set a new name for the current file/folder.
type FileChooser ¶
type FileChooser struct {
// contains filtered or unexported fields
}
func NewFileChooser ¶
func NewFileChooser(vm view.ViewManager) (*FileChooser, error)
func (*FileChooser) ChooseFile ¶
func (fc *FileChooser) ChooseFile(extensions ...string) (io.ReadCloser, error)
ChooseFile shows the file chooser, allowing the user to select a single file. It returns the file as a reader to user.
This is a blocking call, you should call it in a seperated goroutine.
Optionally, it's possible to set which file extensions is supported to be selected (such as `.jpg`, `.png`).
func (*FileChooser) ChooseFiles ¶
func (fc *FileChooser) ChooseFiles(extensions ...string) ([]io.ReadCloser, error)
ChooseFile shows the file chooser, allowing the user to select multiple files. It returns the files as a list of reader to user. This is a blocking call, you should call it in a seperated goroutine.
Optionally, it's possible to set which file extensions is supported to be selected (such as `.jpg`, `.png`).
func (*FileChooser) ChooseFolder ¶
func (fc *FileChooser) ChooseFolder() (string, error)
ChooseFolder shows the file chooser, allowing the user to select a single folder. It returns the folder path to user. This is a blocking call, you should call it in a seperated goroutine.
func (*FileChooser) CreateFile ¶
func (fc *FileChooser) CreateFile(name string) (io.WriteCloser, error)
CreateFile opens the file chooser, and writes the given content into some file, which the use can choose the location. It's important to close the `io.WriteCloser`.
It's a blocking call, you should call it on a separated goroutine.
type FileChooserDialog ¶
func (*FileChooserDialog) ID ¶
func (d *FileChooserDialog) ID() view.ViewID
func (*FileChooserDialog) Layout ¶
func (vw *FileChooserDialog) Layout(gtx layout.Context, th *theme.Theme) layout.Dimensions
func (*FileChooserDialog) Title ¶
func (vw *FileChooserDialog) Title() string
type FileExplorer ¶
type FileExplorer struct {
// contains filtered or unexported fields
}
func (*FileExplorer) Update ¶
func (exp *FileExplorer) Update(gtx C)
type FileTreeNav ¶
type FileTreeNav struct {
// contains filtered or unexported fields
}
func NewFileTreeNav ¶
func NewFileTreeNav(drawer *navi.NavDrawer, title string, navRoot *EntryNavItem) *FileTreeNav
Construct a FileTreeNav object that loads files and folders from rootDir. The skipFolders parameter allows you to specify folder name prefixes to exclude from the navigation.
func (*FileTreeNav) Attach ¶
func (tn *FileTreeNav) Attach(drawer *navi.NavDrawer)
func (*FileTreeNav) Title ¶
func (tn *FileTreeNav) Title() string
type MenuOptionFunc ¶
type MenuOptionFunc func(gtx C, item *EntryNavItem) [][]menu.MenuOption
func DefaultFileMenuOptions ¶
func DefaultFileMenuOptions(vm view.ViewManager) MenuOptionFunc
Default operation for file tree nodes. Support file/folder copy, cut, paste, rename, delete and new file/folder creation. This should better be used as an example. Feel free to copy and build your own.