PageRenderTime 8ms CodeModel.GetById 3ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/llui/llviewinject.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 56 lines | 17 code | 8 blank | 31 comment | 0 complexity | c99e42515fca98e0de3a6ac5a7929afd MD5 | raw file
 1/**
 2 * @file   llviewinject.h
 3 * @author Nat Goodspeed
 4 * @date   2011-08-16
 5 * @brief  Supplemental LLView functionality used for simulating UI events.
 6 * 
 7 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
 8 * Copyright (c) 2011, Linden Research, Inc.
 9 * $/LicenseInfo$
10 */
11
12#if ! defined(LL_LLVIEWINJECT_H)
13#define LL_LLVIEWINJECT_H
14
15#include "llview.h"
16#include <map>
17
18namespace llview
19{
20
21    /**
22     * TargetEvent is a callable with state, specifically intended for use as
23     * an LLView::TemporaryDrilldownFunc. Instantiate it with the desired
24     * target LLView*; pass it to a TemporaryDrilldownFunc instance;
25     * TargetEvent::operator() will then attempt to direct subsequent mouse
26     * events to the desired target LLView*. (This is an "attempt" because
27     * LLView will still balk unless the target LLView and every parent are
28     * visible and enabled.)
29     */
30    class TargetEvent
31    {
32    public:
33        /**
34         * Construct TargetEvent with the desired target LLView*. (See
35         * LLUI::resolvePath() to obtain an LLView* given a string pathname.)
36         * This sets up for operator().
37         */
38        TargetEvent(LLView* view);
39
40        /**
41         * This signature must match LLView::DrilldownFunc. When you install
42         * this TargetEvent instance using LLView::TemporaryDrilldownFunc,
43         * LLView will call this method to decide whether to propagate an
44         * incoming mouse event to the passed child LLView*.
45         */
46        bool operator()(const LLView*, S32 x, S32 y) const;
47
48    private:
49        // For a given parent LLView, identify which child to select.
50        typedef std::map<LLView*, LLView*> ChildMap;
51        ChildMap mChildMap;
52    };
53
54} // llview namespace
55
56#endif /* ! defined(LL_LLVIEWINJECT_H) */