guiScriptNotifyControl.h
Engine/source/gui/core/guiScriptNotifyControl.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _GUISCRIPTNOTIFYCTRL_H_ 25#define _GUISCRIPTNOTIFYCTRL_H_ 26 27#ifndef _GUICONTROL_H_ 28#include "gui/core/guiControl.h" 29#endif 30 31class GuiScriptNotifyCtrl : public GuiControl 32{ 33private: 34 typedef GuiControl Parent; 35public: 36 37 /// @name Event Callbacks 38 /// @{ 39 bool mOnChildAdded; ///< Script Notify : onAddObject(%object) 40 bool mOnChildRemoved; ///< Script Notify : onRemoveObject(%object) 41 bool mOnResize; ///< Script Notify : onResize() 42 bool mOnChildResized; ///< Script Notify : onChildResized(%child) 43 bool mOnParentResized; ///< Script Notify : onParentResized() 44 bool mOnLoseFirstResponder; ///< Script Notify : onLoseFirstResponder() 45 bool mOnGainFirstResponder; ///< Script Notify : onGainFirstResponder() 46 /// @} 47 48public: 49 /// @name Initialization 50 /// @{ 51 DECLARE_CONOBJECT(GuiScriptNotifyCtrl); 52 DECLARE_CATEGORY( "Gui Other Script" ); 53 DECLARE_DESCRIPTION( "A control that implements various script callbacks for\n" 54 "certain GUI events." ); 55 56 GuiScriptNotifyCtrl(); 57 virtual ~GuiScriptNotifyCtrl(); 58 static void initPersistFields(); 59 60 virtual bool resize(const Point2I &newPosition, const Point2I &newExtent); 61 virtual void childResized(GuiScriptNotifyCtrl *child); 62 virtual void parentResized(const RectI &oldParentRect, const RectI &newParentRect); 63 virtual void onChildRemoved( GuiControl *child ); 64 virtual void onChildAdded( GuiControl *child ); 65 66 DECLARE_CALLBACK(void, onResize, (SimObjectId ID) ); 67 DECLARE_CALLBACK(void, onChildAdded, (SimObjectId ID, SimObjectId childID)); 68 DECLARE_CALLBACK(void, onChildRemoved, (SimObjectId ID, SimObjectId childID)); 69 DECLARE_CALLBACK(void, onChildResized, (SimObjectId ID, SimObjectId childID)); 70 DECLARE_CALLBACK(void, onParentResized, (SimObjectId ID)); 71 DECLARE_CALLBACK(void, onLoseFirstResponder, (SimObjectId ID)); 72 DECLARE_CALLBACK(void, onGainFirstResponder, (SimObjectId ID)); 73 74 75 76 77 //virtual void onMouseUp(const GuiEvent &event); 78 //virtual void onMouseDown(const GuiEvent &event); 79 //virtual void onMouseMove(const GuiEvent &event); 80 //virtual void onMouseDragged(const GuiEvent &event); 81 //virtual void onMouseEnter(const GuiEvent &event); 82 //virtual void onMouseLeave(const GuiEvent &event); 83 84 //virtual bool onMouseWheelUp(const GuiEvent &event); 85 //virtual bool onMouseWheelDown(const GuiEvent &event); 86 87 //virtual void onRightMouseDown(const GuiEvent &event); 88 //virtual void onRightMouseUp(const GuiEvent &event); 89 //virtual void onRightMouseDragged(const GuiEvent &event); 90 91 //virtual void onMiddleMouseDown(const GuiEvent &event); 92 //virtual void onMiddleMouseUp(const GuiEvent &event); 93 //virtual void onMiddleMouseDragged(const GuiEvent &event); 94 95 //virtual void onMouseDownEditor(const GuiEvent &event, Point2I offset); 96 //virtual void onRightMouseDownEditor(const GuiEvent &event, Point2I offset); 97 98 virtual void setFirstResponder(GuiControl *firstResponder); 99 virtual void setFirstResponder(); 100 void clearFirstResponder(); 101 virtual void onLoseFirstResponder(); 102 103 //virtual void acceleratorKeyPress(U32 index); 104 //virtual void acceleratorKeyRelease(U32 index); 105 //virtual bool onKeyDown(const GuiEvent &event); 106 //virtual bool onKeyUp(const GuiEvent &event); 107 //virtual bool onKeyRepeat(const GuiEvent &event); 108 109 virtual void onMessage(GuiScriptNotifyCtrl *sender, S32 msg); ///< Receive a message from another control 110 111 virtual void onDialogPush(); 112 virtual void onDialogPop(); 113 114}; 115 116#endif 117