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