Shkyera Engine
Easy to use, game engine for Python
Loading...
Searching...
No Matches
shkyera::FilesystemWidget Class Reference

A user interface widget for interacting with the filesystem. More...

#include <FilesystemWidget.hpp>

Inheritance diagram for shkyera::FilesystemWidget:
[legend]

Public Member Functions

 FilesystemWidget (std::string name, std::shared_ptr< Registry > registry)
 
virtual void draw () override
 Implementation of the abstract draw method to render the filesystem widget.
 
- Public Member Functions inherited from shkyera::Widget
 Widget (std::string name)
 Constructor to create a widget with a specified name.
 
virtual ~Widget ()=default
 Default virtual destructor.
 

Private Member Functions

void drawDirectoryTree (AssetHandle directoryHandle)
 Draw the directory tree, starting from the specified directory.
 
void drawDirectoryContents ()
 Draw the contents of the specified directory.
 
void drawDirectory (AssetHandle directoryHandle)
 Draw a directory icon and name.
 
template<typename AssetType >
void drawAsset (AssetHandle handle)
 Draw an asset icon and name.
 
template<typename AssetType >
void drawAssetIcon (AssetHandle handle)
 
void drawIconName (const std::string &name) const
 Draw an icon and name within the UI.
 
void handleRightMouseClick ()
 
template<>
void drawAssetIcon (AssetHandle handle)
 
template<>
void drawAssetIcon (AssetHandle handle)
 
template<>
void drawAssetIcon (AssetHandle handle)
 
template<>
void drawAssetIcon (AssetHandle handle)
 
template<>
void drawAssetIcon (AssetHandle handle)
 

Private Attributes

std::shared_ptr< Registry_registry
 
AssetHandle _rootDirectoryHandle
 
AssetHandle _currentDirectoryHandle
 
AssetRef< Texture_folderIcon
 
AssetRef< Texture_pythonIcon
 
AssetRef< Texture_imageIcon
 
AssetRef< Texture_textIcon
 
AssetRef< Texture_audioIcon
 
bool _hoveredIcon
 

Static Private Attributes

static constexpr float CONTENTS_ICON_SIZE = 64
 The size of icons representing directory contents.
 

Additional Inherited Members

- Public Attributes inherited from shkyera::Widget
std::string _name
 The name of the widget.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FilesystemWidget()

shkyera::FilesystemWidget::FilesystemWidget ( std::string  name,
std::shared_ptr< Registry registry 
)

Member Function Documentation

◆ 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.

◆ drawAsset()

template<typename AssetType >
void shkyera::FilesystemWidget::drawAsset ( AssetHandle  handle)
inlineprivate

Draw an asset icon and name.

Parameters
assetHandleHandle of the asset to draw.
iconIcon of the asset

◆ drawAssetIcon() [1/6]

template<>
void shkyera::FilesystemWidget::drawAssetIcon ( AssetHandle  handle)
private

◆ drawAssetIcon() [2/6]

template<>
void shkyera::FilesystemWidget::drawAssetIcon ( AssetHandle  handle)
private

◆ drawAssetIcon() [3/6]

template<>
void shkyera::FilesystemWidget::drawAssetIcon ( AssetHandle  handle)
private

◆ drawAssetIcon() [4/6]

template<>
void shkyera::FilesystemWidget::drawAssetIcon ( AssetHandle  handle)
private

◆ drawAssetIcon() [5/6]

template<>
void shkyera::FilesystemWidget::drawAssetIcon ( AssetHandle  handle)
private

◆ drawAssetIcon() [6/6]

template<typename AssetType >
void shkyera::FilesystemWidget::drawAssetIcon ( AssetHandle  handle)
private

Draws the icon of an asset and allows for its drag-and-drop behavior.

Template Parameters
Typeof the asset
Parameters
handeAsset Handle of the drawn asset

◆ drawDirectory()

void shkyera::FilesystemWidget::drawDirectory ( AssetHandle  directoryHandle)
private

Draw a directory icon and name.

Parameters
directoryHandleHandle of the directory to draw.

◆ drawDirectoryContents()

void shkyera::FilesystemWidget::drawDirectoryContents ( )
private

Draw the contents of the specified directory.

Parameters
directoryThe directory whose contents to draw.

◆ drawDirectoryTree()

void shkyera::FilesystemWidget::drawDirectoryTree ( AssetHandle  directoryHandle)
private

Draw the directory tree, starting from the specified directory.

Parameters
directoryThe root directory to draw.

◆ drawIconName()

void shkyera::FilesystemWidget::drawIconName ( const std::string &  name) const
private

Draw an icon and name within the UI.

Parameters
nameThe name to display.

◆ handleRightMouseClick()

void shkyera::FilesystemWidget::handleRightMouseClick ( )
private

Member Data Documentation

◆ _audioIcon

AssetRef<Texture> shkyera::FilesystemWidget::_audioIcon
private

◆ _currentDirectoryHandle

AssetHandle shkyera::FilesystemWidget::_currentDirectoryHandle
private

◆ _folderIcon

AssetRef<Texture> shkyera::FilesystemWidget::_folderIcon
private

◆ _hoveredIcon

bool shkyera::FilesystemWidget::_hoveredIcon
private

◆ _imageIcon

AssetRef<Texture> shkyera::FilesystemWidget::_imageIcon
private

◆ _pythonIcon

AssetRef<Texture> shkyera::FilesystemWidget::_pythonIcon
private

◆ _registry

std::shared_ptr<Registry> shkyera::FilesystemWidget::_registry
private

◆ _rootDirectoryHandle

AssetHandle shkyera::FilesystemWidget::_rootDirectoryHandle
private

◆ _textIcon

AssetRef<Texture> shkyera::FilesystemWidget::_textIcon
private

◆ CONTENTS_ICON_SIZE

constexpr float shkyera::FilesystemWidget::CONTENTS_ICON_SIZE = 64
staticconstexprprivate

The size of icons representing directory contents.


The documentation for this class was generated from the following files: