1- import { QWidget , NodeWidget } from "@nodegui/nodegui" ;
1+ import {
2+ QWidget ,
3+ NodeWidget ,
4+ WidgetAttribute ,
5+ WindowType
6+ } from "@nodegui/nodegui" ;
27import { registerComponent } from "../config" ;
38
49export interface ListenerMap {
@@ -13,6 +18,9 @@ export interface ViewProps {
1318 on ?: ListenerMap ;
1419 mouseTracking ?: boolean ;
1520 enabled ?: boolean ;
21+ attributes ?: WidgetAttribute [ ] ;
22+ windowFlags ?: WindowType [ ] ;
23+ windowOpacity ?: Number ;
1624}
1725
1826export const setProps = (
@@ -60,6 +68,29 @@ export const setProps = (
6068 widget . addEventListener ( eventType , newEvtListener ) ;
6169 }
6270 ) ;
71+ } ,
72+ set attributes ( attributes : WidgetAttribute [ ] ) {
73+ const oldAttributes = oldProps . attributes || [ ] ;
74+ const newAttributes = attributes || [ ] ;
75+ oldAttributes . forEach ( eachOldAttribute => {
76+ widget . setAttribute ( eachOldAttribute , false ) ;
77+ } ) ;
78+ newAttributes . forEach ( eachNewAttribute => {
79+ widget . setAttribute ( eachNewAttribute , true ) ;
80+ } ) ;
81+ } ,
82+ set windowFlags ( windowTypes : WindowType [ ] ) {
83+ const oldFlags = oldProps . windowFlags || [ ] ;
84+ const newFlags = windowTypes || [ ] ;
85+ oldFlags . forEach ( eachOldFlag => {
86+ widget . setWindowFlag ( eachOldFlag , false ) ;
87+ } ) ;
88+ newFlags . forEach ( eachNewWindowFlag => {
89+ widget . setWindowFlag ( eachNewWindowFlag , true ) ;
90+ } ) ;
91+ } ,
92+ set windowOpacity ( opacity : Number ) {
93+ widget . setWindowOpacity ( opacity ) ;
6394 }
6495 } ;
6596 Object . assign ( setter , newProps ) ;
0 commit comments