guiControl.cpp
Engine/source/gui/core/guiControl.cpp
Public Variables
_sGuiControlSetExtent1 ("@brief Resize the control to the given dimensions.\n\n" "Child controls will resize according to their layout settings.\n" "@param width The new width of the control in pixels.\n" "@param height The new height of the control in pixels.", "GuiControl", "void setExtent( S32 width, S32 height );")
_sGuiControlSetExtent2 ("@brief Resize the control to the given dimensions.\n\n" "Child controls with resize according to their layout settings.\n" "@param p The new ( width, height ) extents of the control.", "GuiControl", "void setExtent( Point2I p );")
Public Functions
ConsoleDocClass(GuiControl , "@brief Base class <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> all Gui <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">objects.\n\n</a>" "<a href="/coding/class/classguicontrol/">GuiControl</a> is the basis <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Gui system. It represents an individual <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> that can be placed on the canvas and with which " "the mouse and keyboard can potentially interact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">with.\n\n</a>" "@section GuiControl_Hierarchy Control <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Hierarchies\n</a>" "GuiControls are arranged in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> hierarchy. All children of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> are placed in their parent's coordinate space, i.e. their " "coordinates are relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the upper left corner of their immediate parent. When <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is moved, all its child controls " "are moved along with <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n\n</a>" "Since <a href="/coding/class/classguicontrol/">GuiControl</a> 's are SimGroups, hierarchy also implies ownership. This means that <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is destroyed, all its children " "are destroyed along with it. It also means that <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can only be part of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy. When adding <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "<a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> another control, it will automatically be reparented from another <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> it may have previously been parented <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n\n</a>" " @section GuiControl_Layout Layout <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">System\n</a>" "GuiControls have <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> two-dimensional position and are rectangular in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" " @section GuiControl_Events Event <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">System\n</a>" " @section GuiControl_Profiles Control <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Profiles\n</a>" "Common data accessed by GuiControls is stored in so-called \"Control Profiles.\" This includes font, color , and texture information. " "By pooling this data in shared objects, the appearance of any number of controls can be changed quickly and easily by modifying " "only the shared profile <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If not explicitly assigned <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> will by default look <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile object that matches its class name. This means " "that the class GuiMyCtrl, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example, will look <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile called 'GuiMyProfile'. If this profile cannot be found, the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> " "will fall back <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> GuiDefaultProfile which must be defined in any case <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Gui system <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">work.\n\n</a>" "In addition <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its primary profile, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> may be assigned <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> second profile called 'tooltipProfile' that will be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> " "tooltip popups <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" " @section GuiControl_Actions Triggered <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Actions\n</a>" " @section GuiControl_FirstResponders First <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Responders\n</a>" "At any time, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can be what is called the \"first responder\" on the <a href="/coding/class/classguicanvas/">GuiCanvas</a> is placed on. This <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> " "will be the first <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> receive keyboard events not bound in the global ActionMap. If the first responder choses <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "handle <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> particular keyboard event, \<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @section GuiControl_Waking Waking and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Sleeping\n</a>" " @section GuiControl_VisibleActive Visibility and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Activeness\n</a>" "By default, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classguicontrol/">GuiControl</a> is active which means that <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCore\n</a>" )
DefineEngineMethod(GuiControl , addGuiControl , void , (GuiControl *control) , "Add the given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> child <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "This is synonymous <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> calling <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimGroup::addObject.\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> add as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">child.\n</a>" "@note The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> will retain its current position and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimGroup::addObject\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl_Hierarchy\n</a>" )
DefineEngineMethod(GuiControl , clearFirstResponder , void , (bool ignored) , (false) , "Clear this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> from being the first responder in its hierarchy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">chain.\n</a>" "@param ignored Ignored. Supported <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> backwards-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">compatibility.\n</a>" )
DefineEngineMethod(GuiControl , controlIsChild , bool , (GuiControl *control) , "Test whether the given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> direct or indirect child <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The potential child <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> direct or indirect child <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this control." )
DefineEngineMethod(GuiControl , findHitControl , GuiControl * , (S32 x, S32 y) , "Find the topmost child <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> located at the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" "@note Only children that are both visible and have the 'modal' flag set in their profile will be considered in the search." "@param x The X coordinate in the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s own coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@param y The Y coordinate in the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s own coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@return The topmost child <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> at the given coordintes or the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> on which the method was called <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching child could be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::modal\n</a>" "@see findHitControls" )
DefineEngineMethod(GuiControl , findHitControls , const char * , (S32 x, S32 y, S32 width, S32 height) )
DefineEngineMethod(GuiControl , getAspect , F32 , () , "Get the aspect ratio of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">extents.\n</a>" "@return The width of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> divided by its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">height.\n</a>" "@see getExtent" )
DefineEngineMethod(GuiControl , getCenter , Point2I , () , "Get the coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s center point relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" "@return The coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s center point in parent-relative coordinates." )
DefineEngineMethod(GuiControl , getExtent , Point2I , () , "Get the width and height of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return A point structure containing the width of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in x and the height in y." )
DefineEngineMethod(GuiControl , getFirstResponder , GuiControl * , () , "Get the first responder set on this <a href="/coding/class/classguicontrol/">GuiControl</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tree.\n</a>" "@return The first responder set on the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subtree.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
DefineEngineMethod(GuiControl , getGlobalCenter , Point2I , () , "Get the coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s center point in coordinates relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hierarchy.\n</a>" "@Return the center coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in root-relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" )
DefineEngineMethod(GuiControl , getGlobalPosition , Point2I , () , "Get the position of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root of the <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy it is contained <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n</a>" "@return The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s current position in root-relative coordinates." )
DefineEngineMethod(GuiControl , getMinExtent , Point2I , () , "Get the minimum allowed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return The minimum <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shrunk.\n</a>" "@see minExtent" )
DefineEngineMethod(GuiControl , getParent , GuiControl * , () , "Get the immediate parent <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return The immediate parent <a href="/coding/class/classguicontrol/">GuiControl</a> or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is not parented <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl.\n</a>" )
DefineEngineMethod(GuiControl , getPosition , Point2I , () , "Get the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s current position relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" "@return The coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its parent's coordinate space." )
DefineEngineMethod(GuiControl , getRoot , GuiCanvas * , () , "Get the canvas on which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">placed.\n</a>" "@return The canvas on which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s hierarchy is currently placed or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is not currently placed on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl_Hierarchy\n</a>" )
DefineEngineMethod(GuiControl , getValue , const char * , () , "Get the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" )
DefineEngineMethod(GuiControl , isActive , bool , () , "Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is active or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it's active, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" )
DefineEngineMethod(GuiControl , isAwake , bool , () , "Test whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">awake.\n</a>" "If <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is awake it means that it is part of the <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is awake." "@ref GuiControl_Waking" )
DefineEngineMethod(GuiControl , isFirstResponder , bool , () , "Test whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is the current first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is the current first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
DefineEngineMethod(GuiControl , isMouseLocked , bool , () , "Indicates <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the mouse is locked in this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the mouse is currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">locked.\n</a>" )
DefineEngineMethod(GuiControl , isVisible , bool , () , "Test whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is currently set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">visible.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is currently set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be visible." "@note This method does not tell anything about whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is actually visible <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "the user at the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">moment.\n\n</a>" "@ref GuiControl_VisibleActive" )
DefineEngineMethod(GuiControl , makeFirstResponder , void , (bool isFirst) , "Make this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@param isFirst True <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make first responder, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" )
DefineEngineMethod(GuiControl , pointInControl , bool , (S32 x, S32 y) , "Test whether the given point lies within the rectangle of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param x X coordinate of the point in parent-relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" "@param y Y coordinate of the point in parent-relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the point is within the control, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getExtent\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getPosition\n</a>" )
DefineEngineMethod(GuiControl , resize , void , (S32 x, S32 y, S32 width, S32 height) , "Resize and reposition the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> using the give coordinates and dimensions. Child controls " "will resize according <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> their layout <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">behaviors.\n</a>" "@param x The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> X coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its parent's coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@param y The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Y coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its parent's coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@param width The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> width <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> should be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resized.\n</a>" "@param height The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> height <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> should be resized." )
DefineEngineMethod(GuiControl , setActive , void , (bool state) , (true) , "Set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> as active or inactive." "@param state True <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> as active, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set it as inactive." )
DefineEngineMethod(GuiControl , setCenter , void , (S32 x, S32 y) , "Set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s position by its center <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param x The X coordinate of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> center point of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" "@param y The Y coordinate of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> center point of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s parent." )
DefineEngineMethod(GuiControl , setExtent , void , (const char *extOrX, const char *y) , ("") , "( Point2I p | int x, int y ) Set the width and height of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@hide" )
DefineEngineMethod(GuiControl , setFirstResponder , void , () , "Make this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the current first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@note Only controls with <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile that has canKeyFocus enabled are able <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> become first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responders.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::canKeyFocus\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
DefineEngineMethod(GuiControl , setPosition , void , (S32 x, S32 y) , "Position the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in the local space of the parent <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param x The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> X coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its parent's upper left <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">corner.\n</a>" "@param y The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Y coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its parent's upper left corner." )
DefineEngineMethod(GuiControl , setPositionGlobal , void , (S32 x, S32 y) , "Set position of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root of the <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy it is contained <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n</a>" "@param x The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> X coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root's upper left <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">corner.\n</a>" "@param y The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Y coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root's upper left corner." )
DefineEngineMethod(GuiControl , setProfile , void , (GuiControlProfile *profile) , "Set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> profile <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "The profile used by <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> determines <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> great part of its behavior and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">appearance.\n</a>" "@param profile The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> profile the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> should <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@ref GuiControl_Profiles" )
DefineEngineMethod(GuiControl , setValue , void , (const char *value) , "Set the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" )
DefineEngineMethod(GuiControl , setVisible , void , (bool state) , (true) , "Set whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is visible or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param state The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> visiblity flag state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@ref GuiControl_VisibleActive" )
IMPLEMENT_CALLBACK(GuiControl , onAction , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s associated action is triggered and no 'command' is defined <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@ref GuiControl_Actions" )
IMPLEMENT_CALLBACK(GuiControl , onActive , void , (bool state) , (state) , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> changes its activeness state, i.e. when going from active <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> inactive or vice <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">versa.\n</a>" " @param stat The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> activeness <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isActive\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setActive\n</a>" " @ref GuiControl_VisibleActive" )
IMPLEMENT_CALLBACK(GuiControl , onAdd , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> object is registered with the system after the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> has been created." )
IMPLEMENT_CALLBACK(GuiControl , onControlDragEnter , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> has entered the control. This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> moves over <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The payload of the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">operation.\n</a>" "@param dropPoint The point at which the payload would be dropped <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it were released now. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onControlDragExit , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> has exited the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> and moved over <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> different control. This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> moves off of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The payload of the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">operation.\n</a>" "@param dropPoint The point at which the payload would be dropped <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it were released now. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onControlDragged , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> is moving across the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> after it has entered it. This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> moves across <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The payload of the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">operation.\n</a>" "@param dropPoint The point at which the payload would be dropped <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it were released now. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onControlDropped , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> has completed and is dropping its payload onto the control. " "This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> drops its payload on <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> that is being dropped onto this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param dropPoint The point at which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is being dropped. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onDialogPop , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is removed as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dialog from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">canvas.\n</a>" "@see GuiCanvas::popDialog" )
IMPLEMENT_CALLBACK(GuiControl , onDialogPush , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is pushed as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dialog onto the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">canvas.\n</a>" "@see GuiCanvas::pushDialog" )
IMPLEMENT_CALLBACK(GuiControl , onGainFirstResponder , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> gains first responder status on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
IMPLEMENT_CALLBACK(GuiControl , onLoseFirstResponder , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> loses first responder status on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
IMPLEMENT_CALLBACK(GuiControl , onRemove , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> object is removed from the system before it is deleted." )
IMPLEMENT_CALLBACK(GuiControl , onSleep , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is put <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sleep.\n</a>" "@ref GuiControl_Waking" )
IMPLEMENT_CALLBACK(GuiControl , onVisible , void , (bool state) , (state) , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> changes its visibility state, i.e. when going from visible <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> invisible or vice <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">versa.\n</a>" " @param state The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> visibility <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isVisible\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setVisible\n</a>" " @ref GuiControl_VisibleActive" )
IMPLEMENT_CALLBACK(GuiControl , onWake , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is woken <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">up.\n</a>" "@ref GuiControl_Waking" )
IMPLEMENT_SCOPE(GuiAPI , Gui , "" )
ImplementEnumType(GuiHorizontalSizing , "Horizontal sizing behavior of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl.\n\n</a>" "@ingroup GuiCore" )
ImplementEnumType(GuiVerticalSizing , "Vertical sizing behavior of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl.\n\n</a>" "@ingroup GuiCore" )
Detailed Description
Public Variables
ConsoleDocFragment _sGuiControlSetExtent1 ("@brief Resize the control to the given dimensions.\n\n" "Child controls will resize according to their layout settings.\n" "@param width The new width of the control in pixels.\n" "@param height The new height of the control in pixels.", "GuiControl", "void setExtent( S32 width, S32 height );")
ConsoleDocFragment _sGuiControlSetExtent2 ("@brief Resize the control to the given dimensions.\n\n" "Child controls with resize according to their layout settings.\n" "@param p The new ( width, height ) extents of the control.", "GuiControl", "void setExtent( Point2I p );")
Public Functions
ConsoleDocClass(GuiControl , "@brief Base class <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> all Gui <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">objects.\n\n</a>" "<a href="/coding/class/classguicontrol/">GuiControl</a> is the basis <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Gui system. It represents an individual <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> that can be placed on the canvas and with which " "the mouse and keyboard can potentially interact <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">with.\n\n</a>" "@section GuiControl_Hierarchy Control <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Hierarchies\n</a>" "GuiControls are arranged in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> hierarchy. All children of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> are placed in their parent's coordinate space, i.e. their " "coordinates are relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the upper left corner of their immediate parent. When <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is moved, all its child controls " "are moved along with <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n\n</a>" "Since <a href="/coding/class/classguicontrol/">GuiControl</a> 's are SimGroups, hierarchy also implies ownership. This means that <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is destroyed, all its children " "are destroyed along with it. It also means that <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can only be part of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy. When adding <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "<a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> another control, it will automatically be reparented from another <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> it may have previously been parented <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n\n</a>" " @section GuiControl_Layout Layout <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">System\n</a>" "GuiControls have <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> two-dimensional position and are rectangular in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n\n</a>" " @section GuiControl_Events Event <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">System\n</a>" " @section GuiControl_Profiles Control <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Profiles\n</a>" "Common data accessed by GuiControls is stored in so-called \"Control Profiles.\" This includes font, color , and texture information. " "By pooling this data in shared objects, the appearance of any number of controls can be changed quickly and easily by modifying " "only the shared profile <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "If not explicitly assigned <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> will by default look <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile object that matches its class name. This means " "that the class GuiMyCtrl, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example, will look <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile called 'GuiMyProfile'. If this profile cannot be found, the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> " "will fall back <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> GuiDefaultProfile which must be defined in any case <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the Gui system <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">work.\n\n</a>" "In addition <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its primary profile, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> may be assigned <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> second profile called 'tooltipProfile' that will be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> " "tooltip popups <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" " @section GuiControl_Actions Triggered <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Actions\n</a>" " @section GuiControl_FirstResponders First <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Responders\n</a>" "At any time, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> single <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can be what is called the \"first responder\" on the <a href="/coding/class/classguicanvas/">GuiCanvas</a> is placed on. This <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> " "will be the first <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> receive keyboard events not bound in the global ActionMap. If the first responder choses <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "handle <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> particular keyboard event, \<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @section GuiControl_Waking Waking and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Sleeping\n</a>" " @section GuiControl_VisibleActive Visibility and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Activeness\n</a>" "By default, <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classguicontrol/">GuiControl</a> is active which means that <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCore\n</a>" )
DefineEngineMethod(GuiControl , addGuiControl , void , (GuiControl *control) , "Add the given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> child <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "This is synonymous <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> calling <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimGroup::addObject.\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> add as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">child.\n</a>" "@note The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> will retain its current position and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SimGroup::addObject\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl_Hierarchy\n</a>" )
DefineEngineMethod(GuiControl , clearFirstResponder , void , (bool ignored) , (false) , "Clear this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> from being the first responder in its hierarchy <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">chain.\n</a>" "@param ignored Ignored. Supported <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> backwards-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">compatibility.\n</a>" )
DefineEngineMethod(GuiControl , controlIsChild , bool , (GuiControl *control) , "Test whether the given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> direct or indirect child <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The potential child <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> direct or indirect child <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this control." )
DefineEngineMethod(GuiControl , findHitControl , GuiControl * , (S32 x, S32 y) , "Find the topmost child <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> located at the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" "@note Only children that are both visible and have the 'modal' flag set in their profile will be considered in the search." "@param x The X coordinate in the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s own coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@param y The Y coordinate in the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s own coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@return The topmost child <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> at the given coordintes or the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> on which the method was called <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> no matching child could be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::modal\n</a>" "@see findHitControls" )
DefineEngineMethod(GuiControl , findHitControls , const char * , (S32 x, S32 y, S32 width, S32 height) )
DefineEngineMethod(GuiControl , getAspect , F32 , () , "Get the aspect ratio of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">extents.\n</a>" "@return The width of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> divided by its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">height.\n</a>" "@see getExtent" )
DefineEngineMethod(GuiControl , getCenter , Point2I , () , "Get the coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s center point relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" "@return The coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s center point in parent-relative coordinates." )
DefineEngineMethod(GuiControl , getExtent , Point2I , () , "Get the width and height of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return A point structure containing the width of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in x and the height in y." )
DefineEngineMethod(GuiControl , getFirstResponder , GuiControl * , () , "Get the first responder set on this <a href="/coding/class/classguicontrol/">GuiControl</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tree.\n</a>" "@return The first responder set on the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">subtree.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
DefineEngineMethod(GuiControl , getGlobalCenter , Point2I , () , "Get the coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s center point in coordinates relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hierarchy.\n</a>" "@Return the center coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in root-relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" )
DefineEngineMethod(GuiControl , getGlobalPosition , Point2I , () , "Get the position of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root of the <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy it is contained <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n</a>" "@return The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s current position in root-relative coordinates." )
DefineEngineMethod(GuiControl , getMinExtent , Point2I , () , "Get the minimum allowed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return The minimum <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shrunk.\n</a>" "@see minExtent" )
DefineEngineMethod(GuiControl , getParent , GuiControl * , () , "Get the immediate parent <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return The immediate parent <a href="/coding/class/classguicontrol/">GuiControl</a> or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is not parented <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl.\n</a>" )
DefineEngineMethod(GuiControl , getPosition , Point2I , () , "Get the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s current position relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" "@return The coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its parent's coordinate space." )
DefineEngineMethod(GuiControl , getRoot , GuiCanvas * , () , "Get the canvas on which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">placed.\n</a>" "@return The canvas on which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s hierarchy is currently placed or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is not currently placed on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl_Hierarchy\n</a>" )
DefineEngineMethod(GuiControl , getValue , const char * , () , "Get the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" )
DefineEngineMethod(GuiControl , isActive , bool , () , "Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is active or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it's active, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" )
DefineEngineMethod(GuiControl , isAwake , bool , () , "Test whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">awake.\n</a>" "If <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is awake it means that it is part of the <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is awake." "@ref GuiControl_Waking" )
DefineEngineMethod(GuiControl , isFirstResponder , bool , () , "Test whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is the current first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is the current first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
DefineEngineMethod(GuiControl , isMouseLocked , bool , () , "Indicates <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the mouse is locked in this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the mouse is currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">locked.\n</a>" )
DefineEngineMethod(GuiControl , isVisible , bool , () , "Test whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is currently set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">visible.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is currently set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be visible." "@note This method does not tell anything about whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is actually visible <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "the user at the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">moment.\n\n</a>" "@ref GuiControl_VisibleActive" )
DefineEngineMethod(GuiControl , makeFirstResponder , void , (bool isFirst) , "Make this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@param isFirst True <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make first responder, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" )
DefineEngineMethod(GuiControl , pointInControl , bool , (S32 x, S32 y) , "Test whether the given point lies within the rectangle of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param x X coordinate of the point in parent-relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" "@param y Y coordinate of the point in parent-relative <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">coordinates.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the point is within the control, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getExtent\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">getPosition\n</a>" )
DefineEngineMethod(GuiControl , resize , void , (S32 x, S32 y, S32 width, S32 height) , "Resize and reposition the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> using the give coordinates and dimensions. Child controls " "will resize according <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> their layout <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">behaviors.\n</a>" "@param x The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> X coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its parent's coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@param y The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Y coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in its parent's coordinate <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">space.\n</a>" "@param width The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> width <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> should be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resized.\n</a>" "@param height The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> height <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> should be resized." )
DefineEngineMethod(GuiControl , setActive , void , (bool state) , (true) , "Set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> as active or inactive." "@param state True <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> as active, false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set it as inactive." )
DefineEngineMethod(GuiControl , setCenter , void , (S32 x, S32 y) , "Set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s position by its center <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param x The X coordinate of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> center point of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" "@param y The Y coordinate of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> center point of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s parent." )
DefineEngineMethod(GuiControl , setExtent , void , (const char *extOrX, const char *y) , ("") , "( Point2I p | int x, int y ) Set the width and height of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n\n</a>" "@hide" )
DefineEngineMethod(GuiControl , setFirstResponder , void , () , "Make this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the current first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responder.\n</a>" "@note Only controls with <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> profile that has canKeyFocus enabled are able <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> become first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">responders.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControlProfile::canKeyFocus\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
DefineEngineMethod(GuiControl , setPosition , void , (S32 x, S32 y) , "Position the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> in the local space of the parent <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param x The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> X coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its parent's upper left <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">corner.\n</a>" "@param y The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Y coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> its parent's upper left corner." )
DefineEngineMethod(GuiControl , setPositionGlobal , void , (S32 x, S32 y) , "Set position of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root of the <a href="/coding/class/classguicontrol/">GuiControl</a> hierarchy it is contained <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">in.\n</a>" "@param x The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> X coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root's upper left <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">corner.\n</a>" "@param y The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> Y coordinate of the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root's upper left corner." )
DefineEngineMethod(GuiControl , setProfile , void , (GuiControlProfile *profile) , "Set the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> profile <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "The profile used by <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> determines <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> great part of its behavior and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">appearance.\n</a>" "@param profile The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> profile the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> should <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@ref GuiControl_Profiles" )
DefineEngineMethod(GuiControl , setValue , void , (const char *value) , "Set the <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> associated with the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/pointer_8h/#pointer_8h_1a32aff7c6c4cd253fdf6563677afab5ce">value</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" )
DefineEngineMethod(GuiControl , setVisible , void , (bool state) , (true) , "Set whether the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is visible or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "@param state The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> visiblity flag state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@ref GuiControl_VisibleActive" )
IMPLEMENT_CALLBACK(GuiControl , onAction , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a>'s associated action is triggered and no 'command' is defined <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@ref GuiControl_Actions" )
IMPLEMENT_CALLBACK(GuiControl , onActive , void , (bool state) , (state) , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> changes its activeness state, i.e. when going from active <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> inactive or vice <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">versa.\n</a>" " @param stat The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> activeness <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isActive\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setActive\n</a>" " @ref GuiControl_VisibleActive" )
IMPLEMENT_CALLBACK(GuiControl , onAdd , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> object is registered with the system after the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> has been created." )
IMPLEMENT_CALLBACK(GuiControl , onControlDragEnter , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> has entered the control. This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> moves over <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The payload of the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">operation.\n</a>" "@param dropPoint The point at which the payload would be dropped <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it were released now. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onControlDragExit , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> has exited the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> and moved over <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> different control. This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> moves off of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The payload of the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">operation.\n</a>" "@param dropPoint The point at which the payload would be dropped <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it were released now. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onControlDragged , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> is moving across the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> after it has entered it. This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> moves across <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The payload of the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">operation.\n</a>" "@param dropPoint The point at which the payload would be dropped <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it were released now. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onControlDropped , void , (GuiControl *control, const Point2I &dropPoint) , (control, dropPoint) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> drag&drop operation through <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> has completed and is dropping its payload onto the control. " "This is only called <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> topmost visible controls as the <a href="/coding/class/classguidraganddropcontrol/">GuiDragAndDropControl</a> drops its payload on <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">them.\n\n</a>" "@param <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> The <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> that is being dropped onto this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">control.\n</a>" "@param dropPoint The point at which the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is being dropped. Relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the canvas." )
IMPLEMENT_CALLBACK(GuiControl , onDialogPop , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is removed as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dialog from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">canvas.\n</a>" "@see GuiCanvas::popDialog" )
IMPLEMENT_CALLBACK(GuiControl , onDialogPush , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is pushed as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dialog onto the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">canvas.\n</a>" "@see GuiCanvas::pushDialog" )
IMPLEMENT_CALLBACK(GuiControl , onGainFirstResponder , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> gains first responder status on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
IMPLEMENT_CALLBACK(GuiControl , onLoseFirstResponder , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> loses first responder status on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiCanvas.\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">makeFirstResponder\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isFirstResponder\n</a>" "@ref GuiControl_FirstResponders" )
IMPLEMENT_CALLBACK(GuiControl , onRemove , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> object is removed from the system before it is deleted." )
IMPLEMENT_CALLBACK(GuiControl , onSleep , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is put <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sleep.\n</a>" "@ref GuiControl_Waking" )
IMPLEMENT_CALLBACK(GuiControl , onVisible , void , (bool state) , (state) , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> changes its visibility state, i.e. when going from visible <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> invisible or vice <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">versa.\n</a>" " @param state The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> visibility <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">isVisible\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setVisible\n</a>" " @ref GuiControl_VisibleActive" )
IMPLEMENT_CALLBACK(GuiControl , onWake , void , () , () , "Called when the <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is woken <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">up.\n</a>" "@ref GuiControl_Waking" )
IMPLEMENT_CONOBJECT_CHILDREN(GuiControl )
IMPLEMENT_SCOPE(GuiAPI , Gui , "" )
ImplementEnumType(GuiHorizontalSizing , "Horizontal sizing behavior of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl.\n\n</a>" "@ingroup GuiCore" )
ImplementEnumType(GuiVerticalSizing , "Vertical sizing behavior of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl.\n\n</a>" "@ingroup GuiCore" )
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//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 25// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames 26// Copyright (C) 2015 Faust Logic, Inc. 27//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 28 29#include "platform/platform.h" 30#include "gui/core/guiControl.h" 31 32#include "console/consoleTypes.h" 33#include "console/console.h" 34#include "console/consoleInternal.h" 35#include "console/engineAPI.h" 36#include "console/codeBlock.h" 37#include "gfx/bitmap/gBitmap.h" 38#include "sim/actionMap.h" 39#include "gui/core/guiCanvas.h" 40#include "gui/core/guiDefaultControlRender.h" 41#include "gui/editor/guiEditCtrl.h" 42#include "gfx/gfxDrawUtil.h" 43 44 45//#define DEBUG_SPEW 46 47 48IMPLEMENT_CONOBJECT_CHILDREN( GuiControl ); 49 50ConsoleDocClass( GuiControl, 51 "@brief Base class for all Gui control objects.\n\n" 52 53 "GuiControl is the basis for the Gui system. It represents an individual control that can be placed on the canvas and with which " 54 "the mouse and keyboard can potentially interact with.\n\n" 55 56 "@section GuiControl_Hierarchy Control Hierarchies\n" 57 58 "GuiControls are arranged in a hierarchy. All children of a control are placed in their parent's coordinate space, i.e. their " 59 "coordinates are relative to the upper left corner of their immediate parent. When a control is moved, all its child controls " 60 "are moved along with it.\n\n" 61 62 "Since GuiControl's are SimGroups, hierarchy also implies ownership. This means that if a control is destroyed, all its children " 63 "are destroyed along with it. It also means that a given control can only be part of a single GuiControl hierarchy. When adding a " 64 "control to another control, it will automatically be reparented from another control it may have previously been parented to.\n\n" 65 66 "@section GuiControl_Layout Layout System\n" 67 68 "GuiControls have a two-dimensional position and are rectangular in shape.\n\n" 69 70 "@section GuiControl_Events Event System\n" 71 72 "@section GuiControl_Profiles Control Profiles\n" 73 74 "Common data accessed by GuiControls is stored in so-called \"Control Profiles.\" This includes font, color, and texture information. " 75 "By pooling this data in shared objects, the appearance of any number of controls can be changed quickly and easily by modifying " 76 "only the shared profile object.\n\n" 77 78 "If not explicitly assigned a profile, a control will by default look for a profile object that matches its class name. This means " 79 "that the class GuiMyCtrl, for example, will look for a profile called 'GuiMyProfile'. If this profile cannot be found, the control " 80 "will fall back to GuiDefaultProfile which must be defined in any case for the Gui system to work.\n\n" 81 82 "In addition to its primary profile, a control may be assigned a second profile called 'tooltipProfile' that will be used to render " 83 "tooltip popups for the control.\n\n" 84 85 "@section GuiControl_Actions Triggered Actions\n" 86 87 "@section GuiControl_FirstResponders First Responders\n" 88 89 "At any time, a single control can be what is called the \"first responder\" on the GuiCanvas is placed on. This control " 90 "will be the first control to receive keyboard events not bound in the global ActionMap. If the first responder choses to " 91 "handle a particular keyboard event, \n\n" 92 93 "@section GuiControl_Waking Waking and Sleeping\n" 94 95 "@section GuiControl_VisibleActive Visibility and Activeness\n" 96 "By default, a GuiControl is active which means that it\n\n" 97 98 "@see GuiCanvas\n" 99 "@see GuiControlProfile\n" 100 "@ingroup GuiCore\n" 101); 102 103IMPLEMENT_CALLBACK( GuiControl, onAdd, void, (), (), 104 "Called when the control object is registered with the system after the control has been created." ); 105IMPLEMENT_CALLBACK( GuiControl, onRemove, void, (), (), 106 "Called when the control object is removed from the system before it is deleted." ); 107IMPLEMENT_CALLBACK( GuiControl, onWake, void, (), (), 108 "Called when the control is woken up.\n" 109 "@ref GuiControl_Waking" ); 110IMPLEMENT_CALLBACK( GuiControl, onSleep, void, (), (), 111 "Called when the control is put to sleep.\n" 112 "@ref GuiControl_Waking" ); 113IMPLEMENT_CALLBACK( GuiControl, onGainFirstResponder, void, (), (), 114 "Called when the control gains first responder status on the GuiCanvas.\n" 115 "@see setFirstResponder\n" 116 "@see makeFirstResponder\n" 117 "@see isFirstResponder\n" 118 "@ref GuiControl_FirstResponders" ); 119IMPLEMENT_CALLBACK( GuiControl, onLoseFirstResponder, void, (), (), 120 "Called when the control loses first responder status on the GuiCanvas.\n" 121 "@see setFirstResponder\n" 122 "@see makeFirstResponder\n" 123 "@see isFirstResponder\n" 124 "@ref GuiControl_FirstResponders" ); 125IMPLEMENT_CALLBACK( GuiControl, onAction, void, (), (), 126 "Called when the control's associated action is triggered and no 'command' is defined for the control.\n" 127 "@ref GuiControl_Actions" ); 128IMPLEMENT_CALLBACK( GuiControl, onVisible, void, ( bool state ), ( state ), 129 "Called when the control changes its visibility state, i.e. when going from visible to invisible or vice versa.\n" 130 "@param state The new visibility state.\n" 131 "@see isVisible\n" 132 "@see setVisible\n" 133 "@ref GuiControl_VisibleActive" ); 134IMPLEMENT_CALLBACK( GuiControl, onActive, void, ( bool state ), ( state ), 135 "Called when the control changes its activeness state, i.e. when going from active to inactive or vice versa.\n" 136 "@param stat The new activeness state.\n" 137 "@see isActive\n" 138 "@see setActive\n" 139 "@ref GuiControl_VisibleActive" ); 140IMPLEMENT_CALLBACK( GuiControl, onDialogPush, void, (), (), 141 "Called when the control is pushed as a dialog onto the canvas.\n" 142 "@see GuiCanvas::pushDialog" ); 143IMPLEMENT_CALLBACK( GuiControl, onDialogPop, void, (), (), 144 "Called when the control is removed as a dialog from the canvas.\n" 145 "@see GuiCanvas::popDialog" ); 146IMPLEMENT_CALLBACK( GuiControl, onControlDragEnter, void, ( GuiControl* control, const Point2I& dropPoint ), ( control, dropPoint ), 147 "Called when a drag&drop operation through GuiDragAndDropControl has entered the control. This is only called for " 148 "topmost visible controls as the GuiDragAndDropControl moves over them.\n\n" 149 "@param control The payload of the drag operation.\n" 150 "@param dropPoint The point at which the payload would be dropped if it were released now. Relative to the canvas." ); 151IMPLEMENT_CALLBACK( GuiControl, onControlDragExit, void, ( GuiControl* control, const Point2I& dropPoint ), ( control, dropPoint ), 152 "Called when a drag&drop operation through GuiDragAndDropControl has exited the control and moved over a different control. This is only called for " 153 "topmost visible controls as the GuiDragAndDropControl moves off of them.\n\n" 154 "@param control The payload of the drag operation.\n" 155 "@param dropPoint The point at which the payload would be dropped if it were released now. Relative to the canvas." ); 156IMPLEMENT_CALLBACK( GuiControl, onControlDragged, void, ( GuiControl* control, const Point2I& dropPoint ), ( control, dropPoint ), 157 "Called when a drag&drop operation through GuiDragAndDropControl is moving across the control after it has entered it. This is only called for " 158 "topmost visible controls as the GuiDragAndDropControl moves across them.\n\n" 159 "@param control The payload of the drag operation.\n" 160 "@param dropPoint The point at which the payload would be dropped if it were released now. Relative to the canvas." ); 161IMPLEMENT_CALLBACK( GuiControl, onControlDropped, void, ( GuiControl* control, const Point2I& dropPoint ), ( control, dropPoint ), 162 "Called when a drag&drop operation through GuiDragAndDropControl has completed and is dropping its payload onto the control. " 163 "This is only called for topmost visible controls as the GuiDragAndDropControl drops its payload on them.\n\n" 164 "@param control The control that is being dropped onto this control.\n" 165 "@param dropPoint The point at which the control is being dropped. Relative to the canvas." ); 166 167 168GuiControl *GuiControl::smPrevResponder = NULL; 169GuiControl *GuiControl::smCurResponder = NULL; 170GuiEditCtrl*GuiControl::smEditorHandle = NULL; 171bool GuiControl::smDesignTime = false; 172GuiControl* GuiControl::smThisControl; 173 174IMPLEMENT_SCOPE( GuiAPI, Gui,, "" ); 175 176ImplementEnumType( GuiHorizontalSizing, 177 "Horizontal sizing behavior of a GuiControl.\n\n" 178 "@ingroup GuiCore" ) 179 { GuiControl::horizResizeRight, "right" }, 180 { GuiControl::horizResizeWidth, "width" }, 181 { GuiControl::horizResizeLeft, "left" }, 182 { GuiControl::horizResizeCenter, "center" }, 183 { GuiControl::horizResizeRelative, "relative" }, 184 { GuiControl::horizResizeAspectLeft, "aspectLeft" }, 185 { GuiControl::horizResizeAspectRight, "aspectRight" }, 186 { GuiControl::horizResizeAspectCenter, "aspectCenter" }, 187 { GuiControl::horizResizeWindowRelative, "windowRelative" } 188EndImplementEnumType; 189 190ImplementEnumType( GuiVerticalSizing, 191 "Vertical sizing behavior of a GuiControl.\n\n" 192 "@ingroup GuiCore" ) 193 { GuiControl::vertResizeBottom, "bottom" }, 194 { GuiControl::vertResizeHeight, "height" }, 195 { GuiControl::vertResizeTop, "top" }, 196 { GuiControl::vertResizeCenter, "center" }, 197 { GuiControl::vertResizeRelative, "relative" }, 198 { GuiControl::vertResizeAspectTop, "aspectTop" }, 199 { GuiControl::vertResizeAspectBottom, "aspectBottom" }, 200 { GuiControl::vertResizeAspectCenter, "aspectCenter" }, 201 { GuiControl::vertResizeWindowRelative, "windowRelative" } 202EndImplementEnumType; 203 204//----------------------------------------------------------------------------- 205 206GuiControl::GuiControl() : mAddGroup( NULL ), 207 mBounds(0,0,64,64), 208 mProfile(NULL), 209 mTooltipProfile(NULL), 210 mTipHoverTime(1000), 211 mVisible(true), 212 mActive(true), 213 mAwake(false), 214 mIsContainer(false), 215 mCanResize(true), 216 mCanHit( true ), 217 mLayer(0), 218 mMinExtent(8,2), 219 mLangTable(NULL), 220 mFirstResponder(NULL), 221 mHorizSizing(horizResizeRight), 222 mVertSizing(vertResizeBottom) 223{ 224 mConsoleVariable = StringTable->EmptyString(); 225 mAcceleratorKey = StringTable->EmptyString(); 226 mLangTableName = StringTable->EmptyString(); 227 228 mTooltip = StringTable->EmptyString(); 229 mRenderTooltipDelegate.bind( this, &GuiControl::defaultTooltipRender ); 230 231 mCanSaveFieldDictionary = false; 232 mNotifyChildrenResized = true; 233 fade_amt = 1.0f; 234} 235 236//----------------------------------------------------------------------------- 237 238GuiControl::~GuiControl() 239{ 240} 241 242//----------------------------------------------------------------------------- 243 244void GuiControl::consoleInit() 245{ 246 Con::addVariable( "$ThisControl", TYPEID< GuiControl >(), &smThisControl, 247 "The control for which a command is currently being evaluated. Only set during 'command' " 248 "and altCommand callbacks to the control for which the command or altCommand is invoked.\n" 249 "@ingroup GuiCore"); 250} 251 252//----------------------------------------------------------------------------- 253 254void GuiControl::initPersistFields() 255{ 256 addGroup( "Layout" ); 257 258 addField("position", TypePoint2I, Offset(mBounds.point, GuiControl), 259 "The position relative to the parent control." ); 260 addField("extent", TypePoint2I, Offset(mBounds.extent, GuiControl), 261 "The width and height of the control." ); 262 addField("minExtent", TypePoint2I, Offset(mMinExtent, GuiControl), 263 "The minimum width and height of the control. The control will not be resized smaller than this." ); 264 addField("horizSizing", TYPEID< horizSizingOptions >(), Offset(mHorizSizing, GuiControl), 265 "The horizontal resizing behavior." ); 266 addField("vertSizing", TYPEID< vertSizingOptions >(), Offset(mVertSizing, GuiControl), 267 "The vertical resizing behavior." ); 268 269 endGroup( "Layout" ); 270 271 addGroup( "Control"); 272 273 addProtectedField("profile", TYPEID< GuiControlProfile >(), Offset(mProfile, GuiControl), &setProfileProt, &defaultProtectedGetFn, 274 "The control profile that determines fill styles, font settings, etc." ); 275 276 addProtectedField( "visible", TypeBool, Offset(mVisible, GuiControl), &_setVisible, &defaultProtectedGetFn, 277 "Whether the control is visible or hidden." ); 278 addProtectedField( "active", TypeBool, Offset( mActive, GuiControl ), &_setActive, &defaultProtectedGetFn, 279 "Whether the control is enabled for user interaction." ); 280 281 addDeprecatedField("modal"); 282 addDeprecatedField("setFirstResponder"); 283 284 addField("variable", TypeString, Offset(mConsoleVariable, GuiControl), 285 "Name of the variable to which the value of this control will be synchronized." ); 286 addField("command", TypeCommand, Offset(mConsoleCommand, GuiControl), 287 "Command to execute on the primary action of the control.\n\n" 288 "@note Within this script snippet, the control on which the #command is being executed is bound to " 289 "the global variable $ThisControl." ); 290 addField("altCommand", TypeCommand, Offset(mAltConsoleCommand, GuiControl), 291 "Command to execute on the secondary action of the control.\n\n" 292 "@note Within this script snippet, the control on which the #altCommand is being executed is bound to " 293 "the global variable $ThisControl." ); 294 addField("accelerator", TypeString, Offset(mAcceleratorKey, GuiControl), 295 "Key combination that triggers the control's primary action when the control is on the canvas." ); 296 297 endGroup( "Control" ); 298 299 addGroup( "ToolTip" ); 300 addProtectedField("tooltipProfile", TYPEID< GuiControlProfile >(), Offset(mTooltipProfile, GuiControl), &setTooltipProfileProt, &defaultProtectedGetFn, 301 "Control profile to use when rendering tooltips for this control." ); 302 addField("tooltip", TypeRealString, Offset(mTooltip, GuiControl), 303 "String to show in tooltip for this control." ); 304 addField("hovertime", TypeS32, Offset(mTipHoverTime, GuiControl), 305 "Time for mouse to hover over control until tooltip is shown (in milliseconds)." ); 306 endGroup( "ToolTip" ); 307 308 addGroup( "Editing" ); 309 addField("isContainer", TypeBool, Offset(mIsContainer, GuiControl), 310 "If true, the control may contain child controls." ); 311 endGroup( "Editing" ); 312 313 addGroup( "Localization" ); 314 addField("langTableMod", TypeString, Offset(mLangTableName, GuiControl), 315 "Name of string table to use for lookup of internationalized text." ); 316 endGroup( "Localization" ); 317 318 Parent::initPersistFields(); 319} 320 321//----------------------------------------------------------------------------- 322 323bool GuiControl::processArguments(S32 argc, ConsoleValueRef *argv) 324{ 325 // argv[0] - The GuiGroup to add this control to when it's created. 326 // this is an optional parameter that may be specified at 327 // object creation time to organize a gui control into a 328 // subgroup of GuiControls and is useful in helping the 329 // gui editor group and sort the existent gui's in the Sim. 330 331 // Specified group? 332 if( argc == 1 ) 333 { 334 StringTableEntry steIntName = StringTable->insert(argv[0]); 335 mAddGroup = dynamic_cast<SimGroup*>(Sim::getGuiGroup()->findObjectByInternalName( steIntName )); 336 if( mAddGroup == NULL ) 337 { 338 mAddGroup = new SimGroup(); 339 if( mAddGroup->registerObject() ) 340 { 341 mAddGroup->setInternalName( steIntName ); 342 Sim::getGuiGroup()->addObject( mAddGroup ); 343 } 344 else 345 { 346 SAFE_DELETE( mAddGroup ); 347 return false; 348 } 349 } 350 mAddGroup->addObject(this); 351 } 352 return true; 353} 354 355//----------------------------------------------------------------------------- 356 357void GuiControl::awaken() 358{ 359 PROFILE_SCOPE( GuiControl_awaken ); 360 361 #ifdef DEBUG_SPEW 362 Platform::outputDebugString( "[GuiControl] Waking up %i:%s (%s:%s) awake=%s", 363 getId(), getClassName(), getName(), getInternalName(), 364 mAwake ? "true" : "false" ); 365 #endif 366 367 if( mAwake ) 368 return; 369 370 // Wake up visible children. 371 372 for( GuiControl::iterator iter = begin(); iter != end(); ++ iter ) 373 { 374 GuiControl* ctrl = static_cast< GuiControl* >( *iter ); 375 376 if( ctrl->isVisible() && !ctrl->isAwake() ) 377 ctrl->awaken(); 378 } 379 380 if( !mAwake && !onWake() ) 381 { 382 Con::errorf( ConsoleLogEntry::General, "GuiControl::awaken: failed onWake for obj: %i:%s (%s)", 383 getId(), getClassName(), getName() ); 384 mAwake = false; 385 } 386} 387 388//----------------------------------------------------------------------------- 389 390void GuiControl::sleep() 391{ 392 #ifdef DEBUG_SPEW 393 Platform::outputDebugString( "[GuiControl] Putting to sleep %i:%s (%s:%s) awake=%s", 394 getId(), getClassName(), getName(), getInternalName(), 395 mAwake ? "true" : "false" ); 396 #endif 397 398 if( !mAwake ) 399 return; 400 401 iterator i; 402 for(i = begin(); i != end(); i++) 403 { 404 GuiControl *ctrl = static_cast<GuiControl *>(*i); 405 if( ctrl->isAwake() ) 406 ctrl->sleep(); 407 } 408 409 if( mAwake ) 410 onSleep(); 411} 412 413//============================================================================= 414// Rendering. 415//============================================================================= 416// MARK: ---- Rendering ---- 417 418//----------------------------------------------------------------------------- 419 420void GuiControl::preRender() 421{ 422 if( !mAwake ) 423 return; 424 425 iterator i; 426 for(i = begin(); i != end(); i++) 427 { 428 GuiControl *ctrl = static_cast<GuiControl *>(*i); 429 ctrl->preRender(); 430 } 431 onPreRender(); 432} 433 434//----------------------------------------------------------------------------- 435 436void GuiControl::onPreRender() 437{ 438 // do nothing. 439} 440 441//----------------------------------------------------------------------------- 442 443void GuiControl::onRender(Point2I offset, const RectI &updateRect) 444{ 445 RectI ctrlRect(offset, getExtent()); 446 447 //if opaque, fill the update rect with the fill color 448 if ( mProfile->mOpaque ) 449 GFX->getDrawUtil()->drawRectFill(ctrlRect, mProfile->mFillColor); 450 451 //if there's a border, draw the border 452 if ( mProfile->mBorder ) 453 renderBorder(ctrlRect, mProfile); 454 455 // Render Children 456 renderChildControls(offset, updateRect); 457} 458 459//----------------------------------------------------------------------------- 460 461bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &cursorPos, const char* tipText ) 462{ 463 // Short Circuit. 464 if (!mAwake) 465 return false; 466 467 if ( dStrlen( mTooltip ) == 0 && ( tipText == NULL || dStrlen( tipText ) == 0 ) ) 468 return false; 469 470 String renderTip( mTooltip ); 471 if ( tipText != NULL ) 472 renderTip = tipText; 473 474 // Need to have root. 475 GuiCanvas *root = getRoot(); 476 if ( !root ) 477 return false; 478 479 GFont *font = mTooltipProfile->mFont; 480 481 GFXDrawUtil* drawUtil = GFX->getDrawUtil(); 482 483 // Support for multi-line tooltip text... 484 485 Vector<U32> startLineOffsets, lineLengths; 486 487 font->wrapString( renderTip, U32_MAX, startLineOffsets, lineLengths ); 488 489 // The width is the longest line. 490 U32 tipWidth = 0; 491 for ( U32 i = 0; i < lineLengths.size(); i++ ) 492 { 493 U32 width = font->getStrNWidth( renderTip.c_str() + startLineOffsets[i], lineLengths[i] ); 494 495 if ( width > tipWidth ) 496 tipWidth = width; 497 } 498 499 // The height is the number of lines times the height of the font. 500 U32 tipHeight = lineLengths.size() * font->getHeight(); 501 502 // Vars used: 503 // Screensize (for position check) 504 // Offset to get position of cursor 505 // textBounds for text extent. 506 Point2I screensize = getRoot()->getWindowSize(); 507 Point2I offset = hoverPos; 508 Point2I textBounds; 509 510 // Offset below cursor image 511 offset.y += 20; // TODO: Attempt to fix?: root->getCursorExtent().y; 512 513 // Create text bounds... 514 515 // Pixels above/below the text 516 const U32 vMargin = 2; 517 // Pixels left/right of the text 518 const U32 hMargin = 4; 519 520 textBounds.x = tipWidth + hMargin * 2; 521 textBounds.y = tipHeight + vMargin * 2; 522 523 // Check position/width to make sure all of the tooltip will be rendered 524 // 5 is given as a buffer against the edge 525 if ( screensize.x < offset.x + textBounds.x + 5 ) 526 offset.x = screensize.x - textBounds.x - 5; 527 528 // And ditto for the height 529 if ( screensize.y < offset.y + textBounds.y + 5 ) 530 offset.y = hoverPos.y - textBounds.y - 5; 531 532 RectI oldClip = GFX->getClipRect(); 533 534 // Set rectangle for the box, and set the clip rectangle. 535 RectI rect( offset, textBounds ); 536 GFX->setClipRect( rect ); 537 538 // Draw Filler bit, then border on top of that 539 drawUtil->drawRectFill( rect, mTooltipProfile->mFillColor ); 540 drawUtil->drawRect( rect, mTooltipProfile->mBorderColor ); 541 542 // Draw the text centered in the tool tip box... 543 544 drawUtil->setBitmapModulation( mTooltipProfile->mFontColor ); 545 546 for ( U32 i = 0; i < lineLengths.size(); i++ ) 547 { 548 Point2I start( hMargin, vMargin + i * font->getHeight() ); 549 const UTF8 *line = renderTip.c_str() + startLineOffsets[i]; 550 U32 lineLen = lineLengths[i]; 551 552 drawUtil->drawTextN( font, start + offset, line, lineLen, mProfile->mFontColors ); 553 } 554 555 GFX->setClipRect( oldClip ); 556 557 return true; 558} 559 560//----------------------------------------------------------------------------- 561 562void GuiControl::renderChildControls(Point2I offset, const RectI &updateRect) 563{ 564 // Save the current clip rect 565 // so we can restore it at the end of this method. 566 RectI savedClipRect = GFX->getClipRect(); 567 568 // offset is the upper-left corner of this control in screen coordinates 569 // updateRect is the intersection rectangle in screen coords of the control 570 // hierarchy. This can be set as the clip rectangle in most cases. 571 RectI clipRect = updateRect; 572 573 iterator i; 574 for(i = begin(); i != end(); i++) 575 { 576 GuiControl *ctrl = static_cast<GuiControl *>(*i); 577 if (ctrl->mVisible) 578 { 579 Point2I childPosition = offset + ctrl->getPosition(); 580 RectI childClip(childPosition, ctrl->getExtent() + Point2I(1,1)); 581 582 if (childClip.intersect(clipRect)) 583 { 584 GFX->setClipRect( childClip ); 585 GFX->setStateBlock(mDefaultGuiSB); 586 ctrl->onRender(childPosition, childClip); 587 } 588 } 589 } 590 591 // Restore the clip rect to what it was at the start 592 // of this method. 593 GFX->setClipRect( savedClipRect ); 594} 595 596//----------------------------------------------------------------------------- 597 598void GuiControl::setUpdateRegion(Point2I pos, Point2I ext) 599{ 600 Point2I upos = localToGlobalCoord(pos); 601 GuiCanvas *root = getRoot(); 602 if (root) 603 { 604 root->addUpdateRegion(upos, ext); 605 } 606} 607 608//----------------------------------------------------------------------------- 609 610void GuiControl::setUpdate() 611{ 612 setUpdateRegion(Point2I(0,0), getExtent()); 613} 614 615//----------------------------------------------------------------------------- 616 617void GuiControl::renderJustifiedText(Point2I offset, Point2I extent, const char *text) 618{ 619 GFont *font = mProfile->mFont; 620 if(!font) 621 return; 622 S32 textWidth = font->getStrWidthPrecise((const UTF8*)text); 623 U32 textHeight = font->getHeight(); 624 625 Point2I start( 0, 0 ); 626 627 // Align horizontal. 628 629 if( textWidth > extent.x ) 630 { 631 // If the text is longer then the box size, (it'll get clipped) so 632 // force Left Justify 633 start.x = 0; 634 } 635 else 636 switch( mProfile->mAlignment ) 637 { 638 case GuiControlProfile::RightJustify: 639 start.x = extent.x - textWidth; 640 break; 641 642 case GuiControlProfile::TopJustify: 643 case GuiControlProfile::BottomJustify: 644 case GuiControlProfile::CenterJustify: 645 start.x = ( extent.x - textWidth) / 2; 646 break; 647 648 case GuiControlProfile::LeftJustify: 649 start.x = 0; 650 break; 651 } 652 653 // Align vertical. 654 655 if( textHeight > extent.y ) 656 { 657 start.y = 0 - ( textHeight - extent.y ) / 2; 658 } 659 else 660 switch( mProfile->mAlignment ) 661 { 662 case GuiControlProfile::TopJustify: 663 start.y = 0; 664 break; 665 666 case GuiControlProfile::BottomJustify: 667 start.y = extent.y - textHeight - 1; 668 break; 669 670 default: 671 // Center vertical. 672 start.y = ( extent.y - font->getHeight() ) / 2; 673 break; 674 } 675 676 GFX->getDrawUtil()->drawText( font, start + offset, text, mProfile->mFontColors ); 677} 678 679//============================================================================= 680// Events. 681//============================================================================= 682// MARK: ---- Events ---- 683 684//----------------------------------------------------------------------------- 685 686bool GuiControl::onAdd() 687{ 688 // Let Parent Do Work. 689 if ( !Parent::onAdd() ) 690 return false; 691 692 // Grab the classname of this object 693 const char *cName = getClassName(); 694 695 // if we're a pure GuiControl, then we're a container by default. 696 if ( String::compare( "GuiControl", cName ) == 0 ) 697 mIsContainer = true; 698 699 // Add to root group. 700 if ( mAddGroup == NULL ) 701 mAddGroup = Sim::getGuiGroup(); 702 mAddGroup->addObject(this); 703 704 // If we don't have a profile we must assign one now. 705 // Try assigning one based on the control's class name... 706 if ( !mProfile ) 707 { 708 String name = getClassName(); 709 710 if ( name.isNotEmpty() ) 711 { 712 U32 pos = name.find( "Ctrl" ); 713 714 if ( pos != -1 ) 715 name.replace( pos, 4, "Profile" ); 716 else 717 name += "Profile"; 718 719 GuiControlProfile *profile = NULL; 720 if ( Sim::findObject( name, profile ) ) 721 setControlProfile( profile ); 722 } 723 } 724 725 // Try assigning the default profile... 726 if ( !mProfile ) 727 { 728 GuiControlProfile *profile = NULL; 729 Sim::findObject( "GuiDefaultProfile", profile ); 730 731 AssertISV( profile != NULL, avar("GuiControl::onAdd() unable to find specified profile and GuiDefaultProfile does not exist!") ); 732 733 setControlProfile( profile ); 734 } 735 736 // We must also assign a valid TooltipProfile... 737 if ( !mTooltipProfile ) 738 { 739 GuiControlProfile *profile = NULL; 740 Sim::findObject( "GuiTooltipProfile", profile ); 741 742 AssertISV( profile != NULL, avar("GuiControl::onAdd() unable to find specified tooltip profile and GuiTooltipProfile does not exist!") ); 743 744 setTooltipProfile( profile ); 745 } 746 747 // Notify Script. 748 onAdd_callback(); 749 750 GFXStateBlockDesc d; 751 752 d.cullDefined = true; 753 d.cullMode = GFXCullNone; 754 d.zDefined = true; 755 d.zEnable = false; 756 757 mDefaultGuiSB = GFX->createStateBlock( d ); 758 759 // Return Success. 760 return true; 761} 762 763//----------------------------------------------------------------------------- 764 765void GuiControl::onRemove() 766{ 767 // If control is still awake, put it to sleep first. Otherwise, we'll see an 768 // onSleep() call triggered when we are removed from our parent. 769 770 if( mAwake ) 771 sleep(); 772 773 // Only invoke script callbacks if they can be received 774 onRemove_callback(); 775 776 if ( mProfile ) 777 { 778 mProfile->decUseCount(); 779 mProfile = NULL; 780 } 781 782 if ( mTooltipProfile ) 783 { 784 mTooltipProfile->decUseCount(); 785 mTooltipProfile = NULL; 786 } 787 788 clearFirstResponder(); 789 790 Parent::onRemove(); 791} 792 793//----------------------------------------------------------------------------- 794 795void GuiControl::onDeleteNotify(SimObject *object) 796{ 797 if( object == mProfile ) 798 { 799 GuiControlProfile* profile; 800 Sim::findObject( "GuiDefaultProfile", profile ); 801 802 if ( profile == mProfile ) 803 mProfile = NULL; 804 else 805 setControlProfile( profile ); 806 } 807 if (object == mTooltipProfile) 808 { 809 GuiControlProfile* profile; 810 Sim::findObject( "GuiDefaultProfile", profile ); 811 812 if ( profile == mTooltipProfile ) 813 mTooltipProfile = NULL; 814 else 815 setTooltipProfile( profile ); 816 } 817} 818 819//----------------------------------------------------------------------------- 820 821bool GuiControl::onWake() 822{ 823 PROFILE_SCOPE( GuiControl_onWake ); 824 825 AssertFatal( !mAwake, "GuiControl::onWake() - control is already awake" ); 826 if( mAwake ) 827 return true; 828 829 // [tom, 4/18/2005] Cause mLangTable to be refreshed in case it was changed 830 mLangTable = NULL; 831 832 //set the flag 833 mAwake = true; 834 835 //set the layer 836 GuiCanvas *root = getRoot(); 837 GuiControl *parent = getParent(); 838 if (parent && parent != root) 839 mLayer = parent->mLayer; 840 841 //make sure the first responder exists 842 if (! mFirstResponder) 843 mFirstResponder = findFirstTabable(); 844 845 //increment the profile 846 mProfile->incLoadCount(); 847 mTooltipProfile->incLoadCount(); 848 849 // Only invoke script callbacks if we have a namespace in which to do so 850 // This will suppress warnings 851 onWake_callback(); 852 853 return true; 854} 855 856//----------------------------------------------------------------------------- 857 858void GuiControl::onSleep() 859{ 860 AssertFatal( mAwake, "GuiControl::onSleep() - control is already asleep" ); 861 if( !mAwake ) 862 return; 863 864 clearFirstResponder(); 865 mouseUnlock(); 866 867 // Only invoke script callbacks if we have a namespace in which to do so 868 // This will suppress warnings 869 onSleep_callback(); 870 871 //decrement the profile reference 872 mProfile->decLoadCount(); 873 mTooltipProfile->decLoadCount(); 874 875 // Set Flag 876 mAwake = false; 877} 878 879//----------------------------------------------------------------------------- 880 881void GuiControl::onChildAdded( GuiControl *child ) 882{ 883 // Base class does not make use of this 884} 885 886//----------------------------------------------------------------------------- 887 888void GuiControl::onChildRemoved( GuiControl *child ) 889{ 890 // Base does nothing with this 891} 892 893//----------------------------------------------------------------------------- 894 895void GuiControl::onGroupRemove() 896{ 897 // If we have a first responder in our hierarchy, 898 // make sure to kill it off. 899 900 if( mFirstResponder ) 901 mFirstResponder->clearFirstResponder(); 902 else 903 { 904 GuiCanvas* root = getRoot(); 905 if( root ) 906 { 907 GuiControl* firstResponder = root->getFirstResponder(); 908 if( firstResponder && firstResponder->isChildOfGroup( this ) ) 909 firstResponder->clearFirstResponder(); 910 } 911 } 912 913 // If we are awake, put us to sleep. 914 915 if( isAwake() ) 916 sleep(); 917} 918 919//----------------------------------------------------------------------------- 920 921bool GuiControl::onInputEvent(const InputEventInfo &event) 922{ 923 // Do nothing by default... 924 return( false ); 925} 926 927//----------------------------------------------------------------------------- 928 929bool GuiControl::onKeyDown(const GuiEvent &event) 930{ 931 //pass the event to the parent 932 GuiControl *parent = getParent(); 933 if (parent) 934 return parent->onKeyDown(event); 935 else 936 return false; 937} 938 939//----------------------------------------------------------------------------- 940 941bool GuiControl::onKeyRepeat(const GuiEvent &event) 942{ 943 // default to just another key down. 944 return onKeyDown(event); 945} 946 947//----------------------------------------------------------------------------- 948 949bool GuiControl::onKeyUp(const GuiEvent &event) 950{ 951 //pass the event to the parent 952 GuiControl *parent = getParent(); 953 if (parent) 954 return parent->onKeyUp(event); 955 else 956 return false; 957} 958 959//----------------------------------------------------------------------------- 960 961void GuiControl::onMouseUp(const GuiEvent &event) 962{ 963} 964 965//----------------------------------------------------------------------------- 966 967void GuiControl::onMouseDown(const GuiEvent &event) 968{ 969 if ( !mVisible || !mAwake ) 970 return; 971 972 execConsoleCallback(); 973} 974 975//----------------------------------------------------------------------------- 976 977void GuiControl::onMouseMove(const GuiEvent &event) 978{ 979 //if this control is a dead end, make sure the event stops here 980 if ( !mVisible || !mAwake ) 981 return; 982 983 //pass the event to the parent 984 GuiControl *parent = getParent(); 985 if ( parent ) 986 parent->onMouseMove( event ); 987} 988 989//----------------------------------------------------------------------------- 990 991void GuiControl::onMouseDragged(const GuiEvent &event) 992{ 993} 994 995//----------------------------------------------------------------------------- 996 997void GuiControl::onMouseEnter(const GuiEvent &event) 998{ 999} 1000 1001//----------------------------------------------------------------------------- 1002 1003void GuiControl::onMouseLeave(const GuiEvent &event) 1004{ 1005} 1006 1007//----------------------------------------------------------------------------- 1008 1009bool GuiControl::onMouseWheelUp( const GuiEvent &event ) 1010{ 1011 //if this control is a dead end, make sure the event stops here 1012 if ( !mVisible || !mAwake ) 1013 return true; 1014 1015 //pass the event to the parent 1016 GuiControl *parent = getParent(); 1017 if ( parent ) 1018 return parent->onMouseWheelUp( event ); 1019 else 1020 return false; 1021} 1022 1023//----------------------------------------------------------------------------- 1024 1025bool GuiControl::onMouseWheelDown( const GuiEvent &event ) 1026{ 1027 //if this control is a dead end, make sure the event stops here 1028 if ( !mVisible || !mAwake ) 1029 return true; 1030 1031 //pass the event to the parent 1032 GuiControl *parent = getParent(); 1033 if ( parent ) 1034 return parent->onMouseWheelDown( event ); 1035 else 1036 return false; 1037} 1038 1039//----------------------------------------------------------------------------- 1040 1041void GuiControl::onRightMouseDown(const GuiEvent &) 1042{ 1043} 1044 1045//----------------------------------------------------------------------------- 1046 1047void GuiControl::onRightMouseUp(const GuiEvent &) 1048{ 1049} 1050 1051//----------------------------------------------------------------------------- 1052 1053void GuiControl::onRightMouseDragged(const GuiEvent &) 1054{ 1055} 1056 1057//----------------------------------------------------------------------------- 1058 1059void GuiControl::onMiddleMouseDown(const GuiEvent &) 1060{ 1061} 1062 1063//----------------------------------------------------------------------------- 1064 1065void GuiControl::onMiddleMouseUp(const GuiEvent &) 1066{ 1067} 1068 1069//----------------------------------------------------------------------------- 1070 1071void GuiControl::onMiddleMouseDragged(const GuiEvent &) 1072{ 1073} 1074 1075//----------------------------------------------------------------------------- 1076 1077bool GuiControl::onGamepadButtonDown(const GuiEvent &event) 1078{ 1079 return onKeyDown(event); 1080} 1081 1082//----------------------------------------------------------------------------- 1083 1084bool GuiControl::onGamepadButtonUp(const GuiEvent &event) 1085{ 1086 return onKeyUp(event); 1087} 1088 1089//----------------------------------------------------------------------------- 1090 1091bool GuiControl::onGamepadAxisUp(const GuiEvent &event) 1092{ 1093 //pass the event to the parent 1094 GuiControl *parent = getParent(); 1095 if (parent) 1096 { 1097 return parent->onGamepadAxisUp(event); 1098 } 1099 else 1100 { 1101 return false; 1102 } 1103} 1104 1105//----------------------------------------------------------------------------- 1106 1107bool GuiControl::onGamepadAxisDown(const GuiEvent &event) 1108{ 1109 //pass the event to the parent 1110 GuiControl *parent = getParent(); 1111 if (parent) 1112 { 1113 return parent->onGamepadAxisDown(event); 1114 } 1115 else 1116 { 1117 return false; 1118 } 1119} 1120 1121//----------------------------------------------------------------------------- 1122 1123bool GuiControl::onGamepadAxisLeft(const GuiEvent &event) 1124{ 1125 //pass the event to the parent 1126 GuiControl *parent = getParent(); 1127 if (parent) 1128 { 1129 return parent->onGamepadAxisLeft(event); 1130 } 1131 else 1132 { 1133 return false; 1134 } 1135} 1136 1137//----------------------------------------------------------------------------- 1138 1139bool GuiControl::onGamepadAxisRight(const GuiEvent &event) 1140{ 1141 //pass the event to the parent 1142 GuiControl *parent = getParent(); 1143 if (parent) 1144 { 1145 return parent->onGamepadAxisRight(event); 1146 } 1147 else 1148 { 1149 return false; 1150 } 1151} 1152 1153//----------------------------------------------------------------------------- 1154 1155bool GuiControl::onGamepadTrigger(const GuiEvent &event) 1156{ 1157 //pass the event to the parent 1158 GuiControl *parent = getParent(); 1159 if (parent) 1160 { 1161 return parent->onGamepadTrigger(event); 1162 } 1163 else 1164 { 1165 return false; 1166 } 1167} 1168 1169//----------------------------------------------------------------------------- 1170 1171void GuiControl::onAction() 1172{ 1173 if (! mActive) 1174 return; 1175 1176 //execute the console command 1177 if( mConsoleCommand.isNotEmpty() ) 1178 { 1179 execConsoleCallback(); 1180 } 1181 else 1182 onAction_callback(); 1183} 1184 1185//----------------------------------------------------------------------------- 1186 1187void GuiControl::onMessage( GuiControl* , S32 ) 1188{ 1189} 1190 1191//----------------------------------------------------------------------------- 1192 1193void GuiControl::onDialogPush() 1194{ 1195 // Notify Script. 1196 onDialogPush_callback(); 1197} 1198 1199//----------------------------------------------------------------------------- 1200 1201void GuiControl::onDialogPop() 1202{ 1203 // Notify Script. 1204 onDialogPop_callback(); 1205} 1206 1207//----------------------------------------------------------------------------- 1208 1209void GuiControl::inspectPreApply() 1210{ 1211} 1212 1213//----------------------------------------------------------------------------- 1214 1215void GuiControl::inspectPostApply() 1216{ 1217 // To not require every control to hook onto inspectPostApply to make 1218 // all changed properties take effect, just put controls through a fake 1219 // sleep&wake sequence. This should generally get most property changes 1220 // to show. 1221 // 1222 // Don't do this with the canvas. 1223 1224 if( mAwake && !dynamic_cast< GuiCanvas* >( this ) ) 1225 { 1226 bool isContainer = mIsContainer; 1227 1228 onSleep(); 1229 onWake(); 1230 1231 mIsContainer = isContainer; 1232 } 1233} 1234 1235//============================================================================= 1236// Layout. 1237//============================================================================= 1238// MARK: ---- Layout ---- 1239 1240//----------------------------------------------------------------------------- 1241 1242void GuiControl::setSizing(S32 horz, S32 vert) 1243{ 1244 mHorizSizing = horz; 1245 mVertSizing = vert; 1246} 1247 1248//----------------------------------------------------------------------------- 1249 1250bool GuiControl::resize(const Point2I &newPosition, const Point2I &newExtent) 1251{ 1252 const Point2I minExtent = getMinExtent(); 1253 Point2I actualNewExtent = Point2I(getMax(minExtent.x, newExtent.x), 1254 getMax(minExtent.y, newExtent.y)); 1255 1256 // only do the child control resizing stuff if you really need to. 1257 const RectI bounds = getBounds(); 1258 1259 // If we didn't size anything, return false to indicate such 1260 bool extentChanged = (actualNewExtent != bounds.extent); 1261 bool positionChanged = (newPosition != bounds.point); 1262 if (!extentChanged && !positionChanged ) 1263 return false; 1264 1265 // Update Position 1266 if ( positionChanged ) 1267 mBounds.point = newPosition; 1268 1269 // Update Extent 1270 if( extentChanged ) 1271 { 1272 //call set update both before and after 1273 setUpdate(); 1274 1275 mBounds.extent = actualNewExtent; 1276 1277 // Obey the flag! 1278 // Could be set if we are resizing in response to a child resizing! 1279 if ( mNotifyChildrenResized ) 1280 { 1281 iterator i; 1282 for(i = begin(); i != end(); i++) 1283 { 1284 GuiControl *ctrl = static_cast<GuiControl *>(*i); 1285 ctrl->parentResized(RectI(bounds.point, bounds.extent), RectI(newPosition,actualNewExtent)); 1286 } 1287 } 1288 1289 GuiControl *parent = getParent(); 1290 if (parent) 1291 parent->childResized(this); 1292 setUpdate(); 1293 } 1294 1295 // We sized something 1296 if( extentChanged ) 1297 return true; 1298 1299 // Note : We treat a repositioning as no sizing happening 1300 // because parent's should really not need to know when they 1301 // have moved, as it should not affect any child sizing since 1302 // all child bounds are relative to the parent's 0,0 1303 return false; 1304 1305} 1306 1307//----------------------------------------------------------------------------- 1308 1309bool GuiControl::setPosition( const Point2I &newPosition ) 1310{ 1311 return resize( newPosition, mBounds.extent ); 1312} 1313 1314//----------------------------------------------------------------------------- 1315 1316bool GuiControl::setExtent( const Point2I &newExtent ) 1317{ 1318 return resize( mBounds.point, newExtent ); 1319} 1320 1321//----------------------------------------------------------------------------- 1322 1323bool GuiControl::setBounds( const RectI &newBounds ) 1324{ 1325 return resize( newBounds.point, newBounds.extent ); 1326} 1327 1328//----------------------------------------------------------------------------- 1329 1330void GuiControl::setLeft( S32 newLeft ) 1331{ 1332 resize( Point2I( newLeft, mBounds.point.y), mBounds.extent ); 1333} 1334 1335//----------------------------------------------------------------------------- 1336 1337void GuiControl::setTop( S32 newTop ) 1338{ 1339 resize( Point2I( mBounds.point.x, newTop ), mBounds.extent ); 1340} 1341 1342//----------------------------------------------------------------------------- 1343 1344void GuiControl::setWidth( S32 newWidth ) 1345{ 1346 resize( mBounds.point, Point2I( newWidth, mBounds.extent.y ) ); 1347} 1348 1349//----------------------------------------------------------------------------- 1350 1351void GuiControl::setHeight( S32 newHeight ) 1352{ 1353 resize( mBounds.point, Point2I( mBounds.extent.x, newHeight ) ); 1354} 1355 1356//----------------------------------------------------------------------------- 1357 1358void GuiControl::childResized( GuiControl* ) 1359{ 1360} 1361 1362//----------------------------------------------------------------------------- 1363 1364void GuiControl::parentResized(const RectI &oldParentRect, const RectI &newParentRect) 1365{ 1366 Point2I newPosition = getPosition(); 1367 Point2I newExtent = getExtent(); 1368 1369 S32 deltaX = newParentRect.extent.x - oldParentRect.extent.x; 1370 S32 deltaY = newParentRect.extent.y - oldParentRect.extent.y; 1371 1372 if (mHorizSizing == horizResizeCenter) 1373 newPosition.x = (newParentRect.extent.x - getWidth()) >> 1; 1374 else if (mHorizSizing == horizResizeWidth) 1375 newExtent.x += deltaX; 1376 else if (mHorizSizing == horizResizeLeft) 1377 newPosition.x += deltaX; 1378 else if (mHorizSizing == horizResizeRelative && oldParentRect.extent.x != 0) 1379 { 1380 S32 newLeft = mRoundToNearest( ( F32( newPosition.x ) / F32( oldParentRect.extent.x ) ) * F32( newParentRect.extent.x ) ); 1381 S32 newWidth = mRoundToNearest( ( F32( newExtent.x ) / F32( oldParentRect.extent.x ) ) * F32( newParentRect.extent.x ) ); 1382 1383 newPosition.x = newLeft; 1384 newExtent.x = newWidth; 1385 } 1386 else if (mHorizSizing == horizResizeAspectLeft && oldParentRect.extent.x != 0) 1387 { 1388 S32 newLeft = mRoundToNearest((F32(newPosition.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); 1389 S32 newWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); 1390 1391 newPosition.x = newLeft; 1392 newExtent.x = newWidth; 1393 } 1394 else if (mHorizSizing == horizResizeAspectRight && oldParentRect.extent.x != 0) 1395 { 1396 S32 newLeft = mRoundToNearest((F32(newPosition.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); 1397 S32 newWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //origional aspect ratio corrected width 1398 S32 rWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //parent aspect ratio relative width 1399 1400 S32 offset = rWidth - newWidth; // account for change in relative width 1401 newLeft += offset; 1402 newPosition.x = newLeft; 1403 newExtent.x = newWidth; 1404 } 1405 else if (mHorizSizing == horizResizeAspectCenter && oldParentRect.extent.x != 0) 1406 { 1407 S32 newLeft = mRoundToNearest((F32(newPosition.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); 1408 S32 newWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //origional aspect ratio corrected width 1409 S32 rWidth = mRoundToNearest((F32(newExtent.x) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //parent aspect ratio relative width 1410 1411 S32 offset = rWidth - newWidth; // account for change in relative width 1412 newLeft += offset/2; 1413 newPosition.x = newLeft; 1414 newExtent.x = newWidth; 1415 } 1416 1417 if (mVertSizing == vertResizeCenter) 1418 newPosition.y = (newParentRect.extent.y - getHeight()) >> 1; 1419 else if (mVertSizing == vertResizeHeight) 1420 newExtent.y += deltaY; 1421 else if (mVertSizing == vertResizeTop) 1422 newPosition.y += deltaY; 1423 else if(mVertSizing == vertResizeRelative && oldParentRect.extent.y != 0) 1424 { 1425 S32 newTop = mRoundToNearest( ( F32( newPosition.y ) / F32( oldParentRect.extent.y ) ) * F32( newParentRect.extent.y ) ); 1426 S32 newHeight = mRoundToNearest( ( F32( newExtent.y ) / F32( oldParentRect.extent.y ) ) * F32( newParentRect.extent.y ) ); 1427 1428 newPosition.y = newTop; 1429 newExtent.y = newHeight; 1430 } 1431 else if (mVertSizing == vertResizeAspectTop && oldParentRect.extent.y != 0) 1432 { 1433 S32 newTop = mRoundToNearest((F32(newPosition.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); 1434 S32 newHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); 1435 1436 newPosition.y = newTop; 1437 newExtent.y = newHeight; 1438 } 1439 else if (mVertSizing == vertResizeAspectBottom && oldParentRect.extent.y != 0) 1440 { 1441 S32 newTop = mRoundToNearest((F32(newPosition.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); 1442 S32 newHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //origional aspect ratio corrected hieght 1443 S32 rHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //parent aspect ratio relative hieght 1444 1445 S32 offset = rHeight - newHeight; // account for change in relative hieght 1446 newTop += offset; 1447 newPosition.y = newTop; 1448 newExtent.y = newHeight; 1449 } 1450 else if (mVertSizing == vertResizeAspectCenter && oldParentRect.extent.y != 0) 1451 { 1452 S32 newTop = mRoundToNearest((F32(newPosition.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); 1453 S32 newHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.x)) * F32(newParentRect.extent.x)); //origional aspect ratio corrected hieght 1454 S32 rHeight = mRoundToNearest((F32(newExtent.y) / F32(oldParentRect.extent.y)) * F32(newParentRect.extent.y)); //parent aspect ratio relative hieght 1455 1456 S32 offset = rHeight - newHeight; // account for change in relative hieght 1457 newTop += offset / 2; 1458 newPosition.y = newTop; 1459 newExtent.y = newHeight; 1460 } 1461 1462 // Resizing Re factor [9/18/2006] 1463 // Only resize if our minExtent is satisfied with it. 1464 Point2I minExtent = getMinExtent(); 1465 if( newExtent.x >= minExtent.x && newExtent.y >= minExtent.y ) 1466 resize(newPosition, newExtent); 1467} 1468 1469//----------------------------------------------------------------------------- 1470 1471Point2I GuiControl::localToGlobalCoord(const Point2I &src) 1472{ 1473 Point2I ret = src; 1474 ret += getPosition(); 1475 GuiControl *walk = getParent(); 1476 while(walk) 1477 { 1478 ret += walk->getPosition(); 1479 walk = walk->getParent(); 1480 } 1481 return ret; 1482} 1483 1484//----------------------------------------------------------------------------- 1485 1486Point2I GuiControl::globalToLocalCoord(const Point2I &src) 1487{ 1488 Point2I ret = src; 1489 ret -= getPosition(); 1490 GuiControl *walk = getParent(); 1491 while(walk) 1492 { 1493 ret -= walk->getPosition(); 1494 walk = walk->getParent(); 1495 } 1496 return ret; 1497} 1498 1499//----------------------------------------------------------------------------- 1500 1501bool GuiControl::cursorInControl() 1502{ 1503 GuiCanvas *root = getRoot(); 1504 if (! root) return false; 1505 1506 Point2I pt = root->getCursorPos(); 1507 pt = root->getPlatformWindow() ? root->getPlatformWindow()->screenToClient(pt) : pt; 1508 Point2I extent = getExtent(); 1509 Point2I offset = localToGlobalCoord(Point2I(0, 0)); 1510 if (pt.x >= offset.x && pt.y >= offset.y && 1511 pt.x < offset.x + extent.x && pt.y < offset.y + extent.y) 1512 { 1513 return true; 1514 } 1515 else 1516 { 1517 return false; 1518 } 1519} 1520 1521//----------------------------------------------------------------------------- 1522 1523bool GuiControl::pointInControl(const Point2I& parentCoordPoint) 1524{ 1525 const RectI &bounds = getBounds(); 1526 S32 xt = parentCoordPoint.x - bounds.point.x; 1527 S32 yt = parentCoordPoint.y - bounds.point.y; 1528 return xt >= 0 && yt >= 0 && xt < bounds.extent.x && yt < bounds.extent.y; 1529} 1530 1531//============================================================================= 1532// Properties. 1533//============================================================================= 1534// MARK: ---- Properties ---- 1535 1536//----------------------------------------------------------------------------- 1537 1538void GuiControl::setTooltipProfile( GuiControlProfile *prof ) 1539{ 1540 AssertFatal( prof, "GuiControl::setTooltipProfile: invalid profile" ); 1541 1542 if ( prof == mTooltipProfile ) 1543 return; 1544 1545 bool skipAwaken = false; 1546 1547 if ( mTooltipProfile == NULL ) 1548 skipAwaken = true; 1549 1550 if( mTooltipProfile ) 1551 mTooltipProfile->decUseCount(); 1552 1553 if ( mAwake && mTooltipProfile ) 1554 mTooltipProfile->decLoadCount(); 1555 1556 // Clear the delete notification we previously set up 1557 if ( mTooltipProfile ) 1558 clearNotify( mTooltipProfile ); 1559 1560 mTooltipProfile = prof; 1561 mTooltipProfile->incUseCount(); 1562 if ( mAwake ) 1563 mTooltipProfile->incLoadCount(); 1564 1565 // Make sure that the new profile will notify us when it is deleted 1566 if ( mTooltipProfile ) 1567 deleteNotify( mTooltipProfile ); 1568 1569 // force an update when the profile is changed 1570 if ( mAwake && !skipAwaken ) 1571 { 1572 sleep(); 1573 1574 if( !Sim::isShuttingDown() ) 1575 awaken(); 1576 } 1577} 1578 1579//----------------------------------------------------------------------------- 1580 1581void GuiControl::setControlProfile( GuiControlProfile *prof ) 1582{ 1583 AssertFatal( prof, "GuiControl::setControlProfile: invalid profile" ); 1584 1585 if ( prof == mProfile ) 1586 return; 1587 1588 bool skipAwaken = false; 1589 1590 if ( mProfile == NULL ) 1591 skipAwaken = true; 1592 1593 if( mProfile ) 1594 mProfile->decUseCount(); 1595 1596 if ( mAwake && mProfile ) 1597 mProfile->decLoadCount(); 1598 1599 // Clear the delete notification we previously set up 1600 if ( mProfile ) 1601 clearNotify( mProfile ); 1602 1603 mProfile = prof; 1604 mProfile->incUseCount(); 1605 if ( mAwake ) 1606 mProfile->incLoadCount(); 1607 1608 // Make sure that the new profile will notify us when it is deleted 1609 if ( mProfile ) 1610 deleteNotify( mProfile ); 1611 1612 // force an update when the profile is changed 1613 if ( mAwake && !skipAwaken ) 1614 { 1615 sleep(); 1616 1617 if( !Sim::isShuttingDown() ) 1618 awaken(); 1619 } 1620} 1621 1622//----------------------------------------------------------------------------- 1623 1624bool GuiControl::setProfileProt( void *object, const char *index, const char *data ) 1625{ 1626 GuiControl* ctrl = static_cast<GuiControl*>( object ); 1627 GuiControlProfile *prof = dynamic_cast<GuiControlProfile*>( Sim::findObject( data ) ); 1628 if ( prof == NULL ) 1629 return false; 1630 1631 // filter through our setter, for consistency 1632 ctrl->setControlProfile( prof ); 1633 1634 // ask the console not to set the data, because we've already set it 1635 return false; 1636} 1637 1638//----------------------------------------------------------------------------- 1639 1640bool GuiControl::setTooltipProfileProt( void *object, const char *index, const char *data ) 1641{ 1642 GuiControl* ctrl = static_cast<GuiControl*>( object ); 1643 GuiControlProfile *prof = dynamic_cast<GuiControlProfile*>( Sim::findObject( data ) ); 1644 if ( prof == NULL ) 1645 return false; 1646 1647 // filter through our setter, for consistency 1648 ctrl->setTooltipProfile( prof ); 1649 1650 // ask the console not to set the data, because we've already set it 1651 return false; 1652} 1653 1654//----------------------------------------------------------------------------- 1655 1656 1657const char *GuiControl::getScriptValue() 1658{ 1659 return NULL; 1660} 1661 1662//----------------------------------------------------------------------------- 1663 1664void GuiControl::setScriptValue( const char* ) 1665{ 1666} 1667 1668//----------------------------------------------------------------------------- 1669 1670void GuiControl::setConsoleVariable(const char *variable) 1671{ 1672 if (variable) 1673 { 1674 mConsoleVariable = StringTable->insert(variable); 1675 } 1676 else 1677 { 1678 mConsoleVariable = StringTable->EmptyString(); 1679 } 1680} 1681 1682//----------------------------------------------------------------------------- 1683 1684void GuiControl::setConsoleCommand( const String& newCmd ) 1685{ 1686 mConsoleCommand = newCmd; 1687} 1688 1689//----------------------------------------------------------------------------- 1690 1691const char * GuiControl::getConsoleCommand() 1692{ 1693 return mConsoleCommand; 1694} 1695 1696//----------------------------------------------------------------------------- 1697 1698void GuiControl::setVariable(const char *value) 1699{ 1700 if (mConsoleVariable[0]) 1701 Con::setVariable(mConsoleVariable, value); 1702} 1703 1704//----------------------------------------------------------------------------- 1705 1706void GuiControl::setIntVariable(S32 value) 1707{ 1708 if (mConsoleVariable[0]) 1709 Con::setIntVariable(mConsoleVariable, value); 1710} 1711 1712//----------------------------------------------------------------------------- 1713 1714void GuiControl::setFloatVariable(F32 value) 1715{ 1716 if (mConsoleVariable[0]) 1717 Con::setFloatVariable(mConsoleVariable, value); 1718} 1719 1720//----------------------------------------------------------------------------- 1721 1722const char * GuiControl::getVariable() 1723{ 1724 if (mConsoleVariable[0]) 1725 return Con::getVariable(mConsoleVariable); 1726 else return NULL; 1727} 1728 1729//----------------------------------------------------------------------------- 1730 1731S32 GuiControl::getIntVariable() 1732{ 1733 if (mConsoleVariable[0]) 1734 return Con::getIntVariable(mConsoleVariable); 1735 else return 0; 1736} 1737 1738//----------------------------------------------------------------------------- 1739 1740F32 GuiControl::getFloatVariable() 1741{ 1742 if (mConsoleVariable[0]) 1743 return Con::getFloatVariable(mConsoleVariable); 1744 else return 0.0f; 1745} 1746 1747//----------------------------------------------------------------------------- 1748 1749void GuiControl::setVisible(bool value) 1750{ 1751 mVisible = value; 1752 1753 setUpdate(); 1754 1755 for( iterator i = begin(); i != end(); i++) 1756 { 1757 GuiControl *ctrl = static_cast<GuiControl *>(*i); 1758 ctrl->clearFirstResponder(); 1759 } 1760 1761 GuiControl *parent = getParent(); 1762 if( parent ) 1763 { 1764 parent->childResized( this ); 1765 1766 // If parent is visible and awake and this control has just 1767 // become visible but was sleeping, wake it up now. 1768 1769 if( parent->isVisible() && parent->isAwake() 1770 && this->isVisible() && !this->isAwake() ) 1771 awaken(); 1772 } 1773 1774 if( getNamespace() ) // May be called during construction. 1775 onVisible_callback( value ); 1776} 1777 1778//----------------------------------------------------------------------------- 1779 1780void GuiControl::setActive( bool value ) 1781{ 1782 if( mActive == value ) 1783 return; 1784 1785 mActive = value; 1786 1787 if ( !mActive ) 1788 clearFirstResponder(); 1789 1790 if ( mVisible && mAwake ) 1791 setUpdate(); 1792 1793 if( getNamespace() ) // May be called during construction. 1794 onActive_callback( value ); 1795 1796 // Pass activation on to children. 1797 1798 for( iterator iter = begin(); iter != end(); ++ iter ) 1799 { 1800 GuiControl* child = dynamic_cast< GuiControl* >( *iter ); 1801 if( child ) 1802 child->setActive( value ); 1803 } 1804} 1805 1806//============================================================================= 1807// Persistence. 1808//============================================================================= 1809// MARK: ---- Persistence ---- 1810 1811//----------------------------------------------------------------------------- 1812 1813bool GuiControl::getCanSaveParent() 1814{ 1815 GuiControl *walk = this; 1816 while(walk) 1817 { 1818 if(!walk->getCanSave()) 1819 return false; 1820 1821 walk = walk->getParent(); 1822 } 1823 1824 return true; 1825} 1826 1827//----------------------------------------------------------------------------- 1828 1829void GuiControl::write(Stream &stream, U32 tabStop, U32 flags) 1830{ 1831 //note: this will return false if either we, or any of our parents, are non-save controls 1832 bool bCanSave = ( flags & IgnoreCanSave ) || ( flags & NoCheckParentCanSave && getCanSave() ) || getCanSaveParent(); 1833 1834 if (bCanSave && mAddGroup) 1835 { 1836 StringTableEntry steName = mAddGroup->getInternalName(); 1837 1838 if ((steName != NULL) && (steName != StringTable->insert("null")) && getName()) 1839 { 1840 MutexHandle handle; 1841 handle.lock(mMutex); 1842 1843 // export selected only? 1844 if ((flags & SelectedOnly) && !isSelected()) 1845 { 1846 for (U32 i = 0; i < size(); i++) 1847 (*this)[i]->write(stream, tabStop, flags); 1848 1849 return; 1850 1851 } 1852 1853 stream.writeTabs(tabStop); 1854 char buffer[1024]; 1855 dSprintf(buffer, sizeof(buffer), "new %s(%s,%s) {\r\n", getClassName(), getName() ? getName() : "", mAddGroup->getInternalName()); 1856 stream.write(dStrlen(buffer), buffer); 1857 writeFields(stream, tabStop + 1); 1858 1859 if (size()) 1860 { 1861 stream.write(2, "\r\n"); 1862 for (U32 i = 0; i < size(); i++) 1863 (*this)[i]->write(stream, tabStop + 1, flags); 1864 } 1865 1866 stream.writeTabs(tabStop); 1867 stream.write(4, "};\r\n"); 1868 1869 return; 1870 } 1871 } 1872 1873 if (bCanSave) 1874 Parent::write( stream, tabStop, flags ); 1875} 1876 1877//============================================================================= 1878// Hierarchies. 1879//============================================================================= 1880// MARK: ---- Hierarchies ---- 1881 1882//----------------------------------------------------------------------------- 1883 1884void GuiControl::addObject(SimObject *object) 1885{ 1886 GuiControl *ctrl = dynamic_cast<GuiControl *>(object); 1887 if(object->getGroup() == this) 1888 return; 1889 1890 AssertFatal( ctrl, "GuiControl::addObject() - cannot add non-GuiControl as child of GuiControl" ); 1891 1892 Parent::addObject(object); 1893 1894 AssertFatal(!ctrl->isAwake(), "GuiControl::addObject: object is already awake before add"); 1895 if( mAwake ) 1896 ctrl->awaken(); 1897 1898 // If we are a child, notify our parent that we've been removed 1899 GuiControl *parent = ctrl->getParent(); 1900 if( parent ) 1901 parent->onChildAdded( ctrl ); 1902} 1903 1904//----------------------------------------------------------------------------- 1905 1906void GuiControl::removeObject(SimObject *object) 1907{ 1908 GuiControl* ctrl = static_cast< GuiControl* >( object ); 1909 if( mAwake && ctrl->isAwake() ) 1910 ctrl->sleep(); 1911 1912 onChildRemoved( ctrl ); 1913 1914 Parent::removeObject(object); 1915} 1916 1917//----------------------------------------------------------------------------- 1918 1919GuiControl *GuiControl::getParent() 1920{ 1921 SimObject *obj = getGroup(); 1922 if (GuiControl* gui = dynamic_cast<GuiControl*>(obj)) 1923 return gui; 1924 return 0; 1925} 1926 1927//----------------------------------------------------------------------------- 1928 1929GuiCanvas *GuiControl::getRoot() 1930{ 1931 GuiControl *root = NULL; 1932 GuiControl *parent = getParent(); 1933 while (parent) 1934 { 1935 root = parent; 1936 parent = parent->getParent(); 1937 } 1938 if (root) 1939 return dynamic_cast<GuiCanvas*>(root); 1940 else 1941 return NULL; 1942} 1943 1944//----------------------------------------------------------------------------- 1945 1946bool GuiControl::acceptsAsChild( SimObject* object ) const 1947{ 1948 return ( dynamic_cast< GuiControl* >( object ) != NULL ); 1949} 1950 1951//----------------------------------------------------------------------------- 1952 1953GuiControl* GuiControl::findHitControl(const Point2I &pt, S32 initialLayer) 1954{ 1955 iterator i = end(); // find in z order (last to first) 1956 1957 while (i != begin()) 1958 { 1959 i--; 1960 GuiControl *ctrl = static_cast<GuiControl *>(*i); 1961 if (initialLayer >= 0 && ctrl->mLayer > initialLayer) 1962 { 1963 continue; 1964 } 1965 1966 else if (ctrl->mVisible && ctrl->mCanHit && ctrl->pointInControl(pt)) 1967 { 1968 Point2I ptemp = pt - ctrl->getPosition(); 1969 GuiControl *hitCtrl = ctrl->findHitControl(ptemp); 1970 1971 if ( hitCtrl->mProfile->mModal ) 1972 return hitCtrl; 1973 } 1974 } 1975 1976 if( mCanHit ) 1977 return this; 1978 return NULL; 1979} 1980 1981//----------------------------------------------------------------------------- 1982 1983bool GuiControl::findHitControls( const RectI& rect, Vector< GuiControl*>& outResult, U32 flags, S32 initialLayer, U32 depth ) 1984{ 1985 if( !mVisible ) 1986 return false; 1987 else if( !mCanHit && flags & HIT_NoCanHitNoRecurse ) 1988 return false; 1989 1990 // Check for hit. If not full-box, always counts. 1991 1992 bool isHit = mVisible; 1993 if( flags & HIT_FullBoxOnly ) 1994 { 1995 RectI rectInParentSpace = rect; 1996 rectInParentSpace.point += getPosition(); 1997 1998 isHit &= rectInParentSpace.contains( getBounds() ); 1999 } 2000 else 2001 isHit &= mCanHit; 2002 2003 // If we have a hit and should not recurse into children, 2004 // return us. 2005 2006 if( isHit && flags & HIT_ParentPreventsChildHit && depth > 0 ) 2007 { 2008 outResult.push_back( this ); 2009 return true; 2010 } 2011 2012 // Check child controls. 2013 2014 bool haveFoundChild = false; 2015 iterator i = end(); 2016 2017 while( i != begin() ) 2018 { 2019 i --; 2020 2021 GuiControl* ctrl = static_cast< GuiControl* >( *i ); 2022 if( initialLayer >= 0 && ctrl->mLayer > initialLayer ) 2023 continue; 2024 2025 if( ctrl->getBounds().overlaps( rect ) ) 2026 { 2027 RectI transposedRect = rect; 2028 transposedRect.point -= ctrl->getPosition(); 2029 2030 if( ctrl->findHitControls( transposedRect, outResult, flags, -1, depth + 1 ) ) 2031 haveFoundChild = true; 2032 } 2033 } 2034 2035 if( ( !haveFoundChild || flags & HIT_AddParentHits ) && isHit ) 2036 { 2037 outResult.push_back( this ); 2038 return true; 2039 } 2040 2041 return haveFoundChild; 2042} 2043 2044//----------------------------------------------------------------------------- 2045 2046GuiControl* GuiControl::findFirstTabable() 2047{ 2048 // No tabbing if the control is disabled or hidden. 2049 if ( !mAwake || !mVisible ) 2050 return NULL; 2051 2052 GuiControl *tabCtrl = NULL; 2053 iterator i; 2054 for (i = begin(); i != end(); i++) 2055 { 2056 GuiControl *ctrl = static_cast<GuiControl *>(*i); 2057 tabCtrl = ctrl->findFirstTabable(); 2058 if (tabCtrl) 2059 { 2060 mFirstResponder = tabCtrl; 2061 return tabCtrl; 2062 } 2063 } 2064 2065 //nothing was found, therefore, see if this ctrl is tabable 2066 return ( mProfile != NULL ) ? ( ( mProfile->mTabable && mAwake && mVisible ) ? this : NULL ) : NULL; 2067} 2068 2069//----------------------------------------------------------------------------- 2070 2071GuiControl* GuiControl::findLastTabable(bool firstCall) 2072{ 2073 // No tabbing if the control is disabled or hidden. 2074 if ( !mAwake || !mVisible ) 2075 return NULL; 2076 2077 //if this is the first call, clear the global 2078 if (firstCall) 2079 smPrevResponder = NULL; 2080 2081 //if this control is tabable, set the global 2082 if (mProfile->mTabable) 2083 smPrevResponder = this; 2084 2085 iterator i; 2086 for (i = begin(); i != end(); i++) 2087 { 2088 GuiControl *ctrl = static_cast<GuiControl *>(*i); 2089 ctrl->findLastTabable(false); 2090 } 2091 2092 //after the entire tree has been traversed, return the last responder found 2093 mFirstResponder = smPrevResponder; 2094 return smPrevResponder; 2095} 2096 2097//----------------------------------------------------------------------------- 2098 2099GuiControl *GuiControl::findNextTabable(GuiControl *curResponder, bool firstCall) 2100{ 2101 // No tabbing if the control is disabled or hidden. 2102 if ( !mAwake || !mVisible ) 2103 return NULL; 2104 2105 //if this is the first call, clear the global 2106 if (firstCall) 2107 smCurResponder = NULL; 2108 2109 //first find the current responder 2110 if (curResponder == this) 2111 smCurResponder = this; 2112 2113 //if the first responder has been found, return the very next *tabable* control 2114 else if ( smCurResponder && mProfile->mTabable && mAwake && mVisible && mActive ) 2115 return( this ); 2116 2117 //loop through, checking each child to see if it is the one that follows the firstResponder 2118 GuiControl *tabCtrl = NULL; 2119 iterator i; 2120 for (i = begin(); i != end(); i++) 2121 { 2122 GuiControl *ctrl = static_cast<GuiControl *>(*i); 2123 tabCtrl = ctrl->findNextTabable(curResponder, false); 2124 if (tabCtrl) break; 2125 } 2126 mFirstResponder = tabCtrl; 2127 return tabCtrl; 2128} 2129 2130//----------------------------------------------------------------------------- 2131 2132GuiControl *GuiControl::findPrevTabable(GuiControl *curResponder, bool firstCall) 2133{ 2134 // No tabbing if the control is disabled or hidden. 2135 if ( !mAwake || !mVisible ) 2136 return NULL; 2137 2138 if (firstCall) 2139 smPrevResponder = NULL; 2140 2141 //if this is the current reponder, return the previous one 2142 if (curResponder == this) 2143 return smPrevResponder; 2144 2145 //else if this is a responder, store it in case the next found is the current responder 2146 else if ( mProfile->mTabable && mAwake && mVisible && mActive ) 2147 smPrevResponder = this; 2148 2149 //loop through, checking each child to see if it is the one that follows the firstResponder 2150 GuiControl *tabCtrl = NULL; 2151 iterator i; 2152 for (i = begin(); i != end(); i++) 2153 { 2154 GuiControl *ctrl = static_cast<GuiControl *>(*i); 2155 tabCtrl = ctrl->findPrevTabable(curResponder, false); 2156 if (tabCtrl) break; 2157 } 2158 mFirstResponder = tabCtrl; 2159 return tabCtrl; 2160} 2161 2162//----------------------------------------------------------------------------- 2163 2164bool GuiControl::controlIsChild( GuiControl* child ) 2165{ 2166 for( iterator i = begin(); i != end(); ++ i ) 2167 { 2168 GuiControl* ctrl = static_cast< GuiControl* >( *i ); 2169 if( ctrl == child || ctrl->controlIsChild( child ) ) 2170 return true; 2171 } 2172 2173 return false; 2174} 2175 2176//============================================================================= 2177// Event Handling. 2178//============================================================================= 2179// MARK: ---- Event Handling ---- 2180 2181//----------------------------------------------------------------------------- 2182 2183bool GuiControl::isFirstResponder() 2184{ 2185 GuiCanvas *root = getRoot(); 2186 return root && root->getFirstResponder() == this; 2187} 2188 2189//----------------------------------------------------------------------------- 2190 2191void GuiControl::makeFirstResponder(bool value) 2192{ 2193 if ( value ) 2194 //setFirstResponder(this); 2195 setFirstResponder(); 2196 else 2197 clearFirstResponder(); 2198} 2199 2200//----------------------------------------------------------------------------- 2201 2202void GuiControl::setFirstResponder( GuiControl* firstResponder ) 2203{ 2204 // If the control cannot have keyboard focus, refuse 2205 // to make it first responder. 2206 2207 if( firstResponder && !firstResponder->mProfile->mCanKeyFocus ) 2208 return; 2209 2210 mFirstResponder = firstResponder; 2211 2212 if( getParent() ) 2213 getParent()->setFirstResponder( firstResponder ); 2214} 2215 2216//----------------------------------------------------------------------------- 2217 2218void GuiControl::setFirstResponder() 2219{ 2220 if( mAwake && mVisible ) 2221 { 2222 GuiControl *parent = getParent(); 2223 if ( mProfile->mCanKeyFocus == true && parent != NULL ) 2224 parent->setFirstResponder( this ); 2225 } 2226} 2227 2228//----------------------------------------------------------------------------- 2229 2230void GuiControl::clearFirstResponder() 2231{ 2232 if( !getParent() ) 2233 return; 2234 2235 if( isFirstResponder() ) 2236 getParent()->setFirstResponder( NULL ); 2237 else 2238 for( GuiControl* parent = this; parent != NULL; parent = parent->getParent() ) 2239 if( parent->mFirstResponder == this ) 2240 parent->mFirstResponder = NULL; 2241} 2242 2243//----------------------------------------------------------------------------- 2244 2245void GuiControl::onLoseFirstResponder() 2246{ 2247 // Since many controls have visual cues when they are the firstResponder... 2248 setUpdate(); 2249 2250 onLoseFirstResponder_callback(); 2251} 2252 2253//----------------------------------------------------------------------------- 2254 2255void GuiControl::onGainFirstResponder() 2256{ 2257 // Since many controls have visual cues when they are the firstResponder... 2258 this->setUpdate(); 2259 2260 onGainFirstResponder_callback(); 2261} 2262 2263//----------------------------------------------------------------------------- 2264 2265void GuiControl::buildAcceleratorMap() 2266{ 2267 //add my own accel key 2268 addAcceleratorKey(); 2269 2270 //add all my childrens keys 2271 iterator i; 2272 for(i = begin(); i != end(); i++) 2273 { 2274 GuiControl *ctrl = static_cast<GuiControl *>(*i); 2275 ctrl->buildAcceleratorMap(); 2276 } 2277} 2278 2279//----------------------------------------------------------------------------- 2280 2281void GuiControl::addAcceleratorKey() 2282{ 2283 //see if we have an accelerator 2284 if( mAcceleratorKey == StringTable->EmptyString() ) 2285 return; 2286 2287 EventDescriptor accelEvent; 2288 ActionMap::createEventDescriptor(mAcceleratorKey, &accelEvent); 2289 2290 //now we have a modifier, and a key, add them to the canvas 2291 GuiCanvas *root = getRoot(); 2292 if (root) 2293 root->addAcceleratorKey(this, 0, accelEvent.eventCode, accelEvent.flags); 2294} 2295 2296//----------------------------------------------------------------------------- 2297 2298void GuiControl::acceleratorKeyPress( U32 ) 2299{ 2300 onAction(); 2301} 2302 2303//----------------------------------------------------------------------------- 2304 2305void GuiControl::acceleratorKeyRelease( U32 ) 2306{ 2307 //do nothing 2308} 2309 2310//----------------------------------------------------------------------------- 2311 2312bool GuiControl::isMouseLocked() 2313{ 2314 GuiCanvas *root = getRoot(); 2315 return root ? root->getMouseLockedControl() == this : false; 2316} 2317 2318//----------------------------------------------------------------------------- 2319 2320void GuiControl::mouseLock(GuiControl *lockingControl) 2321{ 2322 GuiCanvas *root = getRoot(); 2323 if (root) 2324 root->mouseLock(lockingControl); 2325} 2326 2327//----------------------------------------------------------------------------- 2328 2329void GuiControl::mouseLock() 2330{ 2331 GuiCanvas *root = getRoot(); 2332 if (root) 2333 root->mouseLock(this); 2334} 2335 2336//----------------------------------------------------------------------------- 2337 2338void GuiControl::mouseUnlock() 2339{ 2340 GuiCanvas *root = getRoot(); 2341 if (root) 2342 root->mouseUnlock(this); 2343} 2344 2345//============================================================================= 2346// Misc. 2347//============================================================================= 2348// MARK: ---- Misc ---- 2349 2350//----------------------------------------------------------------------------- 2351 2352LangTable * GuiControl::getGUILangTable() 2353{ 2354 if(mLangTable) 2355 return mLangTable; 2356 2357 if(mLangTableName && *mLangTableName) 2358 { 2359 mLangTable = (LangTable *)getModLangTable((const UTF8*)mLangTableName); 2360 return mLangTable; 2361 } 2362 2363 GuiControl *parent = getParent(); 2364 if(parent) 2365 return parent->getGUILangTable(); 2366 2367 return NULL; 2368} 2369 2370//----------------------------------------------------------------------------- 2371 2372const UTF8 * GuiControl::getGUIString(S32 id) 2373{ 2374 LangTable *lt = getGUILangTable(); 2375 if(lt) 2376 return lt->getString(id); 2377 2378 return NULL; 2379} 2380 2381//----------------------------------------------------------------------------- 2382 2383void GuiControl::messageSiblings(S32 message) 2384{ 2385 GuiControl *parent = getParent(); 2386 if (! parent) return; 2387 GuiControl::iterator i; 2388 for(i = parent->begin(); i != parent->end(); i++) 2389 { 2390 GuiControl *ctrl = dynamic_cast<GuiControl *>(*i); 2391 if (ctrl != this) 2392 ctrl->onMessage(this, message); 2393 } 2394} 2395 2396//----------------------------------------------------------------------------- 2397 2398void GuiControl::getScrollLineSizes(U32 *rowHeight, U32 *columnWidth) 2399{ 2400 // default to 10 pixels in y, 30 pixels in x 2401 *columnWidth = 30; 2402 *rowHeight = 30; 2403} 2404 2405//----------------------------------------------------------------------------- 2406 2407U32 GuiControl::clipText( String &text, U32 clipWidth ) const 2408{ 2409 PROFILE_SCOPE( GuiControl_clipText ); 2410 2411 U32 textWidth = mProfile->mFont->getStrWidthPrecise( text ); 2412 2413 if ( textWidth <= clipWidth ) 2414 return textWidth; 2415 2416 // Start removing characters from the end of the string 2417 // until the string width plus the elipsesWidth is less 2418 // than clipWidth... 2419 2420 // Note this would be more efficient without calling 2421 // getStrWidthPrecise each loop iteration. eg. get the 2422 // length of each char, store in a temporary U32 array, 2423 // and then remove the number we need from the end all at once. 2424 2425 String temp; 2426 2427 while ( text.isNotEmpty() ) 2428 { 2429 text.erase( text.length() - 1, 1 ); 2430 temp = text; 2431 temp += "..."; 2432 textWidth = mProfile->mFont->getStrWidthPrecise( temp ); 2433 2434 if ( textWidth <= clipWidth ) 2435 { 2436 text = temp; 2437 return textWidth; 2438 } 2439 } 2440 2441 // Uh, not even the ellipses will fit in the passed width. 2442 // Text should be an ellipses string now, 2443 // which is the right thing to do in this case. 2444 2445 return 0; 2446} 2447 2448//----------------------------------------------------------------------------- 2449 2450void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent) 2451{ 2452#ifdef _XBOX 2453 return; 2454#endif 2455 2456 TORQUE_UNUSED(lastGuiEvent); 2457 2458 if( !getRoot() ) 2459 return; 2460 2461 if(getRoot()->mCursorChanged != -1 && !isMouseLocked()) 2462 { 2463 // We've already changed the cursor, 2464 // so set it back before we change it again. 2465 2466 PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow(); 2467 if (!pWindow) 2468 return; 2469 PlatformCursorController *pController = pWindow->getCursorController(); 2470 AssertFatal(pController != NULL,"PlatformWindow without an owned CursorController!"); 2471 2472 pController->popCursor(); 2473 2474 // We haven't changed it 2475 getRoot()->mCursorChanged = -1; 2476 } 2477} 2478 2479//----------------------------------------------------------------------------- 2480 2481const char* GuiControl::evaluate( const char* str ) 2482{ 2483 smThisControl = this; 2484 const char* result = Con::evaluate(str, false); 2485 smThisControl = NULL; 2486 2487 return result; 2488} 2489 2490//----------------------------------------------------------------------------- 2491 2492const char* GuiControl::execConsoleCallback() 2493{ 2494 if( mConsoleCommand.isNotEmpty() ) 2495 return evaluate( mConsoleCommand ); 2496 2497 return ""; 2498} 2499 2500//----------------------------------------------------------------------------- 2501 2502const char* GuiControl::execAltConsoleCallback() 2503{ 2504 if( mAltConsoleCommand.isNotEmpty() ) 2505 return evaluate( mAltConsoleCommand ); 2506 2507 return ""; 2508} 2509 2510//============================================================================= 2511// Console Methods. 2512//============================================================================= 2513// MARK: ---- Console Methods ---- 2514 2515//----------------------------------------------------------------------------- 2516 2517DefineEngineMethod( GuiControl, findHitControl, GuiControl*, ( S32 x, S32 y ),, 2518 "Find the topmost child control located at the given coordinates.\n" 2519 "@note Only children that are both visible and have the 'modal' flag set in their profile will be considered in the search." 2520 "@param x The X coordinate in the control's own coordinate space.\n" 2521 "@param y The Y coordinate in the control's own coordinate space.\n" 2522 "@return The topmost child control at the given coordintes or the control on which the method was called if no matching child could be found.\n" 2523 "@see GuiControlProfile::modal\n" 2524 "@see findHitControls" ) 2525{ 2526 return object->findHitControl( Point2I( x, y ) ); 2527} 2528 2529//----------------------------------------------------------------------------- 2530 2531DefineEngineMethod( GuiControl, findHitControls, const char*, ( S32 x, S32 y, S32 width, S32 height ),, 2532 "Find all visible child controls that intersect with the given rectangle.\n" 2533 "@note Invisible child controls will not be included in the search.\n" 2534 "@param x The X coordinate of the rectangle's upper left corner in the control's own coordinate space.\n" 2535 "@param y The Y coordinate of the rectangle's upper left corner in the control's own coordinate space.\n" 2536 "@param width The width of the search rectangle in pixels.\n" 2537 "@param height The height of the search rectangle in pixels.\n" 2538 "@return A space-separated list of the IDs of all visible control objects intersecting the given rectangle.\n\n" 2539 "@tsexample\n" 2540 "// Lock all controls in the rectangle at x=10 and y=10 and the extent width=100 and height=100.\n" 2541 "foreach$( %ctrl in %this.findHitControls( 10, 10, 100, 100 ) )\n" 2542 " %ctrl.setLocked( true );\n" 2543 "@endtsexample\n" 2544 "@see findHitControl" ) 2545{ 2546 // Find hit controls. 2547 2548 RectI bounds( x, y, width, height ); 2549 Vector< GuiControl*> controls; 2550 2551 if( !object->findHitControls( bounds, controls ) ) 2552 return ""; 2553 2554 // Create vector string. 2555 2556 bool isFirst = true; 2557 StringBuilder str; 2558 for( U32 i = 0, num = controls.size(); i < num; ++ i ) 2559 { 2560 if( !isFirst ) 2561 str.append( ' ' ); 2562 2563 str.append( controls[ i ]->getIdString() ); 2564 isFirst = false; 2565 } 2566 String s = str.end(); 2567 2568 // Return result. 2569 2570 if ( s.compare( object->getIdString() ) == 0 ) 2571 return ""; 2572 2573 char* buffer = Con::getReturnBuffer( s.size() ); 2574 dStrcpy( buffer, s.c_str(), s.size() ); 2575 2576 return buffer; 2577} 2578 2579//----------------------------------------------------------------------------- 2580 2581DefineEngineMethod( GuiControl, controlIsChild, bool, ( GuiControl* control ),, 2582 "Test whether the given control is a direct or indirect child to this control.\n" 2583 "@param control The potential child control.\n" 2584 "@return True if the given control is a direct or indirect child to this control." ) 2585{ 2586 if( !control ) 2587 return false; 2588 2589 return object->controlIsChild( control ); 2590} 2591 2592//----------------------------------------------------------------------------- 2593 2594DefineEngineMethod( GuiControl, isFirstResponder, bool, (),, 2595 "Test whether the control is the current first responder.\n" 2596 "@return True if the control is the current first responder.\n" 2597 "@see makeFirstResponder\n" 2598 "@see setFirstResponder\n" 2599 "@ref GuiControl_FirstResponders" ) 2600{ 2601 return object->isFirstResponder(); 2602} 2603 2604//----------------------------------------------------------------------------- 2605 2606DefineEngineMethod( GuiControl, setFirstResponder, void, (),, 2607 "Make this control the current first responder.\n" 2608 "@note Only controls with a profile that has canKeyFocus enabled are able to become first responders.\n" 2609 "@see GuiControlProfile::canKeyFocus\n" 2610 "@see isFirstResponder\n" 2611 "@ref GuiControl_FirstResponders" ) 2612{ 2613 object->setFirstResponder(); 2614} 2615 2616//----------------------------------------------------------------------------- 2617 2618DefineEngineMethod( GuiControl, getFirstResponder, GuiControl*, (),, 2619 "Get the first responder set on this GuiControl tree.\n" 2620 "@return The first responder set on the control's subtree.\n" 2621 "@see isFirstResponder\n" 2622 "@see makeFirstResponder\n" 2623 "@see setFirstResponder\n" 2624 "@ref GuiControl_FirstResponders" ) 2625{ 2626 return object->getFirstResponder(); 2627} 2628 2629//----------------------------------------------------------------------------- 2630 2631DefineEngineMethod( GuiControl, clearFirstResponder, void, ( bool ignored ), ( false ), 2632 "Clear this control from being the first responder in its hierarchy chain.\n" 2633 "@param ignored Ignored. Supported for backwards-compatibility.\n" ) 2634{ 2635 object->clearFirstResponder(); 2636} 2637 2638//----------------------------------------------------------------------------- 2639 2640DefineEngineMethod( GuiControl, pointInControl, bool, ( S32 x, S32 y ),, 2641 "Test whether the given point lies within the rectangle of the control.\n" 2642 "@param x X coordinate of the point in parent-relative coordinates.\n" 2643 "@param y Y coordinate of the point in parent-relative coordinates.\n" 2644 "@return True if the point is within the control, false if not.\n" 2645 "@see getExtent\n" 2646 "@see getPosition\n" ) 2647{ 2648 return object->pointInControl( Point2I( x, y ) ); 2649} 2650 2651//----------------------------------------------------------------------------- 2652 2653DefineEngineMethod( GuiControl, addGuiControl, void, ( GuiControl* control ),, 2654 "Add the given control as a child to this control.\n" 2655 "This is synonymous to calling SimGroup::addObject.\n" 2656 "@param control The control to add as a child.\n" 2657 "@note The control will retain its current position and size.\n" 2658 "@see SimGroup::addObject\n" 2659 "@ref GuiControl_Hierarchy\n" ) 2660{ 2661 if( control ) 2662 object->addObject( control ); 2663} 2664 2665//----------------------------------------------------------------------------- 2666 2667DefineEngineMethod( GuiControl, getRoot, GuiCanvas*, (),, 2668 "Get the canvas on which the control is placed.\n" 2669 "@return The canvas on which the control's hierarchy is currently placed or 0 if the control is not currently placed on a GuiCanvas.\n" 2670 "@see GuiControl_Hierarchy\n" ) 2671{ 2672 return object->getRoot(); 2673} 2674 2675//----------------------------------------------------------------------------- 2676 2677DefineEngineMethod( GuiControl, getParent, GuiControl*, (),, 2678 "Get the immediate parent control of the control.\n" 2679 "@return The immediate parent GuiControl or 0 if the control is not parented to a GuiControl.\n" ) 2680{ 2681 return object->getParent(); 2682} 2683 2684//----------------------------------------------------------------------------- 2685DefineEngineMethod( GuiControl, isMouseLocked, bool, (),, 2686 "Indicates if the mouse is locked in this control.\n" 2687 "@return True if the mouse is currently locked.\n" ) 2688{ 2689 return object->isMouseLocked(); 2690} 2691 2692//----------------------------------------------------------------------------- 2693 2694DefineEngineMethod( GuiControl, setValue, void, ( const char* value ),, 2695 "Set the value associated with the control.\n" 2696 "@param value The new value for the control.\n" ) 2697{ 2698 object->setScriptValue( value ); 2699} 2700 2701DefineEngineMethod( GuiControl, getValue, const char*, (),, 2702 "Get the value associated with the control.\n" 2703 "@return value for the control.\n" ) 2704{ 2705 return object->getScriptValue(); 2706} 2707 2708DefineEngineMethod( GuiControl, makeFirstResponder, void, ( bool isFirst ),, 2709 "Make this control the first responder.\n" 2710 "@param isFirst True to make first responder, false to not.\n" ) 2711{ 2712 //object->makeFirstResponder(dAtob(argv[2])); 2713 object->makeFirstResponder(isFirst); 2714} 2715 2716DefineEngineMethod( GuiControl, isActive, bool, (),, 2717 "Check if this control is active or not.\n" 2718 "@return True if it's active, false if not.\n" ) 2719{ 2720 return object->isActive(); 2721} 2722 2723//----------------------------------------------------------------------------- 2724 2725DefineEngineMethod( GuiControl, setActive, void, ( bool state ), ( true ), 2726 "Set the control as active or inactive." 2727 "@param state True to set the control as active, false to set it as inactive.") 2728{ 2729 object->setActive( state ); 2730} 2731 2732//----------------------------------------------------------------------------- 2733 2734DefineEngineMethod( GuiControl, isVisible, bool, (),, 2735 "Test whether the control is currently set to be visible.\n" 2736 "@return True if the control is currently set to be visible." 2737 "@note This method does not tell anything about whether the control is actually visible to " 2738 "the user at the moment.\n\n" 2739 "@ref GuiControl_VisibleActive" ) 2740{ 2741 return object->isVisible(); 2742} 2743 2744//----------------------------------------------------------------------------- 2745 2746DefineEngineMethod( GuiControl, setVisible, void, ( bool state ), ( true ), 2747 "Set whether the control is visible or not.\n" 2748 "@param state The new visiblity flag state for the control.\n" 2749 "@ref GuiControl_VisibleActive" ) 2750{ 2751 object->setVisible( state ); 2752} 2753 2754//----------------------------------------------------------------------------- 2755 2756DefineEngineMethod( GuiControl, isAwake, bool, (),, 2757 "Test whether the control is currently awake.\n" 2758 "If a control is awake it means that it is part of the GuiControl hierarchy of a GuiCanvas.\n" 2759 "@return True if the control is awake." 2760 "@ref GuiControl_Waking" ) 2761{ 2762 return object->isAwake(); 2763} 2764 2765//----------------------------------------------------------------------------- 2766 2767DefineEngineMethod( GuiControl, setProfile, void, ( GuiControlProfile* profile ),, 2768 "Set the control profile for the control to use.\n" 2769 "The profile used by a control determines a great part of its behavior and appearance.\n" 2770 "@param profile The new profile the control should use.\n" 2771 "@ref GuiControl_Profiles" ) 2772{ 2773 if( !profile ) 2774 return; 2775 2776 object->setControlProfile( profile ); 2777} 2778 2779//----------------------------------------------------------------------------- 2780 2781DefineEngineMethod( GuiControl, resize, void, ( S32 x, S32 y, S32 width, S32 height ),, 2782 "Resize and reposition the control using the give coordinates and dimensions. Child controls " 2783 "will resize according to their layout behaviors.\n" 2784 "@param x The new X coordinate of the control in its parent's coordinate space.\n" 2785 "@param y The new Y coordinate of the control in its parent's coordinate space.\n" 2786 "@param width The new width to which the control should be resized.\n" 2787 "@param height The new height to which the control should be resized." ) 2788{ 2789 Point2I newPos( x, y ); 2790 Point2I newExt( width, height ); 2791 object->resize(newPos, newExt); 2792} 2793 2794//----------------------------------------------------------------------------- 2795 2796DefineEngineMethod( GuiControl, getPosition, Point2I, (),, 2797 "Get the control's current position relative to its parent.\n" 2798 "@return The coordinate of the control in its parent's coordinate space." ) 2799{ 2800 return object->getPosition(); 2801} 2802 2803//----------------------------------------------------------------------------- 2804 2805DefineEngineMethod( GuiControl, getCenter, Point2I, (),, 2806 "Get the coordinate of the control's center point relative to its parent.\n" 2807 "@return The coordinate of the control's center point in parent-relative coordinates." ) 2808{ 2809 const Point2I pos = object->getPosition(); 2810 const Point2I ext = object->getExtent(); 2811 Point2I center( pos.x + ext.x / 2, pos.y + ext.y / 2 ); 2812 2813 return center; 2814} 2815 2816//----------------------------------------------------------------------------- 2817 2818DefineEngineMethod( GuiControl, setCenter, void, ( S32 x, S32 y ),, 2819 "Set the control's position by its center point.\n" 2820 "@param x The X coordinate of the new center point of the control relative to the control's parent.\n" 2821 "@param y The Y coordinate of the new center point of the control relative to the control's parent." ) 2822{ 2823 const Point2I ext = object->getExtent(); 2824 Point2I newpos( x - ext.x / 2, y - ext.y / 2 ); 2825 object->setPosition( newpos ); 2826} 2827 2828//----------------------------------------------------------------------------- 2829 2830DefineEngineMethod( GuiControl, getGlobalCenter, Point2I, (),, 2831 "Get the coordinate of the control's center point in coordinates relative to the root control in its control hierarchy.\n" 2832 "@Return the center coordinate of the control in root-relative coordinates.\n" ) 2833{ 2834 const Point2I tl( 0, 0 ); 2835 Point2I pos = object->localToGlobalCoord( tl ); 2836 const Point2I ext = object->getExtent(); 2837 Point2I center( pos.x + ext.x / 2, pos.y + ext.y / 2 ); 2838 2839 return center; 2840} 2841 2842//----------------------------------------------------------------------------- 2843 2844DefineEngineMethod( GuiControl, getGlobalPosition, Point2I, (),, 2845 "Get the position of the control relative to the root of the GuiControl hierarchy it is contained in.\n" 2846 "@return The control's current position in root-relative coordinates." ) 2847{ 2848 const Point2I pos(0,0); 2849 return object->localToGlobalCoord(pos); 2850} 2851 2852//----------------------------------------------------------------------------- 2853 2854DefineEngineMethod( GuiControl, setPositionGlobal, void, ( S32 x, S32 y ),, 2855 "Set position of the control relative to the root of the GuiControl hierarchy it is contained in.\n" 2856 "@param x The new X coordinate of the control relative to the root's upper left corner.\n" 2857 "@param y The new Y coordinate of the control relative to the root's upper left corner." ) 2858{ 2859 //see if we can turn the x/y into ints directly, 2860 Point2I lPosOffset = object->globalToLocalCoord( Point2I( x, y ) ); 2861 2862 lPosOffset += object->getPosition(); 2863 2864 object->setPosition( lPosOffset ); 2865} 2866 2867//----------------------------------------------------------------------------- 2868 2869DefineEngineMethod( GuiControl, setPosition, void, ( S32 x, S32 y ),, 2870 "Position the control in the local space of the parent control.\n" 2871 "@param x The new X coordinate of the control relative to its parent's upper left corner.\n" 2872 "@param y The new Y coordinate of the control relative to its parent's upper left corner." ) 2873{ 2874 object->setPosition( Point2I( x, y ) ); 2875} 2876 2877//----------------------------------------------------------------------------- 2878 2879DefineEngineMethod( GuiControl, getExtent, Point2I, (),, 2880 "Get the width and height of the control.\n" 2881 "@return A point structure containing the width of the control in x and the height in y." ) 2882{ 2883 return object->getExtent(); 2884} 2885 2886//----------------------------------------------------------------------------- 2887 2888static ConsoleDocFragment _sGuiControlSetExtent1( 2889 "@brief Resize the control to the given dimensions.\n\n" 2890 "Child controls will resize according to their layout settings.\n" 2891 "@param width The new width of the control in pixels.\n" 2892 "@param height The new height of the control in pixels.", 2893 "GuiControl", // The class to place the method in; use NULL for functions. 2894 "void setExtent( S32 width, S32 height );" ); // The definition string. 2895static ConsoleDocFragment _sGuiControlSetExtent2( 2896 "@brief Resize the control to the given dimensions.\n\n" 2897 "Child controls with resize according to their layout settings.\n" 2898 "@param p The new ( width, height ) extents of the control.", 2899 "GuiControl", // The class to place the method in; use NULL for functions. 2900 "void setExtent( Point2I p );" ); // The definition string. 2901 2902DefineEngineMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), (""), 2903 "( Point2I p | int x, int y ) Set the width and height of the control.\n\n" 2904 "@hide" ) 2905{ 2906 Point2I extent; 2907 if(!String::isEmpty(extOrX) && String::isEmpty(y)) 2908 dSscanf(extOrX, "%d %d", &extent.x, &extent.y); 2909 else if(!String::isEmpty(extOrX) && !String::isEmpty(y)) 2910 { 2911 extent.x = dAtoi(extOrX); 2912 extent.y = dAtoi(y); 2913 } 2914 object->setExtent( extent ); 2915} 2916 2917//----------------------------------------------------------------------------- 2918 2919DefineEngineMethod( GuiControl, getMinExtent, Point2I, (),, 2920 "Get the minimum allowed size of the control.\n" 2921 "@return The minimum size to which the control can be shrunk.\n" 2922 "@see minExtent" ) 2923{ 2924 return object->getMinExtent(); 2925} 2926 2927//----------------------------------------------------------------------------- 2928 2929DefineEngineMethod( GuiControl, getAspect, F32, (),, 2930 "Get the aspect ratio of the control's extents.\n" 2931 "@return The width of the control divided by its height.\n" 2932 "@see getExtent" ) 2933{ 2934 const Point2I &ext = object->getExtent(); 2935 return (F32)ext.x / (F32)ext.y; 2936} 2937