MyGUI: MyGUI_DDItemInfo.h Source File

MyGUI 3.4.3

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#include "MyGUI_Macros.h"
12
13namespace MyGUI
14{
15
16 struct MYGUI_EXPORT DDItemState
17 {
18 enum Enum
19 {
20 None,
21 Start,
22 End,
23 Miss,
24 Accept,
25 Refuse
26 };
27
28 DDItemState(Enum _value = None) :
29 mValue(_value)
30 {
31 }
32
33 friend bool operator==(DDItemState const& a, DDItemState const& b)
34 {
35 return a.mValue == b.mValue;
36 }
37
38 friend bool operator!=(DDItemState const& a, DDItemState const& b)
39 {
40 return a.mValue != b.mValue;
41 }
42
43 int getValue() const
44 {
45 return mValue;
46 }
47
48 private:
49 Enum mValue;
50 };
51
52 // структура информации об индексах дропа
54 struct MYGUI_EXPORT DDItemInfo
55 {
56 DDItemInfo() :
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
89 DDContainer* sender;
91 size_t sender_index;
92
94 DDContainer* receiver;
96 size_t receiver_index;
97 };
98
99 struct MYGUI_EXPORT DDWidgetState
100 {
101 DDWidgetState(size_t _index) :
102 index(_index)
103 {
104 }
105
107 size_t index;
109 bool update{true};
111 bool accept{false};
113 bool refuse{false};
114 };
115
116} // namespace MyGUI
117
118#endif // MYGUI_ITEM_DROP_INFO_H_
MyGUI_Macros.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI::DDContainer
widget description should be here.
Definition MyGUI_DDContainer.h:31
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::DDItemInfo::DDItemInfo
DDItemInfo(DDContainer *_sender, size_t _sender_index, DDContainer *_receiver, size_t _receiver_index)
Definition MyGUI_DDItemInfo.h:64
MyGUI::DDItemInfo::reset
void reset()
Definition MyGUI_DDItemInfo.h:80
MyGUI::DDItemInfo::sender
DDContainer * sender
Definition MyGUI_DDItemInfo.h:89
MyGUI::DDItemInfo::receiver
DDContainer * receiver
Definition MyGUI_DDItemInfo.h:94
MyGUI::DDItemInfo::DDItemInfo
DDItemInfo()
Definition MyGUI_DDItemInfo.h:56
MyGUI::DDItemInfo::set
void set(DDContainer *_sender, size_t _sender_index, DDContainer *_receiver, size_t _receiver_index)
Definition MyGUI_DDItemInfo.h:72
MyGUI::DDItemInfo::receiver_index
size_t receiver_index
Definition MyGUI_DDItemInfo.h:96
MyGUI::DDItemInfo::sender_index
size_t sender_index
Definition MyGUI_DDItemInfo.h:91
MyGUI::DDItemState::DDItemState
DDItemState(Enum _value=None)
Definition MyGUI_DDItemInfo.h:28
MyGUI::DDItemState::operator!=
friend bool operator!=(DDItemState const &a, DDItemState const &b)
Definition MyGUI_DDItemInfo.h:38
MyGUI::DDItemState::getValue
int getValue() const
Definition MyGUI_DDItemInfo.h:43
MyGUI::DDItemState::Enum
Enum
Definition MyGUI_DDItemInfo.h:19
MyGUI::DDItemState::End
@ End
Definition MyGUI_DDItemInfo.h:22
MyGUI::DDItemState::Accept
@ Accept
Definition MyGUI_DDItemInfo.h:24
MyGUI::DDItemState::None
@ None
Definition MyGUI_DDItemInfo.h:20
MyGUI::DDItemState::Start
@ Start
Definition MyGUI_DDItemInfo.h:21
MyGUI::DDItemState::Refuse
@ Refuse
Definition MyGUI_DDItemInfo.h:25
MyGUI::DDItemState::Miss
@ Miss
Definition MyGUI_DDItemInfo.h:23
MyGUI::DDItemState::operator==
friend bool operator==(DDItemState const &a, DDItemState const &b)
Definition MyGUI_DDItemInfo.h:33
MyGUI::DDWidgetState::update
bool update
Definition MyGUI_DDItemInfo.h:109
MyGUI::DDWidgetState::accept
bool accept
Definition MyGUI_DDItemInfo.h:111
MyGUI::DDWidgetState::refuse
bool refuse
Definition MyGUI_DDItemInfo.h:113
MyGUI::DDWidgetState::DDWidgetState
DDWidgetState(size_t _index)
Definition MyGUI_DDItemInfo.h:101
MyGUI::DDWidgetState::index
size_t index
Definition MyGUI_DDItemInfo.h:107