refactor: merge WindowLayoutClass into WindowLayout

This commit is contained in:
Mikhail Zolotukhin 2022-01-30 14:08:44 +03:00
parent f31342f95b
commit e8b876d4e7
3 changed files with 14 additions and 14 deletions

View File

@ -17,7 +17,6 @@ import QuarterLayout from "./engine/layout/quarter_layout";
import CascadeLayout from "./engine/layout/cascade_layout";
import { WindowsLayout } from "./engine/layout";
import { WindowsLayoutClass } from "./engine/layout";
export interface Config {
//#region Layout
@ -154,7 +153,7 @@ export class ConfigImpl implements Config {
["enableQuarterLayout", false, QuarterLayout],
["enableFloatingLayout", false, FloatingLayout],
["enableCascadeLayout", false, CascadeLayout], // TODO: add config
] as Array<[string, boolean, WindowsLayoutClass]>
] as Array<[string, boolean, any]>
).forEach(([configKey, defaultValue, layoutClass]) => {
// For some reason if we put the curly brackets here script breaks
// This will be dealt with, when this facility will be refactored out

View File

@ -10,25 +10,21 @@ import { Controller } from "../../controller";
import { Action } from "../../controller/action";
import { Rect, RectDelta } from "../../util/rect";
import { Config } from "../../config";
export interface WindowsLayoutClass {
readonly id: string;
new (config: Config): WindowsLayout;
}
export interface WindowsLayout {
export abstract class WindowsLayout {
/* read-only */
static readonly id: string;
/**
* Human-readable name of the layout.
*/
readonly name: string;
abstract readonly name: string;
/**
* The icon name of the layout.
*/
readonly icon: string;
abstract readonly icon: string;
/**
* A string that can be used to show layout specific properties in the pop-up,
@ -47,8 +43,14 @@ export interface WindowsLayout {
basis: EngineWindow,
delta: RectDelta
): void;
apply(controller: Controller, tileables: EngineWindow[], area: Rect): void;
abstract apply(
controller: Controller,
tileables: EngineWindow[],
area: Rect
): void;
executeAction?(engine: Engine, action: Action): void;
toString(): string;
abstract toString(): string;
}

View File

@ -3,7 +3,6 @@
//
// SPDX-License-Identifier: MIT
import MonocleLayout from "./layout/monocle_layout";
import FloatingLayout from "./layout/floating_layout";
import { WindowsLayout } from "./layout";