MyGUI
3.2.0
|
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_DDCONTAINER_H__ 00023 #define __MYGUI_DDCONTAINER_H__ 00024 00025 #include "MyGUI_Prerequest.h" 00026 #include "MyGUI_Widget.h" 00027 #include "MyGUI_DDItemInfo.h" 00028 #include "MyGUI_EventPair.h" 00029 00030 namespace MyGUI 00031 { 00032 00033 typedef delegates::CMultiDelegate3<DDContainer*, const DDItemInfo&, bool&> EventHandle_DDContainerPtrCDDItemInfoRefBoolRef; 00034 typedef delegates::CMultiDelegate3<DDContainer*, const DDItemInfo&, bool> EventHandle_DDContainerPtrCDDItemInfoRefBool; 00035 typedef delegates::CMultiDelegate2<DDContainer*, DDItemState> EventHandle_EventHandle_DDContainerPtrDDItemState; 00036 typedef delegates::CDelegate3<DDContainer*, Widget*&, IntCoord&> EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef; 00037 00038 00039 class MYGUI_EXPORT DDContainer : 00040 public Widget 00041 { 00042 MYGUI_RTTI_DERIVED( DDContainer ) 00043 00044 public: 00045 DDContainer(); 00046 00050 void setNeedDragDrop(bool _value); 00052 bool getNeedDragDrop() const; 00053 00054 void resetDrag(); 00055 00056 /*events:*/ 00063 EventHandle_DDContainerPtrCDDItemInfoRefBoolRef 00064 eventStartDrag; 00065 00072 EventHandle_DDContainerPtrCDDItemInfoRefBoolRef 00073 eventRequestDrop; 00074 00081 EventHandle_DDContainerPtrCDDItemInfoRefBool 00082 eventDropResult; 00083 00089 EventHandle_EventHandle_DDContainerPtrDDItemState 00090 eventChangeDDState; 00091 00098 EventHandle_EventHandle_DDContainerPtrWidgetPtrRefIntCoordRef 00099 requestDragWidgetInfo; 00100 00101 00102 /*internal:*/ 00103 // метод для установления стейта айтема 00104 virtual void _setContainerItemInfo(size_t _index, bool _set, bool _accept); 00105 00110 delegates::CMultiDelegate1<DDContainer*> 00111 _eventInvalideContainer; 00112 00119 delegates::CMultiDelegate3<DDContainer*, Widget*, const DDWidgetState&> 00120 eventUpdateDropState; 00121 00122 protected: 00123 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id); 00124 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id); 00125 virtual void onMouseDrag(int _left, int _top, MouseButton _id); 00126 00127 virtual void notifyInvalideDrop(DDContainer* _sender); 00128 00129 virtual void removeDropItems(); 00130 virtual void updateDropItems(); 00131 virtual void updateDropItemsState(const DDWidgetState& _state); 00132 00133 void mouseDrag(MouseButton _id); 00134 void mouseButtonReleased(MouseButton _id); 00135 void mouseButtonPressed(MouseButton _id); 00136 00137 void endDrop(bool _reset); 00138 00139 virtual void setPropertyOverride(const std::string& _key, const std::string& _value); 00140 00141 protected: 00142 bool mDropResult; 00143 bool mNeedDrop; 00144 bool mStartDrop; 00145 00146 Widget* mOldDrop; 00147 Widget* mCurrentSender; 00148 00149 DDItemInfo mDropInfo; 00150 00151 size_t mDropSenderIndex; 00152 00153 // список виджетов для дропа 00154 Widget* mDropItem; 00155 IntCoord mDropDimension; 00156 00157 IntPoint mClickInWidget; 00158 00159 // нужно и виджету поддержка драг энд дропа 00160 bool mNeedDragDrop; 00161 00162 DDContainer* mReseiverContainer; 00163 }; 00164 00165 } // namespace MyGUI 00166 00167 #endif // __MYGUI_DDCONTAINER_H__