From 7a7d64c4befa8475c6cb5802e1d24019dd0c46bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 26 Nov 2023 02:01:01 -0300 Subject: [PATCH] ecode: project tree ccrollBar style improvements. --- include/eepp/ui/uiscrollablewidget.hpp | 2 +- include/eepp/ui/uiscrollbar.hpp | 2 -- src/eepp/scene/node.cpp | 2 +- src/eepp/ui/uiscrollablewidget.cpp | 6 +++--- src/eepp/ui/uiscrollbar.cpp | 12 ++++++++---- src/tools/ecode/applayout.xml.hpp | 9 +++++++++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/include/eepp/ui/uiscrollablewidget.hpp b/include/eepp/ui/uiscrollablewidget.hpp index f4f52bc44..c1c1d1244 100644 --- a/include/eepp/ui/uiscrollablewidget.hpp +++ b/include/eepp/ui/uiscrollablewidget.hpp @@ -25,7 +25,7 @@ class EE_API UIScrollableWidget : public UIWidget { const ScrollViewType& getViewType() const; - void setViewType( const ScrollViewType& viewType ); + void setScrollViewType( const ScrollViewType& viewType ); UIScrollBar* getVerticalScrollBar() const; diff --git a/include/eepp/ui/uiscrollbar.hpp b/include/eepp/ui/uiscrollbar.hpp index 58abdf823..4f8c15ae6 100644 --- a/include/eepp/ui/uiscrollbar.hpp +++ b/include/eepp/ui/uiscrollbar.hpp @@ -92,8 +92,6 @@ class EE_API UIScrollBar : public UIWidget { virtual void onAutoSize(); - virtual Uint32 onMouseOver( const Vector2i& position, const Uint32& flags ); - void adjustChilds(); void onValueChangeCb( const Event* Event ); diff --git a/src/eepp/scene/node.cpp b/src/eepp/scene/node.cpp index 23909725a..35692bc59 100644 --- a/src/eepp/scene/node.cpp +++ b/src/eepp/scene/node.cpp @@ -397,7 +397,7 @@ Uint32 Node::onMouseLeave( const Vector2i& Pos, const Uint32& Flags ) { return 1; } -Uint32 Node::onMouseWheel( const Vector2f& offset, bool flipped ) { +Uint32 Node::onMouseWheel( const Vector2f&, bool ) { return 1; } diff --git a/src/eepp/ui/uiscrollablewidget.cpp b/src/eepp/ui/uiscrollablewidget.cpp index 25661c520..5761de0a0 100644 --- a/src/eepp/ui/uiscrollablewidget.cpp +++ b/src/eepp/ui/uiscrollablewidget.cpp @@ -76,7 +76,7 @@ const UIScrollableWidget::ScrollViewType& UIScrollableWidget::getViewType() cons return mViewType; } -void UIScrollableWidget::setViewType( const ScrollViewType& viewType ) { +void UIScrollableWidget::setScrollViewType( const ScrollViewType& viewType ) { if ( viewType != mViewType ) { mViewType = viewType; onContentSizeChange(); @@ -304,9 +304,9 @@ bool UIScrollableWidget::applyProperty( const StyleSheetProperty& attribute ) { std::string val( attribute.asString() ); String::toLowerInPlace( val ); if ( "inclusive" == val || "inside" == val ) - setViewType( Inclusive ); + setScrollViewType( Inclusive ); else if ( "exclusive" == val || "outside" == val ) - setViewType( Exclusive ); + setScrollViewType( Exclusive ); break; } case PropertyId::VScrollMode: { diff --git a/src/eepp/ui/uiscrollbar.cpp b/src/eepp/ui/uiscrollbar.cpp index 2903f8494..47ac23ec5 100644 --- a/src/eepp/ui/uiscrollbar.cpp +++ b/src/eepp/ui/uiscrollbar.cpp @@ -181,10 +181,6 @@ void UIScrollBar::onAutoSize() { } } -Uint32 UIScrollBar::onMouseOver( const Vector2i&, const Uint32& ) { - return 1; -} - void UIScrollBar::onSizeChange() { onAutoSize(); @@ -263,6 +259,14 @@ void UIScrollBar::adjustChilds() { Uint32 UIScrollBar::onMessage( const NodeMessage* Msg ) { switch ( Msg->getMsg() ) { + case NodeMessage::DragStart: { + addClass( "dragging" ); + return 1; + } + case NodeMessage::DragStop: { + removeClass( "dragging" ); + return 1; + } case NodeMessage::MouseClick: { if ( Msg->getFlags() & EE_BUTTON_LMASK ) { if ( Msg->getSender() == mBtnUp ) { diff --git a/src/tools/ecode/applayout.xml.hpp b/src/tools/ecode/applayout.xml.hpp index e4c21b56e..0185f5cf2 100644 --- a/src/tools/ecode/applayout.xml.hpp +++ b/src/tools/ecode/applayout.xml.hpp @@ -397,6 +397,15 @@ Anchor.error:hover { #code_container Tab:hover > Tab::close { opacity: 1; } +#project_view ScrollBar { + opacity: 0; + transition: opacity 0.15; +} +#project_view:hover ScrollBar, +#project_view ScrollBar.dragging, +#project_view ScrollBar:focus-within { + opacity: 1; +}