occlusionState
ウインドウが他のウインドウなどによってすべて隠れている状態かどうか
@property(readonly) NSWindowOcclusionState occlusionState
var occlusionState: NSWindowOcclusionState { get }
解説
ウインドウが他のウインドウなどによってすべて隠れている状態かどうか
他のウインドウによって隠されていたり、最小化で表示されていない場合はocclusion状態となる。
設定値
@property(readonly) NSWindowOcclusionState occlusionState
var occlusionState: NSWindowOcclusionState { get }
フレームワーク
Appkit
クラス
NSWindow
使用可能
10.9-
参照
関連記事(外部サイト)
例文
//NSWindow occlusionState func buttonAction077(sender: AnyObject){ var aWindow : NSWindow = (sender as NSButton).window! } func timer077(timer:NSTimer!) { var aWindow : NSWindow = (timer.userInfo as NSWindow) //NSLog("default %u",NSWindowOcclusionState.Visible.rawValue) //NSLog("default %u",aWindow.occlusionState.rawValue) switch (aWindow.occlusionState.rawValue){ case 8194: //Visible: NSLog("Visible") case 8192: //Occlusion: NSLog("Occlusion") default: NSLog("default") } } @IBAction func function077(sender: AnyObject) { var theWindow : MyWindow077 = MyWindow077(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(theWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 theWindow.center()//ウインドウをスクリーンの中心に theWindow.title = "ウインドウタイトル"//タイトル設定 theWindow.orderFront(self)//前面に theWindow.makeKeyAndOrderFront(self)//表示 theWindow.delegate = theWindow //ボタンを作成 var theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 2.0, 100.0, 30.0)) theButton.title = "Action" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction077:") theButton.target = self theWindow.contentView.addSubview(theButton) //タイマー var timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("timer077:"), userInfo: theWindow, repeats: true ) //タイマー、モーダルに入るとタイマーが動かなくなるので、ランループに追加する NSRunLoop.currentRunLoop().addTimer(timer, forMode: NSRunLoopCommonModes) }
更新時のバージョン
OS X 10.10