TreeView in ecode and more fixes and improvements for the abstract views, treeview and models.

This commit is contained in:
Martín Lucas Golini
2020-07-19 01:35:20 -03:00
parent 2e1930f51c
commit 08caa0070d
14 changed files with 227 additions and 65 deletions

View File

@@ -48,6 +48,7 @@
#include <eepp/ui/uitheme.hpp>
#include <eepp/ui/uithememanager.hpp>
#include <eepp/ui/uitouchdraggablewidget.hpp>
#include <eepp/ui/uitreeview.hpp>
#include <eepp/ui/uiviewpager.hpp>
#include <eepp/ui/uiwidget.hpp>
#include <eepp/ui/uiwidgetcreator.hpp>
@@ -71,4 +72,8 @@
#include <eepp/ui/tools/uicodeeditorsplitter.hpp>
#include <eepp/ui/tools/uicolorpicker.hpp>
#include <eepp/ui/models/filesystemmodel.hpp>
#include <eepp/ui/models/model.hpp>
#include <eepp/ui/models/modelselection.hpp>
#endif

View File

@@ -20,7 +20,7 @@ class EE_API UIAbstractTableView : public UIAbstractView {
bool isType( const Uint32& type ) const;
virtual Float getRowHeight() const { return getHeaderHeight(); }
virtual Float getRowHeight() const;
virtual Float getHeaderHeight() const;
@@ -34,6 +34,8 @@ class EE_API UIAbstractTableView : public UIAbstractView {
void setColumnHidden( const size_t& column, bool hidden );
void setColumnsHidden( const std::vector<size_t> columns, bool hidden );
virtual void selectAll();
const Float& getDragBorderDistance() const;
@@ -42,6 +44,8 @@ class EE_API UIAbstractTableView : public UIAbstractView {
Vector2f getColumnPosition( const size_t& index );
int visibleColumnCount() const;
protected:
friend class EE::UI::UITableHeaderColumn;
@@ -71,8 +75,14 @@ class EE_API UIAbstractTableView : public UIAbstractView {
virtual void onColumnResizeToContent( const size_t& colIndex );
virtual void updateColumnsWidth();
virtual void updateScroll();
void updateHeaderSize();
int visibleColumn();
UILinearLayout* mHeader;
Float mDragBorderDistance{8};
};

View File

@@ -11,18 +11,27 @@ using namespace EE::UI::Models;
namespace EE { namespace UI { namespace Abstract {
enum class ModelEventType { Open };
class EE_API ModelEvent : public Event {
public:
ModelEvent( Model* model, const ModelIndex& index, Node* node ) :
Event( node, Event::OnModelEvent ), model( model ), index( index ) {}
ModelEvent( Model* model, const ModelIndex& index, Node* node,
const ModelEventType& modelEventType = ModelEventType::Open ) :
Event( node, Event::OnModelEvent ),
model( model ),
index( index ),
modelEventType( modelEventType ) {}
const Model* getModel() const { return model; }
const ModelIndex& getModelIndex() const { return index; }
const ModelEventType& getModelEventType() const { return modelEventType; }
protected:
const Model* model;
ModelIndex index;
ModelEventType modelEventType;
};
class EE_API UIAbstractView : public UIScrollableWidget {

View File

@@ -45,6 +45,7 @@ class EE_API FileSystemModel : public Model {
FileInfo mInfo;
std::vector<Node> mChildren;
bool mHasTraversed{false};
bool mInfoDirty{true};
bool mSelected{false};
ModelIndex index( const FileSystemModel& model, int column ) const;
void traverseIfNeeded( const FileSystemModel& );

View File

@@ -81,6 +81,8 @@ class EE_API UICodeEditorSplitter {
UITabWidget* createEditorWithTabWidget( Node* parent );
UITab* isDocumentOpen( const std::string& path ) const;
void applyColorScheme( const SyntaxColorScheme& colorScheme );
void forEachEditor( std::function<void( UICodeEditor* )> run );