widget/cocoa/nsWindowMap.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/cocoa/nsWindowMap.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsWindowMap_h_
    1.10 +#define nsWindowMap_h_
    1.11 +
    1.12 +#import <Cocoa/Cocoa.h>
    1.13 +
    1.14 +//  WindowDataMap
    1.15 +// 
    1.16 +//  In both mozilla and embedding apps, we need to have a place to put
    1.17 +//  per-top-level-window logic and data, to handle such things as IME
    1.18 +//  commit when the window gains/loses focus. We can't use a window 
    1.19 +//  delegate, because an embeddor probably already has one. Nor can we
    1.20 +//  subclass NSWindow, again because we can't impose that burden on the
    1.21 +//  embeddor.
    1.22 +// 
    1.23 +//  So we have a global map of NSWindow -> TopLevelWindowData, and set
    1.24 +//  up TopLevelWindowData as a notification observer etc.
    1.25 +
    1.26 +@interface WindowDataMap : NSObject
    1.27 +{
    1.28 +@private
    1.29 +  NSMutableDictionary*    mWindowMap;   // dict of TopLevelWindowData keyed by address of NSWindow
    1.30 +}
    1.31 +
    1.32 ++ (WindowDataMap*)sharedWindowDataMap;
    1.33 +
    1.34 +- (void)ensureDataForWindow:(NSWindow*)inWindow;
    1.35 +- (id)dataForWindow:(NSWindow*)inWindow;
    1.36 +
    1.37 +// set data for a given window. inData is retained (and any previously set data
    1.38 +// is released).
    1.39 +- (void)setData:(id)inData forWindow:(NSWindow*)inWindow;
    1.40 +
    1.41 +// remove the data for the given window. the data is released.
    1.42 +- (void)removeDataForWindow:(NSWindow*)inWindow;
    1.43 +
    1.44 +@end
    1.45 +
    1.46 +@class ChildView;
    1.47 +
    1.48 +//  TopLevelWindowData
    1.49 +// 
    1.50 +//  Class to hold per-window data, and handle window state changes.
    1.51 +
    1.52 +@interface TopLevelWindowData : NSObject
    1.53 +{
    1.54 +@private
    1.55 +}
    1.56 +
    1.57 +- (id)initWithWindow:(NSWindow*)inWindow;
    1.58 ++ (void)activateInWindow:(NSWindow*)aWindow;
    1.59 ++ (void)deactivateInWindow:(NSWindow*)aWindow;
    1.60 ++ (void)activateInWindowViews:(NSWindow*)aWindow;
    1.61 ++ (void)deactivateInWindowViews:(NSWindow*)aWindow;
    1.62 +
    1.63 +@end
    1.64 +
    1.65 +#endif // nsWindowMap_h_

mercurial