widget/cocoa/nsWindowMap.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsWindowMap_h_
michael@0 7 #define nsWindowMap_h_
michael@0 8
michael@0 9 #import <Cocoa/Cocoa.h>
michael@0 10
michael@0 11 // WindowDataMap
michael@0 12 //
michael@0 13 // In both mozilla and embedding apps, we need to have a place to put
michael@0 14 // per-top-level-window logic and data, to handle such things as IME
michael@0 15 // commit when the window gains/loses focus. We can't use a window
michael@0 16 // delegate, because an embeddor probably already has one. Nor can we
michael@0 17 // subclass NSWindow, again because we can't impose that burden on the
michael@0 18 // embeddor.
michael@0 19 //
michael@0 20 // So we have a global map of NSWindow -> TopLevelWindowData, and set
michael@0 21 // up TopLevelWindowData as a notification observer etc.
michael@0 22
michael@0 23 @interface WindowDataMap : NSObject
michael@0 24 {
michael@0 25 @private
michael@0 26 NSMutableDictionary* mWindowMap; // dict of TopLevelWindowData keyed by address of NSWindow
michael@0 27 }
michael@0 28
michael@0 29 + (WindowDataMap*)sharedWindowDataMap;
michael@0 30
michael@0 31 - (void)ensureDataForWindow:(NSWindow*)inWindow;
michael@0 32 - (id)dataForWindow:(NSWindow*)inWindow;
michael@0 33
michael@0 34 // set data for a given window. inData is retained (and any previously set data
michael@0 35 // is released).
michael@0 36 - (void)setData:(id)inData forWindow:(NSWindow*)inWindow;
michael@0 37
michael@0 38 // remove the data for the given window. the data is released.
michael@0 39 - (void)removeDataForWindow:(NSWindow*)inWindow;
michael@0 40
michael@0 41 @end
michael@0 42
michael@0 43 @class ChildView;
michael@0 44
michael@0 45 // TopLevelWindowData
michael@0 46 //
michael@0 47 // Class to hold per-window data, and handle window state changes.
michael@0 48
michael@0 49 @interface TopLevelWindowData : NSObject
michael@0 50 {
michael@0 51 @private
michael@0 52 }
michael@0 53
michael@0 54 - (id)initWithWindow:(NSWindow*)inWindow;
michael@0 55 + (void)activateInWindow:(NSWindow*)aWindow;
michael@0 56 + (void)deactivateInWindow:(NSWindow*)aWindow;
michael@0 57 + (void)activateInWindowViews:(NSWindow*)aWindow;
michael@0 58 + (void)deactivateInWindowViews:(NSWindow*)aWindow;
michael@0 59
michael@0 60 @end
michael@0 61
michael@0 62 #endif // nsWindowMap_h_

mercurial