| 1 | /*! |
| 2 | * VisualEditor UserInterface SurfaceWindowManager class. |
| 3 | * |
| 4 | * @copyright See AUTHORS.txt |
| 5 | */ |
| 6 | |
| 7 | /** |
| 8 | * Window manager for desktop inspectors. |
| 9 | * |
| 10 | * @class |
| 11 | * @extends ve.ui.WindowManager |
| 12 | * |
| 13 | * @constructor |
| 14 | * @param {ve.ui.Surface} surface Surface this belongs to |
| 15 | * @param {Object} [config] Configuration options |
| 16 | * @param {ve.ui.Overlay} [config.overlay] Overlay to use for menus |
| 17 | */ |
| 18 | ve.ui.SurfaceWindowManager = function VeUiSurfaceWindowManager( surface, config ) { |
| 19 | // Properties |
| 20 | // Set up surface before calling the parent so we can request |
| 21 | // specific surface-related details from within the constructor. |
| 22 | this.surface = surface; |
| 23 | |
| 24 | // Parent constructor |
| 25 | ve.ui.SurfaceWindowManager.super.call( this, config ); |
| 26 | }; |
| 27 | |
| 28 | /* Inheritance */ |
| 29 | |
| 30 | OO.inheritClass( ve.ui.SurfaceWindowManager, ve.ui.WindowManager ); |
| 31 | |
| 32 | /* Methods */ |
| 33 | |
| 34 | /** |
| 35 | * Override the window manager's directionality method to get the |
| 36 | * directionality from the surface. The surface sometimes does not |
| 37 | * have a directionality set; fallback to direction from the document. |
| 38 | * |
| 39 | * @return {string} UI directionality |
| 40 | */ |
| 41 | ve.ui.SurfaceWindowManager.prototype.getDir = function () { |
| 42 | return this.surface.getDir() || |
| 43 | // Fallback to parent method |
| 44 | ve.ui.SurfaceWindowManager.super.prototype.getDir.call( this ); |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * Get surface. |
| 49 | * |
| 50 | * @return {ve.ui.Surface} Surface this belongs to |
| 51 | */ |
| 52 | ve.ui.SurfaceWindowManager.prototype.getSurface = function () { |
| 53 | return this.surface; |
| 54 | }; |