home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CWindowMediator.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.8 KB  |  134 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  20. //    CWindowMediator.h
  21. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  22.  
  23. #pragma once
  24.  
  25. #include <LBroadcaster.h>
  26. #include <LWindow.h>
  27.  
  28. #include "CAutoPtr.h"
  29.  
  30. enum {
  31.     WindowType_Any                =    '****'
  32. };
  33.  
  34. const MessageT    msg_WindowCreated                =    'cre8';
  35. const MessageT    msg_WindowDisposed                =    'dsp0';
  36. const MessageT    msg_WindowDescriptorChanged        =    'dscG';
  37. const MessageT    msg_WindowActivated                =    'wact';
  38. const MessageT    msg_WindowDeactivated            =    'wdct';
  39. const MessageT    msg_WindowMenuBarModeChanged    =    'wmbr';
  40.  
  41. #include "Netscape_Constants.h"
  42.  
  43. class CMediatedWindow : public LWindow
  44. {
  45.     public:
  46.                             CMediatedWindow(
  47.                                     LStream*     inStream,
  48.                                     DataIDT        inWindowType);
  49.                                     
  50.         virtual                ~CMediatedWindow();
  51.     
  52.         DataIDT                GetWindowType(void) const;
  53.         void                SetWindowType(DataIDT inWindowType);
  54.  
  55.         virtual    void        SetDescriptor(ConstStr255Param inDescriptor);
  56.         
  57.         // I18N stuff
  58.         // If the subclass of CMediatedWindow know the default csid for a new context
  59.         // It should overload the DefaultCSIDForNewWindow() function and return non-0 value
  60.         virtual Int16            DefaultCSIDForNewWindow(void) { return 0; };
  61.  
  62.  
  63.     protected:
  64.  
  65.         virtual    void        ActivateSelf(void);
  66.         virtual void        DeactivateSelf(void);
  67.         
  68.         void                NoteWindowMenubarModeChanged();
  69.         
  70.         DataIDT                mWindowType;
  71. };
  72.  
  73.  
  74. class CWindowIterator
  75. {
  76.     public:
  77.                             CWindowIterator(DataIDT inWindowType);
  78.     
  79.     Boolean                    Next(CMediatedWindow*& outWindow);
  80.     
  81.     protected:
  82.  
  83.         CMediatedWindow*    mIndexWindow;
  84.         DataIDT                mWindowType;
  85. };
  86.  
  87. enum LayerType
  88. {
  89.     dontCareLayerType,
  90.     modalLayerType,
  91.     floatingLayerType,
  92.     regularLayerType
  93. };
  94.  
  95. class CWindowMediator : public LBroadcaster
  96. {
  97.     friend class CMediatedWindow;
  98.     
  99.     public:
  100.         static CWindowMediator*                GetWindowMediator();
  101.  
  102.             // Ñ Window Fetching
  103.         Int16                CountOpenWindows(Int32 inWindType);
  104.         Int16                CountOpenWindows(Int32 inWindType, LayerType inLayerType, Boolean inIncludeInvisible = true);
  105.         CMediatedWindow*    FetchTopWindow(Int32 inWindType);
  106.         CMediatedWindow*    FetchTopWindow(LayerType inLayerType);
  107.         CMediatedWindow*    FetchTopWindow(Int32 inWindType, LayerType inLayerType);
  108.         CMediatedWindow*    FetchTopWindow(Int32 inWindType, LayerType inLayerType, Boolean inIncludeRestrictedTargets);
  109.         CMediatedWindow*    FetchBottomWindow(Boolean inIncludeAlwaysLowered);
  110.         
  111.         void                CloseAllWindows(Int32 inWindType);
  112.         
  113.     protected:
  114.     
  115.         void                NoteWindowCreated(CMediatedWindow* inWindow);
  116.         void                NoteWindowDisposed(CMediatedWindow* inWindow);        
  117.         void                NoteWindowDescriptorChanged(CMediatedWindow* inWindow);
  118.         void                NoteWindowActivated(CMediatedWindow* inWindow);
  119.         void                NoteWindowDeactivated(CMediatedWindow* inWindow);
  120.         void                 NoteWindowMenubarModeChanged(CMediatedWindow* inWindow);
  121.         
  122.         LArray                mWindowList;
  123.         
  124.         static CAutoPtr<CWindowMediator>    sMediator;
  125.  
  126.     private:
  127.         friend class CAutoPtr<CWindowMediator>;
  128.         
  129.                             CWindowMediator();
  130.         virtual                ~CWindowMediator();
  131. };
  132.  
  133.  
  134.