| 7688 | |
| 7689 | |
| 7690 | void GuiType::VisibilityChanged() |
| 7691 | { |
| 7692 | // Adjust the ref count to reflect the fact that the user has a "reference" to the GUI; |
| 7693 | // that is, the user can interact with it, raising events which may cause callbacks into |
| 7694 | // script. The script doesn't need any other references to the GUI, since one will be |
| 7695 | // provided in the event callback. |
| 7696 | // In other words, the script is not required to keep a reference to the object while the |
| 7697 | // GUI is visible, but also isn't required to Destroy() it explicitly. Destroy() will be |
| 7698 | // called automatically when the last reference is released (which may be below). |
| 7699 | bool visible = IsWindowVisible(mHwnd); |
| 7700 | if (visible != mVisibleRefCounted) // Visibility really has changed. |
| 7701 | { |
| 7702 | mVisibleRefCounted = visible; // Change this first in case of recursion. |
| 7703 | if (visible) |
| 7704 | AddRef(); |
| 7705 | else |
| 7706 | Release(); |
| 7707 | } |
| 7708 | } |
| 7709 | |
| 7710 | |
| 7711 |
nothing calls this directly
no outgoing calls
no test coverage detected