00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __MYGUI_DDCONTAINER_H__
00024 #define __MYGUI_DDCONTAINER_H__
00025
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Widget.h"
00028 #include "MyGUI_DDItemInfo.h"
00029 #include "MyGUI_EventPair.h"
00030
00031 namespace MyGUI
00032 {
00033
00034 class MYGUI_EXPORT DDContainer :
00035 public Widget
00036 {
00037 MYGUI_RTTI_DERIVED( DDContainer );
00038
00039 public:
00040 DDContainer();
00041
00045 void setNeedDragDrop(bool _value) { mNeedDragDrop = _value; }
00047 bool getNeedDragDrop() { return mNeedDragDrop; }
00048
00050 virtual void setProperty(const std::string& _key, const std::string& _value);
00051
00052
00059 delegates::CDelegate3<DDContainerPtr, const DDItemInfo&, bool&>
00060 eventStartDrag;
00061
00068 delegates::CDelegate3<DDContainerPtr, const DDItemInfo&, bool&>
00069 eventRequestDrop;
00070
00077 delegates::CDelegate3<DDContainerPtr, const DDItemInfo&, bool>
00078 eventDropResult;
00079
00085 delegates::CDelegate2<DDContainerPtr, DDItemState>
00086 eventChangeDDState;
00087
00094 delegates::CDelegate3<DDContainerPtr, WidgetPtr&, IntCoord&>
00095 requestDragWidgetInfo;
00096
00097
00098
00099
00100 virtual void _setContainerItemInfo(size_t _index, bool _set, bool _accept) { }
00101
00102 virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, WidgetPtr _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
00103
00108 EventPair<EventHandle_WidgetVoid, delegates::CDelegate1<DDContainerPtr> >
00109 _eventInvalideContainer;
00110
00117 delegates::CDelegate3<DDContainerPtr, WidgetPtr, const DDWidgetState&>
00118 eventUpdateDropState;
00119
00120 protected:
00121 virtual ~DDContainer();
00122
00123 void baseChangeWidgetSkin(ResourceSkin* _info);
00124
00125 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
00126 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
00127 virtual void onMouseDrag(int _left, int _top);
00128
00129 virtual void notifyInvalideDrop(DDContainerPtr _sender);
00130
00131 virtual void _getContainer(WidgetPtr& _container, size_t& _index);
00132
00133 virtual void removeDropItems();
00134 virtual void updateDropItems();
00135 virtual void updateDropItemsState(const DDWidgetState& _state);
00136
00137 void mouseDrag();
00138 void mouseButtonReleased(MouseButton _id);
00139 void mouseButtonPressed(MouseButton _id);
00140
00141 void endDrop(bool _reset);
00142
00143 private:
00144 void initialiseWidgetSkin(ResourceSkin* _info);
00145 void shutdownWidgetSkin();
00146
00147
00148 protected:
00149 bool mDropResult;
00150 bool mNeedDrop;
00151 bool mStartDrop;
00152
00153 WidgetPtr mOldDrop;
00154 WidgetPtr mCurrentSender;
00155
00156 DDItemInfo mDropInfo;
00157
00158 size_t mDropSenderIndex;
00159
00160
00161 WidgetPtr mDropItem;
00162 IntCoord mDropDimension;
00163
00164 IntPoint mClickInWidget;
00165
00166
00167 bool mNeedDragDrop;
00168
00169 DDContainerPtr mReseiverContainer;
00170 };
00171
00172 }
00173
00174 #endif // __MYGUI_DDCONTAINER_H__