MyGUI  3.2.1
MyGUI_DDItemInfo.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_ITEM_DROP_INFO_H__
8 #define __MYGUI_ITEM_DROP_INFO_H__
9 
10 #include "MyGUI_Prerequest.h"
11 
12 namespace MyGUI
13 {
14 
16  {
17  enum Enum
18  {
21  End,
22  Miss,
24  Refuse
25  };
26 
27  DDItemState(Enum _value = None) :
28  mValue(_value)
29  {
30  }
31 
32  friend bool operator == (DDItemState const& a, DDItemState const& b)
33  {
34  return a.mValue == b.mValue;
35  }
36 
37  friend bool operator != (DDItemState const& a, DDItemState const& b)
38  {
39  return a.mValue != b.mValue;
40  }
41 
42  int getValue() const
43  {
44  return mValue;
45  }
46 
47  private:
48  Enum mValue;
49  };
50 
51  // структура информации об индексах дропа
54  {
56  sender(nullptr),
57  sender_index(ITEM_NONE),
58  receiver(nullptr),
59  receiver_index(ITEM_NONE)
60  {
61  }
62 
63  DDItemInfo(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index) :
64  sender(_sender),
65  sender_index(_sender_index),
66  receiver(_receiver),
67  receiver_index(_receiver_index)
68  {
69  }
70 
71  void set(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index)
72  {
73  sender = _sender;
74  sender_index = _sender_index;
75  receiver = _receiver;
76  receiver_index = _receiver_index;
77  }
78 
79  void reset()
80  {
81  sender = nullptr;
82  sender_index = ITEM_NONE;
83  receiver = nullptr;
84  receiver_index = ITEM_NONE;
85  }
86 
90  size_t sender_index;
91 
96  };
97 
99  {
100  DDWidgetState(size_t _index) :
101  index(_index),
102  update(true),
103  accept(false),
104  refuse(false)
105  {
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__