1 /** 2 * ae.ui.wm.application 3 * 4 * License: 5 * This Source Code Form is subject to the terms of 6 * the Mozilla Public License, v. 2.0. If a copy of 7 * the MPL was not distributed with this file, You 8 * can obtain one at http://mozilla.org/MPL/2.0/. 9 * 10 * Authors: 11 * Vladimir Panteleev <ae@cy.md> 12 */ 13 14 module ae.ui.wm.application; 15 16 import ae.ui.app.application; 17 import ae.ui.shell.shell; 18 import ae.ui.shell.events; 19 import ae.ui.wm.controls.control; 20 import ae.ui.video.renderer; 21 22 /// Specialization of Application class which automatically handles framework messages. 23 class WMApplication : Application 24 { 25 Shell shell; /// `Shell` implementation. 26 RootControl root; /// The root control. 27 28 this() 29 { 30 root = new RootControl(); 31 } /// 32 33 // ****************************** Event handlers ******************************* 34 35 override void handleMouseDown(uint x, uint y, MouseButton button) 36 { 37 root.handleMouseDown(x, y, button); 38 } /// 39 40 override void handleMouseUp(uint x, uint y, MouseButton button) 41 { 42 root.handleMouseUp(x, y, button); 43 } /// 44 45 override void handleMouseMove(uint x, uint y, MouseButtons buttons) 46 { 47 root.handleMouseMove(x, y, buttons); 48 } /// 49 50 override void handleQuit() 51 { 52 shell.quit(); 53 } /// 54 55 override void handleInit() 56 { 57 uint w, h; 58 shell.video.getScreenSize(w, h); 59 root.w = w; root.h = h; 60 root.sizeChanged(); 61 } /// 62 63 // ********************************* Rendering ********************************* 64 65 override void render(Renderer s) 66 { 67 root.render(s, 0, 0); 68 } /// 69 }