<commit_before>/** <title>ETLayoutItemGroup</title>
	
	<abstract>A layout item tree node which can contain arbitrary 
	ETLayoutItem subclass instances.</abstract>
 
	Copyright (C) 2007 <NAME>
 
	Author:  <NAME> <<EMAIL>>
	Date:  May 2007
	License: Modified BSD (see COPYING)
 */

#import <Foundation/Foundation.h>
#import <EtoileFoundation/ETCollection.h>
#import <AppKit/AppKit.h>
#import <EtoileUI/ETLayoutItem.h>
#import <EtoileUI/ETLayout.h>
#import <EtoileUI/ETWidgetLayout.h>

@class ETController;

/** You must never subclass ETLayoutItemGroup. */
@interface ETLayoutItemGroup : ETLayoutItem <ETLayoutingContext, ETWidgetLayoutingContext, ETItemSelection, ETCollection, ETCollectionMutation>
{
	@private
	NSMutableArray *_layoutItems;
	NSMutableArray *_sortedItems;
	NSArray *_arrangedItems;
	ETLayout *_layout;
	NSImage *_cachedDisplayImage;
	SEL _doubleClickAction;
	BOOL _autolayout;
	BOOL _usesLayoutBasedFrame;
	BOOL _reloading; /* ivar used by ETMutationHandler category */
	BOOL _hasNewContent;
	BOOL _hasNewLayout;
	/* Indicates whether -arrangedItems has changed since the layout was last 
       updated. Sets to YES when the receiver is filtered and/or sorted. */
	BOOL _hasNewArrangement;
	BOOL _shouldMutateRepresentedObject;
	BOOL _sorted;
	BOOL _filtered;
	BOOL _isLayerItem;
	/* We hide the supervisor view subviews when a display cache is set. We 
	   must restore [[[self supervisorView] wrappedView] isHidden] correctly. */
	BOOL _wasViewHidden;
	BOOL _changingSelection;
}

/* Traversing Layout Item Tree */

- (ETLayoutItem *) itemAtIndexPath: (NSIndexPath *)path;
- (ETLayoutItem *) itemForIdentifier: (NSString *)anId;

- (NSString *) descriptionWithProperty: (NSString *)aProperty arranged: (BOOL)usesArrangedItems;

/*  Manipulating Layout Item Tree */

- (void) addItem: (ETLayoutItem *)item;
- (void) insertItem: (ETLayoutItem *)item atIndex: (int)index;
- (void) removeItem: (ETLayoutItem *)item;
- (void) removeItemAtIndex: (int)index;
- (ETLayoutItem *) itemAtIndex: (int)index;
- (ETLayoutItem *) firstItem;
- (ETLayoutItem *) lastItem;
- (int) indexOfItem: (id)item;
- (BOOL) containsItem: (ETLayoutItem *)item;
- (int) numberOfItems;
- (void) addItems: (NSArray *)items;
- (void) removeItems: (NSArray *)items;
- (void) removeAllItems;
- (NSArray *) items;
- (NSArray *) descendantItemsSharingSameBaseItem;
- (NSArray *) allDescendantItems;
- (BOOL) isDescendantItem: (ETLayoutItem *)anItem;

- (BOOL) canReload;
- (void) reload;
- (void) reloadIfNeeded;

- (void) handleAttachItem: (ETLayoutItem *)item;
- (void) handleAttachViewOfItem: (ETLayoutItem *)item;
- (void) handleDetachItem: (ETLayoutItem *)item;
- (void) handleDetachViewOfItem: (ETLayoutItem *)item;

- (BOOL) shouldMutateRepresentedObject;
- (void) setShouldMutateRepresentedObject: (BOOL)flag;
- (BOOL) usesRepresentedObjectAsProvider;
- (id) source;
- (void) setSource: (id)source;
- (id) delegate;
- (void) setDelegate: (id)delegate;
- (ETController *) controller;
- (void) setController: (ETController *)aController;

/* Layout */

- (id) layout;
- (void) setLayout: (ETLayout *)layout;

- (void) reloadAndUpdateLayout;
- (void) updateLayout;
- (void) updateLayoutRecursively: (BOOL)recursively;
- (BOOL) canUpdateLayout;

- (BOOL) isAutolayout;
- (void) setAutolayout: (BOOL)flag;
- (BOOL) usesLayoutBasedFrame;
- (void) setUsesLayoutBasedFrame: (BOOL)flag;

/* Layouting Context Protocol */

- (void) setLayoutView: (NSView *)aView;
- (NSArray *) visibleItems;
- (void) setVisibleItems: (NSArray *)items;
- (NSArray *) visibleItemsForItems: (NSArray *)items;
- (void) setVisibleItems: (NSArray *)visibleItems forItems: (NSArray *)items;
- (NSSize) visibleContentSize;

/* Item scaling */

- (float) itemScaleFactor;
- (void) setItemScaleFactor: (float)aFactor;

/* Rendering */

- (void) render: (NSMutableDictionary *)inputValues 
      dirtyRect: (NSRect)dirtyRect 
      inContext: (id)ctxt;

- (void) setCachedDisplayImage: (NSImage *)anImage;
- (NSImage *) cachedDisplayImage;

/* Selection */

- (unsigned int) selectionIndex;
- (void) setSelectionIndex: (unsigned int)index;
- (NSMutableIndexSet *) selectionIndexes;
- (void) setSelectionIndexes: (NSIndexSet *)indexes;
- (NSArray *) selectionIndexPaths;
- (void) setSelectionIndexPaths: (NSArray *)indexPaths;
- (BOOL) isChangingSelection;

- (NSArray *) selectedItems;
- (NSArray *) selectedItemsInLayout;

/* Sorting and Filtering */

- (void) sortWithSortDescriptors: (NSArray *)descriptors recursively: (BOOL)recursively;
- (void) filterWithPredicate: (NSPredicate *)predicate recursively: (BOOL)recursively;
- (NSArray *) arrangedItems;
- (BOOL) isSorted;
- (BOOL) isFiltered;

/* Actions */

- (void) setDoubleAction: (SEL)selector;
- (SEL) doubleAction;
- (ETLayoutItem *) doubleClickedItem;
- (BOOL) acceptsActionsForItemsOutsideOfFrame;

/* Stacking */

- (BOOL) isStack;
- (BOOL) isStacked;
- (void) stack;
- (void) unstack;

/* Framework Private */
<commit_msg>Forgot to commit some changes<commit_after>/** <title>ETLayoutItemGroup</title>
	
	<abstract>A layout item tree node which can contain arbitrary 
	ETLayoutItem subclass instances.</abstract>
 
	Copyright (C) 2007 <NAME>
 
	Author:  <NAME> <<EMAIL>>
	Date:  May 2007
	License: Modified BSD (see COPYING)
 */

#import <Foundation/Foundation.h>
#import <EtoileFoundation/ETCollection.h>
#import <AppKit/AppKit.h>
#import <EtoileUI/ETLayoutItem.h>
#import <EtoileUI/ETLayout.h>
#import <EtoileUI/ETWidgetLayout.h>

@class ETController;

/** You must never subclass ETLayoutItemGroup. */
@interface ETLayoutItemGroup : ETLayoutItem <ETLayoutingContext, ETWidgetLayoutingContext, ETItemSelection, ETCollection, ETCollectionMutation>
{
	@private
	NSMutableArray *_layoutItems;
	NSMutableArray *_sortedItems;
	NSArray *_arrangedItems;
	ETLayout *_layout;
	NSImage *_cachedDisplayImage;
	SEL _doubleClickAction;
	BOOL _autolayout;
	BOOL _usesLayoutBasedFrame;
	BOOL _reloading; /* ivar used by ETMutationHandler category */
	BOOL _hasNewContent;
	BOOL _hasNewLayout;
	/* Indicates whether -arrangedItems has changed since the layout was last 
       updated. Sets to YES when the receiver is filtered and/or sorted. */
	BOOL _hasNewArrangement;
	BOOL _shouldMutateRepresentedObject;
	BOOL _sorted;
	BOOL _filtered;
	BOOL _isLayerItem;
	/* We hide the supervisor view subviews when a display cache is set. We 
	   must restore [[[self supervisorView] wrappedView] isHidden] correctly. */
	BOOL _wasViewHidden;
	BOOL _changingSelection;
}

/* Traversing Layout Item Tree */

- (ETLayoutItem *) itemAtIndexPath: (NSIndexPath *)path;
- (ETLayoutItem *) itemForIdentifier: (NSString *)anId;

- (NSString *) descriptionWithProperty: (NSString *)aProperty arranged: (BOOL)usesArrangedItems;

/*  Manipulating Layout Item Tree */

- (void) addItem: (ETLayoutItem *)item;
- (void) insertItem: (ETLayoutItem *)item atIndex: (int)index;
- (void) removeItem: (ETLayoutItem *)item;
- (void) removeItemAtIndex: (int)index;
- (ETLayoutItem *) itemAtIndex: (int)index;
- (ETLayoutItem *) firstItem;
- (ETLayoutItem *) lastItem;
- (int) indexOfItem: (id)item;
- (BOOL) containsItem: (ETLayoutItem *)item;
- (int) numberOfItems;
- (void) addItems: (NSArray *)items;
- (void) removeItems: (NSArray *)items;
- (void) removeAllItems;
- (NSArray *) items;
- (NSArray *) descendantItemsSharingSameBaseItem;
- (NSArray *) allDescendantItems;
- (BOOL) isDescendantItem: (ETLayoutItem *)anItem;

- (BOOL) canReload;
- (void) reload;
- (void) reloadIfNeeded;

- (void) handleAttachItem: (ETLayoutItem *)item;
- (void) handleAttachViewOfItem: (ETLayoutItem *)item;
- (void) handleDetachItem: (ETLayoutItem *)item;
- (void) handleDetachViewOfItem: (ETLayoutItem *)item;

- (BOOL) shouldMutateRepresentedObject;
- (void) setShouldMutateRepresentedObject: (BOOL)flag;
- (BOOL) usesRepresentedObjectAsProvider;
- (id) source;
- (void) setSource: (id)source;
- (id) delegate;
- (void) setDelegate: (id)delegate;
- (ETController *) controller;
- (void) setController: (ETController *)aController;

/* Layout */

- (id) layout;
- (void) setLayout: (ETLayout *)layout;

- (void) reloadAndUpdateLayout;
- (void) updateLayout;
- (void) updateLayoutRecursively: (BOOL)recursively;
- (BOOL) canUpdateLayout;

- (BOOL) isAutolayout;
- (void) setAutolayout: (BOOL)flag;
- (BOOL) usesLayoutBasedFrame;
- (void) setUsesLayoutBasedFrame: (BOOL)flag;

/* Layouting Context Protocol */

- (void) setLayoutView: (NSView *)aView;
- (NSArray *) visibleItems;
- (void) setVisibleItems: (NSArray *)items;
- (NSArray *) visibleItemsForItems: (NSArray *)items;
- (void) setVisibleItems: (NSArray *)visibleItems forItems: (NSArray *)items;
- (NSSize) visibleContentSize;

/* Item scaling */

- (float) itemScaleFactor;
- (void) setItemScaleFactor: (float)aFactor;

/* Rendering */

- (void) render: (NSMutableDictionary *)inputValues 
      dirtyRect: (NSRect)dirtyRect 
      inContext: (id)ctxt;

- (void) setCachedDisplayImage: (NSImage *)anImage;
- (NSImage *) cachedDisplayImage;

/* Selection */

- (unsigned int) selectionIndex;
- (void) setSelectionIndex: (unsigned int)index;
- (NSMutableIndexSet *) selectionIndexes;
- (void) setSelectionIndexes: (NSIndexSet *)indexes;
- (NSArray *) selectionIndexPaths;
- (void) setSelectionIndexPaths: (NSArray *)indexPaths;
- (BOOL) isChangingSelection;

- (NSArray *) selectedItems;
- (NSArray *) selectedItemsInLayout;

/* Sorting and Filtering */

- (void) sortWithSortDescriptors: (NSArray *)descriptors recursively: (BOOL)recursively;
- (void) filterWithPredicate: (NSPredicate *)predicate recursively: (BOOL)recursively;
- (NSArray *) arrangedItems;
- (BOOL) isSorted;
- (BOOL) isFiltered;

/* Actions */

- (void) setDoubleAction: (SEL)selector;
- (SEL) doubleAction;
- (ETLayoutItem *) doubleClickedItem;
- (BOOL) acceptsActionsForItemsOutsideOfFrame;

/* Stacking */

- (BOOL) isStack;
- (BOOL) isStacked;
- (void) stack;
- (void) unstack;

/** @taskunit Additions to ETCollectionMutation */

- (ETLayoutItem *) insertObject: (id)object 
                        atIndex: (unsigned int)index 
                           hint: (id)hint 
                   boxingForced: (BOOL)boxingForced;

/* Framework Private */

{'fraction_non_alphanumeric': 0.1345357776463631, 'fraction_numerical': 0.001576976148235758, 'mean_word_length': 5.236631837738169, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2944385', 'n_tokens_mistral': 3415, 'n_tokens_neox': 3296, 'n_words': 820}