summaryrefslogtreecommitdiff
path: root/libcaribou/row-model.vala
blob: fcc47135623309a683d0536ebaf5458da4b1d5b9 (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
namespace Caribou {
    public class RowModel : ScannableGroup, IScannableItem, IKeyboardObject {
        public bool scan_stepping { get; set; }
        public bool scan_selected { get; set; }

        Gee.ArrayList<ColumnModel> columns;

        public RowModel () {
            columns = new Gee.ArrayList<ColumnModel> ();
        }

        internal void add_column (ColumnModel column) {
            column.key_activated.connect ((k) => { key_activated (k); });
            columns.add(column);
        }

        public ColumnModel[] get_columns () {
            return (ColumnModel[]) columns.to_array ();
        }

        public override IScannableItem[] get_scan_children () {
            if (scan_grouping == ScanGrouping.ROWS)
                return (IScannableItem[]) get_keys ();
            else
                return (IScannableItem[]) columns.to_array ();
        }

        public IKeyboardObject[] get_children () {
            return (IKeyboardObject[]) get_columns ();
        }
    }
}