Back to index

lightning-sunbird  0.9+nobinonly
nsWindow.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Peter Hartshorn <peter@igelaus.com.au>
00024  *   Ken Faulkner <faulkner@igelaus.com.au>
00025  *   B.J. Rossiter <bj@igelaus.com.au>
00026  *   Tony Tsui <tony@igelaus.com.au>
00027  *
00028  * Alternatively, the contents of this file may be used under the terms of
00029  * either the GNU General Public License Version 2 or later (the "GPL"), or
00030  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00031  * in which case the provisions of the GPL or the LGPL are applicable instead
00032  * of those above. If you wish to allow use of your version of this file only
00033  * under the terms of either the GPL or the LGPL, and not to allow others to
00034  * use your version of this file under the terms of the MPL, indicate your
00035  * decision by deleting the provisions above and replace them with the notice
00036  * and other provisions required by the GPL or the LGPL. If you do not delete
00037  * the provisions above, a recipient may use your version of this file under
00038  * the terms of any one of the MPL, the GPL or the LGPL.
00039  *
00040  * ***** END LICENSE BLOCK ***** */
00041 
00042 #ifndef nsWindow_h__
00043 #define nsWindow_h__
00044 
00045 #include "nsWidget.h"
00046 #include <X11/cursorfont.h>
00047 
00048 #include "nsString.h"
00049 
00050 class nsListItem {
00051 public:
00052   nsListItem() {}
00053   nsListItem(void *aData, nsListItem *aPrev);
00054   ~nsListItem() {}
00055 
00056   void *getData() { return data; }
00057   nsListItem *getNext() { return next; }
00058   void setNext(nsListItem *aNext) { next = aNext; }
00059   nsListItem *getPrev() { return prev; };
00060   void setPrev(nsListItem *aPrev) { prev = aPrev; }
00061 
00062 private:
00063   void *data;
00064   nsListItem *next;
00065   nsListItem *prev;
00066 };
00067 
00068 class nsList {
00069 public:
00070   nsList();
00071   ~nsList();
00072   nsListItem *getHead() { return head; }
00073   void add(void *aData);
00074   void remove(void *aData);
00075   void reset();
00076 
00077 private:
00078   nsListItem *head;
00079   nsListItem *tail;
00080 };
00081 
00082 
00083 class nsWindow : public nsWidget
00084 {
00085  public:
00086   nsWindow();
00087   ~nsWindow();
00088 
00089   NS_DECL_ISUPPORTS_INHERITED
00090 
00091   static void      UpdateIdle (void *data);
00092   NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, 
00093                                  PRBool aDoCapture, 
00094                                  PRBool aConsumeRollupEvent);
00095   NS_IMETHOD Invalidate(PRBool aIsSynchronous);
00096   NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
00097   NS_IMETHOD           InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous);                  
00098   NS_IMETHOD Update();
00099   NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
00100   NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
00101   NS_IMETHOD ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy);
00102 
00103   NS_IMETHOD SetTitle(const nsAString& aTitle);
00104   NS_IMETHOD Show(PRBool aShow);
00105 
00106   NS_IMETHOD Resize(PRInt32 aWidth,
00107                     PRInt32 aHeight,
00108                     PRBool   aRepaint);
00109   NS_IMETHOD Resize(PRInt32 aX,
00110                     PRInt32 aY,
00111                     PRInt32 aWidth,
00112                     PRInt32 aHeight,
00113                     PRBool   aRepaint);
00114 
00115 
00116   NS_IMETHOD SetFocus(PRBool aRaise);
00117   virtual  PRBool OnExpose(nsPaintEvent &event);
00118   NS_IMETHOD GetAttention(PRInt32 aCycleCount);
00119   
00120 protected:
00121   virtual long GetEventMask();
00122 
00123   // Keyboard and Pointer Grabbing
00124   void NativeGrab(PRBool aGrab);
00125 
00126   void DoPaint (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
00127                 nsIRegion *aClipRegion);
00128                 
00129   void                 QueueDraw();
00130   void                 UnqueueDraw();
00131   PRBool mIsUpdating;
00132   PRBool mBlockFocusEvents;
00133   PRBool mIsTooSmall;
00134   
00135   GC     mScrollGC; // GC used by nsWindow::Scroll()
00136 
00137   static PRBool    sIsGrabbing;
00138   static nsWindow  *sGrabWindow;
00139 
00140 #if 0
00141   virtual void CreateNative(Window aParent, nsRect aRect);
00142 #endif
00143 };
00144 
00145 class ChildWindow : public nsWindow
00146 {
00147  public:
00148   ChildWindow();
00149   virtual PRInt32 IsChild() { return PR_TRUE; };
00150 };
00151 
00152 #endif