summaryrefslogtreecommitdiff
path: root/libcaribou/column-model.vala
blob: f127a10ce5ef25be21c6c9ec52baf72cc4a40903 (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
namespace Caribou {
    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 ();
        }
    }
}