MyGUI_DDContainer.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_DDCONTAINER_H_
#define MYGUI_DDCONTAINER_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Widget.h"
#include "MyGUI_DDItemInfo.h"
#include "MyGUI_EventPair.h"
namespace MyGUI
{
using EventHandle_DDContainerPtrCDDItemInfoRefBoolRef =
delegates::MultiDelegate<DDContainer*, const DDItemInfo&, bool&>;
using EventHandle_DDContainerPtrCDDItemInfoRefBool =
delegates::MultiDelegate<DDContainer*, const DDItemInfo&, bool>;
using EventHandle_EventHandle_DDContainerPtrDDItemState = delegates::MultiDelegate<DDContainer*, DDItemState>;
using EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef =
delegates::Delegate<DDContainer*, Widget*&, IntCoord&>;
class MYGUI_EXPORT DDContainer : public Widget
{
MYGUI_RTTI_DERIVED(DDContainer)
public:
void setNeedDragDrop(bool _value);
bool getNeedDragDrop() const;
void resetDrag();
/*events:*/
EventHandle_DDContainerPtrCDDItemInfoRefBoolRef eventStartDrag;
EventHandle_DDContainerPtrCDDItemInfoRefBoolRef eventRequestDrop;
EventHandle_DDContainerPtrCDDItemInfoRefBool eventDropResult;
EventHandle_EventHandle_DDContainerPtrDDItemState eventChangeDDState;
EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef requestDragWidgetInfo;
/*internal:*/
// метод для установления стейта айтема
virtual void _setContainerItemInfo(size_t _index, bool _set, bool _accept);
delegates::MultiDelegate<DDContainer*> _eventInvalideContainer;
delegates::MultiDelegate<DDContainer*, Widget*, const DDWidgetState&> eventUpdateDropState;
protected:
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
void onMouseDrag(int _left, int _top, MouseButton _id) override;
virtual void notifyInvalideDrop(DDContainer* _sender);
virtual void removeDropItems();
virtual void updateDropItems();
virtual void updateDropItemsState(const DDWidgetState& _state);
void mouseDrag(MouseButton _id);
void mouseButtonReleased(MouseButton _id);
void mouseButtonPressed(MouseButton _id);
void endDrop(bool _reset);
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
protected:
bool mDropResult{false};
bool mNeedDrop{false};
bool mStartDrop{false};
Widget* mOldDrop{nullptr};
DDItemInfo mDropInfo;
size_t mDropSenderIndex{ITEM_NONE};
// список виджетов для дропа
Widget* mDropItem{nullptr};
IntCoord mDropDimension;
IntPoint mClickInWidget;
// нужно и виджету поддержка драг энд дропа
bool mNeedDragDrop{false};
DDContainer* mReseiverContainer{nullptr};
};
} // namespace MyGUI
#endif // MYGUI_DDCONTAINER_H_
MyGUI_DDItemInfo.h
MyGUI_EventPair.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_Widget.h
MyGUI::DDContainer
widget description should be here.
Definition MyGUI_DDContainer.h:31
MyGUI::DDContainer::mDropInfo
DDItemInfo mDropInfo
Definition MyGUI_DDContainer.h:129
MyGUI::DDContainer::onMouseDrag
void onMouseDrag(int _left, int _top, MouseButton _id) override
Definition MyGUI_DDContainer.cpp:32
MyGUI::DDContainer::_eventInvalideContainer
delegates::MultiDelegate< DDContainer * > _eventInvalideContainer
Definition MyGUI_DDContainer.h:93
MyGUI::DDContainer::eventRequestDrop
EventHandle_DDContainerPtrCDDItemInfoRefBoolRef eventRequestDrop
Definition MyGUI_DDContainer.h:59
MyGUI::DDContainer::notifyInvalideDrop
virtual void notifyInvalideDrop(DDContainer *_sender)
Definition MyGUI_DDContainer.cpp:240
MyGUI::DDContainer::eventStartDrag
EventHandle_DDContainerPtrCDDItemInfoRefBoolRef eventStartDrag
Definition MyGUI_DDContainer.h:51
MyGUI::DDContainer::_setContainerItemInfo
virtual void _setContainerItemInfo(size_t _index, bool _set, bool _accept)
Definition MyGUI_DDContainer.cpp:270
MyGUI::DDContainer::mNeedDragDrop
bool mNeedDragDrop
Definition MyGUI_DDContainer.h:140
MyGUI::DDContainer::mOldDrop
Widget * mOldDrop
Definition MyGUI_DDContainer.h:127
MyGUI::DDContainer::requestDragWidgetInfo
EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef requestDragWidgetInfo
Definition MyGUI_DDContainer.h:82
MyGUI::DDContainer::mReseiverContainer
DDContainer * mReseiverContainer
Definition MyGUI_DDContainer.h:142
MyGUI::DDContainer::getNeedDragDrop
bool getNeedDragDrop() const
Definition MyGUI_DDContainer.cpp:265
MyGUI::DDContainer::onMouseButtonPressed
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override
Definition MyGUI_DDContainer.cpp:15
MyGUI::DDContainer::mDropSenderIndex
size_t mDropSenderIndex
Definition MyGUI_DDContainer.h:131
MyGUI::DDContainer::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_DDContainer.cpp:245
MyGUI::DDContainer::mouseButtonPressed
void mouseButtonPressed(MouseButton _id)
Definition MyGUI_DDContainer.cpp:39
MyGUI::DDContainer::updateDropItems
virtual void updateDropItems()
Definition MyGUI_DDContainer.cpp:215
MyGUI::DDContainer::mStartDrop
bool mStartDrop
Definition MyGUI_DDContainer.h:125
MyGUI::DDContainer::eventChangeDDState
EventHandle_EventHandle_DDContainerPtrDDItemState eventChangeDDState
Definition MyGUI_DDContainer.h:74
MyGUI::DDContainer::onMouseButtonReleased
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override
Definition MyGUI_DDContainer.cpp:25
MyGUI::DDContainer::mClickInWidget
IntPoint mClickInWidget
Definition MyGUI_DDContainer.h:137
MyGUI::DDContainer::mouseButtonReleased
void mouseButtonReleased(MouseButton _id)
Definition MyGUI_DDContainer.cpp:59
MyGUI::DDContainer::mDropResult
bool mDropResult
Definition MyGUI_DDContainer.h:123
MyGUI::DDContainer::mDropItem
Widget * mDropItem
Definition MyGUI_DDContainer.h:134
MyGUI::DDContainer::removeDropItems
virtual void removeDropItems()
Definition MyGUI_DDContainer.cpp:210
MyGUI::DDContainer::mNeedDrop
bool mNeedDrop
Definition MyGUI_DDContainer.h:124
MyGUI::DDContainer::setNeedDragDrop
void setNeedDragDrop(bool _value)
Definition MyGUI_DDContainer.cpp:260
MyGUI::DDContainer::updateDropItemsState
virtual void updateDropItemsState(const DDWidgetState &_state)
Definition MyGUI_DDContainer.cpp:235
MyGUI::DDContainer::eventDropResult
EventHandle_DDContainerPtrCDDItemInfoRefBool eventDropResult
Definition MyGUI_DDContainer.h:67
MyGUI::DDContainer::mDropDimension
IntCoord mDropDimension
Definition MyGUI_DDContainer.h:135
MyGUI::DDContainer::resetDrag
void resetDrag()
Definition MyGUI_DDContainer.cpp:274
MyGUI::DDContainer::mouseDrag
void mouseDrag(MouseButton _id)
Definition MyGUI_DDContainer.cpp:67
MyGUI::DDContainer::endDrop
void endDrop(bool _reset)
Definition MyGUI_DDContainer.cpp:184
MyGUI::DDContainer::eventUpdateDropState
delegates::MultiDelegate< DDContainer *, Widget *, const DDWidgetState & > eventUpdateDropState
Definition MyGUI_DDContainer.h:101
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::delegates::Delegate
Definition MyGUI_Delegate.h:158
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:190
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef
delegates::Delegate< DDContainer *, Widget *&, IntCoord & > EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef
Definition MyGUI_DDContainer.h:23
MyGUI::EventHandle_DDContainerPtrCDDItemInfoRefBoolRef
delegates::MultiDelegate< DDContainer *, const DDItemInfo &, bool & > EventHandle_DDContainerPtrCDDItemInfoRefBoolRef
Definition MyGUI_DDContainer.h:18
MyGUI::EventHandle_DDContainerPtrCDDItemInfoRefBool
delegates::MultiDelegate< DDContainer *, const DDItemInfo &, bool > EventHandle_DDContainerPtrCDDItemInfoRefBool
Definition MyGUI_DDContainer.h:20
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::EventHandle_EventHandle_DDContainerPtrDDItemState
delegates::MultiDelegate< DDContainer *, DDItemState > EventHandle_EventHandle_DDContainerPtrDDItemState
Definition MyGUI_DDContainer.h:22
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::DDItemInfo
Definition MyGUI_DDItemInfo.h:55
MyGUI::DDWidgetState
Definition MyGUI_DDItemInfo.h:100
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16