summaryrefslogtreecommitdiff
path: root/libcaribou/ikeyboard-object.vala
blob: ce865d04b171bd9b3d88bba2f01a556eee1de093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
namespace Caribou {
    public interface IKeyboardObject : Object {
        public abstract IKeyboardObject[] get_children ();

        public signal void key_clicked (KeyModel key);
        public signal void key_pressed (KeyModel key);
        public signal void key_released (KeyModel key);

        public virtual KeyModel[] get_keys () {
            Gee.ArrayList<KeyModel> keys = new Gee.ArrayList<KeyModel> ();
            foreach (IKeyboardObject obj in get_children ()) {
                KeyModel[] obj_keys = obj.get_keys();
                foreach (KeyModel key in obj_keys) {
                    keys.add(key);
                }
            }
            return (KeyModel[]) keys.to_array ();
        }
    }
}