/** @packageDocumentation
 * @module UnifiedSelection
 */
import { IDisposable } from "@itwin/core-bentley";
import { IModelConnection } from "@itwin/core-frontend";
import { Keys, KeySet } from "@itwin/presentation-common";
import { ISelectionProvider } from "./ISelectionProvider";
import { SelectionChangeEventArgs, SelectionChangesListener } from "./SelectionChangeEvent";
import { SelectionManager } from "./SelectionManager";
/**
 * Properties for creating a `SelectionHandler` instance.
 * @public
 */
export interface SelectionHandlerProps {
    /** SelectionManager used to store overall selection. */
    manager: SelectionManager;
    /** iModel connection the selection changes will be associated with. */
    imodel: IModelConnection;
    /**
     * Name of the selection handler. This is an identifier of what caused the
     * selection to change, set as `SelectionChangeEventArgs.source` when firing
     * selection change events. `SelectionHandler.shouldHandle` uses `name` to filter
     * events that it doesn't need to handle.
     */
    name: string;
    /**
     * ID of presentation ruleset used by the component using this handler. The ID is set as
     * `SelectionChangeEventArgs.rulesetId` when making selection changes and event
     * listeners can use or ignore this information.
     */
    rulesetId?: string;
    /** Callback function called when selection changes. */
    onSelect?: SelectionChangesListener;
}
/**
 * A class that handles selection changes and helps to change
 * internal the selection state.
 *
 * @public
 */
export declare class SelectionHandler implements IDisposable {
    private _inSelect;
    private _disposables;
    /** Selection manager used by this handler to manage selection */
    readonly manager: SelectionManager;
    /** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */
    name: string;
    /** iModel whose selection is being handled */
    imodel: IModelConnection;
    /**
     * Id of a ruleset selection changes will be associated with.
     * @see `SelectionHandlerProps.rulesetId`
     */
    rulesetId?: string;
    /** Callback function called when selection changes */
    onSelect?: SelectionChangesListener;
    /**
     * Constructor.
     */
    constructor(props: SelectionHandlerProps);
    /**
     * Destructor. Must be called before disposing this object to make sure it cleans
     * up correctly.
     */
    dispose(): void;
    /**
     * Called when the selection changes. Handles this callback by first checking whether
     * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
     */
    protected onSelectionChanged: (evt: SelectionChangeEventArgs, provider: ISelectionProvider) => void;
    /** Called to check whether the event should be handled by this handler */
    protected shouldHandle(evt: SelectionChangeEventArgs): boolean;
    /** Get selection levels for the imodel managed by this handler */
    getSelectionLevels(): number[];
    /**
     * Get selection for the imodel managed by this handler.
     * @param level Level of the selection to get. Defaults to 0.
     */
    getSelection(level?: number): Readonly<KeySet>;
    /**
     * Add to selection.
     * @param keys The keys to add to selection.
     * @param level Level of the selection.
     */
    addToSelection(keys: Keys, level?: number): void;
    /**
     * Remove from selection.
     * @param keys The keys to remove from selection.
     * @param level Level of the selection.
     */
    removeFromSelection(keys: Keys, level?: number): void;
    /**
     * Change selection.
     * @param keys The keys indicating the new selection.
     * @param level Level of the selection.
     */
    replaceSelection(keys: Keys, level?: number): void;
    /**
     * Clear selection.
     * @param level Level of the selection.
     */
    clearSelection(level?: number): void;
}
//# sourceMappingURL=SelectionHandler.d.ts.map