mojo: Fix map of booleans for python bindings.
[chromium-blink-merge.git] / mojo / examples / keyboard / keys.h
blobc09f856f3511c0e822fabd14ae934b84153e3c4d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_EXAMPLES_KEYBOARD_KEYS_H_
6 #define MOJO_EXAMPLES_KEYBOARD_KEYS_H_
8 #include <vector>
10 #include "base/basictypes.h"
12 namespace mojo {
13 namespace examples {
15 enum SpecialKey {
16 SPECIAL_KEY_SHIFT = -1,
17 SPECIAL_KEY_NUMERIC = -2,
18 SPECIAL_KEY_ALPHA = -3,
21 struct Key {
22 int keyboard_code() const {
23 // Handling of keycodes differs between in windows and others.
24 #if defined(OS_WIN)
25 return generated_code ? generated_code : display_code;
26 #else
27 return display_code;
28 #endif
31 // Code used to get the value to display in the UI. This is either a
32 // KeyboardCode or a SpecialKey.
33 int display_code;
35 // How much space (as a percentage) the key is to take up.
36 float size;
38 // Any ui::EventFlags that are required to produce the key.
39 int event_flags;
41 // If non-zero KeyboardCode to generate. If 0 use the |display_code|.
42 int generated_code;
45 struct Row {
46 float padding;
47 const Key* keys;
48 size_t num_keys;
51 // Returns the rows for a qwerty style keyboard. The returned values are owned
52 // by this object and should not be deleted.
53 std::vector<const Row*> GetQWERTYRows();
55 // Returns the rows for a numeric keyboard. The returned values are owned
56 // by this object and should not be deleted.
57 std::vector<const Row*> GetNumericRows();
59 } // namespace examples
60 } // namespace mojo
62 #endif // MOJO_EXAMPLES_KEYBOARD_KEYS_H_