• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_DDContainer.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_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     /*event:*/
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     /*internal:*/
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 } // namespace MyGUI
00173 
00174 #endif // __MYGUI_DDCONTAINER_H__

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1