internal void GetSetState(out NativeMethods.ListViewGroupState m, out NativeMethods.ListViewGroupState s)
 {
     m = s = NativeMethods.ListViewGroupState.Normal;
     if (collapsed.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.Collapsed; if (collapsed.Value)
         {
             s |= NativeMethods.ListViewGroupState.Collapsed;
         }
     }
     if (collapsible.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.Collapsible; if (collapsible.Value)
         {
             s |= NativeMethods.ListViewGroupState.Collapsible;
         }
     }
     if (focused.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.Focused; if (focused.Value)
         {
             s |= NativeMethods.ListViewGroupState.Focused;
         }
     }
     if (hidden.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.Hidden; if (hidden.Value)
         {
             s |= NativeMethods.ListViewGroupState.Hidden;
         }
     }
     if (noheader.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.NoHeader; if (noheader.Value)
         {
             s |= NativeMethods.ListViewGroupState.NoHeader;
         }
     }
     if (selected.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.Selected; if (selected.Value)
         {
             s |= NativeMethods.ListViewGroupState.Selected;
         }
     }
     if (subseted.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.Subseted; if (subseted.Value)
         {
             s |= NativeMethods.ListViewGroupState.Subseted;
         }
     }
     if (subsetlinkfocused.HasValue)
     {
         m |= NativeMethods.ListViewGroupState.SubsetLinkFocused; if (subsetlinkfocused.Value)
         {
             s |= NativeMethods.ListViewGroupState.SubsetLinkFocused;
         }
     }
 }
 private void SetState(NativeMethods.ListViewGroupState item, bool on, ref bool?localVar)
 {
     if (this.ListView != null)
     {
         this.ListView.SetGroupState(this, item, on);
     }
     localVar = on;
 }
 private bool GetState(NativeMethods.ListViewGroupState item, ref bool?localVar)
 {
     if (this.ListView != null)
     {
         NativeMethods.ListViewGroupState s = this.ListView.GetGroupState(this, item);
         localVar = ((s & item) != 0);
     }
     return(localVar.GetValueOrDefault(false));
 }
Esempio n. 4
0
        private static bool GetState(ListViewGroup group, NativeMethods.ListViewGroupState state)
        {
            int groupId = GetGroupId(group);

            if (groupId < 0)
            {
                return(false);
            }
            return((NativeMethods.SendMessage(group.ListView.Handle, (uint)NativeMethods.ListViewMessage.GetGroupState, (IntPtr)groupId, new IntPtr((int)state)).ToInt32() & (int)state) != 0);
        }
Esempio n. 5
0
        private static void SetState(ListViewGroup group, NativeMethods.ListViewGroupState state, bool value)
        {
            int groupId = GetGroupId(group);

            if (groupId >= 0)
            {
                NativeMethods.LVGROUP lvgroup = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.State);
                {
                    lvgroup.SetState(state, value);
                    NativeMethods.SendMessage(group.ListView.Handle, (uint)NativeMethods.ListViewMessage.SetGroupInfo, (IntPtr)groupId, lvgroup);
                }
            }
        }
        private void SetAllGroupState(NativeMethods.ListViewGroupState state, bool on = true)
        {
            NativeMethods.LVGROUP group = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.State);
            group.SetState(state, on);
            //group.Subtitle = "Dog";

            foreach (ListViewGroup g in this.BaseGroups)
            {
                SendMessage(NativeMethods.ListViewMessage.SetGroupInfo, GetGroupId(g), group);
            }

            using (NativeMethods.LVGROUP grp = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.Subtitle))
            {
                int res = SendMessage(NativeMethods.ListViewMessage.GetGroupInfoByIndex, 0, grp);
                if (res >= 0)
                {
                    System.Diagnostics.Debug.WriteLine(grp.Subtitle);
                }
            }

            RecreateHandle();
        }
 internal void SetGroupState(ListViewGroupEx group, NativeMethods.ListViewGroupState item, bool value)
 {
     NativeMethods.LVGROUP mgroup = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.State);
     mgroup.SetState(item, value);
     SendMessage(NativeMethods.ListViewMessage.SetGroupInfo, GetGroupId(group), mgroup);
 }
 internal NativeMethods.ListViewGroupState GetGroupState(ListViewGroup group, NativeMethods.ListViewGroupState stateMask = (NativeMethods.ListViewGroupState) 0xFF)
 {
     return((NativeMethods.ListViewGroupState)SendMessage(NativeMethods.ListViewMessage.GetGroupState, GetGroupId(group), new IntPtr((int)stateMask)));
 }