Placeholder implementation of -setInterfaceState:.

This commit is contained in:
Scott Goodson
2015-11-28 17:45:43 -08:00
parent ff0e94b4e1
commit 943cae7eb9
2 changed files with 34 additions and 1 deletions

View File

@@ -46,7 +46,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState)
ASInterfaceStateMeasureLayout = 1 << 1,
/** The element is likely enough to come onscreen that disk and/or network data required for display should be fetched. */
ASInterfaceStateFetchData = 1 << 2,
/** The elemant is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */
/** The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */
ASInterfaceStateDisplay = 1 << 3,
/** The element is physically onscreen by at least 1 pixel.
In practice, all other bit fields should also be set when this flag is set. */

View File

@@ -1692,6 +1692,39 @@ void recursivelyEnsureDisplayForLayer(CALayer *layer)
- (void)setInterfaceState:(ASInterfaceState)interfaceState
{
if (interfaceState != _interfaceState) {
if ((interfaceState & ASInterfaceStateMeasureLayout) != (_interfaceState & ASInterfaceStateMeasureLayout)) {
// Trigger asynchronous measurement if it is not already cached or being calculated.
}
// Entered or exited data loading state.
if ((interfaceState & ASInterfaceStateFetchData) != (_interfaceState & ASInterfaceStateFetchData)) {
if (interfaceState & ASInterfaceStateFetchData) {
[self fetchData];
} else {
[self clearFetchedData];
}
}
// Entered or exited contents rendering state.
if ((interfaceState & ASInterfaceStateDisplay) != (_interfaceState & ASInterfaceStateDisplay)) {
if (interfaceState & ASInterfaceStateDisplay) {
// Once the working window is eliminated (ASRangeHandlerRender), trigger display directly here.
[self setDisplaySuspended:NO];
} else {
[self setDisplaySuspended:YES];
[self clearContents];
}
}
// Entered or exited data loading state.
if ((interfaceState & ASInterfaceStateVisible) != (_interfaceState & ASInterfaceStateVisible)) {
if (interfaceState & ASInterfaceStateVisible) {
// Consider providing a -didBecomeVisible.
} else {
// Consider providing a -didBecomeInvisible.
}
}
_interfaceState = interfaceState;
}
}