xpfe/appshell/src/nsAppShellWindowEnumerator.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpfe/appshell/src/nsAppShellWindowEnumerator.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,165 @@
     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 nsAppShellWindowEnumerator_h
    1.10 +#define nsAppShellWindowEnumerator_h
    1.11 +
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsString.h"
    1.14 +
    1.15 +#include "nsISimpleEnumerator.h"
    1.16 +#include "nsIXULWindow.h"
    1.17 +
    1.18 +class nsWindowMediator;
    1.19 +
    1.20 +//
    1.21 +// nsWindowInfo
    1.22 +//
    1.23 +
    1.24 +struct nsWindowInfo
    1.25 +{
    1.26 +  nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp);
    1.27 +  ~nsWindowInfo();
    1.28 +
    1.29 +  nsCOMPtr<nsIXULWindow>    mWindow;
    1.30 +  int32_t                   mTimeStamp;
    1.31 +  uint32_t                  mZLevel;
    1.32 +
    1.33 +  // each struct is in two, independent, circular, doubly-linked lists
    1.34 +  nsWindowInfo              *mYounger, // next younger in sequence
    1.35 +                            *mOlder;
    1.36 +  nsWindowInfo              *mLower,   // next lower in z-order
    1.37 +                            *mHigher;
    1.38 +  
    1.39 +  bool TypeEquals(const nsAString &aType);
    1.40 +  void   InsertAfter(nsWindowInfo *inOlder, nsWindowInfo *inHigher);
    1.41 +  void   Unlink(bool inAge, bool inZ);
    1.42 +  void   ReferenceSelf(bool inAge, bool inZ);
    1.43 +};
    1.44 +
    1.45 +//
    1.46 +// virtual enumerators
    1.47 +//
    1.48 +
    1.49 +class nsAppShellWindowEnumerator : public nsISimpleEnumerator {
    1.50 +
    1.51 +friend class nsWindowMediator;
    1.52 +
    1.53 +public:
    1.54 +  nsAppShellWindowEnumerator(const char16_t* aTypeString,
    1.55 +                             nsWindowMediator& inMediator);
    1.56 +  virtual ~nsAppShellWindowEnumerator();
    1.57 +  NS_IMETHOD GetNext(nsISupports **retval) = 0;
    1.58 +  NS_IMETHOD HasMoreElements(bool *retval);
    1.59 +
    1.60 +  NS_DECL_ISUPPORTS
    1.61 +
    1.62 +protected:
    1.63 +
    1.64 +  void AdjustInitialPosition();
    1.65 +  virtual nsWindowInfo *FindNext() = 0;
    1.66 +
    1.67 +  void WindowRemoved(nsWindowInfo *inInfo);
    1.68 +
    1.69 +  nsWindowMediator *mWindowMediator;
    1.70 +  nsString          mType;
    1.71 +  nsWindowInfo     *mCurrentPosition;
    1.72 +};
    1.73 +
    1.74 +class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator {
    1.75 +
    1.76 +public:
    1.77 +  nsASDOMWindowEnumerator(const char16_t* aTypeString,
    1.78 +                          nsWindowMediator& inMediator);
    1.79 +  virtual ~nsASDOMWindowEnumerator();
    1.80 +  NS_IMETHOD GetNext(nsISupports **retval);
    1.81 +};
    1.82 +
    1.83 +class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator {
    1.84 +
    1.85 +public:
    1.86 +  nsASXULWindowEnumerator(const char16_t* aTypeString,
    1.87 +                          nsWindowMediator& inMediator);
    1.88 +  virtual ~nsASXULWindowEnumerator();
    1.89 +  NS_IMETHOD GetNext(nsISupports **retval);
    1.90 +};
    1.91 +
    1.92 +//
    1.93 +// concrete enumerators
    1.94 +//
    1.95 +
    1.96 +class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator {
    1.97 +
    1.98 +public:
    1.99 +  nsASDOMWindowEarlyToLateEnumerator(const char16_t* aTypeString,
   1.100 +                                     nsWindowMediator& inMediator);
   1.101 +
   1.102 +  virtual ~nsASDOMWindowEarlyToLateEnumerator();
   1.103 +
   1.104 +protected:
   1.105 +  virtual nsWindowInfo *FindNext();
   1.106 +};
   1.107 +
   1.108 +class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator {
   1.109 +
   1.110 +public:
   1.111 +  nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString,
   1.112 +                                     nsWindowMediator& inMediator);
   1.113 +
   1.114 +  virtual ~nsASXULWindowEarlyToLateEnumerator();
   1.115 +
   1.116 +protected:
   1.117 +  virtual nsWindowInfo *FindNext();
   1.118 +};
   1.119 +
   1.120 +class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator {
   1.121 +
   1.122 +public:
   1.123 +  nsASDOMWindowFrontToBackEnumerator(const char16_t* aTypeString,
   1.124 +                                     nsWindowMediator& inMediator);
   1.125 +
   1.126 +  virtual ~nsASDOMWindowFrontToBackEnumerator();
   1.127 +
   1.128 +protected:
   1.129 +  virtual nsWindowInfo *FindNext();
   1.130 +};
   1.131 +
   1.132 +class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator {
   1.133 +
   1.134 +public:
   1.135 +  nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString,
   1.136 +                                     nsWindowMediator& inMediator);
   1.137 +
   1.138 +  virtual ~nsASXULWindowFrontToBackEnumerator();
   1.139 +
   1.140 +protected:
   1.141 +  virtual nsWindowInfo *FindNext();
   1.142 +};
   1.143 +
   1.144 +class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator {
   1.145 +
   1.146 +public:
   1.147 +  nsASDOMWindowBackToFrontEnumerator(const char16_t* aTypeString,
   1.148 +                                     nsWindowMediator& inMediator);
   1.149 +
   1.150 +  virtual ~nsASDOMWindowBackToFrontEnumerator();
   1.151 +
   1.152 +protected:
   1.153 +  virtual nsWindowInfo *FindNext();
   1.154 +};
   1.155 +
   1.156 +class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator {
   1.157 +
   1.158 +public:
   1.159 +  nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString,
   1.160 +                                     nsWindowMediator& inMediator);
   1.161 +
   1.162 +  virtual ~nsASXULWindowBackToFrontEnumerator();
   1.163 +
   1.164 +protected:
   1.165 +  virtual nsWindowInfo *FindNext();
   1.166 +};
   1.167 +
   1.168 +#endif

mercurial