michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsWindowMap_h_ michael@0: #define nsWindowMap_h_ michael@0: michael@0: #import michael@0: michael@0: // WindowDataMap michael@0: // michael@0: // In both mozilla and embedding apps, we need to have a place to put michael@0: // per-top-level-window logic and data, to handle such things as IME michael@0: // commit when the window gains/loses focus. We can't use a window michael@0: // delegate, because an embeddor probably already has one. Nor can we michael@0: // subclass NSWindow, again because we can't impose that burden on the michael@0: // embeddor. michael@0: // michael@0: // So we have a global map of NSWindow -> TopLevelWindowData, and set michael@0: // up TopLevelWindowData as a notification observer etc. michael@0: michael@0: @interface WindowDataMap : NSObject michael@0: { michael@0: @private michael@0: NSMutableDictionary* mWindowMap; // dict of TopLevelWindowData keyed by address of NSWindow michael@0: } michael@0: michael@0: + (WindowDataMap*)sharedWindowDataMap; michael@0: michael@0: - (void)ensureDataForWindow:(NSWindow*)inWindow; michael@0: - (id)dataForWindow:(NSWindow*)inWindow; michael@0: michael@0: // set data for a given window. inData is retained (and any previously set data michael@0: // is released). michael@0: - (void)setData:(id)inData forWindow:(NSWindow*)inWindow; michael@0: michael@0: // remove the data for the given window. the data is released. michael@0: - (void)removeDataForWindow:(NSWindow*)inWindow; michael@0: michael@0: @end michael@0: michael@0: @class ChildView; michael@0: michael@0: // TopLevelWindowData michael@0: // michael@0: // Class to hold per-window data, and handle window state changes. michael@0: michael@0: @interface TopLevelWindowData : NSObject michael@0: { michael@0: @private michael@0: } michael@0: michael@0: - (id)initWithWindow:(NSWindow*)inWindow; michael@0: + (void)activateInWindow:(NSWindow*)aWindow; michael@0: + (void)deactivateInWindow:(NSWindow*)aWindow; michael@0: + (void)activateInWindowViews:(NSWindow*)aWindow; michael@0: + (void)deactivateInWindowViews:(NSWindow*)aWindow; michael@0: michael@0: @end michael@0: michael@0: #endif // nsWindowMap_h_