-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): add the Context of windows system button (#1638)
* feat(project): add windows system button context * refactor(flat-components): rename props * refactor(flat-pages): use the Context of the windows system button * refactor(renderer-app): remove unused function * refactor(flat-components): add onDoubleClick event and remove ref prop
- Loading branch information
Showing
16 changed files
with
267 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { WindowsBtnContextInterface } from "@netless/flat-pages/src/components/WindowsBtnContext"; | ||
import { WindowsSystemBtnItem } from "flat-components"; | ||
import { ipcAsyncByMainWindow, ipcReceive, ipcReceiveRemove } from "../utils/ipc"; | ||
|
||
export class WindowsBtnContext implements WindowsBtnContextInterface { | ||
public showWindowsBtn: boolean = window.node.os.platform() === "win32"; | ||
|
||
public onClickWindowsSystemBtn = (winSystemBtn: WindowsSystemBtnItem): void => { | ||
ipcAsyncByMainWindow("set-win-status", { windowStatus: winSystemBtn }); | ||
}; | ||
|
||
public clickWindowMaximize = (): void => { | ||
ipcAsyncByMainWindow("set-win-status", { windowStatus: "maximize" }); | ||
}; | ||
|
||
public sendWindowWillCloseEvent = (callback: () => void): void => { | ||
ipcReceive("window-will-close", () => { | ||
callback(); | ||
}); | ||
}; | ||
|
||
public removeWindowWillCloseEvent = (): void => { | ||
ipcReceiveRemove("window-will-close"); | ||
}; | ||
} | ||
|
||
export const windowsBtnContext = new WindowsBtnContext(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.