/// <summary> /// /// </summary> /// <param name="newRoot"></param> public void SetRootWindow(Window newRoot) { if (_rootWindow == newRoot) { return; } if (_rootWindow != null) { _rootWindow.SetGUIContext(null); } var args = new WindowEventArgs(_rootWindow); _rootWindow = newRoot; if (_rootWindow != null) { _rootWindow.SetGUIContext(this); UpdateRootWindowAreaRects(); //_rootWindow.SyncTargetSurface(); } OnRootWindowChanged(args); }
protected void /*bool*/ WindowDestroyedHandler(object sender, WindowEventArgs args) { var window = args.Window; if (window == _rootWindow) { _rootWindow = null; } if (window == GetWindowContainingCursor()) { ResetWindowContainingCursor(); } if (window == d_modalWindow) { d_modalWindow = null; } if (window == d_captureWindow) { d_captureWindow = null; } if (window == d_defaultTooltipObject) { d_defaultTooltipObject = null; d_weCreatedTooltipObject = false; } // TODO: return true; }
/// <summary> /// notify windows in a hierarchy using default font, when font changes. /// </summary> /// <param name="hierarchyRoot"></param> protected void NotifyDefaultFontChanged(Window hierarchyRoot) { var evtArgs = new WindowEventArgs(hierarchyRoot); if (hierarchyRoot.GetFont(false) == null) { hierarchyRoot.OnFontChanged(evtArgs); } for (var i = 0; i < hierarchyRoot.GetChildCount(); ++i) { NotifyDefaultFontChanged(hierarchyRoot.GetChildAtIdx(i)); } }
// event trigger functions. protected virtual void OnRootWindowChanged(WindowEventArgs args) { if (_rootWindow != null) { UpdateRootWindowAreaRects(); } MarkAsDirty(); var handler = RootWindowChanged; if (handler != null) { handler(this, args); } }
/*! * \brief * Destructor for WindowManager objects * * This will properly destry all remaining Window objects. Note that WindowFactory objects will not * be destroyed (since they are owned by whoever created them). */ // TODO: ~WindowManager(void); /************************************************************************* * Window Related Methods *************************************************************************/ /*! * \brief * * * \param type * \param name * * * \return * \exception InvalidRequestException WindowManager is locked and no Windows may be created. * \exception UnknownObjectException * \exception GenericException */ /// <summary> /// Creates a new Window object of the specified type, and gives it the specified unique name. /// </summary> /// <param name="type"> /// String that describes the type of Window to be created. /// A valid WindowFactory for the specified type must be registered. /// </param> /// <param name="name"> /// String that holds the name that is to be given to the new window. /// If \a name is empty, a name will be generated for the window. /// </param> /// <returns> /// Pointer to the newly created Window object. /// </returns> /// <exception cref="InvalidRequestException"> /// WindowManager is locked and no Windows may be created. /// </exception> /// <exception cref="UnknownObjectException"> /// No WindowFactory is registered for \a type Window objects. /// </exception> /// <exception cref="Exception"> /// Some other error occurred (Exception message has details). /// </exception> public Window CreateWindow(string type, string name = "") { // only allow creation of Window objects if we are in unlocked state if (IsLocked()) { throw new InvalidRequestException("WindowManager is in the locked state."); } var finalName = String.IsNullOrEmpty(name) ? GenerateUniqueWindowName() : name; var wfMgr = WindowFactoryManager.GetSingleton(); var factory = wfMgr.GetFactory(type); var newWindow = factory.CreateWindow(finalName); System.GetSingleton().Logger .LogEvent( "Window '" + finalName + "' of type '" + type + "' has been created. " + newWindow.GetHashCode().ToString("X8"), LoggingLevel.Informative); // see if we need to assign a look to this window if (wfMgr.IsFalagardMappedType(type)) { var fwm = wfMgr.GetFalagardMappingForType(type); // this was a mapped type, so assign a look to the window so it can finalise // its initialisation newWindow.d_falagardType = type; newWindow.SetWindowRenderer(fwm.d_rendererType); newWindow.SetLookNFeel(fwm.d_lookName); InitialiseRenderEffect(newWindow, fwm.d_effectName); } d_windowRegistry.Add(newWindow); // fire event to notify interested parites about the new window. var args = new WindowEventArgs(newWindow); var handler = WindowCreated; if (handler != null) { handler(this, args); } return(newWindow); }