MyGUI: MyGUI_DDContainer.h Source File

MyGUI 3.4.3

MyGUI_DDContainer.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_DDCONTAINER_H_
8#define MYGUI_DDCONTAINER_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Widget.h"
12#include "MyGUI_DDItemInfo.h"
13#include "MyGUI_EventPair.h"
14
15namespace MyGUI
16{
17
18 using EventHandle_DDContainerPtrCDDItemInfoRefBoolRef =
19 delegates::MultiDelegate<DDContainer*, const DDItemInfo&, bool&>;
20 using EventHandle_DDContainerPtrCDDItemInfoRefBool =
21 delegates::MultiDelegate<DDContainer*, const DDItemInfo&, bool>;
22 using EventHandle_EventHandle_DDContainerPtrDDItemState = delegates::MultiDelegate<DDContainer*, DDItemState>;
23 using EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef =
24 delegates::Delegate<DDContainer*, Widget*&, IntCoord&>;
25
26
30 class MYGUI_EXPORT DDContainer : public Widget
31 {
32 MYGUI_RTTI_DERIVED(DDContainer)
33
34 public:
38 void setNeedDragDrop(bool _value);
40 bool getNeedDragDrop() const;
41
42 void resetDrag();
43
44 /*events:*/
51 EventHandle_DDContainerPtrCDDItemInfoRefBoolRef eventStartDrag;
52
59 EventHandle_DDContainerPtrCDDItemInfoRefBoolRef eventRequestDrop;
60
67 EventHandle_DDContainerPtrCDDItemInfoRefBool eventDropResult;
68
74 EventHandle_EventHandle_DDContainerPtrDDItemState eventChangeDDState;
75
82 EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef requestDragWidgetInfo;
83
84
85 /*internal:*/
86 // метод для установления стейта айтема
87 virtual void _setContainerItemInfo(size_t _index, bool _set, bool _accept);
88
93 delegates::MultiDelegate<DDContainer*> _eventInvalideContainer;
94
101 delegates::MultiDelegate<DDContainer*, Widget*, const DDWidgetState&> eventUpdateDropState;
102
103 protected:
104 void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
105 void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
106 void onMouseDrag(int _left, int _top, MouseButton _id) override;
107
108 virtual void notifyInvalideDrop(DDContainer* _sender);
109
110 virtual void removeDropItems();
111 virtual void updateDropItems();
112 virtual void updateDropItemsState(const DDWidgetState& _state);
113
114 void mouseDrag(MouseButton _id);
115 void mouseButtonReleased(MouseButton _id);
116 void mouseButtonPressed(MouseButton _id);
117
118 void endDrop(bool _reset);
119
120 void setPropertyOverride(std::string_view _key, std::string_view _value) override;
121
122 protected:
123 bool mDropResult{false};
124 bool mNeedDrop{false};
125 bool mStartDrop{false};
126
127 Widget* mOldDrop{nullptr};
128
129 DDItemInfo mDropInfo;
130
131 size_t mDropSenderIndex{ITEM_NONE};
132
133 // список виджетов для дропа
134 Widget* mDropItem{nullptr};
135 IntCoord mDropDimension;
136
137 IntPoint mClickInWidget;
138
139 // нужно и виджету поддержка драг энд дропа
140 bool mNeedDragDrop{false};
141
142 DDContainer* mReseiverContainer{nullptr};
143 };
144
145} // namespace MyGUI
146
147#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_DDContainerPtrCDDItemInfoRefBool
delegates::MultiDelegate< DDContainer *, const DDItemInfo &, bool > EventHandle_DDContainerPtrCDDItemInfoRefBool
Definition MyGUI_DDContainer.h:20
MyGUI::EventHandle_DDContainerPtrCDDItemInfoRefBoolRef
delegates::MultiDelegate< DDContainer *, const DDItemInfo &, bool & > EventHandle_DDContainerPtrCDDItemInfoRefBoolRef
Definition MyGUI_DDContainer.h:18
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::EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef
delegates::Delegate< DDContainer *, Widget *&, IntCoord & > EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef
Definition MyGUI_DDContainer.h:23
MyGUI::DDItemInfo
Definition MyGUI_DDItemInfo.h:55
MyGUI::DDWidgetState
Definition MyGUI_DDItemInfo.h:100
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16