~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to include/test/mir_test/event_factory.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-10-10 14:01:26 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20141010140126-n1czko8na1kuz4ll
Tags: upstream-0.8.0+14.10.20141010
Import upstream version 0.8.0+14.10.20141010

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2012 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 3,
6
 
 * as published by the Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authored by: Robert Carr <robert.carr@canonical.com>
17
 
 */
18
 
 
19
 
#ifndef MIR_TEST_EVENT_FACTORY_H
20
 
#define MIR_TEST_EVENT_FACTORY_H
21
 
 
22
 
#include "mir/geometry/point.h"
23
 
 
24
 
namespace mir
25
 
{
26
 
namespace input
27
 
{
28
 
namespace synthesis
29
 
{
30
 
 
31
 
enum class EventAction
32
 
{
33
 
    Down, Up
34
 
};
35
 
 
36
 
class KeyParameters
37
 
{
38
 
public:
39
 
    KeyParameters();
40
 
 
41
 
    KeyParameters& from_device(int device_id);
42
 
    KeyParameters& of_scancode(int scancode);
43
 
    KeyParameters& with_action(EventAction action);
44
 
 
45
 
    int device_id;
46
 
    int scancode;
47
 
    EventAction action;
48
 
};
49
 
KeyParameters a_key_down_event();
50
 
KeyParameters a_key_up_event();
51
 
 
52
 
class ButtonParameters
53
 
{
54
 
public:
55
 
    ButtonParameters();
56
 
    ButtonParameters& from_device(int device_id);
57
 
    ButtonParameters& of_button(int scancode);
58
 
    ButtonParameters& with_action(EventAction action);
59
 
 
60
 
    int device_id;
61
 
    int button;
62
 
    EventAction action;
63
 
};
64
 
ButtonParameters a_button_down_event();
65
 
ButtonParameters a_button_up_event();
66
 
 
67
 
class MotionParameters
68
 
{
69
 
public:
70
 
    MotionParameters();
71
 
    MotionParameters& from_device(int device_id);
72
 
    MotionParameters& with_movement(int rel_x, int rel_y);
73
 
 
74
 
    int device_id;
75
 
    int rel_x;
76
 
    int rel_y;
77
 
};
78
 
MotionParameters a_motion_event();
79
 
 
80
 
class TouchParameters
81
 
{
82
 
public:
83
 
    enum class Action
84
 
    {
85
 
        Tap = 0,
86
 
        Move,
87
 
        Release
88
 
    };
89
 
 
90
 
    TouchParameters();
91
 
    TouchParameters& from_device(int device_id);
92
 
    TouchParameters& at_position(geometry::Point abs_pos);
93
 
    TouchParameters& with_action(Action touch_action);
94
 
    
95
 
    int device_id;
96
 
    int abs_x;
97
 
    int abs_y;
98
 
    Action action;
99
 
};
100
 
TouchParameters a_touch_event();
101
 
 
102
 
}
103
 
}
104
 
}
105
 
 
106
 
#endif /* MIR_TEST_EVENT_FACTORY_H */