summaryrefslogtreecommitdiff
path: root/libcaribou/column-model.vala
blob: 66e842888e2c5a91165b854a19784c8892ff293a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
namespace Caribou {
    /**
     * Object representing a column in a row.
     */
    public class ColumnModel : ScannableGroup, IScannableItem, IKeyboardObject {
        public bool scan_stepping { get; set; }
        public bool scan_selected { get; set; }

        Gee.ArrayList<KeyModel> keys;

        public ColumnModel () {
            keys = new Gee.ArrayList<KeyModel> ();
        }

        internal void add_key (KeyModel key) {
            key.key_clicked.connect ((k) => { key_clicked (k); });
            key.key_pressed.connect ((k) => { key_pressed (k); });
            key.key_released.connect ((k) => { key_released (k); });
            keys.add (key);
        }

        public KeyModel get_key (int index) {
            return keys.get (index);
        }

        public KeyModel first_key () {
            return keys.first();
        }

        public override IScannableItem[] get_scan_children () {
            return (IScannableItem[]) keys.to_array ();
        }

        public IKeyboardObject[] get_children () {
            return (IKeyboardObject[]) keys.to_array ();
        }
    }
}