A user interface widget for interacting with the filesystem.
More...
#include <FilesystemWidget.hpp>
|
virtual void | draw () override |
| Implementation of the abstract draw method to render the filesystem widget. More...
|
|
void | setDirectory (std::filesystem::path path) |
| Set the current working directory to display its contents. More...
|
|
| Widget (std::string name) |
| Constructor to create a widget with a specified name. More...
|
|
| Widget (std::string name) |
| Constructor to create a widget with a specified name. More...
|
|
|
static std::string | getDisplayableName (std::string name, size_t maxCharactersInLine=12) |
| Get a displayable name for rendering within the UI, ensuring it doesn't exceed a maximum line length. More...
|
|
A user interface widget for interacting with the filesystem.
The FilesystemWidget
class provides a graphical user interface for navigating and interacting with the filesystem, displaying directories, files, and enabling file-related actions.
◆ draw()
void shkyera::FilesystemWidget::draw |
( |
| ) |
|
|
overridevirtual |
Implementation of the abstract draw
method to render the filesystem widget.
Apologies to the reader for this hack
Implements shkyera::Widget.
◆ drawCreateMenu()
void shkyera::FilesystemWidget::drawCreateMenu |
( |
| ) |
const |
|
private |
Draw a context menu for creating new files or directories.
◆ drawDirectory()
void shkyera::FilesystemWidget::drawDirectory |
( |
const std::shared_ptr< Directory > |
directory | ) |
|
|
private |
Draw a directory icon and name.
- Parameters
-
directory | The directory to draw. |
◆ drawDirectoryContents()
void shkyera::FilesystemWidget::drawDirectoryContents |
( |
const std::shared_ptr< Directory > |
directory | ) |
|
|
private |
Draw the contents of the specified directory.
- Parameters
-
directory | The directory whose contents to draw. |
◆ drawDirectoryTree()
void shkyera::FilesystemWidget::drawDirectoryTree |
( |
const std::shared_ptr< Directory > |
directory | ) |
|
|
private |
Draw the directory tree, starting from the specified directory.
- Parameters
-
directory | The root directory to draw. |
◆ drawFile()
void shkyera::FilesystemWidget::drawFile |
( |
const std::shared_ptr< File > |
file | ) |
|
|
private |
Draw a file icon and name.
- Parameters
-
◆ drawIconName()
void shkyera::FilesystemWidget::drawIconName |
( |
const std::string |
name | ) |
const |
|
private |
Draw an icon and name within the UI.
- Parameters
-
◆ getDisplayableName()
std::string shkyera::FilesystemWidget::getDisplayableName |
( |
std::string |
name, |
|
|
size_t |
maxCharactersInLine = 12 |
|
) |
| |
|
staticprivate |
Get a displayable name for rendering within the UI, ensuring it doesn't exceed a maximum line length.
- Parameters
-
name | The original name. |
maxCharactersInLine | The maximum number of characters in a line. |
- Returns
- The displayable name.
◆ getTextureOfFile()
ImTextureID shkyera::FilesystemWidget::getTextureOfFile |
( |
const std::shared_ptr< File > |
file | ) |
const |
|
private |
Get the texture ID associated with a specific file for rendering an icon.
- Parameters
-
file | The file for which to retrieve the texture ID. |
- Returns
- The texture ID for rendering the file's icon.
◆ handleRightMouseClick()
void shkyera::FilesystemWidget::handleRightMouseClick |
( |
| ) |
|
|
private |
Handle a right mouse click within the UI.
◆ setDirectory()
void shkyera::FilesystemWidget::setDirectory |
( |
std::filesystem::path |
path | ) |
|
Set the current working directory to display its contents.
- Parameters
-
path | The path to the directory to set as the current working directory. |
◆ Widget()
Constructor to create a widget with a specified name.
- Parameters
-
name | The name of the widget. |
◆ _currentDirectory
std::shared_ptr<Directory> shkyera::FilesystemWidget::_currentDirectory |
|
private |
The current working directory to display.
◆ _directoriesToDisplay
std::vector<std::shared_ptr<Directory> > shkyera::FilesystemWidget::_directoriesToDisplay |
|
private |
Directories to display in the UI.
◆ _filesToDisplay
std::vector<std::shared_ptr<File> > shkyera::FilesystemWidget::_filesToDisplay |
|
private |
Files to display in the UI.
◆ _hoveredIcon
bool shkyera::FilesystemWidget::_hoveredIcon |
|
private |
A flag indicating whether an icon is currently hovered.
◆ CONTENTS_ICON_SIZE
constexpr float shkyera::FilesystemWidget::CONTENTS_ICON_SIZE = 64 |
|
staticconstexprprivate |
The size of icons representing directory contents.
◆ DEFAULT_FILE_NAME
std::string shkyera::FilesystemWidget::DEFAULT_FILE_NAME = "object.py" |
|
staticprivate |
◆ DEFAULT_FOLDER_NAME
std::string shkyera::FilesystemWidget::DEFAULT_FOLDER_NAME = "New Folder" |
|
staticprivate |
The documentation for this class was generated from the following files: