/// <summary> /// Return whether the given component image is specified via a /// property. /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image to check. /// </param> /// <returns> /// - true if the image is specified and fetched via a property. /// - false if the image is not fetched via a property /// (or is not specified) /// </returns> public bool IsImageFetchedFromProperty(FrameImageComponent part) { Debug.Assert((int)part < (int)FrameImageComponent.FIC_FRAME_IMAGE_COUNT); return(FrameImages[(int)part].d_specified && !String.IsNullOrEmpty(FrameImages[(int)part].d_propertyName)); }
/// <summary> /// Set the name of the Property that will be accesssed on the target /// Window to determine the Image that will be drawn by the /// FrameComponent. /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image to be set. /// </param> /// <param name="name"> /// String holding the name of a property that will be accessed. If this /// is the empty string then drawing of the component image specified by /// \a part will be disabled. /// </param> public void SetImagePropertySource(FrameImageComponent part, string name) { Debug.Assert((int)part < (int)FrameImageComponent.FIC_FRAME_IMAGE_COUNT); FrameImages[(int)part].d_image = null; FrameImages[(int)part].d_specified = !String.IsNullOrEmpty(name); FrameImages[(int)part].d_propertyName = name; }
/// <summary> /// Set an Image that will be drawn by this FrameComponent. /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image to be set. /// </param> /// <param name="image"> /// Pointer to the Image object to be drawn. If this is 0 then drawing /// of the component image specified by \a part will be disabled. /// </param> public void SetImage(FrameImageComponent part, Image image) { Debug.Assert((int)part < (int)FrameImageComponent.FIC_FRAME_IMAGE_COUNT); FrameImages[(int)part].d_image = image; FrameImages[(int)part].d_specified = image != null; FrameImages[(int)part].d_propertyName = String.Empty; }
/// <summary> /// Set an Image that will be drawn by this FrameComponent. /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image to be set. /// </param> /// <param name="name"> /// String holding the name of an Image. The image should already exist, /// if the Image does not exist an Exception will be logged and /// drawing of the component image specified by \a part will be /// disabled. /// </param> public void SetImage(FrameImageComponent part, string name) { Image image; try { image = ImageManager.GetSingleton().Get(name); } catch (UnknownObjectException) { image = null; } SetImage(part, image); }
/// <summary> /// Return the Image object that will be drawn by this FrameComponent /// for a specified frame part. /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image to be accessed. /// </param> /// <param name="wnd"> /// Reference to a Window object that will be accessed if the image /// component is fetched from a Property. /// </param> /// <returns> /// pointer to an Image object, or 0 if the image had not been set /// or if the image is sourced from a property that returns an empty /// image name. /// </returns> public Image GetImage(FrameImageComponent part, Window wnd) { Debug.Assert((int)part < (int)FrameImageComponent.FIC_FRAME_IMAGE_COUNT); if (!FrameImages[(int)part].d_specified) { return(null); } if (String.IsNullOrEmpty(FrameImages[(int)part].d_propertyName)) { return(FrameImages[(int)part].d_image); } return(wnd.GetProperty <Image>(FrameImages[(int)part].d_propertyName)); }
/// <summary> /// Return the name of the property that will be used to determine the /// image to use for the given component image. /// /// If the returned String is empty, it indicates either that the /// component image is not specified or that the component image is not /// sourced from a property. /// /// \see /// isImageFetchedFromProperty isImageSpecified /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image property source to return. /// </param> /// <returns></returns> public string GetImagePropertySource(FrameImageComponent part) { Debug.Assert((int)part < (int)FrameImageComponent.FIC_FRAME_IMAGE_COUNT); return(FrameImages[(int)part].d_propertyName); }
/// <summary> /// Return whether the given component image has been specified. /// </summary> /// <param name="part"> /// One of the FrameImageComponent enumerated values specifying the /// component image to check. /// </param> /// <returns> /// - true if the image is specified and will be drawn. /// - false if the image is not specified. /// </returns> public bool IsImageSpecified(FrameImageComponent part) { Debug.Assert((int)part < (int)FrameImageComponent.FIC_FRAME_IMAGE_COUNT); return(FrameImages[(int)part].d_specified); }