Exemple #1
0
 /// <summary>
 /// Get the current state of this group from the underlying control
 /// </summary>
 protected IntPtr SetState(GroupState newState, GroupState mask)
 {
     NativeMethods.LVGROUP2 group = new NativeMethods.LVGROUP2();
     group.cbSize    = ((uint)Marshal.SizeOf(typeof(NativeMethods.LVGROUP2)));
     group.mask      = (uint)GroupMask.LVGF_STATE;
     group.state     = (uint)newState;
     group.stateMask = (uint)mask;
     return(NativeMethods.SetGroupInfo(this.ListView, this.GroupId, group));
 }
Exemple #2
0
        /// <summary>
        /// Get the current state of this group from the underlying control
        /// </summary>
        protected int SetState(GroupState state, GroupState stateMask)
        {
            var group = new NativeMethods.LVGROUP2();

            group.cbSize    = ((uint)Marshal.SizeOf(typeof(NativeMethods.LVGROUP2)));
            group.mask      = (uint)GroupMask.LVGF_STATE;
            group.state     = (uint)state;
            group.stateMask = (uint)stateMask;
            return(NativeMethods.SetGroupInfo(ListView, GroupId, group));
        }
Exemple #3
0
 /// <summary>
 /// Get the current state of this group from the underlying control
 /// </summary>
 protected int SetState(GroupState newState, GroupState mask) {
     NativeMethods.LVGROUP2 group = new NativeMethods.LVGROUP2();
     group.cbSize = ((uint)Marshal.SizeOf(typeof(NativeMethods.LVGROUP2)));
     group.mask = (uint)GroupMask.LVGF_STATE;
     group.state = (uint)newState;
     group.stateMask = (uint)mask;
     return NativeMethods.SetGroupInfo(this.ListView, this.GroupId, group);
 }
Exemple #4
0
        /// <summary>
        /// Create a native LVGROUP structure that matches this group
        /// </summary>
        internal NativeMethods.LVGROUP2 AsNativeGroup(bool withId) {

            NativeMethods.LVGROUP2 group = new NativeMethods.LVGROUP2();
            group.cbSize = (uint)Marshal.SizeOf(typeof(NativeMethods.LVGROUP2));
            group.mask = (uint)(GroupMask.LVGF_HEADER ^ GroupMask.LVGF_ALIGN ^ GroupMask.LVGF_STATE);
            group.pszHeader = this.Header;
            group.uAlign = (uint)this.HeaderAlignment;
            group.stateMask = (uint)this.StateMask;
            group.state = (uint)this.State;

            if (withId) {
                group.iGroupId = this.GroupId;
                group.mask ^= (uint)GroupMask.LVGF_GROUPID;
            }

            if (!String.IsNullOrEmpty(this.Footer)) {
                group.pszFooter = this.Footer;
                group.mask ^= (uint)GroupMask.LVGF_FOOTER;
            }

            if (!String.IsNullOrEmpty(this.Subtitle)) {
                group.pszSubtitle = this.Subtitle;
                group.mask ^= (uint)GroupMask.LVGF_SUBTITLE;
            }

            if (!String.IsNullOrEmpty(this.Task)) {
                group.pszTask = this.Task;
                group.mask ^= (uint)GroupMask.LVGF_TASK;
            }

            if (!String.IsNullOrEmpty(this.TopDescription)) {
                group.pszDescriptionTop = this.TopDescription;
                group.mask ^= (uint)GroupMask.LVGF_DESCRIPTIONTOP;
            }

            if (!String.IsNullOrEmpty(this.BottomDescription)) {
                group.pszDescriptionBottom = this.BottomDescription;
                group.mask ^= (uint)GroupMask.LVGF_DESCRIPTIONBOTTOM;
            }

            int imageIndex = this.GetImageIndex(this.TitleImage);
            if (imageIndex >= 0) {
                group.iTitleImage = imageIndex;
                group.mask ^= (uint)GroupMask.LVGF_TITLEIMAGE;
            }

            imageIndex = this.GetImageIndex(this.ExtendedImage);
            if (imageIndex >= 0) {
                group.iExtendedImage = imageIndex;
                group.mask ^= (uint)GroupMask.LVGF_EXTENDEDIMAGE;
            }

            if (!String.IsNullOrEmpty(this.SubsetTitle)) {
                group.pszSubsetTitle = this.SubsetTitle;
                group.mask ^= (uint)GroupMask.LVGF_SUBSET;
            }

            if (this.VirtualItemCount > 0) {
                group.cItems = this.VirtualItemCount;
                group.mask ^= (uint)GroupMask.LVGF_ITEMS;
            }

            return group;
        }
Exemple #5
0
        /// <summary>
        /// Create a native LVGROUP structure that matches this group
        /// </summary>
        internal NativeMethods.LVGROUP2 AsNativeGroup(bool withId)
        {
            NativeMethods.LVGROUP2 group = new NativeMethods.LVGROUP2();
            group.cbSize    = (uint)Marshal.SizeOf(typeof(NativeMethods.LVGROUP2));
            group.mask      = (uint)(GroupMask.LVGF_HEADER ^ GroupMask.LVGF_ALIGN ^ GroupMask.LVGF_STATE);
            group.pszHeader = this.Header;
            group.uAlign    = (uint)this.HeaderAlignment;
            group.stateMask = (uint)this.StateMask;
            group.state     = (uint)this.State;

            if (withId)
            {
                group.iGroupId = this.GroupId;
                group.mask    ^= (uint)GroupMask.LVGF_GROUPID;
            }

            if (!String.IsNullOrEmpty(this.Footer))
            {
                group.pszFooter = this.Footer;
                group.mask     ^= (uint)GroupMask.LVGF_FOOTER;
            }

            if (!String.IsNullOrEmpty(this.Subtitle))
            {
                group.pszSubtitle = this.Subtitle;
                group.mask       ^= (uint)GroupMask.LVGF_SUBTITLE;
            }

            if (!String.IsNullOrEmpty(this.Task))
            {
                group.pszTask = this.Task;
                group.mask   ^= (uint)GroupMask.LVGF_TASK;
            }

            if (!String.IsNullOrEmpty(this.TopDescription))
            {
                group.pszDescriptionTop = this.TopDescription;
                group.mask ^= (uint)GroupMask.LVGF_DESCRIPTIONTOP;
            }

            if (!String.IsNullOrEmpty(this.BottomDescription))
            {
                group.pszDescriptionBottom = this.BottomDescription;
                group.mask ^= (uint)GroupMask.LVGF_DESCRIPTIONBOTTOM;
            }

            int imageIndex = this.GetImageIndex(this.TitleImage);

            if (imageIndex >= 0)
            {
                group.iTitleImage = imageIndex;
                group.mask       ^= (uint)GroupMask.LVGF_TITLEIMAGE;
            }

            imageIndex = this.GetImageIndex(this.ExtendedImage);
            if (imageIndex >= 0)
            {
                group.iExtendedImage = imageIndex;
                group.mask          ^= (uint)GroupMask.LVGF_EXTENDEDIMAGE;
            }

            if (!String.IsNullOrEmpty(this.SubsetTitle))
            {
                group.pszSubsetTitle = this.SubsetTitle;
                group.mask          ^= (uint)GroupMask.LVGF_SUBSET;
            }

            if (this.VirtualItemCount > 0)
            {
                group.cItems = this.VirtualItemCount;
                group.mask  ^= (uint)GroupMask.LVGF_ITEMS;
            }

            return(group);
        }