MyGUI  3.2.0
MyGUI_DDContainer.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_DDCONTAINER_H__
23 #define __MYGUI_DDCONTAINER_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Widget.h"
27 #include "MyGUI_DDItemInfo.h"
28 #include "MyGUI_EventPair.h"
29 
30 namespace MyGUI
31 {
32 
37 
38 
40  public Widget
41  {
43 
44  public:
45  DDContainer();
46 
50  void setNeedDragDrop(bool _value);
52  bool getNeedDragDrop() const;
53 
54  void resetDrag();
55 
56  /*events:*/
64  eventStartDrag;
65 
73  eventRequestDrop;
74 
82  eventDropResult;
83 
90  eventChangeDDState;
91 
99  requestDragWidgetInfo;
100 
101 
102  /*internal:*/
103  // метод для установления стейта айтема
104  virtual void _setContainerItemInfo(size_t _index, bool _set, bool _accept);
105 
110  delegates::CMultiDelegate1<DDContainer*>
111  _eventInvalideContainer;
112 
119  delegates::CMultiDelegate3<DDContainer*, Widget*, const DDWidgetState&>
120  eventUpdateDropState;
121 
122  protected:
123  virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
124  virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
125  virtual void onMouseDrag(int _left, int _top, MouseButton _id);
126 
127  virtual void notifyInvalideDrop(DDContainer* _sender);
128 
129  virtual void removeDropItems();
130  virtual void updateDropItems();
131  virtual void updateDropItemsState(const DDWidgetState& _state);
132 
133  void mouseDrag(MouseButton _id);
134  void mouseButtonReleased(MouseButton _id);
135  void mouseButtonPressed(MouseButton _id);
136 
137  void endDrop(bool _reset);
138 
139  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
140 
141  protected:
142  bool mDropResult;
143  bool mNeedDrop;
144  bool mStartDrop;
145 
146  Widget* mOldDrop;
147  Widget* mCurrentSender;
148 
149  DDItemInfo mDropInfo;
150 
151  size_t mDropSenderIndex;
152 
153  // список виджетов для дропа
154  Widget* mDropItem;
155  IntCoord mDropDimension;
156 
157  IntPoint mClickInWidget;
158 
159  // нужно и виджету поддержка драг энд дропа
160  bool mNeedDragDrop;
161 
162  DDContainer* mReseiverContainer;
163  };
164 
165 } // namespace MyGUI
166 
167 #endif // __MYGUI_DDCONTAINER_H__