保存一下
This commit is contained in:
6
src/core/window/IWindowForm.ts
Normal file
6
src/core/window/IWindowForm.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { IProcess } from '@/core/process/IProcess.ts'
|
||||
|
||||
export interface IWindowForm {
|
||||
get id(): string;
|
||||
get proc(): IProcess | undefined;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import type ProcessImpl from '../process/impl/ProcessImpl.ts'
|
||||
import XSystem from '../XSystem.ts'
|
||||
import type { ProcessInfoImpl } from '../process/impl/ProcessInfoImpl.ts'
|
||||
|
||||
export default class WindowForm {
|
||||
private readonly _id: string = uuidV4();
|
||||
private readonly _procId: string;
|
||||
|
||||
public get id() {
|
||||
return this._id;
|
||||
}
|
||||
public get proc() {
|
||||
return XSystem.instance.processManage.findProcessById(this._procId)
|
||||
}
|
||||
|
||||
constructor(proc: ProcessImpl, startName: string) {
|
||||
this._procId = proc.id;
|
||||
console.log('WindowForm')
|
||||
}
|
||||
|
||||
}
|
||||
51
src/core/window/impl/WindowFormImpl.ts
Normal file
51
src/core/window/impl/WindowFormImpl.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import XSystem from '../../XSystem.ts'
|
||||
import type { IProcess } from '@/core/process/IProcess.ts'
|
||||
import type { IWindowForm } from '@/core/window/IWindowForm.ts'
|
||||
import type { IWindowFormConfig } from '@/core/window/types/IWindowFormConfig.ts'
|
||||
import type { WindowFormPos } from '@/core/window/types/WindowFormTypes.ts'
|
||||
|
||||
export default class WindowFormImpl implements IWindowForm {
|
||||
private readonly _id: string = uuidV4();
|
||||
private readonly _procId: string;
|
||||
private pos: WindowFormPos = { x: 0, y: 0 };
|
||||
private width: number = 0;
|
||||
private height: number = 0;
|
||||
|
||||
public get id() {
|
||||
return this._id;
|
||||
}
|
||||
public get proc() {
|
||||
return XSystem.instance.processManage.findProcessById(this._procId)
|
||||
}
|
||||
private get desktopRootDom() {
|
||||
return XSystem.instance.desktopRootDom;
|
||||
}
|
||||
|
||||
constructor(proc: IProcess, config: IWindowFormConfig) {
|
||||
this._procId = proc.id;
|
||||
console.log('WindowForm')
|
||||
this.pos = {
|
||||
x: config.left ?? 0,
|
||||
y: config.top ?? 0
|
||||
}
|
||||
this.width = config.width ?? 0;
|
||||
this.height = config.height ?? 0;
|
||||
|
||||
this.createWindowFrom();
|
||||
}
|
||||
|
||||
public createWindowFrom() {
|
||||
const dom = document.createElement('div');
|
||||
dom.style.position = 'absolute';
|
||||
dom.style.left = `${this.pos.x}px`;
|
||||
dom.style.top = `${this.pos.y}px`;
|
||||
dom.style.width = `${this.width}px`;
|
||||
dom.style.height = `${this.height}px`;
|
||||
dom.style.zIndex = '100';
|
||||
dom.style.backgroundColor = 'white';
|
||||
|
||||
this.desktopRootDom.appendChild(dom);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 窗体配置
|
||||
* 窗体配置信息
|
||||
*/
|
||||
export interface IWindowFormConfig {
|
||||
/**
|
||||
|
||||
7
src/core/window/types/WindowFormTypes.ts
Normal file
7
src/core/window/types/WindowFormTypes.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 窗体位置坐标 - 左上角
|
||||
*/
|
||||
export interface WindowFormPos {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
Reference in New Issue
Block a user