MyGUI  3.2.0
MyGUI_DDItemInfo.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_ITEM_DROP_INFO_H__
00023 #define __MYGUI_ITEM_DROP_INFO_H__
00024 
00025 #include "MyGUI_Prerequest.h"
00026 
00027 namespace MyGUI
00028 {
00029 
00030     struct MYGUI_EXPORT DDItemState
00031     {
00032         enum Enum
00033         {
00034             None,
00035             Start, 
00036             End, 
00037             Miss, 
00038             Accept, 
00039             Refuse 
00040         };
00041 
00042         DDItemState(Enum _value = None) :
00043             value(_value)
00044         {
00045         }
00046 
00047         friend bool operator == (DDItemState const& a, DDItemState const& b)
00048         {
00049             return a.value == b.value;
00050         }
00051 
00052         friend bool operator != (DDItemState const& a, DDItemState const& b)
00053         {
00054             return a.value != b.value;
00055         }
00056 
00057     private:
00058         Enum value;
00059     };
00060 
00061     // структура информации об индексах дропа
00063     struct MYGUI_EXPORT DDItemInfo
00064     {
00065         DDItemInfo() :
00066             sender(nullptr),
00067             sender_index(ITEM_NONE),
00068             receiver(nullptr),
00069             receiver_index(ITEM_NONE)
00070         {
00071         }
00072 
00073         DDItemInfo(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index) :
00074             sender(_sender),
00075             sender_index(_sender_index),
00076             receiver(_receiver),
00077             receiver_index(_receiver_index)
00078         {
00079         }
00080 
00081         void set(DDContainer* _sender, size_t _sender_index, DDContainer* _receiver, size_t _receiver_index)
00082         {
00083             sender = _sender;
00084             sender_index = _sender_index;
00085             receiver = _receiver;
00086             receiver_index = _receiver_index;
00087         }
00088 
00089         void reset()
00090         {
00091             sender = nullptr;
00092             sender_index = ITEM_NONE;
00093             receiver = nullptr;
00094             receiver_index = ITEM_NONE;
00095         }
00096 
00098         DDContainer* sender;
00100         size_t sender_index;
00101 
00103         DDContainer* receiver;
00105         size_t receiver_index;
00106     };
00107 
00108     struct MYGUI_EXPORT DDWidgetState
00109     {
00110         DDWidgetState(size_t _index) :
00111             index(_index),
00112             update(true),
00113             accept(false),
00114             refuse(false)
00115         {
00116         }
00117 
00119         size_t index;
00121         bool update;
00123         bool accept;
00125         bool refuse;
00126     };
00127 
00128 } // namespace MyGUI
00129 
00130 #endif // __MYGUI_ITEM_DROP_INFO_H__