MyGUI  3.2.0
MyGUI_DDItemInfo.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_ITEM_DROP_INFO_H__
23 #define __MYGUI_ITEM_DROP_INFO_H__
24 
25 #include "MyGUI_Prerequest.h"
26 
27 namespace MyGUI
28 {
29 
31  {
32  enum Enum
33  {
36  End,
37  Miss,
39  Refuse
40  };
41 
42  DDItemState(Enum _value = None) :
43  value(_value)
44  {
45  }
46 
47  friend bool operator == (DDItemState const& a, DDItemState const& b)
48  {
49  return a.value == b.value;
50  }
51 
52  friend bool operator != (DDItemState const& a, DDItemState const& b)
53  {
54  return a.value != b.value;
55  }
56 
57  private:
58  Enum value;
59  };
60 
61  // структура информации об индексах дропа
64  {
66  sender(nullptr),
67  sender_index(ITEM_NONE),
68  receiver(nullptr),
69  receiver_index(ITEM_NONE)
70  {
71  }
72 
73  DDItemInfo(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index) :
74  sender(_sender),
75  sender_index(_sender_index),
76  receiver(_receiver),
77  receiver_index(_receiver_index)
78  {
79  }
80 
81  void set(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index)
82  {
83  sender = _sender;
84  sender_index = _sender_index;
85  receiver = _receiver;
86  receiver_index = _receiver_index;
87  }
88 
89  void reset()
90  {
91  sender = nullptr;
92  sender_index = ITEM_NONE;
93  receiver = nullptr;
94  receiver_index = ITEM_NONE;
95  }
96 
100  size_t sender_index;
101 
106  };
107 
109  {
110  DDWidgetState(size_t _index) :
111  index(_index),
112  update(true),
113  accept(false),
114  refuse(false)
115  {
116  }
117 
119  size_t index;
121  bool update;
123  bool accept;
125  bool refuse;
126  };
127 
128 } // namespace MyGUI
129 
130 #endif // __MYGUI_ITEM_DROP_INFO_H__