Added support to move Tabs from one UITabWidget to another using the onDrop API.

This commit is contained in:
Martín Lucas Golini
2020-06-18 05:33:21 -03:00
parent d904cea482
commit 6885e34572
14 changed files with 144 additions and 38 deletions

View File

@@ -52,6 +52,7 @@ class EE_API Event {
MsgBoxConfirmClick,
MsgBoxCancelClick,
OnTabSelected,
OnTabAdded,
OnTabClosed,
OnTabNavigate,
OnClose, // Warning: Only some nodes will report this event.

View File

@@ -371,7 +371,7 @@ class EE_API Node : public Transformable {
bool isChild( Node* child ) const;
bool inParentTreeOf( Node* Child ) const;
bool inParentTreeOf( Node* child ) const;
void setLoadingState( bool loading );

View File

@@ -190,6 +190,7 @@ enum class PropertyId : Uint32 {
BorderBottomRightRadius = String::hash( "border-bottom-right-radius" ),
TabBarHideOnSingleTab = String::hash( "tabbar-hide-on-single-tab" ),
TabBarAllowRearrange = String::hash( "tabbar-allow-rearrange" ),
TabBarAllowDragAndDrop = String::hash( "tabbar-allow-drag-and-drop-tabs" ),
};
enum class PropertyType : Uint32 {

View File

@@ -43,6 +43,8 @@ class EE_API UITab : public UISelectButton {
String mText;
std::string mOwnedName;
UIWidget* mCloseButton;
Float mDragTotalDiff;
UITabWidget* mTabWidget;
Uint32 onDrag( const Vector2f& position, const Uint32& flags, const Sizef& dragDiff );

View File

@@ -141,6 +141,14 @@ class EE_API UITabWidget : public UIWidget {
void setAllowRearrangeTabs( bool allowRearrangeTabs );
bool getAllowDragAndDropTabs() const;
void setAllowDragAndDropTabs( bool allowDragAndDropTabs );
const Float& getTabVerticalDragResistance() const;
void setTabVerticalDragResistance( const Float& tabVerticalDragResistance );
protected:
friend class UITab;
@@ -153,17 +161,25 @@ class EE_API UITabWidget : public UIWidget {
TabTryCloseCallback mTabTryCloseCallback;
bool mHideTabBarOnSingleTab;
bool mAllowRearrangeTabs;
bool mAllowDragAndDropTabs;
Float mTabVerticalDragResistance;
void onThemeLoaded();
UITab* createTab( const String& text, UINode* nodeOwned, Drawable* icon );
void removeTab( const Uint32& index, bool destroyOwnedNode, bool destroyTab = true );
void removeTab( UITab* tab, bool destroyOwnedNode, bool destroyTab );
virtual void onSizeChange();
virtual void onChildCountChange( Node* child, const bool& removed );
virtual void onPaddingChange();
virtual Uint32 onMessage( const NodeMessage* msg );
void setContainerSize();
void posTabs();