MyGUI  3.0.1
MyGUI_DDItemInfo.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_ITEM_DROP_INFO_H__
24 #define __MYGUI_ITEM_DROP_INFO_H__
25 
26 #include "MyGUI_Prerequest.h"
27 
28 namespace MyGUI
29 {
30 
32  {
33  enum Enum
34  {
37  End,
38  Miss,
40  Refuse
41  };
42 
43  DDItemState(Enum _value = None) : value(_value) { }
44 
45  friend bool operator == (DDItemState const& a, DDItemState const& b) { return a.value == b.value; }
46  friend bool operator != (DDItemState const& a, DDItemState const& b) { return a.value != b.value; }
47 
48  private:
49  Enum value;
50  };
51 
52  // структура информации об индексах дропа
55  {
57  sender(nullptr),
58  sender_index(ITEM_NONE),
59  receiver(nullptr),
60  receiver_index(ITEM_NONE)
61  {
62  }
63 
64  DDItemInfo(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index) :
65  sender(_sender),
66  sender_index(_sender_index),
67  receiver(_receiver),
68  receiver_index(_receiver_index)
69  {
70  }
71 
72  void set(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index)
73  {
74  sender = _sender;
75  sender_index = _sender_index;
76  receiver = _receiver;
77  receiver_index = _receiver_index;
78  }
79 
80  void reset()
81  {
82  sender = nullptr;
83  sender_index = ITEM_NONE;
84  receiver = nullptr;
85  receiver_index = ITEM_NONE;
86  }
87 
91  size_t sender_index;
92 
97  };
98 
100  {
101  DDWidgetState(size_t _index) :
102  index(_index),
103  update(true),
104  accept(false),
105  refuse(false)
106  { }
107 
109  size_t index;
111  bool update;
113  bool accept;
115  bool refuse;
116  };
117 
118 } // namespace MyGUI
119 
120 #endif // __MYGUI_ITEM_DROP_INFO_H__