1# Copyright 2018 Stuart Buchanan 2# This file is part of FlightGear. 3# 4# FlightGear is free software: you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation, either version 2 of the License, or 7# (at your option) any later version. 8# 9# FlightGear is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with FlightGear. If not, see <http://www.gnu.org/licenses/>. 16# 17# Template 18var Template = 19{ 20 new : func (mfd, myCanvas, device, svg) 21 { 22 var obj = { 23 parents : [ 24 Template, 25 MFDPage.new(mfd, myCanvas, device, svg, "Template", "TemplateTitle") 26 ], 27 }; 28 29 obj.topMenu(device, obj, nil); 30 31 obj.setController(fg1000.TemplateController.new(obj, svg)); 32 33 return obj; 34 }, 35 offdisplay : func() { 36 me._group.setVisible(0); 37 38 # Reset the menu colours. Shouldn't have to do this here, but 39 # there's not currently an obvious other location to do so. 40 for(var i = 0; i < 12; i +=1) { 41 var name = sprintf("SoftKey%d",i); 42 me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0); 43 me.device.svg.getElementById(name).setColor(1.0,1.0,1.0); 44 } 45 me.getController().offdisplay(); 46 }, 47 ondisplay : func() { 48 me._group.setVisible(1); 49 me.mfd.setPageTitle(me.title); 50 me.getController().ondisplay(); 51 }, 52 topMenu : func(device, pg, menuitem) { 53 pg.clearMenu(); 54 pg.resetMenuColors(); 55 device.updateMenus(); 56 }, 57 58 59}; 60