⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guicontrol.h

📁 五行MMORPG引擎系统V1.0
💻 H
📖 第 1 页 / 共 2 页
字号:
    /// Changes the X position of this control
    /// @param   newXPosition   New X Position of this control
    virtual void setLeft( S32 newLeft );

    /// Changes the Y position of this control
    /// @param   newYPosition   New Y Position of this control
    virtual void setTop( S32 newTop );

    /// Changes the width of this control
    /// @param   newWidth   New width of this control
    virtual void setWidth( S32 newWidth );

    /// Changes the height of this control
    /// @param   newHeight   New Height of this control
    virtual void setHeight( S32 newHeight );

    /// Called when a child control of the object is resized
    /// @param   child   Child object
    virtual void childResized(GuiControl *child);

    /// Called when this objects parent is resized
    /// @param   oldParentExtent   The old size of the parent object
    /// @param   newParentExtent   The new size of the parent object
    virtual void parentResized(const Point2I &oldParentExtent, const Point2I &newParentExtent);
    /// @}

    /// @name Rendering
    /// @{

    /// Called when this control is to render itself
    /// @param   offset   The location this control is to begin rendering
    /// @param   updateRect   The screen area this control has drawing access to
    virtual void onRender(Point2I offset, const RectI &updateRect);
	
	virtual bool renderTooltip(Point2I cursorPos);

    /// Called when this control should render its children
    /// @param   offset   The location this control is to begin rendering
    /// @param   updateRect   The screen area this control has drawing access to
    void renderChildControls(Point2I offset, const RectI &updateRect);

    /// Sets the area (local coordinates) this control wants refreshed each frame
    /// @param   pos   UpperLeft point on rectangle of refresh area
    /// @param   ext   Extent of update rect
    void setUpdateRegion(Point2I pos, Point2I ext);

    /// Sets the update area of the control to encompass the whole control
    void setUpdate();
    /// @}

    //child hierarchy calls
    void awaken();          ///< Called when this control and its children have been wired up.
    void sleep();           ///< Called when this control is no more.
    void preRender();       ///< Prerender this control and all its children.

    /// @name Events
    ///
    /// If you subclass these, make sure to call the Parent::'s versions.
    ///
    /// @{

    /// Called when this object is asked to wake up returns true if it's actually awake at the end
    virtual bool onWake();

    /// Called when this object is asked to sleep
    virtual void onSleep();

    /// Do special pre-render proecessing
    virtual void onPreRender();

    /// Called when this object is removed
    virtual void onRemove();

    /// Called when one of this objects children is removed
    virtual void onChildRemoved( GuiControl *child );

    /// Called when this object is added to the scene
    bool onAdd();

    /// Called when this object has a new child
    virtual void onChildAdded( GuiControl *child );

    /// @}

    /// @name Console
    /// @{

    /// Returns the value of the variable bound to this object
    virtual const char *getScriptValue();

    /// Sets the value of the variable bound to this object
    virtual void setScriptValue(const char *value);
    /// @}

    /// @name Input (Keyboard/Mouse)
    /// @{

    /// This function will return true if the provided coordinates (wrt parent object) are
    /// within the bounds of this control
    /// @param   parentCoordPoint   Coordinates to test
    virtual bool pointInControl(const Point2I& parentCoordPoint);

    /// Returns true if the global cursor is inside this control
    bool cursorInControl();

    /// Returns the control which the provided point is under, with layering
    /// @param   pt   Point to test
    /// @param   initialLayer  Layer of gui objects to begin the search
    virtual GuiControl* findHitControl(const Point2I &pt, S32 initialLayer = -1);
#ifdef TGE_RPG
    virtual GuiControl* findAnyHitControl(const Point2I &pt, S32 initialLayer = -1);
#endif

    /// Lock the mouse within the provided control
    /// @param   lockingControl   Control to lock the mouse within
    void mouseLock(GuiControl *lockingControl);

    /// Turn on mouse locking with last used lock control
    void mouseLock();

    /// Unlock the mouse
    void mouseUnlock();

    /// Returns true if the mouse is locked
    bool isMouseLocked();
    /// @}


    /// General input handler.
    virtual bool onInputEvent(const InputEvent &event);

    /// @name Mouse Events
    /// These functions are called when the input event which is
    /// in the name of the function occurs.
    /// @{
    virtual void onMouseUp(const GuiEvent &event);
    virtual void onMouseDown(const GuiEvent &event);
    virtual void onMouseMove(const GuiEvent &event);
    virtual void onMouseDragged(const GuiEvent &event);
    virtual void onMouseEnter(const GuiEvent &event);
    virtual void onMouseLeave(const GuiEvent &event);

    virtual bool onMouseWheelUp(const GuiEvent &event);
    virtual bool onMouseWheelDown(const GuiEvent &event);

    virtual void onRightMouseDown(const GuiEvent &event);
    virtual void onRightMouseUp(const GuiEvent &event);
    virtual void onRightMouseDragged(const GuiEvent &event);

    virtual void onMiddleMouseDown(const GuiEvent &event);
    virtual void onMiddleMouseUp(const GuiEvent &event);
    virtual void onMiddleMouseDragged(const GuiEvent &event);

    /// Called when a mouseDown event occurs on a control and the GUI editor is active
    /// @param   event   the GuiEvent which caused the call to this function
    /// @param   offset   the offset which is representative of the units x and y that the editor takes up on screen
    virtual void onMouseDownEditor(const GuiEvent &event, Point2I offset);

    /// Called when a rightMouseDown event occurs on a control and the GUI editor is active
    /// @param   event   the GuiEvent which caused the call to this function
    /// @param   offset   the offset which is representative of the units x and y that the editor takes up on screen
    virtual void onRightMouseDownEditor(const GuiEvent &event, Point2I offset);

    /// @}

    /// @name Tabs
    /// @{

    /// Find the first tab-accessable child of this control
    virtual GuiControl* findFirstTabable();

    /// Find the last tab-accessable child of this control
    /// @param   firstCall   Set to true to clear the global previous responder
    virtual GuiControl* findLastTabable(bool firstCall = true);

    /// Find previous tab-accessable control with respect to the provided one
    /// @param   curResponder   Current control
    /// @param   firstCall   Set to true to clear the global previous responder
    virtual GuiControl* findPrevTabable(GuiControl *curResponder, bool firstCall = true);

    /// Find next tab-accessable control with regards to the provided control.
    ///
    /// @param   curResponder   Current control
    /// @param   firstCall   Set to true to clear the global current responder
    virtual GuiControl* findNextTabable(GuiControl *curResponder, bool firstCall = true);
    /// @}

    /// Returns true if the provided control is a child (grandchild, or greatgrandchild) of this one.
    ///
    /// @param   child   Control to test
    virtual bool ControlIsChild(GuiControl *child);

    /// @name First Responder
    /// A first responder is the control which reacts first, in it's responder chain, to keyboard events
    /// The responder chain is set for each parent and so there is only one first responder amongst it's
    /// children.
    /// @{

    /// Sets the first responder for child controls
    /// @param   firstResponder   First responder for this chain
    virtual void setFirstResponder(GuiControl *firstResponder);

    /// Sets up this control to be the first in it's group to respond to an input event
    /// @param   value   True if this should be a first responder
    virtual void makeFirstResponder(bool value);

    /// Returns true if this control is a first responder
    bool isFirstResponder();

    /// Sets this object to be a first responder
#ifdef TGE_RPG
    virtual void setFirstResponder();
    /// Clears the first responder for this chain
    virtual void clearFirstResponder();
#else
    void setFirstResponder();

    /// Clears the first responder for this chain
    void clearFirstResponder();
#endif

    /// Returns the first responder for this chain
    GuiControl *getFirstResponder() { return mFirstResponder; }

    /// Occurs when the first responder for this chain is lost
    virtual void onLoseFirstResponder();
    /// @}

    /// @name Keyboard Events
    /// @{

    /// Adds the accelerator key for this object to the canvas
    void addAcceleratorKey();

    /// Adds this control's accelerator key to the accelerator map, and
    /// recursively tells all children to do the same.
    virtual void buildAcceleratorMap();

    /// Occurs when the accelerator key for this control is pressed
    ///
    /// @param   index   Index in the acclerator map of the key
    virtual void acceleratorKeyPress(U32 index);

    /// Occurs when the accelerator key for this control is released
    ///
    /// @param   index   Index in the acclerator map of the key
    virtual void acceleratorKeyRelease(U32 index);

    /// Happens when a key is depressed
    /// @param   event   Event descriptor (which contains the key)
    virtual bool onKeyDown(const GuiEvent &event);

    /// Happens when a key is released
    /// @param   event   Event descriptor (which contains the key)
    virtual bool onKeyUp(const GuiEvent &event);

    /// Happens when the same key that was pressed last press is pressed again
    /// @param   event   Event descriptor (which contains the key)
    virtual bool onKeyRepeat(const GuiEvent &event);
    /// @}

    /// Sets the control profile for this control.
    ///
    /// @see GuiControlProfile
    /// @param   prof   Control profile to apply
    void setControlProfile(GuiControlProfile *prof);

    /// Occurs when this control performs its "action"
    virtual void onAction();

    /// @name Peer Messaging
    /// Used to send a message to other GUIControls which are children of the same parent.
    ///
    /// This is mostly used by radio controls.
    /// @{
    void messageSiblings(S32 message);                      ///< Send a message to all siblings
    virtual void onMessage(GuiControl *sender, S32 msg);    ///< Receive a message from another control
    /// @}

    /// @name Canvas Events
    /// Functions called by the canvas
    /// @{

    /// Called if this object is a dialog, when it is added to the visible layers
    virtual void onDialogPush();

    /// Called if this object is a dialog, when it is removed from the visible layers
    virtual void onDialogPop();
    /// @}

    /// Renders justified text using the profile.
    ///
    /// @note This should move into the graphics library at some point
    void renderJustifiedText(Point2I offset, Point2I extent, const char *text);

    void inspectPostApply();
    void inspectPreApply();
};

#ifdef TGE_RPG
DECLARE_CONSOLETYPE(GuiControl);
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -