зеркало из https://github.com/mozilla/gecko-dev.git
removing gfx2. r=kmcclusk sr/a=roc+moz
189836 not part of any build.
This commit is contained in:
Родитель
9c96a06f86
Коммит
3686edfca5
Двоичные данные
gfx2/macbuild/gfx2.mcp
Двоичные данные
gfx2/macbuild/gfx2.mcp
Двоичный файл не отображается.
|
@ -1,24 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "MacPrefix_debug.h"
|
||||
|
Двоичные данные
gfx2/macbuild/gfx2IDL.mcp
Двоичные данные
gfx2/macbuild/gfx2IDL.mcp
Двоичный файл не отображается.
|
@ -1,23 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "MacSharedPrefix.h"
|
|
@ -1,3 +0,0 @@
|
|||
Makefile
|
||||
.deps
|
||||
_xpidlgen
|
|
@ -1,82 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gfx2
|
||||
XPIDL_MODULE = gfx2
|
||||
|
||||
XPIDLSRCS = \
|
||||
gfxtypes.idl \
|
||||
nsIClipboard.idl \
|
||||
nsICursor.idl \
|
||||
nsIDragService.idl \
|
||||
nsIDragSession.idl \
|
||||
nsIDragTracker.idl \
|
||||
nsIDrawable.idl \
|
||||
nsIFilePicker.idl \
|
||||
nsIFontMetrics.idl \
|
||||
nsIFormatConverter.idl \
|
||||
nsIGUIEventListener.idl \
|
||||
nsIImage.idl \
|
||||
nsIPixmap.idl \
|
||||
nsIRegion.idl \
|
||||
nsIRollupListener.idl \
|
||||
nsIRunAppRun.idl \
|
||||
nsIScreen.idl \
|
||||
nsIScreenManager.idl \
|
||||
nsISystemLook.idl \
|
||||
nsITimer.idl \
|
||||
nsITimerCallback.idl \
|
||||
nsITransferable.idl \
|
||||
nsIWindow.idl \
|
||||
nsIChildWindow.idl \
|
||||
nsIPopupWindow.idl \
|
||||
nsITopLevelWindow.idl \
|
||||
nsIOutputDevice.idl \
|
||||
nsPIWindowXlib.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
gfxcompat.h \
|
||||
nsColor.h \
|
||||
nsColorNameList.h \
|
||||
nsColorNames.h \
|
||||
nsGUIEvent.h \
|
||||
nsMargin2.h \
|
||||
nsMatrix.h \
|
||||
nsFont.h \
|
||||
nsPoint2.h \
|
||||
nsRect2.h \
|
||||
nsSize2.h \
|
||||
nsTransform.h \
|
||||
nsUnitConverters.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* gfx idl declarations to be used by all gfx interfaces.
|
||||
* @file gfxtypes.idl
|
||||
*/
|
||||
|
||||
#include "nsrootidl.idl"
|
||||
|
||||
/*! @verbatim */
|
||||
/* see bug 57094 */
|
||||
%{C++
|
||||
#ifndef NS_NO_VTABLE
|
||||
#define NS_NO_VTABLE
|
||||
#endif
|
||||
#include "gfxcompat.h"
|
||||
%}
|
||||
/*! @endverbatim */
|
||||
|
||||
/**
|
||||
* gfx_dimension should be used for widths and heights
|
||||
* @var typedef float gfx_dimension
|
||||
*/
|
||||
typedef float gfx_dimension;
|
||||
|
||||
/**
|
||||
* gfx_coord should be used for x and y coordinates
|
||||
* @var typedef float gfx_coord
|
||||
*/
|
||||
typedef float gfx_coord;
|
||||
|
||||
typedef gfx_coord nscoord;
|
||||
|
||||
/**
|
||||
* typedef that should be used for angles
|
||||
* @var typedef float gfx_angle
|
||||
*/
|
||||
typedef float gfx_angle;
|
||||
|
||||
/**
|
||||
* A color is a 32 bit unsigned integer with
|
||||
* four components: R, G, B and A.
|
||||
*
|
||||
* @var typedef PRUint32 gfx_color
|
||||
*/
|
||||
typedef PRUint32 gfx_color;
|
||||
|
||||
/**
|
||||
* typedef that should be used for bit depths
|
||||
* @var typedef unsigned short gfx_depth
|
||||
*/
|
||||
typedef unsigned short gfx_depth; // is short ok?
|
||||
|
||||
/**
|
||||
* typedef that should be used for image formats
|
||||
* @var typedef long gfx_format
|
||||
* @see nsIGFXFormat
|
||||
*/
|
||||
typedef long gfx_format;
|
||||
|
||||
/**
|
||||
* typedef that should be used for gamma levels
|
||||
* @var typedef float gfx_gamma
|
||||
*/
|
||||
typedef float gfx_gamma;
|
||||
|
||||
/**
|
||||
* nsIGFXFormat interface
|
||||
*
|
||||
* @author Tim Rowley <tor@cs.brown.edu>
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see gfx_format
|
||||
*/
|
||||
[scriptable]
|
||||
interface nsIGFXFormat
|
||||
{
|
||||
/**
|
||||
* RGB - duh...
|
||||
*/
|
||||
const gfx_format RGB = 0;
|
||||
|
||||
/**
|
||||
* RGB_A1 - RGB image and 1-bit alpha mask
|
||||
*/
|
||||
const gfx_format RGB_A1 = 1;
|
||||
|
||||
/**
|
||||
* RGB_A8 - RGB image and 8-bit alpha image
|
||||
*/
|
||||
const gfx_format RGB_A8 = 2;
|
||||
|
||||
/**
|
||||
* RGBA - packed RGBA image
|
||||
*/
|
||||
const gfx_format RGBA = 3;
|
||||
};
|
||||
|
||||
/*! @verbatim */
|
||||
[ptr] native nsRect2(nsRect2);
|
||||
[ptr] native nsSize2(nsSize2);
|
||||
[ptr] native nsPoint2(nsPoint2);
|
||||
[ptr] native nsFont(nsFont);
|
||||
|
||||
%{C++
|
||||
struct nsPoint2;
|
||||
struct nsSize2;
|
||||
struct nsRect2;
|
||||
struct nsFont;
|
||||
%}
|
||||
/*! @endverbatim */
|
|
@ -1,77 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ..\..
|
||||
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
MODULE = gfx2
|
||||
XPIDL_MODULE = gfx2
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\gfxtypes.idl \
|
||||
.\nsIClipboard.idl \
|
||||
.\nsICursor.idl \
|
||||
.\nsIDragService.idl \
|
||||
.\nsIDragSession.idl \
|
||||
.\nsIDragTracker.idl \
|
||||
.\nsIDrawable.idl \
|
||||
.\nsIFilePicker.idl \
|
||||
.\nsIFontMetrics.idl \
|
||||
.\nsIFormatConverter.idl \
|
||||
.\nsIGUIEventListener.idl \
|
||||
.\nsIImage.idl \
|
||||
.\nsIPixmap.idl \
|
||||
.\nsIRegion.idl \
|
||||
.\nsIRollupListener.idl \
|
||||
.\nsIRunAppRun.idl \
|
||||
.\nsIScreen.idl \
|
||||
.\nsIScreenManager.idl \
|
||||
.\nsISystemLook.idl \
|
||||
.\nsITimer.idl \
|
||||
.\nsITimerCallback.idl \
|
||||
.\nsITransferable.idl \
|
||||
.\nsIWindow.idl \
|
||||
.\nsIChildWindow.idl \
|
||||
.\nsIPopupWindow.idl \
|
||||
.\nsITopLevelWindow.idl \
|
||||
.\nsIOutputDevice.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
.\nsColor.h \
|
||||
.\nsColorNameList.h \
|
||||
.\nsColorNames.h \
|
||||
.\nsGUIEvent.h \
|
||||
.\nsMargin.h \
|
||||
.\nsMatrix.h \
|
||||
.\nsFont.h \
|
||||
.\nsPoint.h \
|
||||
.\nsRect.h \
|
||||
.\nsSize.h \
|
||||
.\nsTransform.h \
|
||||
.\nsUnitConverters.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsColor_h___
|
||||
#define nsColor_h___
|
||||
|
||||
#include "gfxtypes.h"
|
||||
|
||||
class nsString;
|
||||
|
||||
/**
|
||||
* Color utilities and conversion functions
|
||||
* @file nsColor.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* Make a color out of r,g,b values. This assumes that the r,g,b values are
|
||||
* properly constrained to 0-255. This also assumes that a is 255.
|
||||
*/
|
||||
#define NS_RGB(_r,_g,_b) \
|
||||
((gfx_color) ((255 << 24) | ((_b)<<16) | ((_g)<<8) | (_r)))
|
||||
|
||||
/**
|
||||
* Make a color out of r,g,b,a values. This assumes that the r,g,b,a
|
||||
* values are properly constrained to 0-255.
|
||||
*/
|
||||
#define NS_RGBA(_r,_g,_b,_a) \
|
||||
((gfx_color) (((_a) << 24) | ((_b)<<16) | ((_g)<<8) | (_r)))
|
||||
|
||||
/**
|
||||
* Extract color components from gfx_color
|
||||
*/
|
||||
//@{
|
||||
#define NS_GET_R(_rgba) ((PRUint8) ((_rgba) & 0xff))
|
||||
#define NS_GET_G(_rgba) ((PRUint8) (((_rgba) >> 8) & 0xff))
|
||||
#define NS_GET_B(_rgba) ((PRUint8) (((_rgba) >> 16) & 0xff))
|
||||
#define NS_GET_A(_rgba) ((PRUint8) (((_rgba) >> 24) & 0xff))
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Translate a hex string to a color. Return true if it parses ok,
|
||||
* otherwise return false.
|
||||
* This accepts only 3, 6 or 9 digits
|
||||
*/
|
||||
extern "C" NS_GFX_(PRBool) NS_HexToRGB(const nsString& aBuf,
|
||||
gfx_color* aResult);
|
||||
|
||||
/**
|
||||
* Translate a hex string to a color. Return true if it parses ok,
|
||||
* otherwise return false.
|
||||
* This version accepts 1 to 9 digits (missing digits are 0)
|
||||
*/
|
||||
extern "C" NS_GFX_(PRBool) NS_LooseHexToRGB(const nsString& aBuf,
|
||||
gfx_color* aResult);
|
||||
|
||||
/**
|
||||
* Translate a color name to a color. Return true if it parses ok,
|
||||
* otherwise return false.
|
||||
*/
|
||||
extern "C" NS_GFX_(PRBool) NS_ColorNameToRGB(const nsString& aBuf,
|
||||
gfx_color* aResult);
|
||||
|
||||
/**
|
||||
* Weird color computing code stolen from winfe which was stolen
|
||||
* from the xfe which was written originally by Eric Bina. So there.
|
||||
*/
|
||||
extern "C" NS_GFX_(void) NS_Get3DColors(gfx_color aResult[2],
|
||||
gfx_color aColor);
|
||||
|
||||
/**
|
||||
* To determin colors based on the background brightness
|
||||
*/
|
||||
extern "C" NS_GFX_(void) NS_GetSpecial3DColors(gfx_color aResult[2],
|
||||
gfx_color aBackgroundColor,
|
||||
gfx_color aBorderColor);
|
||||
|
||||
/**
|
||||
* Special method to brighten a Color and have it shift to white when
|
||||
* fully saturated.
|
||||
*/
|
||||
extern "C" NS_GFX_(gfx_color) NS_BrightenColor(gfx_color inColor);
|
||||
|
||||
/**
|
||||
* Special method to darken a Color and have it shift to black when
|
||||
* darkest component underflows
|
||||
*/
|
||||
extern "C" NS_GFX_(gfx_color) NS_DarkenColor(gfx_color inColor);
|
||||
|
||||
/**
|
||||
* Determins brightness for a specific color
|
||||
*/
|
||||
extern "C" NS_GFX_(int) NS_GetBrightness(PRUint8 aRed,
|
||||
PRUint8 aGreen,
|
||||
PRUint8 aBlue);
|
||||
|
||||
#endif /* nsColor_h___ */
|
|
@ -1,196 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/******
|
||||
|
||||
This file contains the list of all named colors
|
||||
See nsCSSColorNames.h for access to the enum values for colors
|
||||
|
||||
It is designed to be used as inline input to nsCSSColorNames.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
All entires must be enclosed in the macro GFX_COLOR which will have cruel
|
||||
and unusual things done to it
|
||||
|
||||
It is recommended (but not strictly necessary) to keep all entries
|
||||
in alphabetical order
|
||||
|
||||
The first argument to GFX_COLOR is both the enum identifier of the color
|
||||
and the string value
|
||||
The second argument is the sRGBA value for the named color
|
||||
|
||||
'name' entries *must* use only lowercase characters.
|
||||
|
||||
** Break these invarient and bad things will happen. **
|
||||
|
||||
|
||||
******/
|
||||
|
||||
|
||||
GFX_COLOR(aliceblue, NS_RGB(240, 248, 255))
|
||||
GFX_COLOR(antiquewhite, NS_RGB(250, 235, 215))
|
||||
GFX_COLOR(aqua, NS_RGB( 0, 255, 255))
|
||||
GFX_COLOR(aquamarine, NS_RGB(127, 255, 212))
|
||||
GFX_COLOR(azure, NS_RGB(240, 255, 255))
|
||||
GFX_COLOR(beige, NS_RGB(245, 245, 220))
|
||||
GFX_COLOR(bisque, NS_RGB(255, 228, 196))
|
||||
GFX_COLOR(black, NS_RGB( 0, 0, 0))
|
||||
GFX_COLOR(blanchedalmond, NS_RGB(255, 235, 205))
|
||||
GFX_COLOR(blue, NS_RGB( 0, 0, 255))
|
||||
GFX_COLOR(blueviolet, NS_RGB(138, 43, 226))
|
||||
GFX_COLOR(brown, NS_RGB(165, 42, 42))
|
||||
GFX_COLOR(burlywood, NS_RGB(222, 184, 135))
|
||||
GFX_COLOR(cadetblue, NS_RGB( 95, 158, 160))
|
||||
GFX_COLOR(chartreuse, NS_RGB(127, 255, 0))
|
||||
GFX_COLOR(chocolate, NS_RGB(210, 105, 30))
|
||||
GFX_COLOR(coral, NS_RGB(255, 127, 80))
|
||||
GFX_COLOR(cornflowerblue, NS_RGB(100, 149, 237))
|
||||
GFX_COLOR(cornsilk, NS_RGB(255, 248, 220))
|
||||
GFX_COLOR(crimson, NS_RGB(220, 20, 60))
|
||||
GFX_COLOR(cyan, NS_RGB( 0, 255, 255))
|
||||
GFX_COLOR(darkblue, NS_RGB( 0, 0, 139))
|
||||
GFX_COLOR(darkcyan, NS_RGB( 0, 139, 139))
|
||||
GFX_COLOR(darkgoldenrod, NS_RGB(184, 134, 11))
|
||||
GFX_COLOR(darkgray, NS_RGB(169, 169, 169))
|
||||
GFX_COLOR(darkgreen, NS_RGB( 0, 100, 0))
|
||||
GFX_COLOR(darkgrey, NS_RGB(169, 169, 169))
|
||||
GFX_COLOR(darkkhaki, NS_RGB(189, 183, 107))
|
||||
GFX_COLOR(darkmagenta, NS_RGB(139, 0, 139))
|
||||
GFX_COLOR(darkolivegreen, NS_RGB( 85, 107, 47))
|
||||
GFX_COLOR(darkorange, NS_RGB(255, 140, 0))
|
||||
GFX_COLOR(darkorchid, NS_RGB(153, 50, 204))
|
||||
GFX_COLOR(darkred, NS_RGB(139, 0, 0))
|
||||
GFX_COLOR(darksalmon, NS_RGB(233, 150, 122))
|
||||
GFX_COLOR(darkseagreen, NS_RGB(143, 188, 143))
|
||||
GFX_COLOR(darkslateblue, NS_RGB( 72, 61, 139))
|
||||
GFX_COLOR(darkslategray, NS_RGB( 47, 79, 79))
|
||||
GFX_COLOR(darkslategrey, NS_RGB( 47, 79, 79))
|
||||
GFX_COLOR(darkturquoise, NS_RGB( 0, 206, 209))
|
||||
GFX_COLOR(darkviolet, NS_RGB(148, 0, 211))
|
||||
GFX_COLOR(deeppink, NS_RGB(255, 20, 147))
|
||||
GFX_COLOR(deepskyblue, NS_RGB( 0, 191, 255))
|
||||
GFX_COLOR(dimgray, NS_RGB(105, 105, 105))
|
||||
GFX_COLOR(dimgrey, NS_RGB(105, 105, 105))
|
||||
GFX_COLOR(dodgerblue, NS_RGB( 30, 144, 255))
|
||||
GFX_COLOR(firebrick, NS_RGB(178, 34, 34))
|
||||
GFX_COLOR(floralwhite, NS_RGB(255, 250, 240))
|
||||
GFX_COLOR(forestgreen, NS_RGB( 34, 139, 34))
|
||||
GFX_COLOR(fuchsia, NS_RGB(255, 0, 255))
|
||||
GFX_COLOR(gainsboro, NS_RGB(220, 220, 220))
|
||||
GFX_COLOR(ghostwhite, NS_RGB(248, 248, 255))
|
||||
GFX_COLOR(gold, NS_RGB(255, 215, 0))
|
||||
GFX_COLOR(goldenrod, NS_RGB(218, 165, 32))
|
||||
GFX_COLOR(gray, NS_RGB(128, 128, 128))
|
||||
GFX_COLOR(grey, NS_RGB(128, 128, 128))
|
||||
GFX_COLOR(green, NS_RGB( 0, 128, 0))
|
||||
GFX_COLOR(greenyellow, NS_RGB(173, 255, 47))
|
||||
GFX_COLOR(honeydew, NS_RGB(240, 255, 240))
|
||||
GFX_COLOR(hotpink, NS_RGB(255, 105, 180))
|
||||
GFX_COLOR(indianred, NS_RGB(205, 92, 92))
|
||||
GFX_COLOR(indigo, NS_RGB( 75, 0, 130))
|
||||
GFX_COLOR(ivory, NS_RGB(255, 255, 240))
|
||||
GFX_COLOR(khaki, NS_RGB(240, 230, 140))
|
||||
GFX_COLOR(lavender, NS_RGB(230, 230, 250))
|
||||
GFX_COLOR(lavenderblush, NS_RGB(255, 240, 245))
|
||||
GFX_COLOR(lawngreen, NS_RGB(124, 252, 0))
|
||||
GFX_COLOR(lemonchiffon, NS_RGB(255, 250, 205))
|
||||
GFX_COLOR(lightblue, NS_RGB(173, 216, 230))
|
||||
GFX_COLOR(lightcoral, NS_RGB(240, 128, 128))
|
||||
GFX_COLOR(lightcyan, NS_RGB(224, 255, 255))
|
||||
GFX_COLOR(lightgoldenrodyellow, NS_RGB(250, 250, 210))
|
||||
GFX_COLOR(lightgray, NS_RGB(211, 211, 211))
|
||||
GFX_COLOR(lightgreen, NS_RGB(144, 238, 144))
|
||||
GFX_COLOR(lightgrey, NS_RGB(211, 211, 211))
|
||||
GFX_COLOR(lightpink, NS_RGB(255, 182, 193))
|
||||
GFX_COLOR(lightsalmon, NS_RGB(255, 160, 122))
|
||||
GFX_COLOR(lightseagreen, NS_RGB( 32, 178, 170))
|
||||
GFX_COLOR(lightskyblue, NS_RGB(135, 206, 250))
|
||||
GFX_COLOR(lightslategray, NS_RGB(119, 136, 153))
|
||||
GFX_COLOR(lightslategrey, NS_RGB(119, 136, 153))
|
||||
GFX_COLOR(lightsteelblue, NS_RGB(176, 196, 222))
|
||||
GFX_COLOR(lightyellow, NS_RGB(255, 255, 224))
|
||||
GFX_COLOR(lime, NS_RGB( 0, 255, 0))
|
||||
GFX_COLOR(limegreen, NS_RGB( 50, 205, 50))
|
||||
GFX_COLOR(linen, NS_RGB(250, 240, 230))
|
||||
GFX_COLOR(magenta, NS_RGB(255, 0, 255))
|
||||
GFX_COLOR(maroon, NS_RGB(128, 0, 0))
|
||||
GFX_COLOR(mediumaquamarine, NS_RGB(102, 205, 170))
|
||||
GFX_COLOR(mediumblue, NS_RGB( 0, 0, 205))
|
||||
GFX_COLOR(mediumorchid, NS_RGB(186, 85, 211))
|
||||
GFX_COLOR(mediumpurple, NS_RGB(147, 112, 219))
|
||||
GFX_COLOR(mediumseagreen, NS_RGB( 60, 179, 113))
|
||||
GFX_COLOR(mediumslateblue, NS_RGB(123, 104, 238))
|
||||
GFX_COLOR(mediumspringgreen, NS_RGB( 0, 250, 154))
|
||||
GFX_COLOR(mediumturquoise, NS_RGB( 72, 209, 204))
|
||||
GFX_COLOR(mediumvioletred, NS_RGB(199, 21, 133))
|
||||
GFX_COLOR(midnightblue, NS_RGB( 25, 25, 112))
|
||||
GFX_COLOR(mintcream, NS_RGB(245, 255, 250))
|
||||
GFX_COLOR(mistyrose, NS_RGB(255, 228, 225))
|
||||
GFX_COLOR(moccasin, NS_RGB(255, 228, 181))
|
||||
GFX_COLOR(navajowhite, NS_RGB(255, 222, 173))
|
||||
GFX_COLOR(navy, NS_RGB( 0, 0, 128))
|
||||
GFX_COLOR(oldlace, NS_RGB(253, 245, 230))
|
||||
GFX_COLOR(olive, NS_RGB(128, 128, 0))
|
||||
GFX_COLOR(olivedrab, NS_RGB(107, 142, 35))
|
||||
GFX_COLOR(orange, NS_RGB(255, 165, 0))
|
||||
GFX_COLOR(orangered, NS_RGB(255, 69, 0))
|
||||
GFX_COLOR(orchid, NS_RGB(218, 112, 214))
|
||||
GFX_COLOR(palegoldenrod, NS_RGB(238, 232, 170))
|
||||
GFX_COLOR(palegreen, NS_RGB(152, 251, 152))
|
||||
GFX_COLOR(paleturquoise, NS_RGB(175, 238, 238))
|
||||
GFX_COLOR(palevioletred, NS_RGB(219, 112, 147))
|
||||
GFX_COLOR(papayawhip, NS_RGB(255, 239, 213))
|
||||
GFX_COLOR(peachpuff, NS_RGB(255, 218, 185))
|
||||
GFX_COLOR(peru, NS_RGB(205, 133, 63))
|
||||
GFX_COLOR(pink, NS_RGB(255, 192, 203))
|
||||
GFX_COLOR(plum, NS_RGB(221, 160, 221))
|
||||
GFX_COLOR(powderblue, NS_RGB(176, 224, 230))
|
||||
GFX_COLOR(purple, NS_RGB(128, 0, 128))
|
||||
GFX_COLOR(red, NS_RGB(255, 0, 0))
|
||||
GFX_COLOR(rosybrown, NS_RGB(188, 143, 143))
|
||||
GFX_COLOR(royalblue, NS_RGB( 65, 105, 225))
|
||||
GFX_COLOR(saddlebrown, NS_RGB(139, 69, 19))
|
||||
GFX_COLOR(salmon, NS_RGB(250, 128, 114))
|
||||
GFX_COLOR(sandybrown, NS_RGB(244, 164, 96))
|
||||
GFX_COLOR(seagreen, NS_RGB( 46, 139, 87))
|
||||
GFX_COLOR(seashell, NS_RGB(255, 245, 238))
|
||||
GFX_COLOR(sienna, NS_RGB(160, 82, 45))
|
||||
GFX_COLOR(silver, NS_RGB(192, 192, 192))
|
||||
GFX_COLOR(skyblue, NS_RGB(135, 206, 235))
|
||||
GFX_COLOR(slateblue, NS_RGB(106, 90, 205))
|
||||
GFX_COLOR(slategray, NS_RGB(112, 128, 144))
|
||||
GFX_COLOR(slategrey, NS_RGB(112, 128, 144))
|
||||
GFX_COLOR(snow, NS_RGB(255, 250, 250))
|
||||
GFX_COLOR(springgreen, NS_RGB( 0, 255, 127))
|
||||
GFX_COLOR(steelblue, NS_RGB( 70, 130, 180))
|
||||
GFX_COLOR(tan, NS_RGB(210, 180, 140))
|
||||
GFX_COLOR(teal, NS_RGB( 0, 128, 128))
|
||||
GFX_COLOR(thistle, NS_RGB(216, 191, 216))
|
||||
GFX_COLOR(tomato, NS_RGB(255, 99, 71))
|
||||
GFX_COLOR(turquoise, NS_RGB( 64, 224, 208))
|
||||
GFX_COLOR(violet, NS_RGB(238, 130, 238))
|
||||
GFX_COLOR(wheat, NS_RGB(245, 222, 179))
|
||||
GFX_COLOR(white, NS_RGB(255, 255, 255))
|
||||
GFX_COLOR(whitesmoke, NS_RGB(245, 245, 245))
|
||||
GFX_COLOR(yellow, NS_RGB(255, 255, 0))
|
||||
GFX_COLOR(yellowgreen, NS_RGB(154, 205, 50))
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsColorNames_h___
|
||||
#define nsColorNames_h___
|
||||
|
||||
#include "nsColor.h"
|
||||
|
||||
struct nsStr;
|
||||
class nsCString;
|
||||
|
||||
/*
|
||||
Declare the enum list using the magic of preprocessing
|
||||
enum values are "eColorName_foo" (where foo is the color name)
|
||||
|
||||
To change the list of colors, see nsColorNameList.h
|
||||
|
||||
*/
|
||||
#define GFX_COLOR(_name, _value) eColorName_##_name,
|
||||
enum nsColorName {
|
||||
eColorName_UNKNOWN = -1,
|
||||
#include "nsColorNameList.h"
|
||||
eColorName_COUNT
|
||||
};
|
||||
#undef GFX_COLOR
|
||||
|
||||
class NS_GFX nsColorNames {
|
||||
public:
|
||||
static void AddRefTable(void);
|
||||
static void ReleaseTable(void);
|
||||
|
||||
// Given a color name, return the color enum value
|
||||
// This only functions provided a valid ref on the table
|
||||
static nsColorName LookupName(const nsString& aName);
|
||||
static nsColorName LookupName(const nsCString& aName);
|
||||
|
||||
static const nsCString& GetStringValue(nsColorName aColorName);
|
||||
|
||||
// Color id to rgb value table
|
||||
static const nscolor kColors[];
|
||||
};
|
||||
|
||||
#endif /* nsColorNames_h___ */
|
|
@ -1,100 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsFont_h___
|
||||
#define nsFont_h___
|
||||
|
||||
#include "gfxtypes.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// XXX we need a method to enumerate all of the possible fonts on the
|
||||
// system across family, weight, style, size, etc. But not here!
|
||||
|
||||
// Enumerator callback function. Return PR_FALSE to stop
|
||||
typedef PRBool (*nsFontFamilyEnumFunc)(const nsString& aFamily, PRBool aGeneric, void *aData);
|
||||
|
||||
// Font structure.
|
||||
struct NS_GFX nsFont {
|
||||
// The family name of the font
|
||||
nsString name;
|
||||
|
||||
// The style of font (normal, italic, oblique)
|
||||
PRUint8 style;
|
||||
|
||||
// The variant of the font (normal, small-caps)
|
||||
PRUint8 variant;
|
||||
|
||||
// The weight of the font (0-999)
|
||||
PRUint16 weight;
|
||||
|
||||
// The decorations on the font (underline, overline,
|
||||
// line-through). The decorations can be binary or'd together.
|
||||
PRUint8 decorations;
|
||||
|
||||
// The size of the font, in gfx_coord units
|
||||
gfx_coord size;
|
||||
|
||||
// Initialize the font struct with an iso-latin1 name
|
||||
nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||
PRUint16 aWeight, PRUint8 aDecoration, gfx_coord aSize);
|
||||
|
||||
// Initialize the font struct with a (potentially) unicode name
|
||||
nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||
PRUint16 aWeight, PRUint8 aDecoration, gfx_coord aSize);
|
||||
|
||||
// Make a copy of the given font
|
||||
nsFont(const nsFont& aFont);
|
||||
|
||||
~nsFont();
|
||||
|
||||
PRBool operator==(const nsFont& aOther) const {
|
||||
return Equals(aOther);
|
||||
}
|
||||
|
||||
PRBool Equals(const nsFont& aOther) const ;
|
||||
|
||||
nsFont& operator=(const nsFont& aOther);
|
||||
|
||||
// Utility method to interpret name string
|
||||
// enumerates all families specified by this font only
|
||||
// returns PR_TRUE if completed, PF_FALSE if stopped
|
||||
// enclosing quotes will be removed, and whitespace compressed (as needed)
|
||||
PRBool EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const;
|
||||
void GetFirstFamily(nsString& aFamily) const;
|
||||
};
|
||||
|
||||
#define NS_FONT_STYLE_NORMAL 0
|
||||
#define NS_FONT_STYLE_ITALIC 1
|
||||
#define NS_FONT_STYLE_OBLIQUE 2
|
||||
|
||||
#define NS_FONT_VARIANT_NORMAL 0
|
||||
#define NS_FONT_VARIANT_SMALL_CAPS 1
|
||||
|
||||
#define NS_FONT_DECORATION_NONE 0x0
|
||||
#define NS_FONT_DECORATION_UNDERLINE 0x1
|
||||
#define NS_FONT_DECORATION_OVERLINE 0x2
|
||||
#define NS_FONT_DECORATION_LINE_THROUGH 0x4
|
||||
|
||||
#define NS_FONT_WEIGHT_NORMAL 400
|
||||
#define NS_FONT_WEIGHT_BOLD 700
|
||||
|
||||
#endif /* nsFont_h___ */
|
|
@ -1,861 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsGUIEvent_h__
|
||||
#define nsGUIEvent_h__
|
||||
|
||||
/**
|
||||
* Events sent to an nsIGUIEventListener from an nsIWindow
|
||||
*
|
||||
* @file nsGUIEvent.h
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
#include "nsRect2.h"
|
||||
#include "nsPoint2.h"
|
||||
|
||||
// nsIDOMEvent contains a long enum which includes a member called ERROR,
|
||||
// which conflicts with something that Windows defines somewhere.
|
||||
// So, undefine it:
|
||||
#ifdef WIN32
|
||||
#undef ERROR
|
||||
#endif
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
|
||||
class nsIDrawable;
|
||||
class nsIRegion;
|
||||
class nsIWindow;
|
||||
class nsIMenuItem;
|
||||
|
||||
/**
|
||||
* Return status for event processors.
|
||||
* @enum nsEventStatus
|
||||
*/
|
||||
enum nsEventStatus {
|
||||
/// The event is ignored, do default processing
|
||||
nsEventStatus_eIgnore,
|
||||
|
||||
/// The event is consumed, don't do default processing
|
||||
nsEventStatus_eConsumeNoDefault,
|
||||
|
||||
/// The event is consumed, but do default processing
|
||||
nsEventStatus_eConsumeDoDefault
|
||||
};
|
||||
|
||||
/**
|
||||
* sizemode is an adjunct to widget size
|
||||
* @enum nsSizeMode
|
||||
*/
|
||||
enum nsSizeMode {
|
||||
nsSizeMode_Normal = 0,
|
||||
nsSizeMode_Minimized,
|
||||
nsSizeMode_Maximized
|
||||
};
|
||||
|
||||
/**
|
||||
* different types of (top-level) window z-level positioning
|
||||
* @enum nsWindowZ
|
||||
*/
|
||||
enum nsWindowZ {
|
||||
/// on top
|
||||
nsWindowZTop = 0,
|
||||
|
||||
/// on bottom
|
||||
nsWindowZBottom,
|
||||
|
||||
/// just below some specified widget
|
||||
nsWindowZRelative
|
||||
};
|
||||
|
||||
/**
|
||||
* General event
|
||||
* @struct nsEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsEvent {
|
||||
/// @see event_struct_types
|
||||
PRUint8 eventStructType;
|
||||
|
||||
/// @see messages,
|
||||
PRUint32 message;
|
||||
|
||||
/// in widget relative coordinates, modified to be relative to current view in layout.
|
||||
nsPoint2 point;
|
||||
|
||||
/// in widget relative coordinates, not modified by layout code.
|
||||
nsPoint2 refPoint;
|
||||
|
||||
/**
|
||||
* elapsed time, in milliseconds, from the time the
|
||||
* system was started to the time the message was created
|
||||
*/
|
||||
PRUint32 time;
|
||||
|
||||
/// flags to hold event flow stage and capture/bubble cancellation status
|
||||
PRUint32 flags;
|
||||
|
||||
/// flags for indicating more event state for Mozilla applications.
|
||||
PRUint32 internalAppFlags;
|
||||
};
|
||||
|
||||
/**
|
||||
* General graphic user interface event
|
||||
* @struct nsGUIEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsGUIEvent : public nsEvent {
|
||||
/// Originator of the event
|
||||
nsIWindow *window;
|
||||
/// Internal platform specific message.
|
||||
void *nativeMsg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window resize event
|
||||
* @struct nsSizeEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsSizeEvent : public nsGUIEvent {
|
||||
/// x,y width, height in pixels (client area)
|
||||
nsRect2 *windowSize;
|
||||
|
||||
/// width of entire window (in pixels)
|
||||
PRInt32 mWinWidth;
|
||||
|
||||
/// height of entire window (in pixels)
|
||||
PRInt32 mWinHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window size mode event
|
||||
* @struct nsSizeModeEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsSizeModeEvent : public nsGUIEvent {
|
||||
|
||||
nsSizeMode mSizeMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window z-level event
|
||||
* @struct nsZLevelEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsZLevelEvent : public nsGUIEvent {
|
||||
|
||||
nsWindowZ mPlacement;
|
||||
|
||||
/**
|
||||
* widget we request being below, if any
|
||||
* widget to be below, returned by handler
|
||||
*/
|
||||
nsIWindow *mReqBelow, *mActualBelow;
|
||||
|
||||
/// handler should make changes immediately
|
||||
PRBool mImmediate;
|
||||
/// handler changed placement
|
||||
PRBool mAdjusted;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window repaint event
|
||||
* @struct nsPaintEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsPaintEvent : public nsGUIEvent {
|
||||
/// Context to paint in.
|
||||
nsIDrawable *drawable;
|
||||
|
||||
/// area to paint (should be used instead of rect)
|
||||
nsIRegion *region;
|
||||
|
||||
/**
|
||||
* x,y, width, height in pixels of area to paint
|
||||
* @deprecated use region
|
||||
*/
|
||||
nsRect2 *rect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar event
|
||||
* @struct nsScrollPortEvent
|
||||
* @note what is this used for???
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsScrollPortEvent : public nsGUIEvent {
|
||||
enum orientType {
|
||||
vertical = 0,
|
||||
horizontal = 1,
|
||||
both = 2
|
||||
};
|
||||
|
||||
orientType orient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Input event
|
||||
* @struct nsInputEvent
|
||||
* @attention NEED DOCS
|
||||
* @note couldn't this be a bitfield?
|
||||
*/
|
||||
struct nsInputEvent : public nsGUIEvent {
|
||||
/// PR_TRUE indicates the shift key is down
|
||||
PRBool isShift;
|
||||
|
||||
/// PR_TRUE indicates the control key is down
|
||||
PRBool isControl;
|
||||
|
||||
/// PR_TRUE indicates the alt key is down
|
||||
PRBool isAlt;
|
||||
|
||||
/// PR_TRUE indicates the meta key is down
|
||||
/// (or, on Mac, the Command key)
|
||||
PRBool isMeta;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Mouse event
|
||||
* @struct nsMouseEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsMouseEvent : public nsInputEvent {
|
||||
/// area to paint (should be used instead of rect)
|
||||
PRUint32 clickCount;
|
||||
|
||||
/**
|
||||
* Special return code for MOUSE_ACTIVATE to signal
|
||||
* if the target accepts activation (1), or denies it (0)
|
||||
*/
|
||||
PRBool acceptActivation;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Keyboard event
|
||||
* @struct nsKeyEvent
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsKeyEvent : public nsInputEvent {
|
||||
/// @see nsIDOMKeyEvent
|
||||
PRUint32 keyCode;
|
||||
|
||||
/// OS translated Unicode char
|
||||
PRUint32 charCode;
|
||||
|
||||
/// indicates whether the event signifies a printable character
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @struct nsMouseScrollEvent
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsMouseScrollEvent : public nsInputEvent {
|
||||
PRInt32 deltaLines;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar event
|
||||
* @struct nsScrollbarEvent
|
||||
* @deprecated no more real native scrollbars
|
||||
*/
|
||||
struct nsScrollbarEvent : public nsGUIEvent {
|
||||
/**
|
||||
* ranges between scrollbar 0 and (maxRange - thumbSize).
|
||||
* @see nsIScrollbar
|
||||
*/
|
||||
PRUint32 position;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* IME related events
|
||||
* @defgroup ime_events
|
||||
*/
|
||||
|
||||
/**
|
||||
* @struct nsTextRange
|
||||
* @ingroup ime_events
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsTextRange {
|
||||
PRUint32 mStartOffset;
|
||||
PRUint32 mEndOffset;
|
||||
PRUint32 mRangeType;
|
||||
};
|
||||
|
||||
/**
|
||||
* nsTextRange typedef
|
||||
* @var typedef struct nsTextRange nsTextRange
|
||||
* @ingroup ime_events
|
||||
* @attention do we need this? Isn't a struct in c++ treated like a class (ignoring private/etc)?
|
||||
*/
|
||||
typedef struct nsTextRange nsTextRange;
|
||||
|
||||
/**
|
||||
* nsTextRangeArray typedef
|
||||
* @var typedef nsTextRange* nsTextRangeArray
|
||||
* @ingroup ime_events
|
||||
* @attention why do we need this?????
|
||||
*/
|
||||
typedef nsTextRange* nsTextRangeArray;
|
||||
|
||||
/**
|
||||
* nsTextRangeArray typedef
|
||||
* @struct nsTextEventReply
|
||||
* @ingroup ime_events
|
||||
* @attention why do we need this?????
|
||||
*/
|
||||
struct nsTextEventReply {
|
||||
nsRect2 mCursorPosition;
|
||||
PRBool mCursorIsCollapsed;
|
||||
};
|
||||
|
||||
/**
|
||||
* nsTextEventReply typedef
|
||||
* @var typedef struct nsTextEventReply nsTextEventReply
|
||||
* @ingroup ime_events
|
||||
* @attention do we need this? Isn't a struct in c++ treated like a class (ignoring private/etc)?
|
||||
*/
|
||||
typedef struct nsTextEventReply nsTextEventReply;
|
||||
|
||||
/**
|
||||
* @struct nsTextEvent
|
||||
* @ingroup ime_events
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsTextEvent : public nsInputEvent {
|
||||
PRUnichar *theText;
|
||||
nsTextEventReply theReply;
|
||||
|
||||
PRUint32 rangeCount;
|
||||
nsTextRangeArray rangeArray;
|
||||
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct nsCompositionEvent
|
||||
* @ingroup ime_events
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsCompositionEvent : public nsInputEvent {
|
||||
PRUint32 compositionMessage;
|
||||
nsTextEventReply theReply;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct nsReconversionEventReply
|
||||
* @ingroup ime_events
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsReconversionEventReply {
|
||||
PRUnichar *mReconversionString;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct nsReconversionEvent
|
||||
* @ingroup ime_events
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsReconversionEvent : public nsInputEvent {
|
||||
nsReconversionEventReply theReply;
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem event
|
||||
*
|
||||
* When this event occurs the widget field in nsGUIEvent holds the "target"
|
||||
* for the event
|
||||
*
|
||||
* @struct nsMenuEvent
|
||||
*
|
||||
* @attention NEED DOCS
|
||||
*/
|
||||
struct nsMenuEvent : public nsGUIEvent {
|
||||
nsIMenuItem * mMenuItem;
|
||||
PRUint32 mCommand;
|
||||
};
|
||||
|
||||
/**
|
||||
* Event status for D&D Event
|
||||
* @enum nsDragDropEventStatus
|
||||
*/
|
||||
enum nsDragDropEventStatus {
|
||||
// The event is a enter
|
||||
nsDragDropEventStatus_eDragEntered,
|
||||
// The event is exit
|
||||
nsDragDropEventStatus_eDragExited,
|
||||
// The event is drop
|
||||
nsDragDropEventStatus_eDrop
|
||||
};
|
||||
|
||||
/**
|
||||
* Event Struct Types
|
||||
* @name event_struct_types
|
||||
*/
|
||||
//@{
|
||||
#define NS_EVENT 1
|
||||
#define NS_GUI_EVENT 2
|
||||
#define NS_SIZE_EVENT 3
|
||||
#define NS_SIZEMODE_EVENT 4
|
||||
#define NS_ZLEVEL_EVENT 5
|
||||
#define NS_PAINT_EVENT 6
|
||||
#define NS_SCROLLBAR_EVENT 7
|
||||
#define NS_INPUT_EVENT 8
|
||||
#define NS_KEY_EVENT 9
|
||||
#define NS_MOUSE_EVENT 10
|
||||
#define NS_MENU_EVENT 11
|
||||
#define NS_DRAGDROP_EVENT 12
|
||||
#define NS_TEXT_EVENT 13
|
||||
#define NS_COMPOSITION_START 14
|
||||
#define NS_COMPOSITION_END 15
|
||||
#define NS_MOUSE_SCROLL_EVENT 16
|
||||
#define NS_COMPOSITION_QUERY 17
|
||||
#define NS_SCROLLPORT_EVENT 18
|
||||
#define NS_RECONVERSION_QUERY 19
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* GUI MESSAGES
|
||||
* @name messages
|
||||
*/
|
||||
//@{
|
||||
|
||||
#define NS_WINDOW_START 100
|
||||
|
||||
/**
|
||||
* A window is being created.
|
||||
* @note This message should be sent at the end of nsITopLevelWindow::init(), nsIChildWindow::init() or nsIPopupWindow::init().
|
||||
* @see NS_DESTROY
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_CREATE (NS_WINDOW_START)
|
||||
|
||||
/**
|
||||
* A window is being destroyed (has a refcount of 0).
|
||||
* @note This message should be sent when any object implimenting an nsIWindow gets a refcount of 0.
|
||||
* @see NS_CREATE
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_DESTROY (NS_WINDOW_START + 2)
|
||||
|
||||
|
||||
/**
|
||||
* The OS wants to destroy this window (due to a user clicking close, etc)
|
||||
* @attention can we renamed this NS_DELETE or something?
|
||||
*/
|
||||
#define NS_XUL_CLOSE (NS_WINDOW_START + 1)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A window was resized.
|
||||
* @note This message should be sent when a window is resized by the OS.
|
||||
* @note (This message should not come directly from nsIWindow::resize() or nsIWindow::moveResize(), but when the OS actually resizes the window).
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_SIZE (NS_WINDOW_START + 3)
|
||||
|
||||
/**
|
||||
* NS_RESIZE_EVENT
|
||||
* @attention WTF IS THIS?
|
||||
*/
|
||||
#define NS_RESIZE_EVENT (NS_WINDOW_START + 60)
|
||||
|
||||
/**
|
||||
* Window size mode was changed
|
||||
* @attention wtf is this?
|
||||
*/
|
||||
#define NS_SIZEMODE (NS_WINDOW_START + 4)
|
||||
|
||||
/**
|
||||
* A window has been moved to a new location.
|
||||
* The events point contains the x, y location in parent relative coordinates, or screen coordinates if there is no parent.
|
||||
* @attention this used to be screen relative coordinates
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_MOVE (NS_WINDOW_START + 34)
|
||||
|
||||
|
||||
/**
|
||||
* Window gained focus
|
||||
* @note This message should be sent when the OS gets focus gets focus.
|
||||
* @note This message should come AFTER another window sent a NS_LOSTFOCUS message.
|
||||
* @see NS_LOSTFOCUS
|
||||
* @see NS_ACTIVATE
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_GOTFOCUS (NS_WINDOW_START + 5)
|
||||
|
||||
/**
|
||||
* Window lost focus
|
||||
* @note This message should be sent when the OS gets focus gets focus.
|
||||
* @note This message should come BEFORE another window sends a NS_GOTFOCUS message.
|
||||
* @see NS_GOTFOCUS
|
||||
* @see NS_DEACTIVATE
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_LOSTFOCUS (NS_WINDOW_START + 6)
|
||||
|
||||
/**
|
||||
* A top-level window has gained focus of the keyboard and mouse.
|
||||
* Got activated
|
||||
* @attention is this description correct?
|
||||
* @note This message should be sent when the OS gives a top-level window focus.
|
||||
* @note You must also send an NS_GOTFOCUS message. (seperatly)
|
||||
* @see NS_DEACTIVATE
|
||||
* @see NS_GOTFOCUS
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_ACTIVATE (NS_WINDOW_START + 7)
|
||||
|
||||
/**
|
||||
* A top-level window has lost focus of the keyboard and mouse.
|
||||
* Got deactivated
|
||||
* @attention is this description correct?
|
||||
* @note This message should be sent when a top-level window loses focus.
|
||||
* @note This message should come BEFORE another window sends a NS_ACTIVATE message
|
||||
* @note You must also send an NS_LOSTFOCUS message. (seperatly)
|
||||
* @see NS_ACTIVATE
|
||||
* @see NS_LOSTFOCUS
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_DEACTIVATE (NS_WINDOW_START + 8)
|
||||
|
||||
|
||||
/**
|
||||
* top-level window z-level change request
|
||||
* @attention wtf is this?
|
||||
*/
|
||||
#define NS_SETZLEVEL (NS_WINDOW_START + 9)
|
||||
|
||||
/**
|
||||
* Widget needs to be repainted
|
||||
* @note This message should be sent when the OS wants an area of a window to be repainted.
|
||||
* The OS usually generates these due to an expose event or an invalidation.
|
||||
* @see nsPaintEvent
|
||||
*/
|
||||
#define NS_PAINT (NS_WINDOW_START + 30)
|
||||
|
||||
|
||||
/**
|
||||
* Key events
|
||||
* @defgroup key_event_types Key events
|
||||
* @see nsKeyEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* Key is pressed within a window
|
||||
* @ingroup key_event_types
|
||||
* @attention NEED DOCS
|
||||
* @see nsKeyEvent
|
||||
*/
|
||||
#define NS_KEY_PRESS (NS_WINDOW_START + 31)
|
||||
|
||||
/**
|
||||
* Key is released within a window
|
||||
* @ingroup key_event_types
|
||||
* @attention NEED DOCS
|
||||
* @see nsKeyEvent
|
||||
*/
|
||||
#define NS_KEY_UP (NS_WINDOW_START + 32)
|
||||
|
||||
/**
|
||||
* Key is pressed within a window
|
||||
* @ingroup key_event_types
|
||||
* @attention NEED DOCS
|
||||
* @see nsKeyEvent
|
||||
*/
|
||||
#define NS_KEY_DOWN (NS_WINDOW_START + 33)
|
||||
|
||||
|
||||
|
||||
|
||||
/// Tab control's selected tab has changed
|
||||
#define NS_TABCHANGE (NS_WINDOW_START + 35)
|
||||
|
||||
|
||||
/**
|
||||
* Form control changed: currently == combo box selection changed
|
||||
* but could be expanded to mean textbox, checkbox changed, etc.
|
||||
* This is a GUI specific event that does not necessarily correspond
|
||||
* directly to a mouse click or a key press.
|
||||
*/
|
||||
#define NS_CONTROL_CHANGE (NS_WINDOW_START + 39)
|
||||
|
||||
/**
|
||||
* Indicates the display has changed depth
|
||||
* @note This event should be sent when the output device's bitdepth has changed
|
||||
* @see nsGUIEvent
|
||||
*/
|
||||
#define NS_DISPLAYCHANGED (NS_WINDOW_START + 40)
|
||||
|
||||
/**
|
||||
* Indicates a script error has occurred
|
||||
* @attention WTF IS THIS?
|
||||
*/
|
||||
#define NS_SCRIPT_ERROR (NS_WINDOW_START + 50)
|
||||
|
||||
/**
|
||||
* ...
|
||||
* @attention WTF IS THIS?
|
||||
*/
|
||||
#define NS_PLUGIN_ACTIVATE (NS_WINDOW_START + 62)
|
||||
|
||||
|
||||
|
||||
|
||||
#define NS_MOUSE_MESSAGE_START 300
|
||||
|
||||
/**
|
||||
* The mouse location has changed
|
||||
* @attention NEED DOCS
|
||||
* @see nsMouseEvent
|
||||
*/
|
||||
#define NS_MOUSE_MOVE (NS_MOUSE_MESSAGE_START)
|
||||
|
||||
|
||||
/**
|
||||
* The mouse button has been pressed down
|
||||
* @defgroup mouse_down_event_types Mouse down events
|
||||
* @note This event should be sent when the user presses a mouse button down.
|
||||
* @note This event should be sent BEFORE a mouse up event
|
||||
* @see mouse_up_events
|
||||
* @see nsMouseEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* The left button was pushed
|
||||
* @ingroup mouse_down_event_types
|
||||
*/
|
||||
#define NS_MOUSE_LEFT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 2)
|
||||
|
||||
/**
|
||||
* The left button was pushed
|
||||
* @ingroup mouse_down_event_types
|
||||
*/
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 11)
|
||||
|
||||
/**
|
||||
* The left button was pushed
|
||||
* @ingroup mouse_down_event_types
|
||||
*/
|
||||
#define NS_MOUSE_RIGHT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 21)
|
||||
|
||||
|
||||
/**
|
||||
* The mouse button has been released
|
||||
* @defgroup mouse_up_event_types Mouse up events
|
||||
* @note This event should be sent when the user release a mouse button.
|
||||
* @note This event should be sent AFTER a mouse down event
|
||||
* @see mouse_down_events
|
||||
* @see nsMouseEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* The left button was released
|
||||
* @ingroup mouse_up_event_types
|
||||
*/
|
||||
#define NS_MOUSE_LEFT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 1)
|
||||
|
||||
/**
|
||||
* The middle button was released
|
||||
* @ingroup mouse_up_event_types
|
||||
*/
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_UP (NS_MOUSE_MESSAGE_START + 10)
|
||||
|
||||
/**
|
||||
* The right button was released
|
||||
* @ingroup mouse_up_event_types
|
||||
*/
|
||||
#define NS_MOUSE_RIGHT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 20)
|
||||
|
||||
|
||||
#define NS_MOUSE_ENTER (NS_MOUSE_MESSAGE_START + 22)
|
||||
#define NS_MOUSE_EXIT (NS_MOUSE_MESSAGE_START + 23)
|
||||
#define NS_MOUSE_LEFT_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 24)
|
||||
#define NS_MOUSE_MIDDLE_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 25)
|
||||
#define NS_MOUSE_RIGHT_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 26)
|
||||
#define NS_MOUSE_LEFT_CLICK (NS_MOUSE_MESSAGE_START + 27)
|
||||
#define NS_MOUSE_MIDDLE_CLICK (NS_MOUSE_MESSAGE_START + 28)
|
||||
#define NS_MOUSE_RIGHT_CLICK (NS_MOUSE_MESSAGE_START + 29)
|
||||
#define NS_MOUSE_ACTIVATE (NS_MOUSE_MESSAGE_START + 30)
|
||||
#define NS_MOUSE_ENTER_SYNTH (NS_MOUSE_MESSAGE_START + 31)
|
||||
#define NS_MOUSE_EXIT_SYNTH (NS_MOUSE_MESSAGE_START + 32)
|
||||
|
||||
|
||||
|
||||
|
||||
#define NS_SCROLL_EVENT (NS_WINDOW_START + 61)
|
||||
|
||||
|
||||
#define NS_SCROLLBAR_MESSAGE_START 1000
|
||||
#define NS_SCROLLBAR_POS (NS_SCROLLBAR_MESSAGE_START)
|
||||
#define NS_SCROLLBAR_PAGE_NEXT (NS_SCROLLBAR_MESSAGE_START + 1)
|
||||
#define NS_SCROLLBAR_PAGE_PREV (NS_SCROLLBAR_MESSAGE_START + 2)
|
||||
#define NS_SCROLLBAR_LINE_NEXT (NS_SCROLLBAR_MESSAGE_START + 3)
|
||||
#define NS_SCROLLBAR_LINE_PREV (NS_SCROLLBAR_MESSAGE_START + 4)
|
||||
|
||||
|
||||
#define NS_STREAM_EVENT_START 1100
|
||||
#define NS_PAGE_LOAD (NS_STREAM_EVENT_START)
|
||||
#define NS_PAGE_UNLOAD (NS_STREAM_EVENT_START + 1)
|
||||
#define NS_IMAGE_LOAD (NS_STREAM_EVENT_START + 2)
|
||||
#define NS_IMAGE_ABORT (NS_STREAM_EVENT_START + 3)
|
||||
#define NS_IMAGE_ERROR (NS_STREAM_EVENT_START + 4)
|
||||
|
||||
#define NS_FORM_EVENT_START 1200
|
||||
#define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
|
||||
#define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
|
||||
#define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
|
||||
#define NS_FORM_SELECTED (NS_FORM_EVENT_START + 3)
|
||||
#define NS_FORM_INPUT (NS_FORM_EVENT_START + 4)
|
||||
|
||||
///Need separate focus/blur notifications for non-native widgets
|
||||
#define NS_FOCUS_EVENT_START 1300
|
||||
#define NS_FOCUS_CONTENT (NS_FOCUS_EVENT_START)
|
||||
#define NS_BLUR_CONTENT (NS_FOCUS_EVENT_START + 1)
|
||||
|
||||
|
||||
#define NS_DRAGDROP_EVENT_START 1400
|
||||
#define NS_DRAGDROP_ENTER (NS_DRAGDROP_EVENT_START)
|
||||
#define NS_DRAGDROP_OVER (NS_DRAGDROP_EVENT_START + 1)
|
||||
#define NS_DRAGDROP_EXIT (NS_DRAGDROP_EVENT_START + 2)
|
||||
#define NS_DRAGDROP_DROP (NS_DRAGDROP_EVENT_START + 3)
|
||||
#define NS_DRAGDROP_GESTURE (NS_DRAGDROP_EVENT_START + 4)
|
||||
#define NS_DRAGDROP_OVER_SYNTH (NS_DRAGDROP_EVENT_START + 1)
|
||||
#define NS_DRAGDROP_EXIT_SYNTH (NS_DRAGDROP_EVENT_START + 2)
|
||||
|
||||
|
||||
|
||||
|
||||
/// Menu item selected
|
||||
#define NS_MENU_SELECTED (NS_WINDOW_START + 38)
|
||||
|
||||
|
||||
|
||||
// Events for popups
|
||||
#define NS_MENU_EVENT_START 1500
|
||||
#define NS_MENU_CREATE (NS_MENU_EVENT_START)
|
||||
#define NS_MENU_DESTROY (NS_MENU_EVENT_START+1)
|
||||
#define NS_MENU_ACTION (NS_MENU_EVENT_START+2)
|
||||
#define NS_XUL_BROADCAST (NS_MENU_EVENT_START+3)
|
||||
#define NS_XUL_COMMAND_UPDATE (NS_MENU_EVENT_START+4)
|
||||
//@}
|
||||
|
||||
// Scroll events
|
||||
#define NS_MOUSE_SCROLL_START 1600
|
||||
#define NS_MOUSE_SCROLL (NS_MOUSE_SCROLL_START)
|
||||
|
||||
|
||||
#define NS_SCROLL_EVENT (NS_WINDOW_START + 61)
|
||||
|
||||
|
||||
#define NS_SCROLLPORT_START 1700
|
||||
#define NS_SCROLLPORT_UNDERFLOW (NS_SCROLLPORT_START)
|
||||
#define NS_SCROLLPORT_OVERFLOW (NS_SCROLLPORT_START+1)
|
||||
#define NS_SCROLLPORT_OVERFLOWCHANGED (NS_SCROLLPORT_START+2)
|
||||
|
||||
#define NS_IS_MOUSE_EVENT(evnt) \
|
||||
(((evnt)->message == NS_MOUSE_LEFT_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_ENTER) || \
|
||||
((evnt)->message == NS_MOUSE_EXIT) || \
|
||||
((evnt)->message == NS_MOUSE_ENTER) || \
|
||||
((evnt)->message == NS_MOUSE_EXIT) || \
|
||||
((evnt)->message == NS_MOUSE_ENTER_SYNTH) || \
|
||||
((evnt)->message == NS_MOUSE_EXIT_SYNTH) || \
|
||||
((evnt)->message == NS_MOUSE_MOVE))
|
||||
|
||||
#define NS_IS_DRAG_EVENT(evnt) \
|
||||
(((evnt)->message == NS_DRAGDROP_ENTER) || \
|
||||
((evnt)->message == NS_DRAGDROP_OVER) || \
|
||||
((evnt)->message == NS_DRAGDROP_EXIT) || \
|
||||
((evnt)->message == NS_DRAGDROP_DROP) || \
|
||||
((evnt)->message == NS_DRAGDROP_GESTURE) || \
|
||||
((evnt)->message == NS_DRAGDROP_OVER_SYNTH) || \
|
||||
((evnt)->message == NS_DRAGDROP_EXIT_SYNTH))
|
||||
|
||||
#define NS_IS_KEY_EVENT(evnt) \
|
||||
(((evnt)->message == NS_KEY_DOWN) || \
|
||||
((evnt)->message == NS_KEY_PRESS) || \
|
||||
((evnt)->message == NS_KEY_UP))
|
||||
|
||||
#define NS_IS_IME_EVENT(evnt) \
|
||||
(((evnt)->message == NS_TEXT_EVENT) || \
|
||||
((evnt)->message == NS_COMPOSITION_START) || \
|
||||
((evnt)->message == NS_COMPOSITION_END) || \
|
||||
((evnt)->message == NS_RECONVERSION_QUERY) || \
|
||||
((evnt)->message == NS_COMPOSITION_QUERY))
|
||||
|
||||
#define NS_EVENT_FLAG_NONE 0x0000
|
||||
#define NS_EVENT_FLAG_INIT 0x0001
|
||||
#define NS_EVENT_FLAG_BUBBLE 0x0002
|
||||
#define NS_EVENT_FLAG_CAPTURE 0x0004
|
||||
#define NS_EVENT_FLAG_STOP_DISPATCH 0x0008
|
||||
#define NS_EVENT_FLAG_NO_DEFAULT 0x0010
|
||||
#define NS_EVENT_FLAG_CANT_CANCEL 0x0020
|
||||
#define NS_EVENT_FLAG_CANT_BUBBLE 0x0040
|
||||
|
||||
#define NS_APP_EVENT_FLAG_NONE 0x0000
|
||||
|
||||
/// Similar to NS_EVENT_FLAG_NO_DEFAULT, but it allows focus
|
||||
#define NS_APP_EVENT_FLAG_HANDLED 0x0001
|
||||
|
||||
/**
|
||||
* IME Constants
|
||||
* @name textrange_defines
|
||||
* @note keep in synch with nsIDOMTextRange.h
|
||||
* @note why don't we use the values that nsIDOMTextRange uses???
|
||||
*/
|
||||
//@{
|
||||
#define NS_TEXTRANGE_CARETPOSITION 0x01
|
||||
#define NS_TEXTRANGE_RAWINPUT 0X02
|
||||
#define NS_TEXTRANGE_SELECTEDRAWTEXT 0x03
|
||||
#define NS_TEXTRANGE_CONVERTEDTEXT 0x04
|
||||
#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
|
||||
//@}
|
||||
|
||||
#endif // nsGUIEvent_h__
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIWindow;
|
||||
|
||||
/**
|
||||
* nsIChildWindow interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIWindow
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(081b5644-1dd2-11b2-aaab-8a7e95393e2e)]
|
||||
interface nsIChildWindow : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize a child window
|
||||
* This window represents a window that can be drawn into via
|
||||
* a query interface to nsIDrawable
|
||||
* @see nsIDrawable
|
||||
*
|
||||
* @param aParent the parent window. This parameter can not be null.
|
||||
* @param aX the x position, in pixels, relative to aParent.
|
||||
* @param aY the y position, in pixels, relative to aParent.
|
||||
* @param aWidth the width, in pixels, of the window.
|
||||
* @param aHeight the height, in pixels, of the window.
|
||||
*/
|
||||
void init(in nsIWindow aParent,
|
||||
in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
void takeFocus();
|
||||
|
||||
void moveZOrderAboveSibling(in nsIChildWindow aSibling);
|
||||
void moveZOrderBelowSibling(in nsIChildWindow aSibling);
|
||||
};
|
|
@ -1,128 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsITransferable;
|
||||
|
||||
/**
|
||||
* nsIClipboardOwner interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
* @see nsIClipboard
|
||||
**/
|
||||
[scriptable, uuid(73de5286-1dd2-11b2-a8b9-f5e2993c4a16)]
|
||||
interface nsIClipboardOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the owner of the clipboard transferable that the
|
||||
* transferable is being removed from the clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
*/
|
||||
void losingOwnership ( in nsITransferable aTransferable ) ;
|
||||
};
|
||||
|
||||
/**
|
||||
* nsIClipboard interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
* @note planning on making get async... need new interface for callbacks to hit... or clipboard owner... threadsafety issues?
|
||||
* @see nsIClipboardOwner
|
||||
**/
|
||||
[scriptable, uuid(55b80482-1dd2-11b2-a67a-d657ccb708ea)]
|
||||
interface nsIClipboard : nsISupports
|
||||
{
|
||||
const long kSelectionClipboard = 0;
|
||||
const long kGlobalClipboard = 1;
|
||||
|
||||
/**
|
||||
* Given a transferable, set the data on the native clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @param anOwner The owner of the transferable
|
||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||
*/
|
||||
|
||||
void setData ( in nsITransferable aTransferable, in nsIClipboardOwner anOwner,
|
||||
in long aWhichClipboard );
|
||||
|
||||
/**
|
||||
* Given a transferable, get the clipboard data.
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||
*/
|
||||
|
||||
void getData ( in nsITransferable aTransferable, in long aWhichClipboard ) ;
|
||||
|
||||
/**
|
||||
* This empties the clipboard and notifies the clipboard owner.
|
||||
* This empties the "logical" clipboard. It does not clear the native clipboard.
|
||||
*
|
||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||
*/
|
||||
|
||||
void emptyClipboard ( in long aWhichClipboard ) ;
|
||||
|
||||
/**
|
||||
* Some platforms support deferred notification for putting data on the clipboard
|
||||
* This method forces the data onto the clipboard in its various formats
|
||||
* This may be used if the application going away.
|
||||
*
|
||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||
*/
|
||||
|
||||
void forceDataToClipboard ( in long aWhichClipboard ) ;
|
||||
|
||||
/**
|
||||
* This provides a way to give correct UI feedback about, for instance, if a paste
|
||||
* should be allowed.
|
||||
*
|
||||
* @param aFlavors An array of wstrings containing mime types.
|
||||
* @attention is the documentation for \a aFlavors correct? (the mime types part)
|
||||
* @param nFlavors The number of strings in \a aFlavors.
|
||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||
* @return TRUE if there is data matching one of the flavors on \a aWhichClipboard
|
||||
*
|
||||
* @note It does _NOT_ actually retreive the data and should be a very
|
||||
* inexpensive call. All it does is check if there is data on the clipboard
|
||||
* matching any of the flavors in the given list.
|
||||
|
||||
*/
|
||||
boolean hasDataMatchingFlavors([array, size_is(nFlavors), const] in wstring aFlavors,
|
||||
[const] in unsigned long nFlavors,
|
||||
in long aWhichClipboard);
|
||||
|
||||
/**
|
||||
* Allows clients to determine if the implementation supports the concept of a
|
||||
* separate clipboard for selection.
|
||||
*
|
||||
* @return TRUE if the implimentation supports kSelectionClipboard
|
||||
*/
|
||||
boolean supportsSelectionClipboard ( ) ;
|
||||
};
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIImage;
|
||||
|
||||
/**
|
||||
* nsICursor interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIWindow
|
||||
*/
|
||||
[scriptable, uuid(6e375fe6-1dd2-11b2-bc72-a50ca62dc040)]
|
||||
interface nsICursor : nsISupports
|
||||
{
|
||||
/**
|
||||
* @attention renumber this in order
|
||||
* CSS cursors
|
||||
* @name cursors
|
||||
* @see http://www.w3.org/TR/REC-CSS2/ui.html#cursor-props
|
||||
* @see http://www.w3.org/TR/css3-userint#cursor
|
||||
*/
|
||||
//@{
|
||||
/// cursor has come from an image
|
||||
const long image = -1;
|
||||
/// normal cursor, usually rendered as an arrow
|
||||
const long standard = 0;
|
||||
|
||||
/// system is busy, usually rendered as a hourglass or watch
|
||||
const long wait = 1;
|
||||
|
||||
/// Selecting something, usually rendered as an IBeam
|
||||
const long select = 2;
|
||||
|
||||
/// can hyper-link, usually rendered as a human hand
|
||||
const long hyperlink = 3;
|
||||
|
||||
/// west/east sizing, usually rendered as ->||<-
|
||||
const long sizeWE = 4;
|
||||
|
||||
/// north/south sizing, usually rendered as sizeWE rotated 90 degrees
|
||||
const long sizeNS = 5;
|
||||
|
||||
///(corner sizing)
|
||||
const long sizeNW = 50;
|
||||
const long sizeSE = 51;
|
||||
const long sizeNE = 52;
|
||||
const long sizeSW = 53;
|
||||
|
||||
const long arrow_north = 6;
|
||||
const long arrow_north_plus = 7;
|
||||
const long arrow_south = 8;
|
||||
const long arrow_south_plus = 9;
|
||||
const long arrow_west = 10;
|
||||
const long arrow_west_plus = 11;
|
||||
const long arrow_east = 12;
|
||||
const long arrow_east_plus = 13;
|
||||
const long crosshair = 14;
|
||||
|
||||
/// Don't know what 'move' cursor should be. See CSS2.
|
||||
const long move = 15;
|
||||
|
||||
const long help = 16;
|
||||
|
||||
|
||||
const long copy = 17;
|
||||
const long alias = 18;
|
||||
const long context_menu = 19;
|
||||
const long cell = 20;
|
||||
const long grab = 21;
|
||||
const long grabbing = 22;
|
||||
const long spinning = 23;
|
||||
const long count_up = 24;
|
||||
const long count_down = 25;
|
||||
const long count_up_down = 26;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Create a cursor based on the constant passed in.
|
||||
*
|
||||
* @param cursor the constant for the cursor you wish to create.
|
||||
*/
|
||||
attribute long cursor;
|
||||
|
||||
/**
|
||||
* Create a cursor based on an image.
|
||||
*
|
||||
* @param image The image you wish to create the cursor with.
|
||||
*
|
||||
* @attention this might have issues on X, etc
|
||||
*/
|
||||
void setToImage(in nsIImage image);
|
||||
|
||||
};
|
|
@ -1,78 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIDragSession.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
|
||||
/**
|
||||
* nsIDragService interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
* @see nsIDragSession
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(4d353438-1dd2-11b2-a880-d10d79cf157e)]
|
||||
interface nsIDragService : nsISupports
|
||||
{
|
||||
const long DRAGDROP_ACTION_NONE = 0;
|
||||
const long DRAGDROP_ACTION_COPY = 1;
|
||||
const long DRAGDROP_ACTION_MOVE = 2;
|
||||
const long DRAGDROP_ACTION_LINK = 4;
|
||||
|
||||
/**
|
||||
* Starts a modal drag session with an array of transaferables
|
||||
*
|
||||
* @param aDOMNode ??????????
|
||||
* @param aTransferables An array of nsITransferable objects to be dragged.
|
||||
* @param nTransferables The number of nsITransferable objects in \a aTransferables.
|
||||
* @param aRegion A region containing rectangles for cursor feedback,
|
||||
* in window coordinates.
|
||||
* @param aActionType Specified which of copy/move/link are allowed.
|
||||
*/
|
||||
void invokeDragSession(in nsIDOMNode aDOMNode,
|
||||
[array, size_is(nTransferables)] in nsITransferable aTransferables,
|
||||
in unsigned long nTransferables,
|
||||
in nsIRegion aRegion,
|
||||
in unsigned long aActionType);
|
||||
|
||||
/**
|
||||
* Returns the current Drag Session
|
||||
*/
|
||||
nsIDragSession getCurrentSession();
|
||||
|
||||
/**
|
||||
* Tells the Drag Service to start a drag session. This is called when
|
||||
* an external drag occurs
|
||||
*/
|
||||
void startDragSession();
|
||||
|
||||
/**
|
||||
* Tells the Drag Service to end a drag session. This is called when
|
||||
* an external drag occurs
|
||||
*/
|
||||
void endDragSession();
|
||||
|
||||
};
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
#include "nsITransferable.idl"
|
||||
|
||||
interface nsIRegion;
|
||||
interface nsIDOMDocument;
|
||||
|
||||
/**
|
||||
* nsIDragSession interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
* @see nsIDragService
|
||||
*/
|
||||
[scriptable, uuid(649134c4-1dd2-11b2-b500-d18d1a4c9c06)]
|
||||
interface nsIDragSession : nsISupports
|
||||
{
|
||||
/**
|
||||
* Set the current state of the drag whether it can be dropped or not.
|
||||
* usually the target "frame" sets this so the native system can render the correct feedback
|
||||
*/
|
||||
attribute boolean canDrop;
|
||||
|
||||
/**
|
||||
* Sets the action (copy, move, link, et.c) for the current drag
|
||||
*/
|
||||
attribute unsigned long dragAction;
|
||||
|
||||
/**
|
||||
* Sets the current width and height if the drag target area.
|
||||
* It will contain the current size of the Frame that the drag is currently in
|
||||
*/
|
||||
[noscript] attribute nsSize2 targetSize;
|
||||
|
||||
/**
|
||||
* Get the number items that were dropped
|
||||
*/
|
||||
readonly attribute unsigned long numDropItems;
|
||||
|
||||
/**
|
||||
* The document where the drag was started, which will be null if the
|
||||
* drag originated outside the application. Useful for determining if a drop
|
||||
* originated in the same document.
|
||||
*/
|
||||
readonly attribute nsIDOMDocument sourceDocument;
|
||||
|
||||
/**
|
||||
* Get data from a Drag&Drop. Can be called while the drag is in process
|
||||
* or after the drop has completed.
|
||||
*
|
||||
* @param aTransferable the transferable for the data to be put into
|
||||
* @param aItemIndex which of multiple drag items, zero-based
|
||||
*
|
||||
* @attention should \a aTransferable be an out or inout parameter instead of in?
|
||||
*/
|
||||
void getData(in nsITransferable aTransferable, in unsigned long aItemIndex);
|
||||
|
||||
/**
|
||||
* Check to set if ant of the native data on the clipboard matches this data flavor
|
||||
*
|
||||
* @return NS_OK if if the data flavor is supported and, NS_ERROR_FAILURE is it is not
|
||||
*/
|
||||
boolean isDataFlavorSupported(in string aDataFlavor);
|
||||
};
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* nsIDragTracker
|
||||
*
|
||||
* An interface used with the drag service/session to be notified
|
||||
* when a drag is over or out of its window. This allows an object to,
|
||||
* for example, grab the mouse until and be told when it should stop.
|
||||
*
|
||||
* When the joyride is over, the Drag Session calls |stopTracking()|
|
||||
* to alert the object that it should stop watching.
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
* @see nsIDragService
|
||||
* @see nsIDragSession
|
||||
*/
|
||||
|
||||
[scriptable, uuid(6572722c-1dd2-11b2-a716-d512629216b1)]
|
||||
interface nsIDragTracker : nsISupports
|
||||
{
|
||||
/**
|
||||
* Call to tell the object that is tracking the drag that it
|
||||
* can forget about it (mouse left the window or the drop completed).
|
||||
*/
|
||||
void stopTracking();
|
||||
|
||||
};
|
|
@ -1,415 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIFontMetrics;
|
||||
interface nsIImage;
|
||||
interface nsIRegion;
|
||||
|
||||
/**
|
||||
* nsIDrawable interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(12be2fd2-1dd2-11b2-bc8f-ac54c3aa0d69)]
|
||||
interface nsIDrawable : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* consts used for changing the clip rect and region
|
||||
*
|
||||
* @name clip constants
|
||||
* @see changeClipRectangle()
|
||||
* @see changeClipRegion()
|
||||
*/
|
||||
//@{
|
||||
const short clipIntersect = 0;
|
||||
const short clipUnion = 1;
|
||||
const short clipSubtract = 2;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Get the width and height of this drawable.
|
||||
*
|
||||
* @param width The width of the drawable in pixels.
|
||||
* @param height The height of the drawable in pixels.
|
||||
*/
|
||||
void getSize(out gfx_dimension width, out gfx_dimension height);
|
||||
|
||||
/**
|
||||
* Get the width of this drawable.
|
||||
*
|
||||
* @see getSize()
|
||||
*/
|
||||
readonly attribute gfx_dimension width;
|
||||
|
||||
/**
|
||||
* Get the height of this drawable.
|
||||
*
|
||||
* @see getSize()
|
||||
*/
|
||||
readonly attribute gfx_dimension height;
|
||||
|
||||
|
||||
readonly attribute gfx_depth depth;
|
||||
|
||||
/**
|
||||
* Draw a point at (\a x, \a y).
|
||||
*
|
||||
* @param x The x-coordinate to draw at.
|
||||
* @param y The y-coordinate to draw at.
|
||||
*
|
||||
* @note uses foreground, clip
|
||||
*/
|
||||
void drawPoint(in gfx_coord x,
|
||||
in gfx_coord y);
|
||||
|
||||
|
||||
/**
|
||||
* Draw a line between the points (\a x1, \a y1) and (\a x2, \a y2).
|
||||
*
|
||||
* @param x1 the first point's x coordinate.
|
||||
* @param y1 the first point's y coordinate.
|
||||
* @param x2 the second point's x coordinate.
|
||||
* @param y2 the second point's y coordinate.
|
||||
*
|
||||
* @note uses foreground, line width, clip
|
||||
*/
|
||||
void drawLine(in gfx_coord x1,
|
||||
in gfx_coord y1,
|
||||
in gfx_coord x2,
|
||||
in gfx_coord y2);
|
||||
|
||||
|
||||
/**
|
||||
* Draw a rectangle filled with backgroundColor
|
||||
*
|
||||
* @param aX The x-coordinate of top-left corner of rectangle.
|
||||
* @param aY The y-coordinate of top-left corner of rectangle.
|
||||
* @param aWidth The width of the rectangle.
|
||||
* @param aHeight The height of the rectangle.
|
||||
*
|
||||
* @note uses foreground, background, line width, clip
|
||||
* @see fillRectangle()
|
||||
*/
|
||||
void drawRectangle(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
/**
|
||||
* Draw a rectangle filled with backgroundColor
|
||||
*
|
||||
* @param aX The x-coordinate of top-left corner of rectangle.
|
||||
* @param aY The y-coordinate of top-left corner of rectangle.
|
||||
* @param aWidth The width of the rectangle
|
||||
* @param aHeight The height of the rectangle
|
||||
*
|
||||
* @note uses foreground, background, line width, clip
|
||||
* @see drawRectangle()
|
||||
*/
|
||||
void fillRectangle(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
|
||||
/**
|
||||
* Draw an ellipse
|
||||
*
|
||||
* @param aX The x-coordinate of the rectangle in which to draw the ellipse.
|
||||
* @param aY The y-coordinate of the rectangle in which to draw the ellipse.
|
||||
* @param aWidth The width of the rectangle in which to draw the ellipse.
|
||||
* @param aHeight The height of the rectangle in which to draw the ellipse.
|
||||
*
|
||||
* @note uses foreground, background, clip
|
||||
* @see fillEllipse()
|
||||
*/
|
||||
void drawEllipse(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
/**
|
||||
* Draw an ellipse filled with backgroundColor
|
||||
*
|
||||
* @param aX The x-coordinate of the rectangle in which to draw the ellipse.
|
||||
* @param aY The y-coordinate of the rectangle in which to draw the ellipse.
|
||||
* @param aWidth The width of the rectangle in which to draw the ellipse.
|
||||
* @param aHeight The height of the rectangle in which to draw the ellipse.
|
||||
*
|
||||
* @note uses foreground, background, clip
|
||||
* @see drawEllipse()
|
||||
*/
|
||||
void fillEllipse(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
|
||||
/**
|
||||
* Draw an arc
|
||||
*
|
||||
* @param x The x-coordinate for the arc's bounding rectangle.
|
||||
* @param a The y-coordinate for the arc's bounding rectangle.
|
||||
* @param width The width of the arc's bounding rectangle.
|
||||
* @param height The height of the arc's bounding rectangle.
|
||||
* @param angle1 the starting angle of the arc, in the ellipse
|
||||
* @param angle2 The ending angle of the arc, in the ellipse
|
||||
*
|
||||
* @note uses foreground, clip
|
||||
* @see fillArc()
|
||||
*/
|
||||
void drawArc(in gfx_coord x,
|
||||
in gfx_coord y,
|
||||
in gfx_dimension width,
|
||||
in gfx_dimension height,
|
||||
in gfx_angle angle1,
|
||||
in gfx_angle angle2);
|
||||
/**
|
||||
* Draw an arc filled with backgroundColor
|
||||
*
|
||||
* @param x The x-coordinate for the arc's bounding rectangle.
|
||||
* @param a The y-coordinate for the arc's bounding rectangle.
|
||||
* @param width The width of the arc's bounding rectangle.
|
||||
* @param height The height of the arc's bounding rectangle.
|
||||
* @param angle1 the starting angle of the arc, in the ellipse
|
||||
* @param angle2 The ending angle of the arc, in the ellipse
|
||||
*
|
||||
* @note uses foreground, background, clip
|
||||
* @see drawArc()
|
||||
*/
|
||||
void fillArc(in gfx_coord x,
|
||||
in gfx_coord y,
|
||||
in gfx_dimension width,
|
||||
in gfx_dimension height,
|
||||
in gfx_angle angle1,
|
||||
in gfx_angle angle2);
|
||||
|
||||
|
||||
/**
|
||||
* Draw a polygon
|
||||
*
|
||||
* @param points An array of nsPoint2 structs that define the vertices of the polygon.
|
||||
* @param npoints The number of points in the array. This number must be at least two.
|
||||
*
|
||||
* @note currently noscript because xpidl doesn't support structs
|
||||
* @see fillPolygon()
|
||||
*/
|
||||
[noscript] void drawPolygon([array, size_is(npoints), const] in nsPoint2 points,
|
||||
[const] in unsigned long npoints);
|
||||
/**
|
||||
* Draw a polygon filled with backgroundColor
|
||||
*
|
||||
* @param points An array of nsPoint2 structs that define the vertices of the polygon.
|
||||
* @param npoints The number of points in the array. This number must be at least two.
|
||||
*
|
||||
* @note currently noscript because xpidl doesn't support structs
|
||||
* @see drawPolygon()
|
||||
*/
|
||||
[noscript] void fillPolygon([array, size_is(npoints), const] in nsPoint2 points,
|
||||
[const] in unsigned long npoints);
|
||||
|
||||
/**
|
||||
* Draw a wide string
|
||||
*
|
||||
* @param text the text to draw
|
||||
* @param length the length of the text to draw
|
||||
* @param x offset from the origin of the drawable to begin drawing
|
||||
* @param y offset from the origin of the drawable to begin drawing
|
||||
*
|
||||
* @note The baseline of the characters are drawn starting at the x and y coordinates ???
|
||||
*/
|
||||
void drawString([const] in wstring text,
|
||||
in unsigned long length,
|
||||
in gfx_coord x,
|
||||
in gfx_coord y);
|
||||
|
||||
/**
|
||||
* Draw a C string
|
||||
*
|
||||
* @param text the text to draw
|
||||
* @param length the length of the text to draw
|
||||
* @param x offset from the origin of the drawable to begin drawing
|
||||
* @param y offset from the origin of the drawable to begin drawing
|
||||
*
|
||||
* @note The baseline of the characters are drawn starting at the x and y coordinates ???
|
||||
*/
|
||||
void drawCString([const] in string text,
|
||||
in unsigned long length,
|
||||
in gfx_coord x,
|
||||
in gfx_coord y);
|
||||
|
||||
/**
|
||||
* Copy the data of 'this' drawable in to \a dest
|
||||
*
|
||||
* @param dest The nsIDrawable to copy the contents of 'this' in to.
|
||||
* @param xsrc The source x-coordinate.
|
||||
* @param ysrc The source y-coordinate.
|
||||
* @param xdest The destination x-coordinate.
|
||||
* @param ydest The destination y-coordinate.
|
||||
* @param width The width of the area to copy.
|
||||
* @param height The height of the area to copy.
|
||||
*
|
||||
* @note uses clipping (from dest or source??)
|
||||
*/
|
||||
void copyTo(in nsIDrawable dest,
|
||||
in gfx_coord xsrc,
|
||||
in gfx_coord ysrc,
|
||||
in gfx_coord xdest,
|
||||
in gfx_coord ydest,
|
||||
in gfx_dimension width,
|
||||
in gfx_dimension height);
|
||||
|
||||
/**
|
||||
* Clear an area
|
||||
*
|
||||
* @param x The x-coordinate of the rectangular area to clear.
|
||||
* @param y The y-coordinate of the rectangular area to clear.
|
||||
* @param width The width of the area to clear.
|
||||
* @param height The height of the area to clear.
|
||||
*
|
||||
* @note This should not generate an expose event
|
||||
* @see clear()
|
||||
*/
|
||||
void clearArea(in gfx_coord x,
|
||||
in gfx_coord y,
|
||||
in gfx_dimension width,
|
||||
in gfx_dimension height);
|
||||
|
||||
/**
|
||||
* Clear the entire contents of the drawing area
|
||||
*
|
||||
* @note This should not generate an expose event
|
||||
* @see clearArea()
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Draw an image without scaling.
|
||||
*
|
||||
* @param aImage The image to draw in to this drawable.
|
||||
* @param aSrcRect The source rectangle of aImage to draw in to this at aDestPoint.
|
||||
* @param aDestPoint The point at which to start drawing aSrcRect of aImage.
|
||||
*
|
||||
* @see drawScaledImage()
|
||||
* @see drawTile()
|
||||
* @see drawScaledTile()
|
||||
*/
|
||||
[noscript] void drawImage(in nsIImage aImage,
|
||||
[const] in nsRect2 aSrcRect,
|
||||
[const] in nsPoint2 aDestPoint);
|
||||
|
||||
/**
|
||||
* Draw an image scaling \a aSrcRect to \a aDestRect
|
||||
*
|
||||
* @param aImage The image to draw in to this drawable.
|
||||
* @param aSrcRect The source rectangle of aImage to draw in to this at aDestPoint.
|
||||
* @param aDestRect The destination rectangle.
|
||||
*
|
||||
* @note If size(\a aSrcRect) < size(\a aDestRect), scale larger.
|
||||
* @note If size(\a aSrcRect) > size(\a aDestRect), scale smaller.
|
||||
*
|
||||
* @exception NS_ERROR_FAILURE if size(dest) == size(source). use drawImage()
|
||||
*
|
||||
* @see drawImage()
|
||||
* @see drawTile()
|
||||
* @see drawScaledTile()
|
||||
*/
|
||||
[noscript] void drawScaledImage(in nsIImage aImage,
|
||||
[const] in nsRect2 aSrcRect,
|
||||
[const] in nsRect2 aDestRect);
|
||||
|
||||
/**
|
||||
* Tile an image without scaling.
|
||||
*
|
||||
* @param aImage The image to tile in to this drawable.
|
||||
* @param aXOffset The x-coordinate of the upper right tile.
|
||||
* @param aYOffset The y-coordinate of the upper right tile.
|
||||
* @param aTargetRect The entire area to tile the image in to.
|
||||
*
|
||||
* @see drawImage()
|
||||
* @see drawScaledImage()
|
||||
* @see drawScaledTile()
|
||||
*/
|
||||
[noscript] void drawTile(in nsIImage aImage,
|
||||
in gfx_coord aXOffset,
|
||||
in gfx_coord aYOffset,
|
||||
[const] in nsRect2 aTargetRect);
|
||||
|
||||
/**
|
||||
* Tile an an image scaling \a aSrcRect to \a aDestRect
|
||||
*
|
||||
* @note why are the params here so different from the other image drawing methods???
|
||||
*
|
||||
* @see drawImage()
|
||||
* @see drawScaledImage()
|
||||
* @see drawTile()
|
||||
*/
|
||||
[noscript] void drawScaledTile(in nsIImage aImage,
|
||||
in gfx_coord aXOffset,
|
||||
in gfx_coord aYOffset,
|
||||
in gfx_dimension aTileWidth,
|
||||
in gfx_dimension aTileHeight,
|
||||
[const] in nsRect2 aTargetRect);
|
||||
|
||||
/* drawBezierCurve() */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* drawable state stuff */
|
||||
|
||||
/**
|
||||
* Width of the current line in pixels.
|
||||
*
|
||||
* @note used by drawLine, .....?
|
||||
*/
|
||||
attribute gfx_coord lineWidth;
|
||||
|
||||
attribute gfx_color foregroundColor;
|
||||
attribute gfx_color backgroundColor;
|
||||
|
||||
[noscript] void setFont([const] in nsFont font);
|
||||
[noscript] nsFont getFont();
|
||||
|
||||
attribute nsIFontMetrics fontMetrics;
|
||||
|
||||
/* clipping */
|
||||
void getClipOrigin(out gfx_coord x, out gfx_coord y);
|
||||
void setClipOrigin(in gfx_coord x, in gfx_coord y);
|
||||
|
||||
/* these should all set the same thing */
|
||||
/* [noscript] attribute nsRect2 clipRectangle; */
|
||||
void getClipRectangle(out gfx_coord x, out gfx_coord y, out gfx_dimension width, out gfx_dimension height);
|
||||
void setClipRectangle(in gfx_coord x, in gfx_coord y, in gfx_dimension width, in gfx_dimension height);
|
||||
|
||||
attribute nsIRegion clipRegion;
|
||||
|
||||
[noscript] void changeClipRectangle([const] in nsRect2 rect, in short clipOperation);
|
||||
void changeClipRegion(/*[const]*/in nsIRegion aRegion, in short clipOperation);
|
||||
|
||||
};
|
|
@ -1,140 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURL;
|
||||
interface nsIFileURL;
|
||||
interface nsILocalFile;
|
||||
interface nsIDOMWindowInternal;
|
||||
|
||||
/**
|
||||
* nsIFilePicker interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.1
|
||||
* @note Need to look at changing filtering for gfx2. Talk to Mike Pinkerton <pinkerton@netscape.com> about this.
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(0db4f996-1dd2-11b2-99b7-b7c666fe92f8)]
|
||||
interface nsIFilePicker : nsISupports
|
||||
{
|
||||
/**
|
||||
* File picker modes
|
||||
* @name init_modes
|
||||
* @see init()
|
||||
*/
|
||||
//@{
|
||||
const short modeOpen = 0; // Load a file or directory
|
||||
const short modeSave = 1; // Save a file or directory
|
||||
const short modeGetFolder = 2; // Select a fodler/directory
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Return values from show()
|
||||
* @name show_returns
|
||||
* @see show()
|
||||
*/
|
||||
//@{
|
||||
const short returnOK = 0; // User hit cancel, ignore selection
|
||||
const short returnCancel = 1; // User hit Ok, process selection
|
||||
const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Pre-defined filter types
|
||||
* @name filter_types
|
||||
* @see appendFilters()
|
||||
*/
|
||||
//@{
|
||||
const long filterAll = 0x01; // *.*
|
||||
const long filterHTML = 0x02; // *.html; *.htm
|
||||
const long filterText = 0x04; // *.txt
|
||||
const long filterImages = 0x08; // *.png; *.gif; *.jpg; *.jpeg
|
||||
const long filterXML = 0x10; // *.xml
|
||||
const long filterXUL = 0x20; // *.xul
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the file widget.
|
||||
*
|
||||
* @param parent nsIDOMWindowInternal parent. This dialog should be dependant on this parent.
|
||||
* @param title The title for the file widget
|
||||
* @param mode load, save, or get folder
|
||||
*
|
||||
*/
|
||||
void init(in nsIDOMWindowInternal parent, [const] in wstring title, in short mode);
|
||||
|
||||
/**
|
||||
* Append to the filter list with things from the predefined list
|
||||
*
|
||||
* @param filters mask of filters i.e. (filterAll | filterHTML)
|
||||
*
|
||||
*/
|
||||
void appendFilters(in long filterMask);
|
||||
|
||||
/**
|
||||
* Add a filter
|
||||
*
|
||||
* @param title name of the filter
|
||||
* @param filter extentions to filter -- semicolon and space seperated
|
||||
*
|
||||
*/
|
||||
void appendFilter(in wstring title,
|
||||
in wstring filter);
|
||||
|
||||
/* what is this? */
|
||||
attribute wstring defaultString;
|
||||
|
||||
/**
|
||||
* Set the directory that the file open/save dialog initially displays
|
||||
*
|
||||
* @param displayDirectory the name of the directory
|
||||
*
|
||||
*/
|
||||
attribute nsILocalFile displayDirectory;
|
||||
|
||||
|
||||
/**
|
||||
* Get the nsILocalFile for the file or directory.
|
||||
*
|
||||
* @return Returns the file currently selected
|
||||
*/
|
||||
readonly attribute nsILocalFile file;
|
||||
|
||||
/**
|
||||
* Get the nsIFileURL for the file or directory.
|
||||
*
|
||||
* @return Returns the file currently selected
|
||||
*/
|
||||
readonly attribute nsIFileURL fileURL;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return returnOK if the user selects OK, returnCancel if the user selects cancel
|
||||
*
|
||||
*/
|
||||
short show();
|
||||
};
|
|
@ -1,221 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Erik van der Poel <erik@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIAtom;
|
||||
|
||||
typedef voidPtr nsFontHandle;
|
||||
|
||||
/**
|
||||
* Font metrics interface
|
||||
*
|
||||
* This interface may be somewhat misnamed. A better name might be
|
||||
* nsIFontList. The style system uses the nsFont struct for various font
|
||||
* properties, one of which is font-family, which can contain a *list* of
|
||||
* font names. The nsFont struct is "realized" by asking the device context
|
||||
* to cough up an nsIFontMetrics object, which contains a list of real font
|
||||
* handles, one for each font mentioned in font-family (and for each fallback
|
||||
* when we fall off the end of that list).
|
||||
*
|
||||
* The style system needs to have access to certain metrics, such as the
|
||||
* em height (for the CSS "em" unit), and we use the first Western font's
|
||||
* metrics for that purpose. The platform-specific implementations are
|
||||
* expected to select non-Western fonts that "fit" reasonably well with the
|
||||
* Western font that is loaded at Init time.
|
||||
*
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
[scriptable, uuid(ff47d78c-1dd1-11b2-839b-b4ba9c43f22a)]
|
||||
interface nsIFontMetrics : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize the font metrics. Call this after creating the font metrics.
|
||||
* Font metrics you get from the font cache do NOT need to be initialized
|
||||
*
|
||||
* @see nsIOutputDevice#getFontMetrics()
|
||||
*/
|
||||
[noscript] void init([const] in nsFont aFont,
|
||||
in nsIAtom aLangGroup);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of a unicode character
|
||||
* If no font has been Set, the results are undefined.
|
||||
* @param aString string to measure
|
||||
* @param aLength number of characters in string
|
||||
* @return width
|
||||
*/
|
||||
gfx_coord getCharWidth([const] in PRUnichar aChar);
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of an 8-bit character
|
||||
* If no font has been Set, the results are undefined.
|
||||
* @param aString string to measure
|
||||
* @param aLength number of characters in string
|
||||
* @return width
|
||||
*/
|
||||
gfx_coord getCCharWidth([const] in char aChar);
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of a Unicode character string
|
||||
* If no font has been Set, the results are undefined.
|
||||
* @param aString string to measure
|
||||
* @param aLength number of characters in string
|
||||
* @return width
|
||||
*/
|
||||
gfx_coord getStringWidth([const] in wstring aString,
|
||||
in long aLength);
|
||||
|
||||
/**
|
||||
* Returns the width (in app units) of an 8-bit character string
|
||||
* If no font has been Set, the results are undefined.
|
||||
* @param aString string to measure
|
||||
* @param aLength number of characters in string
|
||||
* @return width
|
||||
*/
|
||||
gfx_coord getCStringWidth([const] in string aString,
|
||||
in long aLength);
|
||||
|
||||
/**
|
||||
* Return the font's italic slope, i.e., the tangent of the italic angle.
|
||||
* The slope = 0 for an upright font. It is > 0 for a forward-slanted
|
||||
* font (italic style) and is < 0 for a back-slanted font.
|
||||
*/
|
||||
readonly attribute float italicSlope;
|
||||
|
||||
/**
|
||||
* Return the font's xheight property, scaled into app-units.
|
||||
*/
|
||||
readonly attribute gfx_coord XHeight;
|
||||
|
||||
/**
|
||||
* Return the font's superscript offset (the distance from the
|
||||
* baseline to where a superscript's baseline should be placed). The
|
||||
* value returned will be a positive value.
|
||||
*/
|
||||
readonly attribute gfx_coord superscriptOffset;
|
||||
|
||||
/**
|
||||
* Return the font's subscript offset (the distance from the
|
||||
* baseline to where a subscript's baseline should be placed). The
|
||||
* value returned will be a positive value.
|
||||
*/
|
||||
readonly attribute gfx_coord subscriptOffset;
|
||||
|
||||
/**
|
||||
* Return the font's strikeout offset (the distance from the
|
||||
* baseline to where a strikeout should be placed) and size
|
||||
* Positive values are above the baseline, negative below.
|
||||
*/
|
||||
void getStrikeout(out gfx_coord aOffset, out gfx_coord aSize);
|
||||
|
||||
/**
|
||||
* Return the font's underline offset (the distance from the
|
||||
* baseline to where a underline should be placed) and size.
|
||||
* Positive values are above the baseline, negative below.
|
||||
*/
|
||||
void getUnderline(out gfx_coord aOffset, out gfx_coord aSize);
|
||||
|
||||
/**
|
||||
* Returns the height (in app units) of the font. This is ascent plus descent
|
||||
* plus any internal leading
|
||||
*
|
||||
* This method will be removed once the callers have been moved over to the
|
||||
* new GetEmHeight (and possibly GetMaxHeight).
|
||||
*/
|
||||
readonly attribute gfx_coord height;
|
||||
|
||||
/**
|
||||
* Returns the normal line height (em height + leading).
|
||||
*/
|
||||
readonly attribute gfx_coord normalLineHeight;
|
||||
|
||||
/**
|
||||
* Returns the amount of internal leading (in app units) for the font. This
|
||||
* is computed as the "height - (ascent + descent)"
|
||||
*/
|
||||
readonly attribute gfx_coord leading;
|
||||
|
||||
/**
|
||||
* Returns the height (in app units) of the Western font's em square. This is
|
||||
* em ascent plus em descent.
|
||||
*/
|
||||
readonly attribute gfx_coord emHeight;
|
||||
|
||||
/**
|
||||
* Returns, in app units, the ascent part of the Western font's em square.
|
||||
*/
|
||||
readonly attribute gfx_coord emAscent;
|
||||
|
||||
/**
|
||||
* Returns, in app units, the descent part of the Western font's em square.
|
||||
*/
|
||||
readonly attribute gfx_coord emDescent;
|
||||
|
||||
/**
|
||||
* Returns the height (in app units) of the Western font's bounding box.
|
||||
* This is max ascent plus max descent.
|
||||
*/
|
||||
readonly attribute gfx_coord maxHeight;
|
||||
|
||||
/**
|
||||
* Returns, in app units, the maximum distance characters in this font extend
|
||||
* above the base line.
|
||||
*/
|
||||
readonly attribute gfx_coord maxAscent;
|
||||
|
||||
/**
|
||||
* Returns, in app units, the maximum distance characters in this font extend
|
||||
* below the base line.
|
||||
*/
|
||||
readonly attribute gfx_coord maxDescent;
|
||||
|
||||
/**
|
||||
* Returns, in app units, the maximum character advance for the font
|
||||
*/
|
||||
readonly attribute gfx_coord maxAdvance;
|
||||
|
||||
/**
|
||||
* Returns the font associated with these metrics
|
||||
*/
|
||||
[noscript] readonly attribute nsFont font;
|
||||
|
||||
/**
|
||||
* Returns the language group associated with these metrics
|
||||
*/
|
||||
readonly attribute nsIAtom langGroup;
|
||||
|
||||
/**
|
||||
* Returns the font handle associated with these metrics
|
||||
*/
|
||||
[noscript] readonly attribute nsFontHandle fontHandle;
|
||||
|
||||
/**
|
||||
* Returns the average character width
|
||||
*/
|
||||
readonly attribute gfx_coord aveCharWidth;
|
||||
};
|
|
@ -1,71 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
/**
|
||||
* nsIFormatConverter interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
*/
|
||||
[scriptable, uuid(ac4bfeac-1dd1-11b2-a070-ef0944f6fe13)]
|
||||
interface nsIFormatConverter : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the list of the "input" data flavors (mime types as nsISupportsString),
|
||||
* in otherwords, the flavors that this converter can convert "from" (the
|
||||
* incoming data to the converter).
|
||||
*/
|
||||
nsISupportsArray getInputDataFlavors ( ) ;
|
||||
|
||||
/**
|
||||
* Get the list of the "output" data flavors (mime types as nsISupportsString),
|
||||
* in otherwords, the flavors that this converter can convert "to" (the
|
||||
* outgoing data to the converter).
|
||||
*
|
||||
* @param aDataFlavorList fills list with supported flavors
|
||||
*/
|
||||
nsISupportsArray getOutputDataFlavors ( ) ;
|
||||
|
||||
/**
|
||||
* Determines whether a converion from one flavor to another is supported
|
||||
*
|
||||
* @param aFromFormatConverter flavor to convert from
|
||||
* @param aFromFormatConverter flavor to convert to
|
||||
*/
|
||||
boolean canConvert ( in string aFromDataFlavor, in string aToDataFlavor ) ;
|
||||
|
||||
/**
|
||||
* Converts from one flavor to another.
|
||||
*
|
||||
* @param aFromFormatConverter flavor to convert from
|
||||
* @param aFromFormatConverter flavor to convert to (destination own the memory)
|
||||
* @returns returns NS_OK if it was converted
|
||||
*/
|
||||
void convert ( in string aFromDataFlavor, in nsISupports aFromData, in unsigned long aDataLen,
|
||||
in string aToDataFlavor, out nsISupports aToData, out unsigned long aDataToLen ) ;
|
||||
|
||||
};
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
// xxx hack
|
||||
interface nsGUIEvent;
|
||||
|
||||
/**
|
||||
* nsIGUIEventListener interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIWindow
|
||||
*/
|
||||
[scriptable, uuid(bf8f42e6-1dd1-11b2-ae64-f8bf62d5f75e)]
|
||||
interface nsIGUIEventListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Progress this event
|
||||
*
|
||||
* @param event The event to process.
|
||||
*
|
||||
* @see nsGUIEvent.h for event types.
|
||||
* @note If a mouse listener is registered this method will not process mouse events.
|
||||
*/
|
||||
|
||||
[noscript] void processEvent([const] in nsGUIEvent event);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIDrawable;
|
||||
|
||||
/**
|
||||
* nsIImage interface
|
||||
*
|
||||
* @author Tim Rowley <tor@cs.brown.edu>
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.2
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(5e8405a4-1dd2-11b2-8385-bc8e3446cad3)]
|
||||
interface nsIImage : nsISupports
|
||||
{
|
||||
/**
|
||||
* Create a new \a aWidth x \a aHeight sized image.
|
||||
*
|
||||
* @param aWidth The width of the image to create.
|
||||
* @param aHeight The height of the image to create.
|
||||
* @param aFormat the width of the image to create.
|
||||
*
|
||||
* @note The data of a new image is unspecified (Whats the word i'm looking for here?).
|
||||
*/
|
||||
void init(in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight,
|
||||
in gfx_format aFormat);
|
||||
|
||||
/**
|
||||
* Create an image with the bits copied from aDrawable
|
||||
*
|
||||
* @param aDrawable The drawing area to gather the image bits from.
|
||||
* @param aX The x-coordinate of the rectangle in aDrawable to grab.
|
||||
* @param aY The y-coordinate of the rectangle in aDrawable to grab.
|
||||
* @param aWidth The width of the rectangle in aDrawable to grab.
|
||||
* @param aHeight The height of the rectangle in aDrawable to grab.
|
||||
*/
|
||||
void initFromDrawable(in nsIDrawable aDrawable,
|
||||
in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* The width of the image.
|
||||
*/
|
||||
readonly attribute gfx_dimension width;
|
||||
|
||||
/**
|
||||
* The height of the image.
|
||||
*/
|
||||
readonly attribute gfx_dimension height;
|
||||
|
||||
/**
|
||||
* The image data format the image was created with.
|
||||
* @see nsIGFXFormat
|
||||
*/
|
||||
readonly attribute gfx_format format;
|
||||
|
||||
readonly attribute unsigned long bytesPerRow;
|
||||
|
||||
/**
|
||||
* returns the number of bytes allocated for the image
|
||||
*/
|
||||
readonly attribute unsigned long bitsLength;
|
||||
|
||||
|
||||
readonly attribute PRUint8 bits;
|
||||
|
||||
/**
|
||||
* Sets \a length bytes of \a data in this object.
|
||||
* @param offset The offset from the first pixel in bytes. To set
|
||||
* data beginning with the first (top left) pixel in the image, \a offset
|
||||
* should be 0; to set data beginning with, for example, the sixth pixel in
|
||||
* the first row of a RGBA32 image, the offset should be 20.
|
||||
* @attension should we use PRUint32 instead?
|
||||
*/
|
||||
void setBits([array, size_is(length), const] in PRUint8 data,
|
||||
in unsigned long length,
|
||||
in long offset);
|
||||
|
||||
};
|
|
@ -1,113 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIAtom; // should we really be using an atom??
|
||||
interface nsIFontMetrics;
|
||||
|
||||
/**
|
||||
* nsIOutputDevice interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIScreenManager
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(ecc03f96-1dd1-11b2-8d3a-a652b5f45e04)]
|
||||
interface nsIOutputDevice : nsISupports
|
||||
{
|
||||
readonly attribute gfx_format preferedAlphaFormat;
|
||||
|
||||
/**
|
||||
* Get the nsIFontMetrics that describe the properties of
|
||||
* an nsFont.
|
||||
*
|
||||
* @param aFont font description to obtain metrics for
|
||||
* @param aLangGroup the language group of the document
|
||||
* @return The nsIFontMetrics that describes aFont and aLangGroup.
|
||||
*/
|
||||
[noscript] nsIFontMetrics getFontMetricsWithLanguage([const] in nsFont aFont,
|
||||
in nsIAtom aLangGroup);
|
||||
|
||||
/**
|
||||
* Get the nsIFontMetrics that describe the properties of
|
||||
* an nsFont.
|
||||
*
|
||||
* @param aFont font description to obtain metrics for
|
||||
* @return The nsIFontMetrics that describes aFont.
|
||||
*/
|
||||
[noscript] nsIFontMetrics getFontMetrics([const] in nsFont aFont);
|
||||
|
||||
|
||||
/**
|
||||
* Check to see if a particular named font exists.
|
||||
* @param aFontName character string of font face name
|
||||
* @return TRUE if font is available, else FALSE if font is unavailable
|
||||
*/
|
||||
boolean checkFontExistence([const] in wstring aFaceName);
|
||||
|
||||
|
||||
// whats this do?
|
||||
[noscript] wstring firstExistingFont([const] in nsFont aFont);
|
||||
|
||||
|
||||
// what does aliased mean?
|
||||
wstring getLocalFontName([const] in wstring aFaceName, out boolean aAliased);
|
||||
|
||||
|
||||
// XXX ?
|
||||
/**
|
||||
* Attempt to free up resoruces by flushing out any fonts no longer
|
||||
* referenced by anything other than the font cache itself.
|
||||
* @return error status
|
||||
*/
|
||||
void flushFontCache();
|
||||
|
||||
|
||||
|
||||
|
||||
//functions for handling gamma correction of output device
|
||||
attribute gfx_gamma gamma;
|
||||
|
||||
|
||||
// do we need this?
|
||||
//XXX the return from this really needs to be ref counted somehow. MMP
|
||||
// this should be an array
|
||||
void getGamaTable([array, size_is(nelements)] out PRUint8 points,
|
||||
out unsigned long nelements);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[noscript] readonly attribute nsSize2 size;
|
||||
|
||||
|
||||
readonly attribute gfx_depth depth;
|
||||
|
||||
|
||||
};
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIWindow;
|
||||
|
||||
/**
|
||||
* nsIPixmap interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIDrawable
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(37b7da08-1dd2-11b2-9169-94eb3b118a88)]
|
||||
interface nsIPixmap : nsISupports
|
||||
{
|
||||
/**
|
||||
* Create an offscreen drawing area.
|
||||
* @see nsIDrawable
|
||||
*
|
||||
* @param aParent the parent window.
|
||||
* @param aWidth the width, in pixels, of the pixmap.
|
||||
* @param aHeight the height, in pixels, of the pixmap.
|
||||
* @param aDepth the bit depth to create the pixmap at.
|
||||
*/
|
||||
void init(in nsIWindow aParent,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight,
|
||||
in gfx_depth aDepth);
|
||||
};
|
||||
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIWindow;
|
||||
interface nsIPixmap;
|
||||
|
||||
/**
|
||||
* nsIPopupWindow interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIWindow
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(4a210674-1dd2-11b2-8451-dbd941f8d393)]
|
||||
interface nsIPopupWindow : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize a popup window
|
||||
* The popup window represents a window that can be drawn into via
|
||||
* a query interface to nsIDrawable
|
||||
* @see nsIDrawable
|
||||
*
|
||||
* @param aParent the parent window
|
||||
* @param aX the x position, in pixels, relative to aParent.
|
||||
* @param aY the y position, in pixels, relative to aParent.
|
||||
* @param aWidth the width, in pixels, of the window.
|
||||
* @param aHeight the height, in pixels, of the window.
|
||||
*/
|
||||
void init(in nsIWindow aParent,
|
||||
in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* Bring the window to the top (infront of all other windows)
|
||||
*/
|
||||
void bringToTop();
|
||||
|
||||
/**
|
||||
* eeeeeek!
|
||||
* @attention NEEDS DOCS
|
||||
* @warning this may not be implemented on all platforms
|
||||
* @exception NS_ERROR_NOT_IMPLEMENTED If this is not implemented.
|
||||
*/
|
||||
void setTransparency(in nsIPixmap mask);
|
||||
};
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999-2000 Netscape Communications Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
/**
|
||||
* nsIRegion interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.1
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(85da5ba0-1dd2-11b2-be02-970202b0f7d5)]
|
||||
interface nsIRegion : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize the region to an empty state
|
||||
* @note rename to setEmpty() ?
|
||||
**/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* Create a clone of the current region.
|
||||
**/
|
||||
nsIRegion copy();
|
||||
|
||||
/**
|
||||
* copy operator equivalent that takes another region
|
||||
*
|
||||
* @param region to copy
|
||||
**/
|
||||
void setToRegion(in nsIRegion aRegion);
|
||||
|
||||
/**
|
||||
* copy operator equivalent that takes a rect
|
||||
*
|
||||
* @param aX The x-coordinate of rect to set region to
|
||||
* @param aY The y-coordinate of rect to set region to
|
||||
* @param aWidth The width of rect to set region to
|
||||
* @param aHeight The height of rect to set region to
|
||||
**/
|
||||
void setToRect(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* destructively intersect another region with this one
|
||||
*
|
||||
* @param region to intersect
|
||||
**/
|
||||
void intersectRegion(in nsIRegion aRegion);
|
||||
|
||||
/**
|
||||
* destructively intersect a rect with this region
|
||||
*
|
||||
* @param aX The x-coordinate of rect to intersect with region
|
||||
* @param aY The y-coordinate of rect to intersect with region
|
||||
* @param aWidth The width of rect to intersect with region
|
||||
* @param aHeight The height of rect to intersect with region
|
||||
**/
|
||||
void intersectRect(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* destructively union another region with this one
|
||||
*
|
||||
* @param region to union
|
||||
**/
|
||||
void unionRegion(in nsIRegion aRegion);
|
||||
|
||||
/**
|
||||
* destructively union a rect with this region
|
||||
*
|
||||
* @param aX The x-coordinate of rect to union with region
|
||||
* @param aY The y-coordinate of rect to union with region
|
||||
* @param aWidth The width of rect to union with region
|
||||
* @param aHeight The height of rect to union with region
|
||||
**/
|
||||
void unionRect(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* destructively subtract another region with this one
|
||||
*
|
||||
* @param region to subtract
|
||||
**/
|
||||
void subtractRegion(in nsIRegion aRegion);
|
||||
|
||||
/**
|
||||
* Destructively subtract a rect from this region
|
||||
*
|
||||
* @param aX xoffset of rect to subtract with region
|
||||
* @param aY yoffset of rect to subtract with region
|
||||
* @param aWidth width of rect to subtract with region
|
||||
* @param aHeight height of rect to subtract with region
|
||||
**/
|
||||
void subtractRect(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* is this region empty?
|
||||
*
|
||||
* @return returns whether the region is empty
|
||||
**/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* operator == equivalent i.e. do the regions contain exactly
|
||||
* the same pixels
|
||||
*
|
||||
* @param aRegion The region to compare.
|
||||
* @return Whether the regions are identical.
|
||||
**/
|
||||
boolean isEqual(in nsIRegion aRegion);
|
||||
|
||||
/**
|
||||
* returns the bounding box of the region i.e. the smallest
|
||||
* rectangle that completely contains the region.
|
||||
*
|
||||
* @param aX out parameter for xoffset of bounding rect for region
|
||||
* @param aY out parameter for yoffset of bounding rect for region
|
||||
* @param aWidth out parameter for width of bounding rect for region
|
||||
* @param aHeight out parameter for height of bounding rect for region
|
||||
**/
|
||||
void getBoundingBox(out gfx_coord aX,
|
||||
out gfx_coord aY,
|
||||
out gfx_dimension aWidth,
|
||||
out gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* Offset the region by (x,y)
|
||||
*
|
||||
* @param aXOffset The x-coordinate offset.
|
||||
* @param aYOffset The y-coordinate offset.
|
||||
**/
|
||||
void offsetBy(in gfx_coord aXOffset,
|
||||
in gfx_coord aYOffset);
|
||||
|
||||
/**
|
||||
* does the region intersect the rectangle?
|
||||
*
|
||||
* @param rect to check for containment
|
||||
* @return true if the region intersects the rect
|
||||
*
|
||||
**/
|
||||
boolean containsRect(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* Get an array of rectangles that make up this region.
|
||||
*
|
||||
* @param rects An array of nsRect2 structs that make up the region.
|
||||
* @param nrects The number rects that make up this region.
|
||||
*
|
||||
* @note i'd like to be able to do this without allocating...
|
||||
**/
|
||||
[noscript] void getRects([array, size_is(nrects)] out nsRect2 rects,
|
||||
out unsigned long nrects);
|
||||
|
||||
/**
|
||||
* get the number of rects which make up this region.
|
||||
*
|
||||
* @return number containing the number of rects
|
||||
* comprising the region
|
||||
*
|
||||
**/
|
||||
readonly attribute unsigned long numRects;
|
||||
};
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIWidget;
|
||||
|
||||
[uuid(23C2BA03-6C76-11d3-96ED-0060B0FB9956)]
|
||||
interface nsIRollupListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the object to rollup
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
void rollup();
|
||||
|
||||
/**
|
||||
* Asks the RoolupListener if it should rollup on mousevents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
void shouldRollupOnMouseWheelEvent(out PRBool aShould);
|
||||
|
||||
};
|
|
@ -1,35 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(aa1b501c-1dd1-11b2-bb36-f3ef7303c475)]
|
||||
interface nsIRunAppRun : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize the region to an empty state
|
||||
*
|
||||
*/
|
||||
void go();
|
||||
};
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
/**
|
||||
* nsIScreenManager interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.1
|
||||
* @see nsIOutputDevice
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(f728830e-1dd1-11b2-9598-fb9f414f2465)]
|
||||
interface nsIScreen : nsISupports
|
||||
{
|
||||
void getRect(out gfx_coord x, out gfx_coord y, out gfx_dimension width, out gfx_dimension height);
|
||||
void getAvailRect(out gfx_coord x, out gfx_coord y, out gfx_dimension width, out gfx_dimension height);
|
||||
|
||||
readonly attribute gfx_depth pixelDepth;
|
||||
readonly attribute gfx_depth colorDepth;
|
||||
};
|
|
@ -1,80 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIScreen;
|
||||
|
||||
/**
|
||||
* nsIScreenManager interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIOutputDevice
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(662e7b78-1dd2-11b2-a3d3-fc1e5f5fb9d4)]
|
||||
interface nsIScreenManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the screen that contains the rectangle specified
|
||||
*
|
||||
* @param x the x coordinate for the rect
|
||||
* @param y the y coordinate for the rect
|
||||
* @param width the width of the rect
|
||||
* @param height the height of the rect
|
||||
* @return the screen that contains the rectangle. If the rect overlaps multiple screens,
|
||||
* it will return the screen with the greatest area of intersection.
|
||||
*/
|
||||
nsIScreen screenForRect(in gfx_coord x,
|
||||
in gfx_coord y,
|
||||
in gfx_dimension width,
|
||||
in gfx_dimension height);
|
||||
|
||||
/**
|
||||
* Get the "main" screen.
|
||||
* On the mac, the one with the menubar.
|
||||
* On windows, the one with the taskbar.
|
||||
* etc.
|
||||
*
|
||||
* @return the primary screen
|
||||
*/
|
||||
readonly attribute nsIScreen primaryScreen;
|
||||
|
||||
/**
|
||||
* Get the number of screens on this system
|
||||
*
|
||||
* @return the number of screens
|
||||
*/
|
||||
readonly attribute unsigned long numberOfScreens;
|
||||
|
||||
/**
|
||||
* Get a screen based on an index.
|
||||
*
|
||||
* @param screenIndex The screen number you wish to get starting with 0.
|
||||
* @return the nsIScreen object that corresponds with screenIndex.
|
||||
*/
|
||||
nsIScreen getScreen(in long screenIndex);
|
||||
};
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIURL.idl"
|
||||
|
||||
// XXX look at this interface and make it not suck
|
||||
|
||||
[scriptable, uuid(359ccaa8-1dd2-11b2-858b-f22b02a616fc)] // zach's first uuid ;)
|
||||
interface nsISoundService : nsISupports
|
||||
{
|
||||
void beep();
|
||||
|
||||
/* mute, etc? */
|
||||
}
|
||||
|
||||
[scriptable, uuid(13ac207e-1dd2-11b2-8e43-c76b93faa99e)]
|
||||
interface nsISoundFile : nsISupports
|
||||
{
|
||||
// seperate out play to take an nsISoundFile (which has things like stop, etc on it)
|
||||
void init(in nsIURL aURL);
|
||||
|
||||
void play();
|
||||
void stop();
|
||||
};
|
|
@ -1,176 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
/**
|
||||
* nsISystemLook interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(bfe1502c-1dd1-11b2-8826-ee17ee8675f9)]
|
||||
interface nsISystemLook : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* CSS native system colors
|
||||
* @name colors
|
||||
* @see CSS2: http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
||||
* @see CSS3: http://www.w3.org/TR/2000/WD-css3-userint-20000216.html#color
|
||||
*/
|
||||
//@{
|
||||
const long color_WindowBackground = 1;
|
||||
const long color_WindowForeground = 2;
|
||||
const long color_WidgetBackground = 3;
|
||||
const long color_WidgetForeground = 4;
|
||||
const long color_WidgetSelectBackground = 5;
|
||||
const long color_WidgetSelectForeground = 6;
|
||||
const long color_Widget3DHighlight = 7;
|
||||
const long color_Widget3DShadow = 8;
|
||||
const long color_TextBackground = 9;
|
||||
const long color_TextForeground = 10;
|
||||
const long color_TextSelectBackground = 11;
|
||||
const long color_TextSelectForeground = 12;
|
||||
|
||||
// New CSS 2 color definitions
|
||||
const long color_ActiveBorder = 13;
|
||||
const long color_ActiveCaption = 14;
|
||||
const long color_AppWorkspace = 15;
|
||||
const long color_Background = 16;
|
||||
const long color_ButtonFace = 17;
|
||||
const long color_ButtonHighlight = 18;
|
||||
const long color_ButtonShadow = 19;
|
||||
const long color_ButtonText = 20;
|
||||
const long color_CaptionText = 21;
|
||||
const long color_GrayText = 22;
|
||||
const long color_Highlight = 23;
|
||||
const long color_HighlightText = 24;
|
||||
const long color_InactiveBorder = 25;
|
||||
const long color_InactiveCaption = 26;
|
||||
const long color_InactiveCaptionText = 27;
|
||||
const long color_InfoBackground = 28;
|
||||
const long color_InfoText = 29;
|
||||
const long color_Menu = 30;
|
||||
const long color_MenuText = 31;
|
||||
const long color_Scrollbar = 32;
|
||||
const long color_ThreeDDarkShadow = 33;
|
||||
const long color_ThreeDFace = 34;
|
||||
const long color_ThreeDHighlight = 35;
|
||||
const long color_ThreeDLightShadow = 36;
|
||||
const long color_ThreeDShadow = 37;
|
||||
const long color_Window = 38;
|
||||
const long color_WindowFrame = 39;
|
||||
const long color_WindowText = 40;
|
||||
|
||||
// moz extensions
|
||||
const long color_moz_Field = 41;
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* CSS native system fonts
|
||||
* @name fonts
|
||||
* @see CSS2: http://www.w3.org/TR/REC-CSS2/ui.html#system-fonts
|
||||
* @see CSS3: http://www.w3.org/TR/2000/WD-css3-userint-20000216.html#font
|
||||
*/
|
||||
//@{
|
||||
// css2
|
||||
const long font_Caption = 1;
|
||||
const long font_Icon = 2;
|
||||
const long font_Menu = 3;
|
||||
const long font_MessageBox = 4;
|
||||
const long font_SmallCaption = 5;
|
||||
const long font_StatusBar = 6;
|
||||
|
||||
// css3
|
||||
const long font_Window = 7;
|
||||
const long font_Document = 8;
|
||||
const long font_Workspace = 9;
|
||||
const long font_Desktop = 10;
|
||||
const long font_Info = 11;
|
||||
const long font_Dialog = 12;
|
||||
const long font_Button = 13;
|
||||
const long font_PullDownMenu = 14;
|
||||
const long font_List = 15;
|
||||
const long font_Field = 16;
|
||||
|
||||
// moz
|
||||
const long font_Tooltips = 17;
|
||||
const long font_Widget = 18;
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* Other native system attributes
|
||||
* @name other
|
||||
*/
|
||||
//@{
|
||||
const long dimension_TextFieldHeight = 0;
|
||||
const long dimension_CheckboxDiameter = 1;
|
||||
const long dimension_RadioboxDiameter = 2;
|
||||
const long dimension_SingleLineCaretWidth = 4;
|
||||
const long dimension_MultiLineCaretWidth = 5;
|
||||
|
||||
const long delay_CaretBlink = 0;
|
||||
const long delay_Submenu = 1;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Returns the color that the system uses for a given
|
||||
* constant value which relates to CSS native system
|
||||
* font values.
|
||||
* @param colorID the constant for the color you wish to get
|
||||
* @return the color
|
||||
*/
|
||||
gfx_color getColor(in long colorID);
|
||||
|
||||
/**
|
||||
* Returns the nsFont wrapped native font for a given
|
||||
* constant value which related to CSS native system
|
||||
* font values.
|
||||
* @param fontID the constant for the font you wish to get
|
||||
* @return the nsFont wrapped native font
|
||||
*/
|
||||
[noscript] nsFont getFont(in long fontID);
|
||||
|
||||
/**
|
||||
* Returns the size in pixels of the dimension the system
|
||||
* uses for the specified attribute you asked for.
|
||||
* @param dimensionID is the constant for the dimension you
|
||||
* wish to get
|
||||
* @return the size in pixels of the dimension.
|
||||
*/
|
||||
gfx_dimension getDimension(in long dimensionID);
|
||||
|
||||
/**
|
||||
* Returns the number of milliseconds that the system
|
||||
* uses for the specified attribute.
|
||||
* @param delayID the constant for the time you wish to get
|
||||
* @return the number of milliseconds
|
||||
*/
|
||||
unsigned long getDelay(in long delayID);
|
||||
|
||||
};
|
|
@ -1,166 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Michael Lowe <michael.lowe@bigfoot.com>
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsITimer;
|
||||
interface nsITimerCallback;
|
||||
|
||||
/// Signature of timer callback function
|
||||
native nsTimerCallbackFunc(nsTimerCallbackFunc);
|
||||
|
||||
/*! @verbatim */
|
||||
%{C++
|
||||
typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure);
|
||||
%}
|
||||
/*! @endverbatim */
|
||||
|
||||
/**
|
||||
* Timer interface. Used to invoke a function or method after a fixed
|
||||
* millisecond interval.
|
||||
*
|
||||
* @author Michael Lowe <michael.lowe@bigfoot.com>
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.1
|
||||
*
|
||||
* @note Implementations of nsITimer should be written such that there are no limitations
|
||||
* on what can be called by the TimerCallbackFunc. On platforms like the Macintosh this
|
||||
* means that callback functions must be called from the main event loop NOT from
|
||||
* an interrupt.
|
||||
*/
|
||||
[scriptable, uuid(791cb316-1dd2-11b2-8f3b-caa107815990)]
|
||||
interface nsITimer : nsISupports
|
||||
{
|
||||
/**
|
||||
* Timer priorities
|
||||
* @name timer_priorities Timer Priorities
|
||||
*/
|
||||
//@{
|
||||
const long NS_PRIORITY_HIGHEST = 10;
|
||||
const long NS_PRIORITY_HIGH = 8;
|
||||
const long NS_PRIORITY_NORMAL = 5;
|
||||
const long NS_PRIORITY_LOW = 2;
|
||||
const long NS_PRIORITY_LOWEST = 0;
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Timer types
|
||||
* @name timer_types Timer types
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Timer which fires once only
|
||||
*/
|
||||
const unsigned long NS_TYPE_ONE_SHOT = 0;
|
||||
|
||||
/**
|
||||
* After firing, timer is stopped and not
|
||||
* restarted until notifcation routine completes.
|
||||
* Specified timer period will be at least time between
|
||||
* when processing for last firing notifcation completes
|
||||
* and when the next firing occurs. This is the preferable
|
||||
* repeating type for most situations.
|
||||
*/
|
||||
const unsigned long NS_TYPE_REPEATING_SLACK = 1;
|
||||
|
||||
/**
|
||||
* Timer which aims to have constant time between firings.
|
||||
* The processing time for each timer notification should
|
||||
* not influence timer period. However, if the processing
|
||||
* for the last timer firing could not be completed until
|
||||
* just before the next firing occurs, then you could have
|
||||
* two timer notification routines being executed in quick
|
||||
* sucession.
|
||||
*/
|
||||
const unsigned long NS_TYPE_REPEATING_PRECISE = 2;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Initialize a timer to fire after the given millisecond interval.
|
||||
* This version takes an interface of type nsITimerCallback.
|
||||
* nsITimerCallback::notify() method of this method is invoked.
|
||||
*
|
||||
* @param aCallback - The interface to notify
|
||||
* @param aDelay - The millisecond interval
|
||||
* @param aPriority - The timer priority
|
||||
* @param aType - The timer type : one shot or repeating
|
||||
* @return NS_OK if this operation was successful
|
||||
*
|
||||
* @attention \a aPriority and \a aType are no longer optional parameters.
|
||||
* \a aPriority was defaulted to NS_PRIORITY_NORMAL and
|
||||
* \a aType was defaulted to NS_TYPE_ONE_SHOT
|
||||
*/
|
||||
void init(in nsITimerCallback aCallback,
|
||||
in unsigned long aDelay,
|
||||
in unsigned long aPriority,
|
||||
in long aType);
|
||||
|
||||
/**
|
||||
* Initialize a timer to fire after the given millisecond interval.
|
||||
* This version takes a function to call and a closure to pass to
|
||||
* that function.
|
||||
*
|
||||
* @param aFunc - The function to invoke
|
||||
* @param aClosure - an opaque pointer to pass to that function
|
||||
* @param aDelay - The millisecond interval
|
||||
* @param aPriority - The timer priority
|
||||
* @param aType - The timer type : one shot or repeating
|
||||
* @return NS_OK if this operation was successful
|
||||
*
|
||||
* @attention \a aPriority and \a aType are no longer optional parameters.
|
||||
* \a aPriority was defaulted to NS_PRIORITY_NORMAL and
|
||||
* \a aType was defaulted to NS_TYPE_ONE_SHOT
|
||||
*
|
||||
* @deprecated use init()
|
||||
*/
|
||||
[noscript] void initOld(in nsTimerCallbackFunc aFunc,
|
||||
in voidPtr aClosure,
|
||||
in unsigned long aDelay,
|
||||
in unsigned long aPriority,
|
||||
in long aType);
|
||||
|
||||
/// Cancels the timeout
|
||||
void cancel();
|
||||
|
||||
/// Change the millisecond interval for the timeout
|
||||
attribute unsigned long delay;
|
||||
|
||||
/**
|
||||
* The priority of this timer.
|
||||
* @see timer_priorities
|
||||
*/
|
||||
attribute unsigned long priority;
|
||||
|
||||
/**
|
||||
* The type of timer this is
|
||||
* @see timer_types
|
||||
*/
|
||||
attribute unsigned long type;
|
||||
|
||||
/// @return the opaque pointer
|
||||
[noscript] readonly attribute voidPtr closure;
|
||||
};
|
|
@ -1,43 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Someone else
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsITimer;
|
||||
|
||||
/**
|
||||
* Interface implemented by users of the nsITimer class. An instance
|
||||
* of this interface is passed in when creating a timer. The notify()
|
||||
* method of that instance is invoked after the specified delay.
|
||||
*
|
||||
* @author someone else
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.1
|
||||
* @see nsITimer
|
||||
*/
|
||||
[scriptable, uuid(a5d2f5f8-1dd1-11b2-9250-ce21e6692e21)]
|
||||
interface nsITimerCallback : nsISupports
|
||||
{
|
||||
void notify(in nsITimer timer);
|
||||
};
|
|
@ -1,181 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIImage;
|
||||
interface nsIWindow;
|
||||
interface nsIPixmap;
|
||||
|
||||
/**
|
||||
* nsITopLevelWindow interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIWindow
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(e820e062-1dd1-11b2-b677-cd3faed4a440)]
|
||||
interface nsITopLevelWindow : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* border styles
|
||||
* @name toplevel_window_border_styles Top-level window Border Styles
|
||||
* @attention rename these. eBorderStyle_ is silly
|
||||
*/
|
||||
|
||||
//@{
|
||||
/// whatever the OS wants... i.e. don't do anything
|
||||
const long eBorderStyle_default = -1;
|
||||
|
||||
/// no border, titlebar, etc.. opposite of all
|
||||
const long eBorderStyle_none = 0;
|
||||
|
||||
/// all window decorations
|
||||
const long eBorderStyle_all = 1 << 0;
|
||||
|
||||
/**
|
||||
* enables the border on the window.
|
||||
* @note these are only for decoration and are not resize hadles.
|
||||
*/
|
||||
const long eBorderStyle_border = 1 << 1;
|
||||
|
||||
/**
|
||||
* enables the resize handles for the window.
|
||||
* @note If this is set, border is implied to also be set
|
||||
*/
|
||||
const long eBorderStyle_resizeh = 1 << 2;
|
||||
|
||||
/// enables the titlebar for the window
|
||||
const long eBorderStyle_title = 1 << 3;
|
||||
|
||||
/**
|
||||
* enables the window menu button on the title bar. this being
|
||||
* on should force the title bar to display
|
||||
*/
|
||||
const long eBorderStyle_menu = 1 << 4;
|
||||
|
||||
/**
|
||||
* enables the minimize button so the user can minimize the window.
|
||||
* turned off for tranient windows since they can not be minimized
|
||||
* seperate from their parent
|
||||
*/
|
||||
const long eBorderStyle_minimize = 1 << 5;
|
||||
|
||||
/// enables the maxmize button so the user can maximize the window
|
||||
const long eBorderStyle_maximize = 1 << 6;
|
||||
|
||||
/// show the close button
|
||||
const long eBorderStyle_close = 1 << 7;
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a top level window
|
||||
*
|
||||
* @param aParent the parent window
|
||||
* @param aX the x position, in pixels, relative to aParent.
|
||||
* @param aY the y position, in pixels, relative to aParent.
|
||||
* @param aWidth the width, in pixels, of the window.
|
||||
* @param aHeight the height in pixels, of the window.
|
||||
* @param aBorder A bitfield of border styles
|
||||
*
|
||||
* @attention should you only be able to parent top level windows to
|
||||
* other top level windows?
|
||||
*
|
||||
* @note This window represents a window that can be drawn into via
|
||||
* a query interface to nsIDrawable.
|
||||
* @note This window can also be the parent for nsIWindow objects.
|
||||
*/
|
||||
void init(in nsIWindow aParent,
|
||||
in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight,
|
||||
in long aBorder);
|
||||
|
||||
/**
|
||||
* Minimize, maximize, restore
|
||||
*
|
||||
* getting:
|
||||
* normal == !(minimize || maximize)
|
||||
* minimize == !(normal || maximize)
|
||||
* maximize == !(normal || minimize)
|
||||
*
|
||||
* setting:
|
||||
* normal will restore a minimized or maximized window to its "normal" state.
|
||||
*/
|
||||
attribute long sizeState;
|
||||
|
||||
/**
|
||||
* Perform platform-dependent sanity check on a potential window position.
|
||||
* This is guaranteed to work only for top-level windows.
|
||||
*
|
||||
* @param aX in: an x position expressed in screen coordinates.
|
||||
* out: the x position constrained to fit on the screen(s).
|
||||
* @param aY in an y position expressed in screen coordinates.
|
||||
* out: the y position constrained to fit on the screen(s).
|
||||
*
|
||||
*/
|
||||
void constrainPosition(inout gfx_coord aX, inout gfx_coord aY);
|
||||
|
||||
/**
|
||||
* Bring the window to the top (infront of all other windows)
|
||||
*/
|
||||
void bringToTop();
|
||||
|
||||
/**
|
||||
* Sets the title of the window
|
||||
*/
|
||||
attribute wstring title;
|
||||
|
||||
/* some getbounds like thing that lets you get size+border? */
|
||||
|
||||
/**
|
||||
* Sets the icon for this window
|
||||
*/
|
||||
void setIcon(in nsIImage image);
|
||||
|
||||
|
||||
/**
|
||||
* set the window class
|
||||
* @attention is this only needed for unix?
|
||||
* It would be nice to have the XP code set this
|
||||
*/
|
||||
attribute string windowClass;
|
||||
|
||||
/**
|
||||
* eeeeeek!
|
||||
* @attention NEEDS DOCS
|
||||
* @warning this may not be implemented on all platforms
|
||||
* @exception NS_ERROR_NOT_IMPLEMENTED If this is not implemented.
|
||||
*/
|
||||
void setTransparency(in nsIPixmap mask);
|
||||
};
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFormatConverter.idl"
|
||||
|
||||
|
||||
// these probably shouldn't live here, but in some central repository shared
|
||||
// by the entire app.
|
||||
|
||||
|
||||
/*! @verbatim */
|
||||
%{C++
|
||||
#define kTextMime "text/plain"
|
||||
#define kUnicodeMime "text/unicode"
|
||||
#define kHTMLMime "text/html"
|
||||
#define kAOLMailMime "AOLMAIL"
|
||||
#define kPNGImageMime "image/png"
|
||||
#define kJPEGImageMime "image/jpg"
|
||||
#define kGIFImageMime "image/gif"
|
||||
#define kFileMime "application/x-moz-file"
|
||||
#define kURLMime "text/x-moz-url"
|
||||
%}
|
||||
/*! @endverbatim */
|
||||
|
||||
/**
|
||||
* nsITransferable interface
|
||||
*
|
||||
* @author Mike Pinkerton <pinkerton@netscape.com>
|
||||
* @version 1.1
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(d0420dd2-1dd1-11b2-87cd-894b24affa87)]
|
||||
interface nsITransferable : nsISupports
|
||||
{
|
||||
/**
|
||||
* Computes a list of flavors that the transferable can export, either through intrinsic
|
||||
* knowledge or output data converters.
|
||||
*
|
||||
* @param aFlavors An array of strings that contains the supported flavors.
|
||||
* @param nFlavors The number of strings in the \a aFlavors array.
|
||||
* @note This is a copy of the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
void flavorsTransferableCanExport([array, size_is(nFlavors)] out string aFlavors,
|
||||
out unsigned long nFlavors);
|
||||
|
||||
/**
|
||||
* Given a flavor retrieve the data.
|
||||
*
|
||||
* @param aFlavor The flavor of data to retrieve
|
||||
* @param aData The data. Some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen The length of the data
|
||||
*/
|
||||
void getTransferData(in string aFlavor, out nsISupports aData, out unsigned long aDataLen);
|
||||
|
||||
/**
|
||||
* Returns the best flavor in the transferable, given those that have
|
||||
* been added to it with addFlavor()
|
||||
*
|
||||
* @param aFlavor The flavor of data that was retrieved
|
||||
* @param aData The data. Some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen The length of the data
|
||||
*/
|
||||
void getAnyTransferData(out string aFlavor, out nsISupports aData, out unsigned long aDataLen);
|
||||
|
||||
/**
|
||||
* Is the data larger than XXXXXX bytes?
|
||||
* @attention define "large"
|
||||
* @return TRUE if the data is large.
|
||||
*/
|
||||
boolean isLargeDataSet();
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
// Setter part of interface
|
||||
///////////////////////////////
|
||||
|
||||
/**
|
||||
* Computes a list of flavors (mime types) that the transferable can
|
||||
* accept into it, either through intrinsic knowledge or input data converters.
|
||||
*
|
||||
* @param aFlavors An array of strings that contains the supported flavors.
|
||||
* @param nFlavors The number of strings in the \a aFlavors array.
|
||||
* @note This is a copy of the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
void flavorsTransferableCanImport([array, size_is(nFlavors)] out string aFlavors,
|
||||
out unsigned long nFlavors);
|
||||
|
||||
/**
|
||||
* Sets the data in the transferable with the specified flavor. The transferable
|
||||
* will maintain its own copy the data, so it is not necessary to do that beforehand.
|
||||
*
|
||||
* @param aFlavor the flavor of data that is being set
|
||||
* @param aData the data, some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void setTransferData(in string aFlavor, in nsISupports aData, in unsigned long aDataLen);
|
||||
|
||||
/**
|
||||
* Add the data flavor, indicating that this transferable
|
||||
* can receive this type of flavor
|
||||
*
|
||||
* @param aDataFlavor a new data flavor to handle
|
||||
*/
|
||||
void addDataFlavor(in string aDataFlavor);
|
||||
|
||||
/**
|
||||
* Removes the data flavor matching the given one (string compare) and the data
|
||||
* that goes along with it.
|
||||
*
|
||||
* @param aDataFlavor a data flavor to remove
|
||||
*/
|
||||
void removeDataFlavor(in string aDataFlavor);
|
||||
|
||||
attribute nsIFormatConverter converter;
|
||||
|
||||
};
|
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
/**
|
||||
* nsIVectorDrawable interface
|
||||
*
|
||||
* this interface currently just has ideas on it
|
||||
*
|
||||
* @see nsIDrawable
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(93d39e82-1dd1-11b2-b4d5-c4d0b914ce2b)]
|
||||
interface nsIVectorDrawable : nsISupports
|
||||
{
|
||||
/**
|
||||
* do we want to use a path of vectors here instead of raw points?
|
||||
*/
|
||||
|
||||
drawQuadraticBezierCurve([array, size_is(nPoints), const] in nsPathPoint,
|
||||
[const] in unsigned long nPoints,
|
||||
[const] in nsTransformList aTransforms);
|
||||
|
||||
};
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsICursor;
|
||||
interface nsIGUIEventListener;
|
||||
interface nsIImage;
|
||||
interface nsIRegion;
|
||||
interface nsIRollupListener;
|
||||
|
||||
/*! @verbatim */
|
||||
// remove this later...
|
||||
[ref] native nsRectRef(nsRect2);
|
||||
/*! @endverbatim */
|
||||
|
||||
/**
|
||||
* nsIWindow interface
|
||||
*
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 0.0
|
||||
* @see nsIChildWindow
|
||||
* @see nsIPopupWindow
|
||||
* @see nsITopLevelWindow
|
||||
* @see nsIDrawable
|
||||
* @see "gfx2"
|
||||
**/
|
||||
[scriptable, uuid(dba78efe-1dd1-11b2-87c6-96864a58da7e)]
|
||||
interface nsIWindow : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* The parent of this window
|
||||
*/
|
||||
attribute nsIWindow parent;
|
||||
|
||||
/**
|
||||
* Make this window visible on the screen.
|
||||
*
|
||||
* @note show() should not affect the z-order of the window.
|
||||
**/
|
||||
void show();
|
||||
|
||||
/**
|
||||
* Make this window not visible on the screen.
|
||||
**/
|
||||
void hide();
|
||||
|
||||
/**
|
||||
* Find out if the window is visible or not.
|
||||
*
|
||||
* @return TRUE if the window is visible or FALSE if it is not
|
||||
**/
|
||||
readonly attribute boolean isVisible;
|
||||
|
||||
/**
|
||||
* Move this window.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
**/
|
||||
void move(in gfx_coord aX, in gfx_coord aY);
|
||||
|
||||
/**
|
||||
* Resize this window.
|
||||
*
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the window should be repainted
|
||||
*/
|
||||
void resize(in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight,
|
||||
in boolean aRepaint);
|
||||
|
||||
/**
|
||||
* Move and resize this window.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the window should be repainted if the size changes
|
||||
*/
|
||||
void moveResize(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight,
|
||||
in boolean aRepaint);
|
||||
|
||||
/**
|
||||
* Get the geometry of this window.
|
||||
*
|
||||
* @param aX the x position expressed in the parent's coordinate system
|
||||
* @param aY the y position expressed in the parent's coordinate system
|
||||
* @param aWidth the width expressed in the parent's coordinate system
|
||||
* @param aHeight the height expressed in the parent's coordinate system
|
||||
*/
|
||||
void getBounds(out gfx_coord aX,
|
||||
out gfx_coord aY,
|
||||
out gfx_dimension aWidth,
|
||||
out gfx_dimension aHeight);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert from this widget coordinates to screen coordinates.
|
||||
*
|
||||
* @param aOldRect widget coordinates stored in the x,y members
|
||||
* @param aNewRect (out) screen coordinates stored in the x,y members
|
||||
*
|
||||
* @attention this should be scriptable and use nsPoint's
|
||||
*/
|
||||
[noscript] void widgetToScreen([const] in nsRectRef aOldRect, in nsRectRef aNewRect );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enables/Disables system capture of any and all events that would cause a
|
||||
* dropdown to be rolled up, This method ignores the aConsumeRollupEvent
|
||||
* parameter when aDoCapture is FALSE
|
||||
*
|
||||
* @param aListener the rollup listener.
|
||||
* @param aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
* @param aConsumeRollupEvent PR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event
|
||||
*
|
||||
* @attention FIX DOCS to reflect that this captures all events for this widget and any children
|
||||
* of it dealing with mouse and keyboard events.
|
||||
*/
|
||||
void captureRollupEvents(in nsIRollupListener aListener,
|
||||
in boolean aDoCapture,
|
||||
in boolean aConsumeRollupEvent);
|
||||
|
||||
|
||||
/**
|
||||
* The event listener for this window
|
||||
* should you be able to have multiple event listeners? ugh
|
||||
*/
|
||||
attribute nsIGUIEventListener eventListener;
|
||||
|
||||
/**
|
||||
* Set/Get the background color for this window.
|
||||
*
|
||||
* @param aColor the new background color
|
||||
*/
|
||||
attribute gfx_color winBackgroundColor;
|
||||
|
||||
/**
|
||||
* Set/Get the cursor for this window
|
||||
*
|
||||
* @param aCursor the new cursor for this window.
|
||||
*/
|
||||
attribute nsICursor cursor;
|
||||
|
||||
|
||||
/**
|
||||
* Invalidate a the area \a aRect in 'this' window.
|
||||
*
|
||||
* @param aRect The rectangle to invalidate, or NULL if you wish to invalidate the entire window.
|
||||
* @param aIsSynchronouse If TRUE then repaint now else repaint later.
|
||||
* @see update()
|
||||
*/
|
||||
[noscript] void invalidateRect([const] in nsRect2 aRect, in boolean aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Invalidate the area \a aRegion in 'this' window.
|
||||
*
|
||||
* @param aRegion The region to invalidate.
|
||||
* @param aIsSynchronouse If TRUE then repaint now else repaint later.
|
||||
* @see update()
|
||||
*/
|
||||
void invalidateRegion(in nsIRegion aRegion, in boolean aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Force a synchronous repaint of the window if there are dirty rects.
|
||||
*
|
||||
* @see invalidate()
|
||||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
* Scroll the window.
|
||||
* @attention NEED DOCS!
|
||||
*
|
||||
* @param aSrcX src x
|
||||
* @param aSrcY src y
|
||||
* @param aDestX dest x
|
||||
* @param aDestY dest y
|
||||
* @param aWidth width to scroll
|
||||
* @param aHeight height to scroll
|
||||
*
|
||||
* @note Implementations are required to generate expose events for any areas of the
|
||||
* destination rectangle that could not be painted because the corresponding
|
||||
* source area was obscured. (roc)
|
||||
*/
|
||||
void scroll(in gfx_coord aSrcX,
|
||||
in gfx_coord aSrcY,
|
||||
in gfx_coord aDestX,
|
||||
in gfx_coord aDestY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
};
|
|
@ -1,184 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file nsMatrix.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* nsMatrix class
|
||||
* @class nsMatrix
|
||||
*
|
||||
* A 2x3 matrices of the form:
|
||||
*
|
||||
* \f$
|
||||
\left[ \begin{array}{ccc}
|
||||
a & c & e\\
|
||||
b & d & f
|
||||
\end{array} \right]
|
||||
* \f$
|
||||
*
|
||||
* which, when expanded into a 3x3 matrix for the purposes of matrix arithmetic, become:
|
||||
*
|
||||
* \f$
|
||||
\left[ \begin{array}{ccc}
|
||||
a & c & e\\
|
||||
b & d & f\\
|
||||
0 & 0 & 1
|
||||
\end{array} \right]
|
||||
* \f$
|
||||
*
|
||||
* @see nsTransform
|
||||
*/
|
||||
class nsMatrix {
|
||||
|
||||
private:
|
||||
float a;
|
||||
float b;
|
||||
float c;
|
||||
float d;
|
||||
float e;
|
||||
float f;
|
||||
|
||||
public:
|
||||
nsMatrix();
|
||||
virtual ~nsMatrix();
|
||||
|
||||
float GetA() const { return a; };
|
||||
float GetB() const { return b; };
|
||||
float GetC() const { return c; };
|
||||
float GetD() const { return d; };
|
||||
float GetE() const { return e; };
|
||||
float GetF() const { return f; };
|
||||
|
||||
|
||||
/**
|
||||
* Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting new matrix.
|
||||
*
|
||||
* @param secondMatrix The matrix which is post-multiplied to this matrix.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *Multiply(const nsMatrix &secondMatrix);
|
||||
|
||||
/**
|
||||
* Returns the inverse matrix.
|
||||
*
|
||||
* @return The inverse matrix
|
||||
*/
|
||||
nsMatrix *Inverse();
|
||||
|
||||
/**
|
||||
* Post-multiplies a translation transformation on the current matrix and returns the resulting matrix.
|
||||
*
|
||||
* @param x The distance to translate along the x-axis.
|
||||
* @param y The distance to translate along the y-axis.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *Translate(float x, float y);
|
||||
|
||||
/**
|
||||
* Post-multiplies a uniform scale transformation on the current matrix and returns the resulting matrix.
|
||||
*
|
||||
* @param scaleFactor Scale factor in both X and Y.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *Scale(float scaleFactor);
|
||||
|
||||
|
||||
/**
|
||||
* Post-multiplies a non-uniform scale transformation on the current matrix and returns the resulting matrix.
|
||||
*
|
||||
* @param scaleFactorX Scale factor in X.
|
||||
* @param scaleFactorY Scale factor in Y.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *ScaleNonUniform(float scaleFactorX, float scaleFactorY);
|
||||
|
||||
/**
|
||||
* Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.
|
||||
*
|
||||
* @param angle Rotation angle.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *Rotate(float angle);
|
||||
|
||||
/**
|
||||
* Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.
|
||||
* The rotation angle is determined by taking (+/-) atan(\a y/ \a x). The direction of the vector (\a x, \a y) determines
|
||||
* whether the positive or negative angle value is used.
|
||||
*
|
||||
* @param x The X coordinate of the vector (\a x, \a y). Must not be zero.
|
||||
* @param y The Y coordinate of the vector (\a x, \a y). Must not be zero.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *RotateFromVector(float x, float y);
|
||||
|
||||
/**
|
||||
* Post-multiplies the transformation \f$
|
||||
\left[ \begin{array}{ccc}
|
||||
-1 & 0 & 0\\
|
||||
1 & 0 & 0\\
|
||||
\end{array} \right]
|
||||
* \f$ and returns the resulting matrix.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *FlipX();
|
||||
|
||||
/**
|
||||
* Post-multiplies the transformation \f$
|
||||
\left[ \begin{array}{ccc}
|
||||
1 & 0 & 0\\
|
||||
-1 & 0 & 0\\
|
||||
\end{array} \right]
|
||||
* \f$ and returns the resulting matrix.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *FlipY();
|
||||
|
||||
/**
|
||||
* Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.
|
||||
*
|
||||
* @param angle Skew angle.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *SkewX(float angle);
|
||||
|
||||
/**
|
||||
* Post-multiplies a skewY transformation on the current matrix and returns the resulting matrix.
|
||||
*
|
||||
* @param angle Skew angle.
|
||||
*
|
||||
* @return The resulting matrix.
|
||||
*/
|
||||
nsMatrix *SkewY(float angle);
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
native Window(Window);
|
||||
[ptr] native XEvent(XEvent);
|
||||
|
||||
[ptr] native nsGUIEvent(nsGUIEvent);
|
||||
|
||||
/*! @verbatim */
|
||||
%{C++
|
||||
#include <X11/Xlib.h>
|
||||
struct nsGUIEvent;
|
||||
%}
|
||||
/*! @endverbatim */
|
||||
|
||||
/**
|
||||
* Private window interface for xlib
|
||||
*/
|
||||
[uuid(2e13a08e-1dd2-11b2-9e2b-e45ef2d1a542)]
|
||||
interface nsPIWindowXlib : nsISupports
|
||||
{
|
||||
void initFromNative(in Window window);
|
||||
|
||||
readonly attribute Window nativeWindow;
|
||||
|
||||
void dispatchEvent(in nsGUIEvent aEvent);
|
||||
};
|
|
@ -1,143 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsMatrix.h"
|
||||
|
||||
/**
|
||||
* @file nsTransform.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* nsTransform class
|
||||
* @class nsTransform
|
||||
*
|
||||
* @see nsMatrix
|
||||
*/
|
||||
class nsTransform {
|
||||
public:
|
||||
nsTransform();
|
||||
virtual ~nsTransform();
|
||||
|
||||
/**
|
||||
* Transform types
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
* The unit type is not one of predefined types. It is invalid to attempt to define a
|
||||
* new value of this type or to attempt to switch an existing value to this type.
|
||||
*/
|
||||
enum {
|
||||
NS_TRANSFORM_UNKNOWN = 0,
|
||||
|
||||
NS_TRANSFORM_IDENTITY = 1,
|
||||
|
||||
/**
|
||||
* A "matrix(...)" transformation.
|
||||
*/
|
||||
NS_TRANSFORM_MATRIX = 2,
|
||||
|
||||
/**
|
||||
* A "translate(...)" transformation.
|
||||
*/
|
||||
NS_TRANSFORM_TRANSLATE = 3,
|
||||
|
||||
/**
|
||||
* A "scale(...)" transformation.
|
||||
*/
|
||||
NS_TRANSFORM_SCALE = 4,
|
||||
|
||||
/**
|
||||
* A "rotate(...)" transformation.
|
||||
*/
|
||||
NS_TRANSFORM_ROTATE = 5,
|
||||
|
||||
/**
|
||||
* A "skewX(...)" transformation.
|
||||
*/
|
||||
NS_TRANSFORM_SKEWX = 6,
|
||||
|
||||
/**
|
||||
* A "skewY(...)" transformation.
|
||||
*/
|
||||
NS_TRANSFORM_SKEWY = 7
|
||||
};
|
||||
//@}
|
||||
|
||||
unsigned short GetType() const;
|
||||
nsMatrix *GetMatrix() const;
|
||||
float GetAngle() const;
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_IDENTITY.
|
||||
*/
|
||||
void SetIdentity();
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_MATRIX, with parameter matrix defining the new transformation.
|
||||
*
|
||||
* @param matrix The new matrix for the transformation.
|
||||
*/
|
||||
void SetMatrix(nsMatrix *matrix);
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_TRANSLATE, with parameters tx and ty defining the translation amounts
|
||||
*
|
||||
* @param tx The translation amount in X.
|
||||
* @param ty The translation amount in Y.
|
||||
*/
|
||||
void SetTranslate(float tx, float ty);
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_SCALE, with parameters sx and sy defining the scale amounts.
|
||||
*
|
||||
* @param sx The scale factor in X.
|
||||
* @param sy The scale factor in Y.
|
||||
*/
|
||||
void SetScale(float sx, float sy);
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_ROTATE, with parameter angle defining the rotation angle and
|
||||
* parameters cx and cy defining the optional centre of rotation.
|
||||
*
|
||||
* @param angle The rotation angle.
|
||||
* @param cx The x coordinate of centre of rotation.
|
||||
* @param cy The y coordinate of centre of rotation.
|
||||
*/
|
||||
void SetRotate(float angle, float cx, float cy);
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_SKEWX, with parameter angle defining the amount of skew.
|
||||
*
|
||||
* @param angle The skew angle.
|
||||
*/
|
||||
void SetSkewX(float angle);
|
||||
|
||||
/**
|
||||
* Sets the transform type to NS_TRANSFORM_SKEWY, with parameter angle defining the amount of skew.
|
||||
*
|
||||
* @param angle The skew angle.
|
||||
*/
|
||||
void SetSkewY(float angle);
|
||||
};
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsUnitConverters_h__
|
||||
#define nsUnitConverters_h__
|
||||
|
||||
#include "gfxtypes.h"
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* gfx unit conversion functions
|
||||
* @file nsUnitConverters.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unit Convertion Constants
|
||||
* @defgroup conversion_constants Unit conversion constants
|
||||
*/
|
||||
|
||||
/**
|
||||
* ROUND_EXCLUSIVE_CONST_FLOAT
|
||||
* @ingroup conversion_constants
|
||||
* @note XXX this should be derived from platform FLOAT_MIN
|
||||
*/
|
||||
#define ROUND_EXCLUSIVE_CONST_FLOAT 0.4999999999999999
|
||||
|
||||
/**
|
||||
* ROUND_CONST_FLOAT
|
||||
* @ingroup conversion_constants
|
||||
*/
|
||||
#define ROUND_CONST_FLOAT 0.5
|
||||
|
||||
/**
|
||||
* CEIL_CONST_FLOAT
|
||||
* @ingroup conversion_constants
|
||||
* @note XXX this should be derived from platform FLOAT_MIN
|
||||
*/
|
||||
#define CEIL_CONST_FLOAT 0.9999999999999999
|
||||
|
||||
|
||||
/**
|
||||
* gfx_coord rounding, floor, ceil functions
|
||||
* @defgroup gfx_coord_functions gfx_coord conversion functions
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Return the absolute value of \a aValue
|
||||
* @ingroup gfx_coord_functions
|
||||
* @param aValue the value you wish to get the absolute value of
|
||||
* @return the absolute value
|
||||
*/
|
||||
inline gfx_coord GFXCoordAbs(gfx_coord aValue)
|
||||
{
|
||||
return fabs(aValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Round a gfx_coord
|
||||
* @ingroup gfx_coord_functions
|
||||
* @param aValue the value you wish to round
|
||||
* @return the rounded value
|
||||
*/
|
||||
inline gfx_coord GFXCoordRound(gfx_coord aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? (aValue + ROUND_CONST_FLOAT) : (aValue - ROUND_CONST_FLOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Floor a gfx_coord
|
||||
* @ingroup gfx_coord_functions
|
||||
* @param aValue the value you wish to floor
|
||||
* @return the floored value
|
||||
*/
|
||||
inline gfx_coord GFXCoordFloor(gfx_coord aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? aValue : (aValue - CEIL_CONST_FLOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ceil a gfx_coord
|
||||
* @ingroup gfx_coord_functions
|
||||
* @param aValue the value you wish to ceil
|
||||
* @return the ceiled value
|
||||
*/
|
||||
inline gfx_coord GFXCoordCeil(gfx_coord aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? (aValue + CEIL_CONST_FLOAT) : aValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gfx_coord -> integer
|
||||
* @defgroup gfx_coord_to_int_functions gfx_coord to integer conversion functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Round a gfx_coord to a 32bit integer
|
||||
* @ingroup gfx_coord_to_int_functions
|
||||
* @param aValue the value you wish to round
|
||||
* @return the rounded integer value
|
||||
*/
|
||||
inline PRInt32 GFXCoordToIntRound(gfx_coord aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? PRInt32(aValue + ROUND_CONST_FLOAT) : PRInt32(aValue - ROUND_CONST_FLOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Floor a gfx_coord and convert to a 32bit integer
|
||||
* @ingroup gfx_coord_to_int_functions
|
||||
* @param aValue the value you wish to floor
|
||||
* @return the floored 32bit integer value
|
||||
*/
|
||||
inline PRInt32 GFXCoordToIntFloor(gfx_coord aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? PRInt32(aValue) : PRInt32(aValue - CEIL_CONST_FLOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ceil a gfx_coord and convert to a 32bit integer
|
||||
* @ingroup gfx_coord_to_int_functions
|
||||
* @param aValue the value you wish to ceil
|
||||
* @return the ceiled 32bit integer value
|
||||
*/
|
||||
inline PRInt32 GFXCoordToIntCeil(gfx_coord aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? PRInt32(aValue + CEIL_CONST_FLOAT) : PRInt32(aValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* gfx_angle -> integer
|
||||
* @defgroup gfx_angle_to_int_functions gfx_angle to integer conversion functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Round a gfx_angle to a 32bit integer
|
||||
* @ingroup gfx_angle_to_int_functions
|
||||
* @param aValue the value you wish to round
|
||||
* @return the rounded integer value
|
||||
*/
|
||||
inline PRInt32 GFXAngleToIntRound(gfx_angle aValue)
|
||||
{
|
||||
return (0.0f <= aValue) ? PRInt32(aValue + ROUND_CONST_FLOAT) : PRInt32(aValue - ROUND_CONST_FLOAT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* other... ?
|
||||
*/
|
||||
|
||||
#if 0
|
||||
inline gfx_coord NSToCoordRoundExclusive(float aValue)
|
||||
{
|
||||
return ((0.0f <= aValue) ? nscoord(aValue + ROUND_EXCLUSIVE_CONST_FLOAT) :
|
||||
nscoord(aValue - ROUND_EXCLUSIVE_CONST_FLOAT));
|
||||
}
|
||||
|
||||
inline PRInt32 NSToIntRoundExclusive(float aValue)
|
||||
{
|
||||
return ((0.0f <= aValue) ? PRInt32(aValue + ROUND_EXCLUSIVE_CONST_FLOAT) :
|
||||
PRInt32(aValue - ROUND_EXCLUSIVE_CONST_FLOAT));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -1,3 +0,0 @@
|
|||
Makefile
|
||||
.deps
|
||||
libgfx_base.a
|
|
@ -1,44 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gfx2
|
||||
LIBRARY_NAME = gfx_base
|
||||
|
||||
CPPSRCS = \
|
||||
nsRect.cpp \
|
||||
$(NULL)
|
||||
|
||||
DIRS = xlib
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsCursor.h"
|
||||
|
||||
#include <Appearance.h>
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsCursor, nsICursor)
|
||||
|
||||
nsCursor::nsCursor() :
|
||||
mCursor(0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsCursor::~nsCursor()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCursor::Init(const PRInt32 aCursor)
|
||||
{
|
||||
short cursor = -1;
|
||||
switch (aCursor) {
|
||||
case nsICursor::standard: cursor = kThemeArrowCursor; break;
|
||||
case nsICursor::wait: cursor = kThemeWatchCursor; break;
|
||||
case nsICursor::select: cursor = kThemeIBeamCursor; break;
|
||||
case nsICursor::hyperlink: cursor = kThemePointingHandCursor; break;
|
||||
case nsICursor::sizeWE: cursor = kThemeResizeLeftRightCursor; break;
|
||||
case nsICursor::sizeNS: cursor = 129; break;
|
||||
#if 0
|
||||
case nsICursor::sizeNW: cursor = 130; break;
|
||||
case nsICursor::sizeSE: cursor = 131; break;
|
||||
case nsICursor::sizeNE: cursor = 132; break;
|
||||
case nsICursor::sizeSW: cursor = 133; break;
|
||||
#endif
|
||||
case nsICursor::arrow_north: cursor = 134; break;
|
||||
case nsICursor::arrow_north_plus: cursor = 135; break;
|
||||
case nsICursor::arrow_south: cursor = 136; break;
|
||||
case nsICursor::arrow_south_plus: cursor = 137; break;
|
||||
case nsICursor::arrow_west: cursor = 138; break;
|
||||
case nsICursor::arrow_west_plus: cursor = 139; break;
|
||||
case nsICursor::arrow_east: cursor = 140; break;
|
||||
case nsICursor::arrow_east_plus: cursor = 141; break;
|
||||
case nsICursor::crosshair: cursor = kThemeCrossCursor; break;
|
||||
case nsICursor::move: cursor = kThemeOpenHandCursor; break;
|
||||
case nsICursor::help: cursor = 143; break;
|
||||
#if 0
|
||||
case nsICursor::copy: cursor = 144; break; // CSS3
|
||||
case nsICursor::alias: cursor = 145; break;
|
||||
case nsICursor::context_menu: cursor = 146; break;
|
||||
case nsICursor::cell: cursor = kThemePlusCursor; break;
|
||||
case nsICursor::grab: cursor = kThemeOpenHandCursor; break;
|
||||
case nsICursor::grabbing: cursor = kThemeClosedHandCursor; break;
|
||||
case nsICursor::spinning: cursor = kThemeSpinningCursor; break;
|
||||
case nsICursor::count_up: cursor = kThemeCountingUpHandCursor; break;
|
||||
case nsICursor::count_down: cursor = kThemeCountingDownHandCursor; break;
|
||||
case nsICursor::count_up_down: cursor = kThemeCountingUpAndDownHandCursor; break;
|
||||
#endif
|
||||
}
|
||||
if (cursor >= 0) {
|
||||
if (cursor >= 128) {
|
||||
//nsMacResources::OpenLocalResourceFile();
|
||||
mCursor = ::GetCursor(cursor);
|
||||
//nsMacResources::CloseLocalResourceFile();
|
||||
if (mCursor != NULL) {
|
||||
SInt8 state = ::HGetState(Handle(mCursor));
|
||||
::HLock(Handle(mCursor));
|
||||
::SetCursor(*mCursor);
|
||||
::HSetState(Handle(mCursor), state);
|
||||
}
|
||||
} else {
|
||||
::ShowCursor();
|
||||
::SetThemeCursor(cursor);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsCursor_h___
|
||||
#define nsCursor_h___
|
||||
|
||||
#include "nsICursor.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
|
||||
#define NS_CURSOR_CID \
|
||||
{ /* 312707a4-1dd2-11b2-9453-cff424d9e371 */ \
|
||||
0x312707a4, \
|
||||
0x1dd2, \
|
||||
0x11b2, \
|
||||
{0x94, 0x53, 0xcf, 0xf4, 0x24, 0xd9, 0xe3, 0x71} \
|
||||
}
|
||||
|
||||
class nsCursor : public nsICursor
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICURSOR
|
||||
|
||||
nsCursor();
|
||||
virtual ~nsCursor();
|
||||
|
||||
private:
|
||||
CursHandle mCursor;
|
||||
};
|
||||
|
||||
#endif // nsCursor_h___
|
|
@ -1,332 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsDrawable.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDrawable, nsIDrawable)
|
||||
|
||||
nsDrawable::nsDrawable() :
|
||||
mBounds(0,0,0,0),
|
||||
mDepth(0),
|
||||
|
||||
mLineWidth(0),
|
||||
mForegroundColor(0),
|
||||
mBackgroundColor(0),
|
||||
mClipOrigin(0, 0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsDrawable::~nsDrawable()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetSize(gfx_width *aWidth, gfx_height *aHeight)
|
||||
{
|
||||
*aWidth = mBounds.width;
|
||||
*aHeight = mBounds.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetWidth(gfx_width *aWidth)
|
||||
{
|
||||
*aWidth = mBounds.width;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetHeight(gfx_height *aHeight)
|
||||
{
|
||||
*aHeight = mBounds.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetDepth(gfx_depth *aDepth)
|
||||
{
|
||||
*aDepth = mDepth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawPoint(gfx_coord x, gfx_coord y)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawLine(gfx_coord aX1, gfx_coord aY1,
|
||||
gfx_coord aX2, gfx_coord aY2)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawRectangle(gfx_coord x, gfx_coord y,
|
||||
gfx_width width, gfx_height height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillRectangle(gfx_coord x, gfx_coord y,
|
||||
gfx_width width, gfx_height height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawEllipse(gfx_coord x, gfx_coord y,
|
||||
gfx_width width, gfx_height height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillEllipse(gfx_coord x, gfx_coord y,
|
||||
gfx_width width, gfx_height height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawArc(gfx_coord x, gfx_coord y,
|
||||
gfx_width width, gfx_height height,
|
||||
PRInt32 angle1, PRInt32 angle2)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillArc(gfx_coord x, gfx_coord y,
|
||||
gfx_width width, gfx_height height,
|
||||
PRInt32 angle1, PRInt32 angle2)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawPolygon(const nsPoint **points,
|
||||
const PRUint32 npoints)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillPolygon(const nsPoint **points,
|
||||
const PRUint32 npoints)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawString(const PRUnichar *aText,
|
||||
PRUint32 aLength,
|
||||
gfx_coord aX, gfx_coord aY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawCString(const char *aText,
|
||||
PRUint32 aLength,
|
||||
gfx_coord aX, gfx_coord aY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::CopyTo(nsIDrawable *aDest,
|
||||
gfx_coord xsrc, gfx_coord ysrc,
|
||||
gfx_coord xdest, gfx_coord ydest,
|
||||
gfx_width width, gfx_height height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::ClearArea(gfx_coord x,
|
||||
gfx_coord y,
|
||||
gfx_width width,
|
||||
gfx_height height)
|
||||
{
|
||||
Rect macRect;
|
||||
GrafPtr savePort;
|
||||
|
||||
::SetRect(&macRect, x, y, width, height);
|
||||
|
||||
::GetPort(&savePort);
|
||||
::SetPort(mGrafPtr);
|
||||
::EraseRect(&macRect);
|
||||
::SetPort(savePort);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::Clear()
|
||||
{
|
||||
Rect macRect;
|
||||
GrafPtr savePort;
|
||||
|
||||
::SetRect(&macRect, 0, 0, mBounds.width, mBounds.height);
|
||||
|
||||
::GetPort(&savePort);
|
||||
::SetPort(mGrafPtr);
|
||||
::EraseRect(&macRect);
|
||||
::SetPort(savePort);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] void drawImage (in nsIImage aImage, in nsIImage aMask, [const] in nsRect aSrcRect, [const] in nsRect aDestRect); */
|
||||
NS_IMETHODIMP nsDrawable::DrawImage(nsIImage *aImage, nsIImage *aMask, const nsRect * aSrcRect, const nsRect * aDestRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void drawTile (in nsIImage aImage, in nsIImage aMask, in gfx_coord aX0, in gfx_coord aY0, in gfx_coord aX1, in gfx_coord aY1, in gfx_width width, in gfx_height height); */
|
||||
NS_IMETHODIMP nsDrawable::DrawTile(nsIImage *aImage,
|
||||
nsIImage *aMask,
|
||||
gfx_coord aX0,
|
||||
gfx_coord aY0,
|
||||
gfx_coord aX1,
|
||||
gfx_coord aY1,
|
||||
gfx_width width,
|
||||
gfx_height height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* attribute gfx_coord lineWidth; */
|
||||
NS_IMETHODIMP nsDrawable::GetLineWidth(gfx_coord *aLineWidth)
|
||||
{
|
||||
*aLineWidth = mLineWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetLineWidth(gfx_coord aLineWidth)
|
||||
{
|
||||
mLineWidth = aLineWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute gfx_color foregroundColor; */
|
||||
NS_IMETHODIMP nsDrawable::GetForegroundColor(gfx_color *aForegroundColor)
|
||||
{
|
||||
*aForegroundColor = mForegroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetForegroundColor(gfx_color aForegroundColor)
|
||||
{
|
||||
mForegroundColor = aForegroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute gfx_color backgroundColor; */
|
||||
NS_IMETHODIMP nsDrawable::GetBackgroundColor(gfx_color *aBackgroundColor)
|
||||
{
|
||||
*aBackgroundColor = mBackgroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetBackgroundColor(gfx_color aBackgroundColor)
|
||||
{
|
||||
mBackgroundColor = aBackgroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] void setFont ([const] in nsFont font); */
|
||||
NS_IMETHODIMP nsDrawable::SetFont(const nsFont * font)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] nsFont getFont (); */
|
||||
NS_IMETHODIMP nsDrawable::GetFont(nsFont * *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsIFontMetrics fontMetrics; */
|
||||
NS_IMETHODIMP nsDrawable::GetFontMetrics(nsIFontMetrics * *aFont)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetFontMetrics(nsIFontMetrics * aFont)
|
||||
{
|
||||
mFontMetrics = aFont;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getClipOrigin (out gfx_coord x, out gfx_coord y); */
|
||||
NS_IMETHODIMP nsDrawable::GetClipOrigin(gfx_coord *x, gfx_coord *y)
|
||||
{
|
||||
*x = mClipOrigin.x;
|
||||
*y = mClipOrigin.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void setClipOrigin (in gfx_coord x, in gfx_coord y); */
|
||||
NS_IMETHODIMP nsDrawable::SetClipOrigin(gfx_coord x, gfx_coord y)
|
||||
{
|
||||
mClipOrigin.MoveTo(x, y);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getClipRectangle (out gfx_coord x, out gfx_coord y, out gfx_width width, out gfx_height height); */
|
||||
NS_IMETHODIMP nsDrawable::GetClipRectangle(gfx_coord *x, gfx_coord *y, gfx_width *width, gfx_height *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setClipRectangle (in gfx_coord x, in gfx_coord y, in gfx_width width, in gfx_height height); */
|
||||
NS_IMETHODIMP nsDrawable::SetClipRectangle(gfx_coord x, gfx_coord y, gfx_width width, gfx_height height)
|
||||
{
|
||||
if (!mClipRegion) {
|
||||
nsresult rv;
|
||||
mClipRegion = do_CreateInstance("mozilla.gfx.region.2", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return mClipRegion->SetToRect(x, y, width, height);
|
||||
}
|
||||
|
||||
/* attribute nsIRegion clipRegion; */
|
||||
NS_IMETHODIMP nsDrawable::GetClipRegion(nsIRegion * *aClipRegion)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetClipRegion(nsIRegion * aClipRegion)
|
||||
{
|
||||
if (!mClipRegion) {
|
||||
nsresult rv;
|
||||
mClipRegion = do_CreateInstance("mozilla.gfx.region.2", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return mClipRegion->SetToRegion(aClipRegion);
|
||||
}
|
||||
|
||||
/* [noscript] void changeClipRectangle ([const] in nsRect rect, in short clipOperation); */
|
||||
NS_IMETHODIMP nsDrawable::ChangeClipRectangle(const nsRect * rect, PRInt16 clipOperation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void changeClipRegion (in nsIRegion aRegion, in short clipOperation); */
|
||||
NS_IMETHODIMP nsDrawable::ChangeClipRegion(nsIRegion *aRegion, PRInt16 clipOperation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsDrawable_h___
|
||||
#define nsDrawable_h___
|
||||
|
||||
#include "nsIDrawable.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIRegion.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
#ifndef __QUICKDRAW__
|
||||
#include <Quickdraw.h>
|
||||
#endif
|
||||
|
||||
class nsDrawable : public nsIDrawable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDRAWABLE
|
||||
|
||||
nsDrawable();
|
||||
virtual ~nsDrawable();
|
||||
|
||||
protected:
|
||||
inline void SetDrawable(GrafPtr aDrawable) { mGrafPtr = aDrawable; }
|
||||
|
||||
/* protected members variables */
|
||||
nsRect mBounds;
|
||||
|
||||
gfx_depth mDepth;
|
||||
|
||||
private:
|
||||
/* private members variables */
|
||||
GrafPtr mGrafPtr;
|
||||
|
||||
/* GC related stuff */
|
||||
gfx_coord mLineWidth;
|
||||
|
||||
gfx_color mForegroundColor;
|
||||
gfx_color mBackgroundColor;
|
||||
|
||||
nsPoint mClipOrigin;
|
||||
nsCOMPtr<nsIRegion> mClipRegion;
|
||||
|
||||
nsCOMPtr<nsIFontMetrics> mFontMetrics;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsDrawable_h___
|
|
@ -1,62 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsPixmap.h"
|
||||
|
||||
#include "nsIWindow.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPixmap, nsDrawable, nsIPixmap)
|
||||
|
||||
nsPixmap::nsPixmap()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsPixmap::~nsPixmap()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPixmap::Init(nsIWindow *aParent, gfx_width width, gfx_height height, gfx_depth depth)
|
||||
{
|
||||
mBounds.SizeTo(width, height);
|
||||
mDepth = depth;
|
||||
|
||||
Rect macRect;
|
||||
GrafPtr savePort;
|
||||
|
||||
mBounds.SizeTo(width, height);
|
||||
mDepth = depth;
|
||||
|
||||
::SetRect(&macRect, 0, 0, width, height);
|
||||
|
||||
// create offscreen, first with normal memory, if that fails use temp memory, if that fails, return
|
||||
QDErr osErr = ::NewGWorld(&mGWorld, depth, &macRect, NULL, NULL, NULL);
|
||||
if (osErr != noErr)
|
||||
osErr = ::NewGWorld(&mGWorld, depth, &macRect, NULL, NULL, useTempMem);
|
||||
if (osErr != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsPixmap_h___
|
||||
#define nsPixmap_h___
|
||||
|
||||
#include "nsIPixmap.h"
|
||||
#include "nsDrawable.h"
|
||||
|
||||
#ifndef __QDOFFSCREEN__
|
||||
#include <QDOffscreen.h>
|
||||
#endif
|
||||
|
||||
#define NS_PIXMAP_CID \
|
||||
{ /* 51d24afe-1dd2-11b2-bb2f-c50415059b04 */ \
|
||||
0x51d24afe, \
|
||||
0x1dd2, \
|
||||
0x11b2, \
|
||||
{0xbb, 0x2f, 0xc5, 0x04, 0x15, 0x05, 0x9b, 0x04} \
|
||||
}
|
||||
|
||||
class nsPixmap : public nsIPixmap,
|
||||
public nsDrawable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPIXMAP
|
||||
|
||||
nsPixmap();
|
||||
virtual ~nsPixmap();
|
||||
|
||||
private:
|
||||
|
||||
GWorldPtr mGWorld;
|
||||
};
|
||||
|
||||
#endif // nsPixmap_h___
|
|
@ -1,48 +0,0 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
MODULE = gfx2
|
||||
LIBRARY_NAME= gfx_base
|
||||
DLLNAME = gfx_base
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsRect.obj \
|
||||
$(NULL)
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
|
||||
DIRS = windows
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
rm -f $(PDBFILE).pdb
|
|
@ -1,213 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsRect2.h"
|
||||
#include "nsMargin2.h"
|
||||
|
||||
#ifdef DEBUG_STRING
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
#ifdef MIN
|
||||
#undef MIN
|
||||
#endif
|
||||
|
||||
#ifdef MAX
|
||||
#undef MAX
|
||||
#endif
|
||||
|
||||
#define MIN(a,b)\
|
||||
((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b)\
|
||||
((a) > (b) ? (a) : (b))
|
||||
|
||||
// Containment
|
||||
PRBool nsRect2::Contains(gfx_coord aX, gfx_coord aY) const
|
||||
{
|
||||
return (PRBool) ((aX >= x) && (aY >= y) &&
|
||||
(aX < XMost()) && (aY < YMost()));
|
||||
}
|
||||
|
||||
PRBool nsRect2::Contains(const nsRect2 &aRect) const
|
||||
{
|
||||
return (PRBool) ((aRect.x >= x) && (aRect.y >= y) &&
|
||||
(aRect.XMost() <= XMost()) && (aRect.YMost() <= YMost()));
|
||||
}
|
||||
|
||||
// Intersection. Returns TRUE if the receiver overlaps aRect and
|
||||
// FALSE otherwise
|
||||
PRBool nsRect2::Intersects(const nsRect2 &aRect) const
|
||||
{
|
||||
return (PRBool) ((x < aRect.XMost()) && (y < aRect.YMost()) &&
|
||||
(aRect.x < XMost()) && (aRect.y < YMost()));
|
||||
}
|
||||
|
||||
// Computes the area in which aRect1 and aRect2 overlap and fills 'this' with
|
||||
// the result. Returns FALSE if the rectangles don't intersect.
|
||||
PRBool nsRect2::IntersectRect(const nsRect2 &aRect1, const nsRect2 &aRect2)
|
||||
{
|
||||
gfx_coord xmost1 = aRect1.XMost();
|
||||
gfx_coord ymost1 = aRect1.YMost();
|
||||
gfx_coord xmost2 = aRect2.XMost();
|
||||
gfx_coord ymost2 = aRect2.YMost();
|
||||
gfx_coord temp;
|
||||
|
||||
x = MAX(aRect1.x, aRect2.x);
|
||||
y = MAX(aRect1.y, aRect2.y);
|
||||
|
||||
// Compute the destination width
|
||||
temp = MIN(xmost1, xmost2);
|
||||
if (temp <= x) {
|
||||
Empty();
|
||||
return PR_FALSE;
|
||||
}
|
||||
width = temp - x;
|
||||
|
||||
// Compute the destination height
|
||||
temp = MIN(ymost1, ymost2);
|
||||
if (temp <= y) {
|
||||
Empty();
|
||||
return PR_FALSE;
|
||||
}
|
||||
height = temp - y;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Computes the smallest rectangle that contains both aRect1 and aRect2 and
|
||||
// fills 'this' with the result. Returns FALSE if both aRect1 and aRect2 are
|
||||
// empty and TRUE otherwise
|
||||
PRBool nsRect2::UnionRect(const nsRect2 &aRect1, const nsRect2 &aRect2)
|
||||
{
|
||||
PRBool result = PR_TRUE;
|
||||
|
||||
// Is aRect1 empty?
|
||||
if (aRect1.IsEmpty()) {
|
||||
if (aRect2.IsEmpty()) {
|
||||
// Both rectangles are empty which is an error
|
||||
Empty();
|
||||
result = PR_FALSE;
|
||||
} else {
|
||||
// aRect1 is empty so set the result to aRect2
|
||||
*this = aRect2;
|
||||
}
|
||||
} else if (aRect2.IsEmpty()) {
|
||||
// aRect2 is empty so set the result to aRect1
|
||||
*this = aRect1;
|
||||
} else {
|
||||
gfx_coord xmost1 = aRect1.XMost();
|
||||
gfx_coord xmost2 = aRect2.XMost();
|
||||
gfx_coord ymost1 = aRect1.YMost();
|
||||
gfx_coord ymost2 = aRect2.YMost();
|
||||
|
||||
// Compute the origin
|
||||
x = MIN(aRect1.x, aRect2.x);
|
||||
y = MIN(aRect1.y, aRect2.y);
|
||||
|
||||
// Compute the size
|
||||
width = MAX(xmost1, xmost2) - x;
|
||||
height = MAX(ymost1, ymost2) - y;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Inflate the rect by the specified width and height
|
||||
void nsRect2::Inflate(gfx_coord aDx, gfx_coord aDy)
|
||||
{
|
||||
x -= aDx;
|
||||
y -= aDy;
|
||||
width += 2 * aDx;
|
||||
height += 2 * aDy;
|
||||
}
|
||||
|
||||
// Inflate the rect by the specified margin
|
||||
void nsRect2::Inflate(const nsMargin2 &aMargin)
|
||||
{
|
||||
x -= aMargin.left;
|
||||
y -= aMargin.top;
|
||||
width += aMargin.left + aMargin.right;
|
||||
height += aMargin.top + aMargin.bottom;
|
||||
}
|
||||
|
||||
// Deflate the rect by the specified width and height
|
||||
void nsRect2::Deflate(gfx_coord aDx, gfx_coord aDy)
|
||||
{
|
||||
x += aDx;
|
||||
y += aDy;
|
||||
width -= 2 * aDx;
|
||||
height -= 2 * aDy;
|
||||
}
|
||||
|
||||
// Deflate the rect by the specified margin
|
||||
void nsRect2::Deflate(const nsMargin2 &aMargin)
|
||||
{
|
||||
x += aMargin.left;
|
||||
y += aMargin.top;
|
||||
width -= aMargin.left + aMargin.right;
|
||||
height -= aMargin.top + aMargin.bottom;
|
||||
}
|
||||
|
||||
// scale the rect but round to smallest containing rect
|
||||
nsRect2& nsRect2::ScaleRoundOut(const float aScale)
|
||||
{
|
||||
gfx_coord right = GFXCoordCeil((x + width) * aScale);
|
||||
gfx_coord bottom = GFXCoordCeil((y + height) * aScale);
|
||||
x = GFXCoordFloor(x * aScale);
|
||||
y = GFXCoordFloor(y * aScale);
|
||||
width = (right - x);
|
||||
height = (bottom - y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// scale the rect but round to largest contained rect
|
||||
nsRect2& nsRect2::ScaleRoundIn(const float aScale)
|
||||
{
|
||||
gfx_coord right = GFXCoordFloor((x + width) * aScale);
|
||||
gfx_coord bottom = GFXCoordFloor((y + height) * aScale);
|
||||
x = GFXCoordCeil(x * aScale);
|
||||
y = GFXCoordCeil(y * aScale);
|
||||
width = (right - x);
|
||||
height = (bottom - y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Diagnostics
|
||||
#ifdef DEBUG_RECT
|
||||
FILE* operator<<(FILE* out, const nsRect2& rect)
|
||||
{
|
||||
nsAutoString tmp;
|
||||
|
||||
// Output the coordinates in fractional points so they're easier to read
|
||||
tmp.AppendWithConversion("{");
|
||||
tmp.AppendFloat(NSTwipsToFloatPoints(rect.x));
|
||||
tmp.AppendWithConversion(", ");
|
||||
tmp.AppendFloat(NSTwipsToFloatPoints(rect.y));
|
||||
tmp.AppendWithConversion(", ");
|
||||
tmp.AppendFloat(NSTwipsToFloatPoints(rect.width));
|
||||
tmp.AppendWithConversion(", ");
|
||||
tmp.AppendFloat(NSTwipsToFloatPoints(rect.height));
|
||||
tmp.AppendWithConversion("}");
|
||||
fputs(tmp, out);
|
||||
return out;
|
||||
}
|
||||
#endif
|
|
@ -1,57 +0,0 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH=..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
MODULE = gfx2
|
||||
LIBRARY_NAME = gfx2
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsDrawable.obj \
|
||||
.\$(OBJDIR)\nsPixmap.obj \
|
||||
.\$(OBJDIR)\nsRegion.obj \
|
||||
.\$(OBJDIR)\nsWindow.obj \
|
||||
.\$(OBJDIR)\nsChildWindow.obj \
|
||||
.\$(OBJDIR)\nsPopupWindow.obj \
|
||||
.\$(OBJDIR)\nsTopLevelWindow.obj \
|
||||
.\$(OBJDIR)\nsGfxFactory.obj \
|
||||
.\$(OBJDIR)\nsRunAppRun.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
LLIBS= \
|
||||
$(LLIBS) \
|
||||
$(DIST)\lib\gfx_base.lib \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\$(LIBRARY_NAME).dll
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
|
@ -1,307 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsRegion.h"
|
||||
#include "nsRect.h"
|
||||
#include "xregion.h"
|
||||
#include "prmem.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRegion, nsIRegion)
|
||||
|
||||
nsRegion::nsRegion()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mRegion = NULL;
|
||||
mRegionType = NULLREGION;
|
||||
mData = NULL;
|
||||
mDataSize = 0;
|
||||
}
|
||||
|
||||
nsRegion::~nsRegion()
|
||||
{
|
||||
if (NULL != mRegion)
|
||||
{
|
||||
::DeleteObject(mRegion);
|
||||
mRegion = NULL;
|
||||
}
|
||||
|
||||
if (NULL != mData)
|
||||
{
|
||||
PR_Free(mData);
|
||||
|
||||
mData = NULL;
|
||||
mDataSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::Init(void)
|
||||
{
|
||||
if (NULL != mRegion) {
|
||||
::DeleteObject(mRegion);
|
||||
FreeRects(nsnull);
|
||||
}
|
||||
mRegion = ::CreateRectRgn(0, 0, 0, 0);
|
||||
mRegionType = NULLREGION;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::Copy(nsIRegion **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRegion::SetToRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
mRegionType = ::CombineRgn(mRegion, pRegion->mRegion, NULL, RGN_COPY);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::SetToRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
if (NULL != mRegion)
|
||||
::DeleteObject(mRegion);
|
||||
|
||||
mRegion = ::CreateRectRgn(aX, aY, aX + aWidth, aY + aHeight);
|
||||
|
||||
if ((aWidth == 0) || (aHeight == 0))
|
||||
mRegionType = NULLREGION;
|
||||
else
|
||||
mRegionType = SIMPLEREGION;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IntersectRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
mRegionType = ::CombineRgn(mRegion, mRegion, pRegion->mRegion, RGN_AND);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IntersectRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
HRGN tRegion;
|
||||
|
||||
tRegion = ::CreateRectRgn(aX, aY, aX + aWidth, aY + aHeight);
|
||||
mRegionType = ::CombineRgn(mRegion, mRegion, tRegion, RGN_AND);
|
||||
|
||||
::DeleteObject(tRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::UnionRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
mRegionType = ::CombineRgn(mRegion, mRegion, pRegion->mRegion, RGN_OR);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::UnionRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
HRGN tRegion;
|
||||
|
||||
tRegion = ::CreateRectRgn(aX, aY, aX + aWidth, aY + aHeight);
|
||||
mRegionType = ::CombineRgn(mRegion, mRegion, tRegion, RGN_OR);
|
||||
|
||||
::DeleteObject(tRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::SubtractRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
mRegionType = ::CombineRgn(mRegion, mRegion, pRegion->mRegion, RGN_DIFF);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::SubtractRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
HRGN tRegion;
|
||||
|
||||
tRegion = ::CreateRectRgn(aX, aY, aX + aWidth, aY + aHeight);
|
||||
mRegionType = ::CombineRgn(mRegion, mRegion, tRegion, RGN_DIFF);
|
||||
|
||||
::DeleteObject(tRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IsEmpty(PRBool *aResult)
|
||||
{
|
||||
*aResult = (mRegionType == NULLREGION) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IsEqual(nsIRegion *aRegion, PRBool *aResult)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
*aResult = ::EqualRgn(mRegion, pRegion->mRegion) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::GetBoundingBox(gfx_coord *aX, gfx_coord *aY, gfx_dimension *aWidth, gfx_dimension *aHeight)
|
||||
{
|
||||
RECT bounds;
|
||||
|
||||
if (mRegionType != NULLREGION)
|
||||
{
|
||||
::GetRgnBox(mRegion, &bounds);
|
||||
|
||||
*aX = bounds.left;
|
||||
*aY = bounds.top;
|
||||
*aWidth = bounds.right - bounds.left;
|
||||
*aHeight = bounds.bottom - bounds.top;
|
||||
}
|
||||
else
|
||||
*aX = *aY = *aWidth = *aHeight = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::OffsetBy(gfx_coord aXOffset, gfx_coord aYOffset)
|
||||
{
|
||||
::OffsetRgn(mRegion, aXOffset, aYOffset);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::ContainsRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight, PRBool *aResult)
|
||||
{
|
||||
RECT trect;
|
||||
|
||||
trect.left = aX;
|
||||
trect.top = aY;
|
||||
trect.right = aX + aWidth;
|
||||
trect.bottom = aY + aHeight;
|
||||
|
||||
*aResult = ::RectInRegion(mRegion, &trect) ? PR_TRUE : PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::GetRects(nsRect ***aRects, PRUint32 *npoints)
|
||||
{
|
||||
#if 0
|
||||
nsRegionRectSet *rects;
|
||||
nsRegionRect *rect;
|
||||
LPRECT pRects;
|
||||
DWORD dwCount, dwResult;
|
||||
unsigned int num_rects;
|
||||
|
||||
NS_ASSERTION(!(nsnull == aRects), "bad ptr");
|
||||
|
||||
rects = *aRects;
|
||||
|
||||
if (nsnull != rects)
|
||||
rects->mNumRects = 0;
|
||||
|
||||
// code lifted from old winfe. MMP
|
||||
|
||||
/* Get the size of the region data */
|
||||
dwCount = GetRegionData(mRegion, 0, NULL);
|
||||
|
||||
NS_ASSERTION(!(dwCount == 0), "bad region");
|
||||
|
||||
if (dwCount == 0)
|
||||
return NS_OK;
|
||||
|
||||
if (dwCount > mDataSize)
|
||||
{
|
||||
if (NULL != mData)
|
||||
PR_Free(mData);
|
||||
|
||||
mData = (LPRGNDATA)PR_Malloc(dwCount);
|
||||
}
|
||||
|
||||
NS_ASSERTION(!(nsnull == mData), "failed allocation");
|
||||
|
||||
if (mData == NULL)
|
||||
return NS_OK;
|
||||
|
||||
dwResult = GetRegionData(mRegion, dwCount, mData);
|
||||
|
||||
NS_ASSERTION(!(dwResult == 0), "get data failed");
|
||||
|
||||
if (dwResult == 0)
|
||||
return NS_OK;
|
||||
|
||||
if ((nsnull == rects) || (rects->mRectsLen < mData->rdh.nCount))
|
||||
{
|
||||
void *buf = PR_Realloc(rects, sizeof(nsRect) + (sizeof(nsRegionRect) * (mData->rdh.nCount - 1)));
|
||||
|
||||
if (nsnull == buf)
|
||||
{
|
||||
if (nsnull != rects)
|
||||
rects->mNumRects = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rects = (nsRegionRectSet *)buf;
|
||||
rects->mRectsLen = mData->rdh.nCount;
|
||||
}
|
||||
|
||||
rects->mNumRects = mData->rdh.nCount;
|
||||
rects->mArea = 0;
|
||||
rect = &rects->mRects[0];
|
||||
|
||||
for (pRects = (LPRECT)mData->Buffer, num_rects = 0;
|
||||
num_rects < mData->rdh.nCount;
|
||||
num_rects++, pRects++, rect++)
|
||||
{
|
||||
rect->x = pRects->left;
|
||||
rect->y = pRects->top;
|
||||
rect->width = pRects->right - rect->x;
|
||||
rect->height = pRects->bottom - rect->y;
|
||||
|
||||
rects->mArea += rect->width * rect->height;
|
||||
}
|
||||
|
||||
*aRects = rects;
|
||||
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLIMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::GetNumRects(PRUint32 *aRects)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLIMENTED;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsRegion_h___
|
||||
#define nsRegion_h___
|
||||
|
||||
#include "nsIRegion.h"
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#define NS_REGION_CID \
|
||||
{ /* 9cb3d640-1dd1-11b2-9518-d76af15f2e31 */ \
|
||||
0x9cb3d640, \
|
||||
0x1dd1, \
|
||||
0x11b2, \
|
||||
{0x95, 0x18, 0xd7, 0x6a, 0xf1, 0x5f, 0x2e, 0x31} \
|
||||
}
|
||||
|
||||
class nsRegion : public nsIRegion
|
||||
{
|
||||
public:
|
||||
nsRegion();
|
||||
virtual ~nsRegion();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREGION
|
||||
|
||||
protected:
|
||||
LPRGNDATA mData;
|
||||
PRUint32 mDataSize;
|
||||
|
||||
HRGN mRegion;
|
||||
int mRegionType;
|
||||
};
|
||||
|
||||
#endif // nsRegion_h___
|
|
@ -1,2 +0,0 @@
|
|||
Makefile
|
||||
.deps
|
|
@ -1,67 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gfx2
|
||||
LIBRARY_NAME = gfx2
|
||||
IS_COMPONENT = 1
|
||||
|
||||
CPPSRCS = \
|
||||
nsCursor.cpp \
|
||||
nsDrawable.cpp \
|
||||
nsGCCache.cpp \
|
||||
nsImage.cpp \
|
||||
nsPixmap.cpp \
|
||||
nsRegion.cpp \
|
||||
nsWindow.cpp \
|
||||
nsChildWindow.cpp \
|
||||
nsPopupWindow.cpp \
|
||||
nsTopLevelWindow.cpp \
|
||||
nsWindowHelper.cpp \
|
||||
nsGfxFactory.cpp \
|
||||
nsRunAppRun.cpp \
|
||||
nsKeyCode.cpp \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = $(DIST)/lib/libgfx_base.a
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
EXTRA_DSO_LDOPTS += -L$(DIST)/bin
|
||||
EXTRA_DSO_LDOPTS += $(TK_LIBS)
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(NSPR_LIBS) \
|
||||
-lxpcom \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
DEFINES += -D_BSD_SOURCE
|
||||
endif
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsChildWindow.h"
|
||||
#include "nsWindowHelper.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
NS_IMPL_QUERY_HEAD(nsChildWindow)
|
||||
NS_IMPL_QUERY_BODY(nsIChildWindow)
|
||||
NS_IMPL_QUERY_TAIL_INHERITING(nsWindow)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsChildWindow, nsWindow)
|
||||
NS_IMPL_RELEASE_INHERITED(nsChildWindow, nsWindow)
|
||||
|
||||
|
||||
#define ALL_EVENTS ( KeyPressMask | KeyReleaseMask | ButtonPressMask | \
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | \
|
||||
PointerMotionMask | PointerMotionHintMask | Button1MotionMask | \
|
||||
Button2MotionMask | Button3MotionMask | \
|
||||
Button4MotionMask | Button5MotionMask | ButtonMotionMask | \
|
||||
KeymapStateMask | ExposureMask | VisibilityChangeMask | \
|
||||
StructureNotifyMask | ResizeRedirectMask | \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask | \
|
||||
FocusChangeMask | PropertyChangeMask | \
|
||||
ColormapChangeMask | OwnerGrabButtonMask )
|
||||
|
||||
|
||||
|
||||
nsChildWindow::nsChildWindow()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mDisplay = nsRunAppRun::sDisplay;
|
||||
}
|
||||
|
||||
nsChildWindow::~nsChildWindow()
|
||||
{
|
||||
SetDrawable((Drawable)0);
|
||||
|
||||
if (mWindow) {
|
||||
nsWindowHelper::RemoveWindow(mWindow);
|
||||
::XDestroyWindow(mDisplay, mWindow);
|
||||
}
|
||||
}
|
||||
|
||||
/* nsIChildWindow methods */
|
||||
NS_IMETHODIMP nsChildWindow::Init(nsIWindow *aParent,
|
||||
gfx_coord aX,
|
||||
gfx_coord aY,
|
||||
gfx_dimension aWidth,
|
||||
gfx_dimension aHeight)
|
||||
{
|
||||
|
||||
if (!aParent) {
|
||||
printf("no parent window\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mBounds.SetRect(aX, aY, aWidth, aHeight);
|
||||
mDepth = 24; // this could be wrong :)
|
||||
|
||||
Window parent = 0;
|
||||
|
||||
mParent = getter_AddRefs(NS_GetWeakReference(aParent));
|
||||
|
||||
nsCOMPtr<nsPIWindowXlib> wx(do_QueryInterface(aParent));
|
||||
if (!wx)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
wx->GetNativeWindow(&parent);
|
||||
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long attr_mask;
|
||||
|
||||
Screen *screen = DefaultScreenOfDisplay(mDisplay);
|
||||
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
attr.colormap = DefaultColormapOfScreen(screen);
|
||||
attr.event_mask = ALL_EVENTS;
|
||||
attr_mask = CWBitGravity | CWColormap | CWEventMask;
|
||||
|
||||
mWindow = ::XCreateWindow(mDisplay, parent, aX, aY,
|
||||
aWidth, aHeight,
|
||||
0,
|
||||
CopyFromParent, // is this what we want here for depth?
|
||||
InputOutput,
|
||||
DefaultVisualOfScreen(screen),
|
||||
attr_mask, &attr);
|
||||
|
||||
nsWindowHelper::AddWindow(mWindow, this);
|
||||
|
||||
SetDrawable((Drawable)mWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void takeFocus (); */
|
||||
NS_IMETHODIMP nsChildWindow::TakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void moveZOrderAboveSibling (in nsIChildWindow aSibling); */
|
||||
NS_IMETHODIMP nsChildWindow::MoveZOrderAboveSibling(nsIChildWindow *aSibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void moveZOrderBelowSibling (in nsIChildWindow aSibling); */
|
||||
NS_IMETHODIMP nsChildWindow::MoveZOrderBelowSibling(nsIChildWindow *aSibling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsChildWindow_h___
|
||||
#define nsChildWindow_h___
|
||||
|
||||
#include "nsIChildWindow.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
#define NS_CHILDWINDOW_CID \
|
||||
{ /* a61effcc-1dd1-11b2-8167-c8e35841fd2f */ \
|
||||
0xa61effcc, \
|
||||
0x1dd1, \
|
||||
0x11b2, \
|
||||
{0x81, 0x67, 0xc8, 0xe3, 0x58, 0x41, 0xfd, 0x2f} \
|
||||
}
|
||||
|
||||
class nsChildWindow : public nsIChildWindow,
|
||||
public nsWindow
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICHILDWINDOW
|
||||
|
||||
nsChildWindow();
|
||||
virtual ~nsChildWindow();
|
||||
|
||||
private:
|
||||
/* member variables */
|
||||
};
|
||||
|
||||
#endif // nsChildWindow_h___
|
|
@ -1,114 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsCursor.h"
|
||||
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsCursor, nsICursor)
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
nsCursor::nsCursor() :
|
||||
mDisplay(nsnull),
|
||||
mCursor(0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
mDisplay = nsRunAppRun::sDisplay;
|
||||
}
|
||||
|
||||
nsCursor::~nsCursor()
|
||||
{
|
||||
if (mCursor)
|
||||
::XFreeCursor(mDisplay, mCursor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCursor::GetCursor(PRInt32 *aCursor)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCursor::SetCursor(PRInt32 aCursor)
|
||||
{
|
||||
unsigned int cursor = 0;
|
||||
|
||||
switch(aCursor) {
|
||||
case nsICursor::select:
|
||||
cursor = XC_xterm;
|
||||
break;
|
||||
|
||||
case nsICursor::wait:
|
||||
cursor = XC_watch;
|
||||
break;
|
||||
|
||||
case nsICursor::hyperlink:
|
||||
cursor = XC_hand2;
|
||||
break;
|
||||
|
||||
case nsICursor::standard:
|
||||
cursor = XC_left_ptr;
|
||||
break;
|
||||
|
||||
case nsICursor::sizeWE:
|
||||
case nsICursor::sizeNS:
|
||||
cursor = XC_tcross;
|
||||
break;
|
||||
|
||||
case nsICursor::arrow_south:
|
||||
case nsICursor::arrow_south_plus:
|
||||
cursor = XC_bottom_side;
|
||||
break;
|
||||
|
||||
case nsICursor::arrow_north:
|
||||
case nsICursor::arrow_north_plus:
|
||||
cursor = XC_top_side;
|
||||
break;
|
||||
|
||||
case nsICursor::arrow_east:
|
||||
case nsICursor::arrow_east_plus:
|
||||
cursor = XC_right_side;
|
||||
break;
|
||||
|
||||
case nsICursor::arrow_west:
|
||||
case nsICursor::arrow_west_plus:
|
||||
cursor = XC_left_side;
|
||||
break;
|
||||
|
||||
case nsICursor::move:
|
||||
cursor = XC_dotbox;
|
||||
break;
|
||||
|
||||
default:
|
||||
cursor = XC_left_ptr;
|
||||
break;
|
||||
}
|
||||
|
||||
mCursor = ::XCreateFontCursor(mDisplay, cursor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCursor::SetToImage(nsIImage *aImage)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsCursor_h___
|
||||
#define nsCursor_h___
|
||||
|
||||
#include "nsICursor.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#define NS_CURSOR_CID \
|
||||
{ /* 86f574ae-1dd2-11b2-a4c5-d5509ba74703 */ \
|
||||
0x86f574ae, \
|
||||
0x1dd2, \
|
||||
0x11b2, \
|
||||
{0xa4, 0xc5, 0xd5, 0x50, 0x9b, 0xa7, 0x47, 0x03} \
|
||||
}
|
||||
|
||||
class nsCursor : public nsICursor
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICURSOR
|
||||
|
||||
friend class nsWindow;
|
||||
|
||||
nsCursor();
|
||||
virtual ~nsCursor();
|
||||
|
||||
private:
|
||||
Display *mDisplay;
|
||||
Cursor mCursor;
|
||||
};
|
||||
|
||||
#endif // nsCursor_h___
|
|
@ -1,485 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsDrawable.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsGCCache.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
nsGCCache *nsDrawable::sGCCache = new nsGCCache();
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDrawable, nsIDrawable)
|
||||
|
||||
nsDrawable::nsDrawable() :
|
||||
mDisplay(nsnull),
|
||||
mGC(nsnull),
|
||||
mBounds(0.0,0.0,0.0,0.0),
|
||||
mDepth(0),
|
||||
mDrawable(0),
|
||||
|
||||
mLineWidth(0.0),
|
||||
mForegroundColor(0),
|
||||
mBackgroundColor(0),
|
||||
mClipOrigin(0.0, 0.0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsDrawable::~nsDrawable()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetSize(gfx_dimension *aWidth, gfx_dimension *aHeight)
|
||||
{
|
||||
*aWidth = mBounds.width;
|
||||
*aHeight = mBounds.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetWidth(gfx_dimension *aWidth)
|
||||
{
|
||||
*aWidth = mBounds.width;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetHeight(gfx_dimension *aHeight)
|
||||
{
|
||||
*aHeight = mBounds.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::GetDepth(gfx_depth *aDepth)
|
||||
{
|
||||
*aDepth = mDepth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawPoint(gfx_coord x, gfx_coord y)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XDrawPoint(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawLine(gfx_coord aX1, gfx_coord aY1,
|
||||
gfx_coord aX2, gfx_coord aY2)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XDrawLine(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(aX1),
|
||||
GFXCoordToIntRound(aY1),
|
||||
GFXCoordToIntRound(aX2),
|
||||
GFXCoordToIntRound(aY2));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawRectangle(gfx_coord x, gfx_coord y,
|
||||
gfx_dimension width, gfx_dimension height)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XDrawRectangle(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillRectangle(gfx_coord x, gfx_coord y,
|
||||
gfx_dimension width, gfx_dimension height)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XFillRectangle(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawEllipse(gfx_coord x, gfx_coord y,
|
||||
gfx_dimension width, gfx_dimension height)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XDrawArc(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height),
|
||||
0, 360 * 64);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillEllipse(gfx_coord x, gfx_coord y,
|
||||
gfx_dimension width, gfx_dimension height)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XFillArc(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height),
|
||||
0, 360 * 64);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawArc(gfx_coord x, gfx_coord y,
|
||||
gfx_dimension width, gfx_dimension height,
|
||||
gfx_angle angle1, gfx_angle angle2)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XDrawArc(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height),
|
||||
GFXAngleToIntRound(angle1),
|
||||
GFXAngleToIntRound(angle2));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillArc(gfx_coord x, gfx_coord y,
|
||||
gfx_dimension width, gfx_dimension height,
|
||||
gfx_angle angle1, gfx_angle angle2)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XFillArc(mDisplay, mDrawable, *mGC,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height),
|
||||
GFXAngleToIntRound(angle1), GFXAngleToIntRound(angle2));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawPolygon(const nsPoint2 **points,
|
||||
const PRUint32 npoints)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XDrawLines(mDisplay, mDrawable,
|
||||
*mGC,
|
||||
NS_REINTERPRET_CAST(XPoint*, NS_CONST_CAST(nsPoint2*,*points)),
|
||||
npoints,
|
||||
CoordModeOrigin);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::FillPolygon(const nsPoint2 **points,
|
||||
const PRUint32 npoints)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
::XFillPolygon(mDisplay, mDrawable,
|
||||
*mGC,
|
||||
NS_REINTERPRET_CAST(XPoint*, NS_CONST_CAST(nsPoint2*,*points)),
|
||||
npoints,
|
||||
Complex, CoordModeOrigin);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawString(const PRUnichar *aText,
|
||||
PRUint32 aLength,
|
||||
gfx_coord aX, gfx_coord aY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::DrawCString(const char *aText,
|
||||
PRUint32 aLength,
|
||||
gfx_coord aX, gfx_coord aY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::CopyTo(nsIDrawable *aDest,
|
||||
gfx_coord xsrc, gfx_coord ysrc,
|
||||
gfx_coord xdest, gfx_coord ydest,
|
||||
gfx_dimension width, gfx_dimension height)
|
||||
{
|
||||
UpdateGC();
|
||||
|
||||
// XXX should you be able to copy to another nsIDrawable that isn't this real class?
|
||||
Drawable dest = NS_STATIC_CAST(nsDrawable*, aDest)->mDrawable;
|
||||
|
||||
::XCopyArea(mDisplay,
|
||||
mDrawable, dest,
|
||||
*mGC,
|
||||
GFXCoordToIntRound(xsrc),
|
||||
GFXCoordToIntRound(ysrc),
|
||||
GFXCoordToIntRound(xdest),
|
||||
GFXCoordToIntRound(ydest),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::ClearArea(gfx_coord x,
|
||||
gfx_coord y,
|
||||
gfx_dimension width,
|
||||
gfx_dimension height)
|
||||
{
|
||||
::XClearArea(mDisplay, (Window)mDrawable,
|
||||
GFXCoordToIntRound(x),
|
||||
GFXCoordToIntRound(y),
|
||||
GFXCoordToIntRound(width),
|
||||
GFXCoordToIntRound(height),
|
||||
False);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDrawable::Clear()
|
||||
{
|
||||
::XClearWindow(mDisplay, (Window)mDrawable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] void drawImage (in nsIImage aImage, [const] in nsRect2 aSrcRect, [const] in nsPoint2 aDestPoint); */
|
||||
NS_IMETHODIMP nsDrawable::DrawImage(nsIImage *aImage, const nsRect2 * aSrcRect, const nsPoint2 * aDestPoint)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] void drawScaledImage (in nsIImage aImage, [const] in nsRect2 aSrcRect, [const] in nsRect2 aDestRect); */
|
||||
NS_IMETHODIMP nsDrawable::DrawScaledImage(nsIImage *aImage, const nsRect2 * aSrcRect, const nsRect2 * aDestRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] void drawTile (in nsIImage aImage, in gfx_coord aXOffset, in gfx_coord aYOffset, [const] in nsRect2 aTargetRect); */
|
||||
NS_IMETHODIMP nsDrawable::DrawTile(nsIImage *aImage, gfx_coord aXOffset, gfx_coord aYOffset, const nsRect2 * aTargetRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] void drawScaledTile (in nsIImage aImage, in gfx_coord aXOffset, in gfx_coord aYOffset, in gfx_dimension aTileWidth, in gfx_dimension aTileHeight, [const] in nsRect2 aTargetRect); */
|
||||
NS_IMETHODIMP nsDrawable::DrawScaledTile(nsIImage *aImage, gfx_coord aXOffset, gfx_coord aYOffset, gfx_dimension aTileWidth, gfx_dimension aTileHeight, const nsRect2 * aTargetRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* attribute gfx_coord lineWidth; */
|
||||
NS_IMETHODIMP nsDrawable::GetLineWidth(gfx_coord *aLineWidth)
|
||||
{
|
||||
*aLineWidth = mLineWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetLineWidth(gfx_coord aLineWidth)
|
||||
{
|
||||
mLineWidth = aLineWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute gfx_color foregroundColor; */
|
||||
NS_IMETHODIMP nsDrawable::GetForegroundColor(gfx_color *aForegroundColor)
|
||||
{
|
||||
*aForegroundColor = mForegroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetForegroundColor(gfx_color aForegroundColor)
|
||||
{
|
||||
mForegroundColor = aForegroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute gfx_color backgroundColor; */
|
||||
NS_IMETHODIMP nsDrawable::GetBackgroundColor(gfx_color *aBackgroundColor)
|
||||
{
|
||||
*aBackgroundColor = mBackgroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetBackgroundColor(gfx_color aBackgroundColor)
|
||||
{
|
||||
mBackgroundColor = aBackgroundColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] void setFont ([const] in nsFont font); */
|
||||
NS_IMETHODIMP nsDrawable::SetFont(const nsFont * font)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] nsFont getFont (); */
|
||||
NS_IMETHODIMP nsDrawable::GetFont(nsFont * *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsIFontMetrics fontMetrics; */
|
||||
NS_IMETHODIMP nsDrawable::GetFontMetrics(nsIFontMetrics * *aFont)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetFontMetrics(nsIFontMetrics * aFont)
|
||||
{
|
||||
mFontMetrics = aFont;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getClipOrigin (out gfx_coord x, out gfx_coord y); */
|
||||
NS_IMETHODIMP nsDrawable::GetClipOrigin(gfx_coord *x, gfx_coord *y)
|
||||
{
|
||||
*x = mClipOrigin.x;
|
||||
*y = mClipOrigin.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void setClipOrigin (in gfx_coord x, in gfx_coord y); */
|
||||
NS_IMETHODIMP nsDrawable::SetClipOrigin(gfx_coord x, gfx_coord y)
|
||||
{
|
||||
mClipOrigin.MoveTo(x, y);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getClipRectangle (out gfx_coord x, out gfx_coord y, out gfx_dimension width, out gfx_dimension height); */
|
||||
NS_IMETHODIMP nsDrawable::GetClipRectangle(gfx_coord *x, gfx_coord *y, gfx_dimension *width, gfx_dimension *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setClipRectangle (in gfx_coord x, in gfx_coord y, in gfx_dimension width, in gfx_dimension height); */
|
||||
NS_IMETHODIMP nsDrawable::SetClipRectangle(gfx_coord x, gfx_coord y, gfx_dimension width, gfx_dimension height)
|
||||
{
|
||||
if (!mClipRegion) {
|
||||
nsresult rv;
|
||||
mClipRegion = do_CreateInstance("mozilla.gfx.region.2", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return mClipRegion->SetToRect(x, y, width, height);
|
||||
}
|
||||
|
||||
/* attribute nsIRegion clipRegion; */
|
||||
NS_IMETHODIMP nsDrawable::GetClipRegion(nsIRegion * *aClipRegion)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsDrawable::SetClipRegion(nsIRegion * aClipRegion)
|
||||
{
|
||||
if (!mClipRegion) {
|
||||
nsresult rv;
|
||||
mClipRegion = do_CreateInstance("mozilla.gfx.region.2", &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return mClipRegion->SetToRegion(aClipRegion);
|
||||
}
|
||||
|
||||
/* [noscript] void changeClipRectangle ([const] in nsRect2 rect, in short clipOperation); */
|
||||
NS_IMETHODIMP nsDrawable::ChangeClipRectangle(const nsRect2 * rect, PRInt16 clipOperation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void changeClipRegion (in nsIRegion aRegion, in short clipOperation); */
|
||||
NS_IMETHODIMP nsDrawable::ChangeClipRegion(nsIRegion *aRegion, PRInt16 clipOperation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* local helper methods */
|
||||
void nsDrawable::UpdateGC()
|
||||
{
|
||||
XGCValues values;
|
||||
unsigned long valuesMask;
|
||||
|
||||
if (mGC)
|
||||
mGC->Release();
|
||||
|
||||
memset(&values, 0, sizeof(XGCValues));
|
||||
|
||||
// values.foreground.pixel = gdk_rgb_xpixel_from_rgb(NS_TO_GDK_RGB(mCurrentColor));
|
||||
values.foreground = mForegroundColor;
|
||||
valuesMask = GCForeground;
|
||||
|
||||
values.foreground = mBackgroundColor;
|
||||
valuesMask = GCBackground;
|
||||
|
||||
|
||||
#if 0
|
||||
if (mCurrentFont) {
|
||||
valuesMask |= GCFont;
|
||||
values.font = mFont;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
valuesMask |= GCLineStyle;
|
||||
values.line_style = mLineStyle;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
valuesMask = GdkGCValuesMask(valuesMask | GDK_GC_FUNCTION);
|
||||
values.function = mFunction;
|
||||
#endif
|
||||
|
||||
valuesMask |= GCLineWidth;
|
||||
values.line_width = GFXCoordToIntRound(mLineWidth);
|
||||
|
||||
Region rgn = 0;
|
||||
#if 0
|
||||
if (mClipRegion) {
|
||||
rgn = mClipRegion->mRegion;
|
||||
}
|
||||
#endif
|
||||
|
||||
mGC = sGCCache->GetGC(mDisplay,
|
||||
mDrawable,
|
||||
valuesMask,
|
||||
&values,
|
||||
rgn);
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsDrawable_h___
|
||||
#define nsDrawable_h___
|
||||
|
||||
#include "nsIDrawable.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIRegion.h"
|
||||
#include "nsPoint2.h"
|
||||
#include "nsRect2.h"
|
||||
|
||||
class nsGCCache;
|
||||
class xGC;
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
class nsDrawable : public nsIDrawable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDRAWABLE
|
||||
|
||||
friend class nsPixmap;
|
||||
|
||||
nsDrawable();
|
||||
virtual ~nsDrawable();
|
||||
|
||||
private:
|
||||
/* helper functions */
|
||||
void UpdateGC();
|
||||
|
||||
|
||||
protected:
|
||||
inline void SetDrawable(Drawable aDrawable) { mDrawable = aDrawable; }
|
||||
|
||||
/* protected members variables */
|
||||
Display *mDisplay;
|
||||
xGC *mGC;
|
||||
|
||||
nsRect2 mBounds;
|
||||
|
||||
gfx_depth mDepth;
|
||||
|
||||
|
||||
private:
|
||||
static nsGCCache *sGCCache;
|
||||
|
||||
/* private members variables */
|
||||
Drawable mDrawable;
|
||||
|
||||
/* GC related stuff */
|
||||
gfx_coord mLineWidth;
|
||||
|
||||
gfx_color mForegroundColor;
|
||||
gfx_color mBackgroundColor;
|
||||
|
||||
nsPoint2 mClipOrigin;
|
||||
nsCOMPtr<nsIRegion> mClipRegion;
|
||||
|
||||
nsCOMPtr<nsIFontMetrics> mFontMetrics;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsDrawable_h___
|
|
@ -1,231 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Mike Shaver <shaver@zeroknowledge.com>
|
||||
* Tomi Leppikangas <Tomi.Leppikangas@oulu.fi>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsGCCache.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
/* The GC cache is shared among all windows, since it doesn't hog
|
||||
any scarce resources (like colormap entries.) */
|
||||
|
||||
Region nsGCCache::copyRegion = 0;
|
||||
|
||||
nsGCCache::nsGCCache()
|
||||
{
|
||||
PR_INIT_CLIST(&GCCache);
|
||||
PR_INIT_CLIST(&GCFreeList);
|
||||
for (int i = 0; i < GC_CACHE_SIZE; i++) {
|
||||
GCCacheEntry *entry = new GCCacheEntry();
|
||||
entry->gc=NULL;
|
||||
PR_INSERT_LINK(&entry->clist, &GCFreeList);
|
||||
}
|
||||
DEBUG_METER(memset(&GCCacheStats, 0, sizeof(GCCacheStats));)
|
||||
}
|
||||
|
||||
void
|
||||
nsGCCache::move_cache_entry(PRCList *clist)
|
||||
{
|
||||
/* thread on the freelist, at the front */
|
||||
PR_REMOVE_LINK(clist);
|
||||
PR_INSERT_LINK(clist, &GCFreeList);
|
||||
}
|
||||
|
||||
void
|
||||
nsGCCache::free_cache_entry(PRCList *clist)
|
||||
{
|
||||
GCCacheEntry *entry = (GCCacheEntry *)clist;
|
||||
entry->gc->Release();
|
||||
if (entry->clipRegion)
|
||||
::XDestroyRegion(entry->clipRegion);
|
||||
|
||||
/* thread on the freelist, at the front */
|
||||
PR_REMOVE_LINK(clist);
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
PR_INSERT_LINK(clist, &GCFreeList);
|
||||
}
|
||||
|
||||
nsGCCache::~nsGCCache()
|
||||
{
|
||||
PRCList *head;
|
||||
|
||||
ReportStats();
|
||||
|
||||
while (!PR_CLIST_IS_EMPTY(&GCCache)) {
|
||||
head = PR_LIST_HEAD(&GCCache);
|
||||
if (head == &GCCache)
|
||||
break;
|
||||
free_cache_entry(head);
|
||||
}
|
||||
|
||||
while (!PR_CLIST_IS_EMPTY(&GCFreeList)) {
|
||||
head = PR_LIST_HEAD(&GCFreeList);
|
||||
if (head == &GCFreeList)
|
||||
break;
|
||||
PR_REMOVE_LINK(head);
|
||||
delete (GCCacheEntry *)head;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGCCache::ReportStats() {
|
||||
DEBUG_METER(
|
||||
fprintf(stderr, "GC Cache:\n\thits:");
|
||||
int hits = 0;
|
||||
for (int i = 0; i < GC_CACHE_SIZE; i++) {
|
||||
fprintf(stderr, " %4d", GCCacheStats.hits[i]);
|
||||
hits+=GCCacheStats.hits[i];
|
||||
}
|
||||
int total = hits + GCCacheStats.misses;
|
||||
float percent = float(float(hits) / float(total));
|
||||
percent *= 100;
|
||||
fprintf(stderr, "\n\thits: %d, misses: %d, hit percent: %f%%\n",
|
||||
hits, GCCacheStats.misses, percent);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsGCCache::XCopyRegion(Region srca, Region dr_return)
|
||||
{
|
||||
if (!copyRegion) copyRegion = ::XCreateRegion();
|
||||
::XUnionRegion(srca, copyRegion, dr_return);
|
||||
}
|
||||
|
||||
/* Dispose of entries matching the given flags, compressing the GC cache */
|
||||
void nsGCCache::Flush(unsigned long flags)
|
||||
{
|
||||
while (!PR_CLIST_IS_EMPTY(&GCCache)) {
|
||||
PRCList *head = PR_LIST_HEAD(&GCCache);
|
||||
if (head == &GCCache)
|
||||
break;
|
||||
GCCacheEntry *entry = (GCCacheEntry *)head;
|
||||
if (entry->flags & flags)
|
||||
free_cache_entry(head);
|
||||
}
|
||||
}
|
||||
|
||||
xGC *nsGCCache::GetGC(Display *display, Drawable drawable, unsigned long flags, XGCValues *gcv, Region clipRegion)
|
||||
{
|
||||
PRCList *iter;
|
||||
GCCacheEntry *entry;
|
||||
DEBUG_METER(int i = 0;)
|
||||
|
||||
for (iter = PR_LIST_HEAD(&GCCache); iter != &GCCache;
|
||||
iter = PR_NEXT_LINK(iter)) {
|
||||
|
||||
entry = (GCCacheEntry *)iter;
|
||||
if (flags == entry->flags &&
|
||||
!memcmp (gcv, &entry->gcv, sizeof (*gcv))) {
|
||||
/* if there's a clipRegion, we have to match */
|
||||
|
||||
if ((clipRegion && entry->clipRegion &&
|
||||
::XEqualRegion(clipRegion, entry->clipRegion)) ||
|
||||
/* and if there isn't, we can't have one */
|
||||
(!clipRegion && !entry->clipRegion)) {
|
||||
|
||||
/* move to the front of the list, if needed */
|
||||
if (iter != PR_LIST_HEAD(&GCCache)) {
|
||||
PR_REMOVE_LINK(iter);
|
||||
PR_INSERT_LINK(iter, &GCCache);
|
||||
}
|
||||
DEBUG_METER(GCCacheStats.hits[i]++;)
|
||||
|
||||
entry->gc->AddRef();
|
||||
return entry->gc;
|
||||
}
|
||||
}
|
||||
DEBUG_METER(++i;)
|
||||
}
|
||||
|
||||
/* might need to forcibly free the LRU cache entry */
|
||||
if (PR_CLIST_IS_EMPTY(&GCFreeList)) {
|
||||
DEBUG_METER(GCCacheStats.reclaim++);
|
||||
move_cache_entry(PR_LIST_TAIL(&GCCache));
|
||||
}
|
||||
|
||||
DEBUG_METER(GCCacheStats.misses++;)
|
||||
|
||||
iter = PR_LIST_HEAD(&GCFreeList);
|
||||
PR_REMOVE_LINK(iter);
|
||||
PR_INSERT_LINK(iter, &GCCache);
|
||||
entry = (GCCacheEntry *)iter;
|
||||
|
||||
if (!entry->gc) {
|
||||
// No old GC, greate new
|
||||
entry->gc = new xGC(display, drawable, flags, gcv);
|
||||
entry->gc->AddRef(); // addref the newly created xGC
|
||||
entry->flags = flags;
|
||||
entry->gcv = *gcv;
|
||||
entry->clipRegion = NULL;
|
||||
//printf("creating new gc=%X\n",entry->gc);
|
||||
}
|
||||
else if (entry->gc->mRefCnt > 1) {
|
||||
// Old GC still in use, create new
|
||||
entry->gc->Release();
|
||||
entry->gc = new xGC(display, drawable, flags, gcv);
|
||||
entry->gc->AddRef(); // addref the newly created xGC
|
||||
entry->flags = flags;
|
||||
entry->gcv = *gcv;
|
||||
entry->clipRegion = NULL;
|
||||
//printf("creating new (use)gc=%X\n",entry->gc);
|
||||
}
|
||||
else {
|
||||
ReuseGC(entry, flags, gcv);
|
||||
}
|
||||
|
||||
if (clipRegion) {
|
||||
entry->clipRegion = ::XCreateRegion();
|
||||
XCopyRegion(clipRegion, entry->clipRegion);
|
||||
if (entry->clipRegion)
|
||||
::XSetRegion(display, entry->gc->mGC, entry->clipRegion);
|
||||
/* XXX what if it fails? */
|
||||
}
|
||||
|
||||
entry->gc->AddRef();
|
||||
return entry->gc;
|
||||
}
|
||||
|
||||
void nsGCCache::ReuseGC(GCCacheEntry *entry, unsigned long flags, XGCValues *gcv)
|
||||
{
|
||||
// We have old GC, reuse it and check what
|
||||
// we have to change
|
||||
|
||||
if (entry->clipRegion) {
|
||||
// set it to none here and then set the clip region with
|
||||
// gdk_gc_set_clip_region in GetGC()
|
||||
gcv->clip_mask = None;
|
||||
flags |= GCClipMask;
|
||||
::XDestroyRegion(entry->clipRegion);
|
||||
entry->clipRegion = NULL;
|
||||
}
|
||||
|
||||
if (flags != 0) {
|
||||
::XChangeGC(entry->gc->mDisplay, entry->gc->mGC,
|
||||
flags, gcv);
|
||||
}
|
||||
entry->flags = flags; entry->gcv = *gcv;
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Mike Shaver <shaver@zeroknowledge.com>
|
||||
*/
|
||||
|
||||
#ifndef nsGCCache_h___
|
||||
#define nsGCCache_h___
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "nscore.h"
|
||||
#include "prclist.h"
|
||||
|
||||
#define countof(x) ((int)(sizeof(x) / sizeof (*x)))
|
||||
#define GC_CACHE_SIZE 10
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_METER(x) x
|
||||
#else
|
||||
#define DEBUG_METER(x)
|
||||
#endif
|
||||
|
||||
class nsGCCache;
|
||||
|
||||
class xGC {
|
||||
friend class nsGCCache;
|
||||
|
||||
public:
|
||||
xGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values)
|
||||
{
|
||||
mRefCnt = 0;
|
||||
mDisplay = display;
|
||||
mGC = ::XCreateGC(display, d, valuemask, values);
|
||||
}
|
||||
|
||||
virtual ~xGC() {
|
||||
::XFreeGC(mDisplay, mGC);
|
||||
}
|
||||
|
||||
PRInt32 AddRef(void) {
|
||||
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");
|
||||
++mRefCnt;
|
||||
return mRefCnt;
|
||||
}
|
||||
PRInt32 Release(void) {
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||
--mRefCnt;
|
||||
if (mRefCnt == 0) {
|
||||
mRefCnt = 1; /* stabilize */
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
//operator GC() { return mGC; }
|
||||
operator const GC() { return (const GC)mGC; }
|
||||
|
||||
private:
|
||||
PRInt32 mRefCnt;
|
||||
Display *mDisplay;
|
||||
GC mGC;
|
||||
};
|
||||
|
||||
|
||||
struct GCCacheEntry
|
||||
{
|
||||
PRCList clist;
|
||||
unsigned long flags;
|
||||
XGCValues gcv;
|
||||
Region clipRegion;
|
||||
xGC *gc;
|
||||
};
|
||||
|
||||
class nsGCCache
|
||||
{
|
||||
public:
|
||||
nsGCCache();
|
||||
virtual ~nsGCCache();
|
||||
|
||||
void Flush(unsigned long flags);
|
||||
|
||||
xGC *GetGC(Display *display, Window window, unsigned long flags, XGCValues *gcv, Region clipRegion);
|
||||
|
||||
private:
|
||||
void ReuseGC(GCCacheEntry *entry, unsigned long flags, XGCValues *gcv);
|
||||
PRCList GCCache;
|
||||
PRCList GCFreeList;
|
||||
void free_cache_entry(PRCList *clist);
|
||||
void move_cache_entry(PRCList *clist);
|
||||
static void XCopyRegion(Region src, Region dr_return);
|
||||
static Region copyRegion;
|
||||
void ReportStats();
|
||||
|
||||
DEBUG_METER(
|
||||
struct {
|
||||
int hits[GC_CACHE_SIZE];
|
||||
int misses;
|
||||
int reclaim;
|
||||
} GCCacheStats;
|
||||
)
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,91 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIModule.h"
|
||||
|
||||
#include "nsCursor.h"
|
||||
#include "nsPixmap.h"
|
||||
#include "nsImage.h"
|
||||
#include "nsRegion.h"
|
||||
|
||||
#include "nsChildWindow.h"
|
||||
#include "nsPopupWindow.h"
|
||||
#include "nsTopLevelWindow.h"
|
||||
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
// objects that just require generic constructors
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCursor)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPixmap)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImage)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegion)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildWindow)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPopupWindow)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTopLevelWindow)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRunAppRun)
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "xlib cursor",
|
||||
NS_CURSOR_CID,
|
||||
"@mozilla.org/gfx/cursor;2",
|
||||
nsCursorConstructor, },
|
||||
{ "xlib pixmap",
|
||||
NS_PIXMAP_CID,
|
||||
"@mozilla.org/gfx/pixmap;2",
|
||||
nsPixmapConstructor, },
|
||||
{ "xlib image",
|
||||
NS_IMAGE_CID,
|
||||
"@mozilla.org/gfx/image;2",
|
||||
nsImageConstructor, },
|
||||
{ "xlib region",
|
||||
NS_REGION_CID,
|
||||
"@mozilla.org/gfx/region;2",
|
||||
nsRegionConstructor, },
|
||||
{ "xlib window",
|
||||
NS_CHILDWINDOW_CID,
|
||||
"@mozilla.org/gfx/window/child;2",
|
||||
nsChildWindowConstructor, },
|
||||
{ "xlib window",
|
||||
NS_POPUPWINDOW_CID,
|
||||
"@mozilla.org/gfx/window/popup;2",
|
||||
nsPopupWindowConstructor, },
|
||||
{ "xlib window",
|
||||
NS_TOPLEVELWINDOW_CID,
|
||||
"@mozilla.org/gfx/window/toplevel;2",
|
||||
nsTopLevelWindowConstructor, },
|
||||
{ "xlib run app run",
|
||||
NS_RUNAPPRUN_CID,
|
||||
"@mozilla.org/gfx/run;2",
|
||||
nsRunAppRunConstructor, }
|
||||
};
|
||||
|
||||
|
||||
// @mozilla/gfx/systemlook;2
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsGfx2Module", components)
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsImage.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsImage, nsIImage)
|
||||
|
||||
nsImage::nsImage()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsImage::~nsImage()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* void init (in gfx_dimension aWidth, in gfx_dimension aHeight, in gfx_format aFormat); */
|
||||
NS_IMETHODIMP nsImage::Init(gfx_dimension aWidth, gfx_dimension aHeight, gfx_format aFormat)
|
||||
{
|
||||
mSize.SizeTo(aWidth, aHeight);
|
||||
mFormat = aFormat;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void initFromDrawable (in nsIDrawable aDrawable, in gfx_coord aX, in gfx_coord aY, in gfx_dimension aWidth, in gfx_dimension aHeight); */
|
||||
NS_IMETHODIMP nsImage::InitFromDrawable(nsIDrawable *aDrawable, gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_dimension width; */
|
||||
NS_IMETHODIMP nsImage::GetWidth(gfx_dimension *aWidth)
|
||||
{
|
||||
*aWidth = mSize.width;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_dimension height; */
|
||||
NS_IMETHODIMP nsImage::GetHeight(gfx_dimension *aHeight)
|
||||
{
|
||||
*aHeight = mSize.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_format format; */
|
||||
NS_IMETHODIMP nsImage::GetFormat(gfx_format *aFormat)
|
||||
{
|
||||
*aFormat = mFormat;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long bytesPerRow; */
|
||||
NS_IMETHODIMP nsImage::GetBytesPerRow(PRUint32 *aBytesPerRow)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long bitsLength; */
|
||||
NS_IMETHODIMP nsImage::GetBitsLength(PRUint32 *aBitsLength)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute PRUint8 bits; */
|
||||
NS_IMETHODIMP nsImage::GetBits(PRUint8 *aBits)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setBits ([array, size_is (length), const] in PRUint8 data, in unsigned long length, in long offset); */
|
||||
NS_IMETHODIMP nsImage::SetBits(const PRUint8 *data, PRUint32 length, PRInt32 offset)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "nsSize2.h"
|
||||
|
||||
#define NS_IMAGE_CID \
|
||||
{0x73c72e6c, 0x1dd2, 0x11b2, \
|
||||
{ 0x98, 0xb7, 0xae, 0x59, 0x35, 0xee, 0x63, 0xf5 }}
|
||||
|
||||
class nsImage : public nsIImage
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIIMAGE
|
||||
|
||||
nsImage();
|
||||
virtual ~nsImage();
|
||||
|
||||
/* additional members */
|
||||
|
||||
private:
|
||||
nsSize2 mSize;
|
||||
gfx_format mFormat;
|
||||
};
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsKeyCode.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/keysymdef.h>
|
||||
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
|
||||
struct nsKeyConverter
|
||||
{
|
||||
int vkCode; // Platform independent key code
|
||||
unsigned int keysym; // XK keysym key code
|
||||
};
|
||||
|
||||
struct nsKeyConverter nsKeycodes[] =
|
||||
{
|
||||
{ nsIDOMKeyEvent::DOM_VK_CANCEL, XK_Cancel},
|
||||
{ nsIDOMKeyEvent::DOM_VK_BACK_SPACE, XK_BackSpace},
|
||||
{ nsIDOMKeyEvent::DOM_VK_TAB, XK_Tab},
|
||||
#ifdef XK_ISO_Left_Tab
|
||||
{ nsIDOMKeyEvent::DOM_VK_TAB, XK_ISO_Left_Tab }, // SunOS 5.5.1 doesn't have it.
|
||||
#endif
|
||||
{ nsIDOMKeyEvent::DOM_VK_CLEAR, XK_Clear},
|
||||
{ nsIDOMKeyEvent::DOM_VK_RETURN, XK_Return},
|
||||
{ nsIDOMKeyEvent::DOM_VK_ENTER, XK_KP_Enter},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SHIFT, XK_Shift_L},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SHIFT, XK_Shift_R},
|
||||
{ nsIDOMKeyEvent::DOM_VK_CONTROL, XK_Control_L},
|
||||
{ nsIDOMKeyEvent::DOM_VK_CONTROL, XK_Control_R},
|
||||
{ nsIDOMKeyEvent::DOM_VK_ALT, XK_Alt_L},
|
||||
{ nsIDOMKeyEvent::DOM_VK_ALT, XK_Alt_R},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PAUSE, XK_Pause},
|
||||
{ nsIDOMKeyEvent::DOM_VK_CAPS_LOCK, XK_Caps_Lock},
|
||||
{ nsIDOMKeyEvent::DOM_VK_ESCAPE, XK_Escape},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SPACE, XK_KP_Space},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PAGE_UP, XK_Page_Up},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PAGE_UP, XK_KP_Page_Up},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PAGE_DOWN, XK_Page_Down},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PAGE_DOWN, XK_KP_Page_Down},
|
||||
{ nsIDOMKeyEvent::DOM_VK_END, XK_End},
|
||||
{ nsIDOMKeyEvent::DOM_VK_END, XK_KP_End},
|
||||
{ nsIDOMKeyEvent::DOM_VK_HOME, XK_Home},
|
||||
{ nsIDOMKeyEvent::DOM_VK_HOME, XK_KP_Home},
|
||||
{ nsIDOMKeyEvent::DOM_VK_LEFT, XK_Left},
|
||||
{ nsIDOMKeyEvent::DOM_VK_LEFT, XK_KP_Left},
|
||||
{ nsIDOMKeyEvent::DOM_VK_UP, XK_Up},
|
||||
{ nsIDOMKeyEvent::DOM_VK_UP, XK_KP_Up},
|
||||
{ nsIDOMKeyEvent::DOM_VK_RIGHT, XK_Right},
|
||||
{ nsIDOMKeyEvent::DOM_VK_RIGHT, XK_KP_Right},
|
||||
{ nsIDOMKeyEvent::DOM_VK_DOWN, XK_Down},
|
||||
{ nsIDOMKeyEvent::DOM_VK_DOWN, XK_KP_Down},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PRINTSCREEN, XK_Print},
|
||||
{ nsIDOMKeyEvent::DOM_VK_INSERT, XK_Insert},
|
||||
{ nsIDOMKeyEvent::DOM_VK_INSERT, XK_KP_Insert},
|
||||
{ nsIDOMKeyEvent::DOM_VK_DELETE, XK_Delete},
|
||||
{ nsIDOMKeyEvent::DOM_VK_DELETE, XK_KP_Delete},
|
||||
{ nsIDOMKeyEvent::DOM_VK_0, XK_0},
|
||||
{ nsIDOMKeyEvent::DOM_VK_1, XK_1},
|
||||
{ nsIDOMKeyEvent::DOM_VK_2, XK_2},
|
||||
{ nsIDOMKeyEvent::DOM_VK_3, XK_3},
|
||||
{ nsIDOMKeyEvent::DOM_VK_4, XK_4},
|
||||
{ nsIDOMKeyEvent::DOM_VK_5, XK_5},
|
||||
{ nsIDOMKeyEvent::DOM_VK_6, XK_6},
|
||||
{ nsIDOMKeyEvent::DOM_VK_7, XK_7},
|
||||
{ nsIDOMKeyEvent::DOM_VK_8, XK_8},
|
||||
{ nsIDOMKeyEvent::DOM_VK_9, XK_9},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SEMICOLON, XK_semicolon},
|
||||
{ nsIDOMKeyEvent::DOM_VK_EQUALS, XK_equal},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD0, XK_KP_0},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD1, XK_KP_1},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD2, XK_KP_2},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD3, XK_KP_3},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD4, XK_KP_4},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD5, XK_KP_5},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD6, XK_KP_6},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD7, XK_KP_7},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD8, XK_KP_8},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUMPAD9, XK_KP_9},
|
||||
{ nsIDOMKeyEvent::DOM_VK_MULTIPLY, XK_KP_Multiply},
|
||||
{ nsIDOMKeyEvent::DOM_VK_ADD, XK_KP_Add},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SEPARATOR, XK_KP_Separator},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SUBTRACT, XK_KP_Subtract},
|
||||
{ nsIDOMKeyEvent::DOM_VK_DECIMAL, XK_KP_Decimal},
|
||||
{ nsIDOMKeyEvent::DOM_VK_DIVIDE, XK_KP_Divide},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F1, XK_F1},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F2, XK_F2},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F3, XK_F3},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F4, XK_F4},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F5, XK_F5},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F6, XK_F6},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F7, XK_F7},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F8, XK_F8},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F9, XK_F9},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F10, XK_F10},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F11, XK_F11},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F12, XK_F12},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F13, XK_F13},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F14, XK_F14},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F15, XK_F15},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F16, XK_F16},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F17, XK_F17},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F18, XK_F18},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F19, XK_F19},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F20, XK_F20},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F21, XK_F21},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F22, XK_F22},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F23, XK_F23},
|
||||
{ nsIDOMKeyEvent::DOM_VK_F24, XK_F24},
|
||||
{ nsIDOMKeyEvent::DOM_VK_NUM_LOCK, XK_Num_Lock},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SCROLL_LOCK, XK_Scroll_Lock},
|
||||
{ nsIDOMKeyEvent::DOM_VK_COMMA, XK_comma},
|
||||
{ nsIDOMKeyEvent::DOM_VK_PERIOD, XK_period},
|
||||
{ nsIDOMKeyEvent::DOM_VK_SLASH, XK_slash},
|
||||
{ nsIDOMKeyEvent::DOM_VK_BACK_QUOTE, XK_grave},
|
||||
{ nsIDOMKeyEvent::DOM_VK_OPEN_BRACKET, XK_bracketleft},
|
||||
{ nsIDOMKeyEvent::DOM_VK_BACK_SLASH, XK_backslash},
|
||||
{ nsIDOMKeyEvent::DOM_VK_CLOSE_BRACKET, XK_bracketright},
|
||||
{ nsIDOMKeyEvent::DOM_VK_QUOTE, XK_apostrophe}
|
||||
};
|
||||
|
||||
PRInt32
|
||||
nsKeyCode::ConvertKeySymToVirtualKey(KeySym keysym)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter);
|
||||
|
||||
if (keysym >= XK_a && keysym <= XK_z)
|
||||
return keysym - XK_a + nsIDOMKeyEvent::DOM_VK_A;
|
||||
if (keysym >= XK_A && keysym <= XK_Z)
|
||||
return keysym - XK_A + nsIDOMKeyEvent::DOM_VK_A;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (nsKeycodes[i].keysym == keysym)
|
||||
{
|
||||
return(nsKeycodes[i].vkCode);
|
||||
}
|
||||
}
|
||||
|
||||
return((int)0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* static */ PRBool
|
||||
nsKeyCode::KeyCodeIsModifier(KeyCode aKeyCode)
|
||||
{
|
||||
if (aKeyCode == XK_Shift_L ||
|
||||
aKeyCode == XK_Shift_R ||
|
||||
aKeyCode == XK_Control_L ||
|
||||
aKeyCode == XK_Control_R ||
|
||||
aKeyCode == XK_Caps_Lock ||
|
||||
aKeyCode == XK_Shift_Lock ||
|
||||
aKeyCode == XK_Meta_L ||
|
||||
aKeyCode == XK_Meta_R ||
|
||||
aKeyCode == XK_Alt_L ||
|
||||
aKeyCode == XK_Alt_R)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* static */ KeySym
|
||||
nsKeyCode::ConvertKeyCodeToKeySym(Display * aDisplay,
|
||||
KeyCode aKeyCode)
|
||||
{
|
||||
KeySym keysym = 0;
|
||||
|
||||
keysym = XKeycodeToKeysym(aDisplay, aKeyCode, 0);
|
||||
|
||||
return keysym;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsKeyCode_h
|
||||
#define __nsKeyCode_h
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
struct nsKeyCode
|
||||
{
|
||||
static PRInt32 ConvertKeySymToVirtualKey(KeySym aKeySym);
|
||||
|
||||
static PRBool KeyCodeIsModifier(KeyCode aKeyCode);
|
||||
|
||||
static KeySym ConvertKeyCodeToKeySym(Display *aDisplay,
|
||||
KeyCode aKeyCode);
|
||||
};
|
||||
|
||||
#endif // __nsKeyCode_h
|
|
@ -1,70 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsPixmap.h"
|
||||
|
||||
#include "nsWindow.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPixmap, nsDrawable, nsIPixmap)
|
||||
|
||||
nsPixmap::nsPixmap() :
|
||||
mPixmap(0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mDisplay = nsRunAppRun::sDisplay;
|
||||
}
|
||||
|
||||
nsPixmap::~nsPixmap()
|
||||
{
|
||||
SetDrawable((Drawable)0);
|
||||
|
||||
if (mPixmap)
|
||||
::XFreePixmap(mDisplay, mPixmap);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPixmap::Init(nsIWindow *aParent, gfx_dimension width, gfx_dimension height, gfx_depth depth)
|
||||
{
|
||||
mBounds.SizeTo(width, height);
|
||||
mDepth = depth;
|
||||
|
||||
Drawable parent = 0;
|
||||
|
||||
Screen *screen = DefaultScreenOfDisplay(mDisplay);
|
||||
|
||||
if (aParent) {
|
||||
parent = NS_STATIC_CAST(nsWindow*, aParent)->mDrawable;
|
||||
} else {
|
||||
parent = RootWindowOfScreen(screen);
|
||||
}
|
||||
|
||||
mPixmap = ::XCreatePixmap(mDisplay, (Window)parent, width, height, depth);
|
||||
|
||||
SetDrawable((Drawable)mPixmap);
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsPixmap_h___
|
||||
#define nsPixmap_h___
|
||||
|
||||
#include "nsIPixmap.h"
|
||||
#include "nsDrawable.h"
|
||||
|
||||
#define NS_PIXMAP_CID \
|
||||
{ /* 6c090a8a-1dd2-11b2-9c3a-e52a0dc93584 */ \
|
||||
0x6c090a8a, \
|
||||
0x1dd2, \
|
||||
0x11b2, \
|
||||
{0x9c, 0x3a, 0xe5, 0x2a, 0x0d, 0xc9, 0x35, 0x84} \
|
||||
}
|
||||
|
||||
class nsPixmap : public nsIPixmap,
|
||||
public nsDrawable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPIXMAP
|
||||
|
||||
nsPixmap();
|
||||
virtual ~nsPixmap();
|
||||
|
||||
private:
|
||||
Pixmap mPixmap;
|
||||
};
|
||||
|
||||
#endif // nsPixmap_h___
|
|
@ -1,137 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsPopupWindow.h"
|
||||
#include "nsWindowHelper.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
NS_IMPL_QUERY_HEAD(nsPopupWindow)
|
||||
NS_IMPL_QUERY_BODY(nsIPopupWindow)
|
||||
NS_IMPL_QUERY_TAIL_INHERITING(nsWindow)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsPopupWindow, nsWindow)
|
||||
NS_IMPL_RELEASE_INHERITED(nsPopupWindow, nsWindow)
|
||||
|
||||
|
||||
#define ALL_EVENTS ( KeyPressMask | KeyReleaseMask | ButtonPressMask | \
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | \
|
||||
PointerMotionMask | PointerMotionHintMask | Button1MotionMask | \
|
||||
Button2MotionMask | Button3MotionMask | \
|
||||
Button4MotionMask | Button5MotionMask | ButtonMotionMask | \
|
||||
KeymapStateMask | ExposureMask | VisibilityChangeMask | \
|
||||
StructureNotifyMask | ResizeRedirectMask | \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask | \
|
||||
FocusChangeMask | PropertyChangeMask | \
|
||||
ColormapChangeMask | OwnerGrabButtonMask )
|
||||
|
||||
|
||||
|
||||
nsPopupWindow::nsPopupWindow()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mDisplay = nsRunAppRun::sDisplay;
|
||||
}
|
||||
|
||||
nsPopupWindow::~nsPopupWindow()
|
||||
{
|
||||
SetDrawable((Drawable)0);
|
||||
|
||||
if (mWindow) {
|
||||
nsWindowHelper::RemoveWindow(mWindow);
|
||||
::XDestroyWindow(mDisplay, mWindow);
|
||||
}
|
||||
}
|
||||
|
||||
/* nsIPopupWindow methods */
|
||||
NS_IMETHODIMP nsPopupWindow::Init(nsIWindow *aParent,
|
||||
gfx_coord aX,
|
||||
gfx_coord aY,
|
||||
gfx_dimension aWidth,
|
||||
gfx_dimension aHeight)
|
||||
{
|
||||
mBounds.SetRect(aX, aY, aWidth, aHeight);
|
||||
|
||||
mDepth = 24; // this could be wrong :)
|
||||
|
||||
Window parent = 0;
|
||||
|
||||
Screen *screen = DefaultScreenOfDisplay(mDisplay);
|
||||
|
||||
if (aParent) {
|
||||
mParent = getter_AddRefs(NS_GetWeakReference(aParent));
|
||||
|
||||
nsCOMPtr<nsPIWindowXlib> wx(do_QueryInterface(aParent));
|
||||
if (!wx)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
wx->GetNativeWindow(&parent);
|
||||
} else {
|
||||
parent = RootWindowOfScreen(screen);
|
||||
}
|
||||
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long attr_mask;
|
||||
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
attr.colormap = DefaultColormapOfScreen(screen);
|
||||
attr.event_mask = ALL_EVENTS;
|
||||
attr_mask = CWBitGravity | CWColormap | CWEventMask;
|
||||
|
||||
mWindow = ::XCreateWindow(mDisplay, parent, aX, aY,
|
||||
aWidth, aHeight,
|
||||
0,
|
||||
CopyFromParent, // is this what we want here for depth?
|
||||
InputOutput,
|
||||
DefaultVisualOfScreen(screen),
|
||||
attr_mask, &attr);
|
||||
|
||||
nsWindowHelper::AddWindow(mWindow, this);
|
||||
|
||||
SetDrawable((Drawable)mWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void bringToTop (); */
|
||||
NS_IMETHODIMP nsPopupWindow::BringToTop()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setTransparency (in nsIPixmap mask); */
|
||||
NS_IMETHODIMP nsPopupWindow::SetTransparency(nsIPixmap *mask)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsPopupWindow_h___
|
||||
#define nsPopupWindow_h___
|
||||
|
||||
#include "nsIPopupWindow.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
#define NS_POPUPWINDOW_CID \
|
||||
{ /* e1f41f14-1dd1-11b2-bac7-e2c3167d09f4 */ \
|
||||
0xe1f41f14, \
|
||||
0x1dd1, \
|
||||
0x11b2, \
|
||||
{0xba, 0xc7, 0xe2, 0xc3, 0x16, 0x7d, 0x09, 0xf4} \
|
||||
}
|
||||
|
||||
class nsPopupWindow : public nsIPopupWindow,
|
||||
public nsWindow
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPOPUPWINDOW
|
||||
|
||||
nsPopupWindow();
|
||||
virtual ~nsPopupWindow();
|
||||
|
||||
private:
|
||||
/* member variables */
|
||||
};
|
||||
|
||||
#endif // nsPopupWindow_h___
|
|
@ -1,292 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Stuart Parmenter.
|
||||
* Portions created by Stuart Parmenter are Copyright (C) 1998-2000
|
||||
* Stuart Parmenter. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsRegion.h"
|
||||
#include "nsRect2.h"
|
||||
#include "xregion.h"
|
||||
#include "prmem.h"
|
||||
|
||||
Region nsRegion::copyRegion = nsnull;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRegion, nsIRegion)
|
||||
|
||||
nsRegion::nsRegion()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mRegion = nsnull;
|
||||
}
|
||||
|
||||
nsRegion::~nsRegion()
|
||||
{
|
||||
if (mRegion)
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nsnull;
|
||||
}
|
||||
|
||||
Region
|
||||
nsRegion::GetCopyRegion() {
|
||||
if (!copyRegion) copyRegion = ::XCreateRegion();
|
||||
return copyRegion;
|
||||
}
|
||||
|
||||
void
|
||||
nsRegion::XCopyRegion(Region srca, Region dr_return)
|
||||
{
|
||||
::XUnionRegion(srca, GetCopyRegion(), dr_return);
|
||||
}
|
||||
|
||||
void
|
||||
nsRegion::XUnionRegionWithRect(Region srca,
|
||||
gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight,
|
||||
Region dr_return)
|
||||
{
|
||||
XRectangle rect;
|
||||
|
||||
rect.x = GFXCoordToIntRound(aX);
|
||||
rect.y = GFXCoordToIntRound(aY);
|
||||
rect.width = GFXCoordToIntRound(aWidth);
|
||||
rect.height = GFXCoordToIntRound(aHeight);
|
||||
|
||||
::XUnionRectWithRegion(&rect, srca, dr_return);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::Init(void)
|
||||
{
|
||||
if (mRegion) {
|
||||
::XDestroyRegion(mRegion);
|
||||
mRegion = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::Copy(nsIRegion **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRegion::SetToRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = (nsRegion *)aRegion;
|
||||
|
||||
if (!mRegion)
|
||||
mRegion = ::XCreateRegion();
|
||||
this->XCopyRegion(pRegion->mRegion, mRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::SetToRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
if (!mRegion)
|
||||
mRegion = ::XCreateRegion();
|
||||
this->XUnionRegionWithRect(GetCopyRegion(), aX, aY, aWidth, aHeight, mRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IntersectRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
::XIntersectRegion(mRegion, pRegion->mRegion, mRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IntersectRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
Region tRegion = ::XCreateRegion();
|
||||
this->XUnionRegionWithRect(GetCopyRegion(), aX, aY, aWidth, aHeight, tRegion);
|
||||
|
||||
::XIntersectRegion(mRegion, tRegion, mRegion);
|
||||
|
||||
::XDestroyRegion(tRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::UnionRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
if (pRegion->mRegion) {
|
||||
if (mRegion) {
|
||||
::XUnionRegion(mRegion, pRegion->mRegion, mRegion);
|
||||
} else {
|
||||
mRegion = ::XCreateRegion();
|
||||
this->XCopyRegion(pRegion->mRegion, mRegion);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::UnionRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
if (!mRegion)
|
||||
mRegion = ::XCreateRegion();
|
||||
|
||||
this->XUnionRegionWithRect(mRegion, aX, aY, aWidth, aHeight, mRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::SubtractRegion(nsIRegion *aRegion)
|
||||
{
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
if (pRegion->mRegion) {
|
||||
if (!mRegion) {
|
||||
mRegion = ::XCreateRegion();
|
||||
}
|
||||
::XSubtractRegion(mRegion, pRegion->mRegion, mRegion);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::SubtractRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
Region tRegion = ::XCreateRegion();
|
||||
this->XUnionRegionWithRect(GetCopyRegion(), aX, aY, aWidth, aHeight, tRegion);
|
||||
|
||||
if (!mRegion) {
|
||||
mRegion = ::XCreateRegion();
|
||||
}
|
||||
|
||||
::XSubtractRegion(mRegion, tRegion, mRegion);
|
||||
|
||||
::XDestroyRegion(tRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IsEmpty(PRBool *aResult)
|
||||
{
|
||||
if (!mRegion) {
|
||||
*aResult = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
*aResult = ::XEmptyRegion(mRegion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::IsEqual(nsIRegion *aRegion, PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
nsRegion *pRegion = NS_STATIC_CAST(nsRegion*, aRegion);
|
||||
|
||||
if (mRegion && pRegion->mRegion) {
|
||||
*aResult = ::XEqualRegion(mRegion, pRegion->mRegion);
|
||||
} else if (!mRegion && !pRegion->mRegion) {
|
||||
*aResult = PR_TRUE;
|
||||
} else if ((mRegion && !pRegion->mRegion) || (!mRegion && pRegion->mRegion)) {
|
||||
*aResult = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::GetBoundingBox(gfx_coord *aX, gfx_coord *aY, gfx_dimension *aWidth, gfx_dimension *aHeight)
|
||||
{
|
||||
if (mRegion) {
|
||||
XRectangle rect;
|
||||
|
||||
::XClipBox(mRegion, &rect);
|
||||
|
||||
*aX = rect.x;
|
||||
*aY = rect.y;
|
||||
*aWidth = rect.width;
|
||||
*aHeight = rect.height;
|
||||
} else {
|
||||
*aX = 0;
|
||||
*aY = 0;
|
||||
*aWidth = 0;
|
||||
*aHeight = 0;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::OffsetBy(gfx_coord aXOffset, gfx_coord aYOffset)
|
||||
{
|
||||
if (mRegion) {
|
||||
::XOffsetRegion(mRegion, GFXCoordToIntRound(aXOffset), GFXCoordToIntRound(aYOffset));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::ContainsRect(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight, PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
if (mRegion) {
|
||||
int containment = ::XRectInRegion(mRegion,
|
||||
GFXCoordToIntRound(aX), GFXCoordToIntRound(aY),
|
||||
GFXCoordToIntRound(aWidth), GFXCoordToIntRound(aHeight));
|
||||
|
||||
if (containment != RectangleOut)
|
||||
*aResult = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::GetRects(nsRect2 ***aRects, PRUint32 *npoints)
|
||||
{
|
||||
if (!mRegion)
|
||||
return NS_OK;
|
||||
|
||||
// XXX untested code :-)
|
||||
|
||||
nsRect2 *rects = new nsRect2[mRegion->numRects];
|
||||
|
||||
BOX *pbox = mRegion->rects;
|
||||
int nbox = mRegion->numRects;
|
||||
|
||||
while (nbox--)
|
||||
{
|
||||
rects->SetRect(pbox->x1,
|
||||
pbox->y1,
|
||||
(pbox->x2 - pbox->x1),
|
||||
(pbox->y2 - pbox->y1));
|
||||
rects++;
|
||||
pbox++;
|
||||
}
|
||||
|
||||
*aRects = &rects;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRegion::GetNumRects(PRUint32 *aRects)
|
||||
{
|
||||
if (!mRegion)
|
||||
*aRects = 0;
|
||||
|
||||
*aRects = mRegion->numRects;
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Stuart Parmenter.
|
||||
* Portions created by Stuart Parmenter are Copyright (C) 1998-2000
|
||||
* Stuart Parmenter. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsRegion_h___
|
||||
#define nsRegion_h___
|
||||
|
||||
#include "nsIRegion.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#define NS_REGION_CID \
|
||||
{ /* 8c8d6e7e-1dd2-11b2-b6ba-efe851e28e39 */ \
|
||||
0x8c8d6e7e, \
|
||||
0x1dd2, \
|
||||
0x11b2, \
|
||||
{0xb6, 0xba, 0xef, 0xe8, 0x51, 0xe2, 0x8e, 0x39} \
|
||||
}
|
||||
|
||||
class nsRegion : public nsIRegion
|
||||
{
|
||||
public:
|
||||
nsRegion();
|
||||
virtual ~nsRegion();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREGION
|
||||
|
||||
friend class nsDrawable;
|
||||
friend class nsWindow;
|
||||
|
||||
protected:
|
||||
Region mRegion;
|
||||
static Region copyRegion;
|
||||
|
||||
private:
|
||||
void XCopyRegion(Region src, Region dr_return);
|
||||
void XUnionRegionWithRect(Region srca,
|
||||
gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight,
|
||||
Region dr_return);
|
||||
|
||||
Region CreateRectRegion(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight);
|
||||
inline Region GetCopyRegion();
|
||||
|
||||
};
|
||||
|
||||
#endif // nsRegion_h___
|
|
@ -1,900 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
|
||||
#include "nsWindow.h"
|
||||
#include "nsWindowHelper.h"
|
||||
|
||||
|
||||
#include "nsIDragService.h"
|
||||
|
||||
#include "nsRegion.h"
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
#include "nsRect2.h"
|
||||
#include "nsPoint2.h"
|
||||
|
||||
#include "nsKeyCode.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
|
||||
Display *nsRunAppRun::sDisplay = nsnull;
|
||||
|
||||
|
||||
PRBool nsRunAppRun::DieAppShellDie = PR_FALSE;
|
||||
PRBool nsRunAppRun::mClicked = PR_FALSE;
|
||||
PRTime nsRunAppRun::mClickTime = 0;
|
||||
PRInt16 nsRunAppRun::mClicks = 1;
|
||||
PRUint16 nsRunAppRun::mClickedButton = 0;
|
||||
Display *nsRunAppRun::mDisplay = nsnull;
|
||||
PRBool nsRunAppRun::mDragging = PR_FALSE;
|
||||
PRBool nsRunAppRun::mAltDown = PR_FALSE;
|
||||
PRBool nsRunAppRun::mShiftDown = PR_FALSE;
|
||||
PRBool nsRunAppRun::mCtrlDown = PR_FALSE;
|
||||
PRBool nsRunAppRun::mMetaDown = PR_FALSE;
|
||||
|
||||
PRLogModuleInfo *XlibWidgetsLM = PR_NewLogModule("XlibWidgets");
|
||||
|
||||
// For debugging.
|
||||
static char *event_names[] = {
|
||||
"",
|
||||
"",
|
||||
"KeyPress",
|
||||
"KeyRelease",
|
||||
"ButtonPress",
|
||||
"ButtonRelease",
|
||||
"MotionNotify",
|
||||
"EnterNotify",
|
||||
"LeaveNotify",
|
||||
"FocusIn",
|
||||
"FocusOut",
|
||||
"KeymapNotify",
|
||||
"Expose",
|
||||
"GraphicsExpose",
|
||||
"NoExpose",
|
||||
"VisibilityNotify",
|
||||
"CreateNotify",
|
||||
"DestroyNotify",
|
||||
"UnmapNotify",
|
||||
"MapNotify",
|
||||
"MapRequest",
|
||||
"ReparentNotify",
|
||||
"ConfigureNotify",
|
||||
"ConfigureRequest",
|
||||
"GravityNotify",
|
||||
"ResizeRequest",
|
||||
"CirculateNotify",
|
||||
"CirculateRequest",
|
||||
"PropertyNotify",
|
||||
"SelectionClear",
|
||||
"SelectionRequest",
|
||||
"SelectionNotify",
|
||||
"ColormapNotify",
|
||||
"ClientMessage",
|
||||
"MappingNotify"
|
||||
};
|
||||
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRunAppRun, nsIRunAppRun)
|
||||
|
||||
|
||||
static int
|
||||
my_x_error (Display *display,
|
||||
XErrorEvent *error)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
nsRunAppRun::nsRunAppRun()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
sDisplay = ::XOpenDisplay(NULL);
|
||||
|
||||
|
||||
// XSetErrorHandler(my_x_error);
|
||||
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsRunAppRun::~nsRunAppRun()
|
||||
{
|
||||
::XCloseDisplay(sDisplay);
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* void go (); */
|
||||
NS_IMETHODIMP nsRunAppRun::Go()
|
||||
{
|
||||
while(1) {
|
||||
|
||||
XEvent event;
|
||||
XNextEvent(sDisplay, &event);
|
||||
|
||||
HandleXEvent(&event);
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleXEvent(const XEvent *event)
|
||||
{
|
||||
|
||||
nsWindow *window = (nsWindow*)nsWindowHelper::FindIWindow(event->xany.window);
|
||||
|
||||
// did someone pass us an x event for a window we don't own?
|
||||
// bad! bad!
|
||||
if (window == nsnull)
|
||||
return;
|
||||
|
||||
// switch on the type of event
|
||||
switch (event->type)
|
||||
{
|
||||
case Expose:
|
||||
HandleExposeEvent(event, window);
|
||||
break;
|
||||
|
||||
case ConfigureNotify:
|
||||
// we need to make sure that this is the LAST of the
|
||||
// config events.
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("DispatchEvent: ConfigureNotify event for window 0x%lx %d %d %d %d\n",
|
||||
event->xconfigure.window,
|
||||
event->xconfigure.x,
|
||||
event->xconfigure.y,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height));
|
||||
|
||||
HandleConfigureNotifyEvent(event, window);
|
||||
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
HandleFocusInEvent(event, window);
|
||||
HandleButtonEvent(event, window);
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
HandleMotionNotifyEvent(event, window);
|
||||
break;
|
||||
|
||||
case KeyPress:
|
||||
HandleKeyPressEvent(event, window);
|
||||
break;
|
||||
case KeyRelease:
|
||||
HandleKeyReleaseEvent(event, window);
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
HandleFocusInEvent(event, window);
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
HandleFocusOutEvent(event, window);
|
||||
break;
|
||||
|
||||
case EnterNotify:
|
||||
HandleEnterEvent(event, window);
|
||||
break;
|
||||
|
||||
case LeaveNotify:
|
||||
HandleLeaveEvent(event, window);
|
||||
break;
|
||||
|
||||
case NoExpose:
|
||||
// these annoy me.
|
||||
break;
|
||||
case VisibilityNotify:
|
||||
HandleVisibilityNotifyEvent(event, window);
|
||||
break;
|
||||
case ClientMessage:
|
||||
HandleClientMessageEvent(event, window);
|
||||
break;
|
||||
case SelectionRequest:
|
||||
HandleSelectionRequestEvent(event, window);
|
||||
break;
|
||||
default:
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Unhandled window event: Window 0x%lx Got a %s event\n",
|
||||
event->xany.window, event_names[event->type]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleMotionNotifyEvent(const XEvent *aEvent, nsWindow *aWindow)
|
||||
{
|
||||
nsMouseEvent mevent;
|
||||
|
||||
if (mDragging) {
|
||||
HandleDragMotionEvent(aEvent, aWindow);
|
||||
}
|
||||
|
||||
mevent.window = aWindow;
|
||||
mevent.time = 0;
|
||||
mevent.point.x = aEvent->xmotion.x;
|
||||
mevent.point.y = aEvent->xmotion.y;
|
||||
|
||||
// Display * dpy = (Display *)aWindow->GetNativeData(NS_NATIVE_DISPLAY);
|
||||
Display *dpy = sDisplay;
|
||||
Window win;
|
||||
aWindow->GetNativeWindow(&win);
|
||||
|
||||
XEvent event;
|
||||
// We are only interested in the LAST (newest) location of the pointer
|
||||
while(XCheckWindowEvent(dpy,
|
||||
win,
|
||||
ButtonMotionMask,
|
||||
&event)) {
|
||||
mevent.point.x = event.xmotion.x;
|
||||
mevent.point.y = event.xmotion.y;
|
||||
}
|
||||
|
||||
mevent.message = NS_MOUSE_MOVE;
|
||||
mevent.eventStructType = NS_MOUSE_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&mevent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleButtonEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
nsMouseEvent mevent;
|
||||
mevent.isShift = mShiftDown;
|
||||
mevent.isControl = mCtrlDown;
|
||||
mevent.isAlt = mAltDown;
|
||||
mevent.isMeta = mMetaDown;
|
||||
PRUint32 eventType = 0;
|
||||
PRBool currentlyDragging = mDragging;
|
||||
nsMouseScrollEvent scrollEvent;
|
||||
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Button event for window 0x%lx button %d type %s\n",
|
||||
event->xany.window,
|
||||
event->xbutton.button,
|
||||
(event->type == ButtonPress ? "ButtonPress" : "ButtonRelease")));
|
||||
|
||||
switch(event->type) {
|
||||
case ButtonPress:
|
||||
switch(event->xbutton.button) {
|
||||
case 1:
|
||||
eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
|
||||
mDragging = PR_TRUE;
|
||||
break;
|
||||
case 2:
|
||||
eventType = NS_MOUSE_MIDDLE_BUTTON_DOWN;
|
||||
break;
|
||||
case 3:
|
||||
eventType = NS_MOUSE_RIGHT_BUTTON_DOWN;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
scrollEvent.deltaLines = (event->xbutton.button == 4) ? -3 : 3;
|
||||
scrollEvent.message = NS_MOUSE_SCROLL;
|
||||
scrollEvent.window = aWindow;
|
||||
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||
|
||||
scrollEvent.point.x = event->xbutton.x;
|
||||
scrollEvent.point.y = event->xbutton.y;
|
||||
|
||||
scrollEvent.isShift = mShiftDown;
|
||||
scrollEvent.isControl = mCtrlDown;
|
||||
scrollEvent.isAlt = mAltDown;
|
||||
scrollEvent.isMeta = mMetaDown;
|
||||
scrollEvent.time = PR_Now();
|
||||
NS_IF_ADDREF(aWindow);
|
||||
aWindow->DispatchEvent(&scrollEvent);
|
||||
NS_IF_RELEASE(aWindow);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case ButtonRelease:
|
||||
switch(event->xbutton.button) {
|
||||
case 1:
|
||||
eventType = NS_MOUSE_LEFT_BUTTON_UP;
|
||||
mDragging = PR_FALSE;
|
||||
break;
|
||||
case 2:
|
||||
eventType = NS_MOUSE_MIDDLE_BUTTON_UP;
|
||||
break;
|
||||
case 3:
|
||||
eventType = NS_MOUSE_RIGHT_BUTTON_UP;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
mevent.window = aWindow;
|
||||
mevent.point.x = event->xbutton.x;
|
||||
mevent.point.y = event->xbutton.y;
|
||||
mevent.time = PR_Now();
|
||||
|
||||
// If we are waiting longer than 1 sec for the second click, this is not a
|
||||
// double click.
|
||||
if (PR_Now() - mClickTime > 1000000)
|
||||
mClicked = PR_FALSE;
|
||||
|
||||
if (event->type == ButtonPress) {
|
||||
if (!mClicked) {
|
||||
mClicked = PR_TRUE;
|
||||
mClickTime = PR_Now();
|
||||
mClicks = 1;
|
||||
mClickedButton = event->xbutton.button;
|
||||
} else {
|
||||
mClickTime = PR_Now() - mClickTime;
|
||||
if ((mClickTime < 500000) && (mClickedButton == event->xbutton.button))
|
||||
mClicks = 2;
|
||||
else
|
||||
mClicks = 1;
|
||||
mClicked = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyDragging && !mDragging) {
|
||||
HandleDragDropEvent(event, aWindow);
|
||||
}
|
||||
|
||||
mevent.message = eventType;
|
||||
mevent.eventStructType = NS_MOUSE_EVENT;
|
||||
mevent.clickCount = mClicks;
|
||||
|
||||
aWindow->DispatchEvent(&mevent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleExposeEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Expose event for window 0x%lx %d %d %d %d\n", event->xany.window,
|
||||
event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height));
|
||||
|
||||
|
||||
nsCOMPtr<nsIRegion> region(do_CreateInstance("@mozilla.org/gfx/region;2"));
|
||||
|
||||
region->SetToRect(event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height);
|
||||
|
||||
/* compress expose events...
|
||||
*/
|
||||
if (event->xexpose.count != 0) {
|
||||
XEvent txe;
|
||||
do {
|
||||
XWindowEvent(event->xany.display, event->xany.window, ExposureMask, (XEvent *)&txe);
|
||||
region->UnionRect(txe.xexpose.x, txe.xexpose.y,
|
||||
txe.xexpose.width, txe.xexpose.height);
|
||||
} while (txe.xexpose.count > 0);
|
||||
}
|
||||
|
||||
nsPaintEvent pevent;
|
||||
pevent.message = NS_PAINT;
|
||||
pevent.window = aWindow;
|
||||
pevent.eventStructType = NS_PAINT_EVENT;
|
||||
|
||||
|
||||
// XXX fix this
|
||||
pevent.time = 0;
|
||||
//pevent.time = PR_Now();
|
||||
//pevent.region = nsnull;
|
||||
// pevent.rect = dirtyRect;
|
||||
|
||||
|
||||
// aWindow->SetBackgroundColor(255);
|
||||
|
||||
nsRect2 r;
|
||||
region->GetBoundingBox(&r.x, &r.y, &r.width, &r.height);
|
||||
aWindow->FillRectangle(r.x, r.y, r.width, r.height);
|
||||
|
||||
aWindow->DispatchEvent(&pevent);
|
||||
|
||||
// delete pevent.rect;
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleConfigureNotifyEvent(const XEvent *aEvent, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("ConfigureNotify event for window 0x%lx %d %d %d %d\n",
|
||||
aEvent->xconfigure.window,
|
||||
aEvent->xconfigure.x, aEvent->xconfigure.y,
|
||||
aEvent->xconfigure.width, aEvent->xconfigure.height));
|
||||
|
||||
XEvent *event = (XEvent *)aEvent; // we promise not to change you
|
||||
XEvent config_event;
|
||||
while (XCheckTypedWindowEvent(aEvent->xany.display,
|
||||
aEvent->xany.window,
|
||||
ConfigureNotify,
|
||||
&config_event) == True) {
|
||||
// make sure that we don't get other types of events.
|
||||
// StructureNotifyMask includes other kinds of events, too.
|
||||
if (config_event.type == ConfigureNotify) {
|
||||
*event = config_event;
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("DispatchEvent: Extra ConfigureNotify event for window 0x%lx %d %d %d %d\n",
|
||||
event->xconfigure.window,
|
||||
event->xconfigure.x,
|
||||
event->xconfigure.y,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height));
|
||||
}
|
||||
else {
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("EVENT LOSSAGE\n"));
|
||||
}
|
||||
}
|
||||
|
||||
nsSizeEvent sevent;
|
||||
sevent.message = NS_SIZE;
|
||||
sevent.window = aWindow;
|
||||
sevent.eventStructType = NS_SIZE_EVENT;
|
||||
sevent.windowSize = new nsRect2 (event->xconfigure.x, event->xconfigure.y,
|
||||
event->xconfigure.width, event->xconfigure.height);
|
||||
sevent.point.x = event->xconfigure.x;
|
||||
sevent.point.y = event->xconfigure.y;
|
||||
sevent.mWinWidth = event->xconfigure.width;
|
||||
sevent.mWinHeight = event->xconfigure.height;
|
||||
// XXX fix this
|
||||
sevent.time = 0;
|
||||
|
||||
aWindow->DispatchEvent(&sevent);
|
||||
|
||||
delete sevent.windowSize;
|
||||
}
|
||||
|
||||
#define CHAR_BUF_SIZE 40
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleKeyPressEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
|
||||
char string_buf[CHAR_BUF_SIZE];
|
||||
int len = 0;
|
||||
Window focusWindow = 0;
|
||||
nsWindow *focusWidget = 0;
|
||||
|
||||
#if 0
|
||||
// figure out where the real focus should go...
|
||||
focusWindow = nsWindow::GetFocusWindow();
|
||||
if (focusWindow) {
|
||||
focusWidget = nsWindow::GetWidgetForWindow(focusWindow);
|
||||
}
|
||||
#endif
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("KeyPress event for window 0x%lx ( 0x%lx focus window )\n",
|
||||
event->xkey.window,
|
||||
focusWindow));
|
||||
|
||||
// don't even bother...
|
||||
if (focusWidget == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
KeySym keysym = nsKeyCode::ConvertKeyCodeToKeySym(event->xkey.display,
|
||||
event->xkey.keycode);
|
||||
|
||||
switch (keysym) {
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
mAltDown = PR_TRUE;
|
||||
break;
|
||||
case XK_Control_L:
|
||||
case XK_Control_R:
|
||||
mCtrlDown = PR_TRUE;
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
mShiftDown = PR_TRUE;
|
||||
break;
|
||||
case XK_Meta_L:
|
||||
case XK_Meta_R:
|
||||
mMetaDown = PR_TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Dont dispatch events for modifier keys pressed ALONE
|
||||
if (nsKeyCode::KeyCodeIsModifier(event->xkey.keycode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nsKeyEvent keyEvent;
|
||||
|
||||
XComposeStatus compose;
|
||||
|
||||
len = XLookupString((XKeyEvent*)&event->xkey, string_buf, CHAR_BUF_SIZE, &keysym, &compose);
|
||||
string_buf[len] = '\0';
|
||||
|
||||
keyEvent.keyCode = nsKeyCode::ConvertKeySymToVirtualKey(keysym);
|
||||
keyEvent.charCode = 0;
|
||||
keyEvent.time = event->xkey.time;
|
||||
keyEvent.isShift = event->xkey.state & ShiftMask;
|
||||
keyEvent.isControl = (event->xkey.state & ControlMask) ? 1 : 0;
|
||||
keyEvent.isAlt = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
// I think 'meta' is the same as 'alt' in X11. Is this OK for other systems?
|
||||
keyEvent.isMeta = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.point.x = 0;
|
||||
keyEvent.point.y = 0;
|
||||
keyEvent.message = NS_KEY_DOWN;
|
||||
keyEvent.window = focusWidget;
|
||||
keyEvent.eventStructType = NS_KEY_EVENT;
|
||||
|
||||
// printf("keysym = %x, keycode = %x, vk = %x\n",
|
||||
// keysym,
|
||||
// event->xkey.keycode,
|
||||
// keyEvent.keyCode);
|
||||
|
||||
focusWidget->DispatchEvent(&keyEvent);
|
||||
|
||||
keyEvent.keyCode = nsKeyCode::ConvertKeySymToVirtualKey(keysym);
|
||||
keyEvent.charCode = isprint(string_buf[0]) ? string_buf[0] : 0;
|
||||
keyEvent.time = event->xkey.time;
|
||||
keyEvent.isShift = event->xkey.state & ShiftMask;
|
||||
keyEvent.isControl = (event->xkey.state & ControlMask) ? 1 : 0;
|
||||
keyEvent.isAlt = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.isMeta = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.point.x = 0;
|
||||
keyEvent.point.y = 0;
|
||||
keyEvent.message = NS_KEY_PRESS;
|
||||
keyEvent.window = focusWidget;
|
||||
keyEvent.eventStructType = NS_KEY_EVENT;
|
||||
|
||||
focusWidget->DispatchEvent(&keyEvent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleKeyReleaseEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("KeyRelease event for window 0x%lx\n",
|
||||
event->xkey.window));
|
||||
|
||||
KeySym keysym = nsKeyCode::ConvertKeyCodeToKeySym(event->xkey.display,
|
||||
event->xkey.keycode);
|
||||
|
||||
switch (keysym) {
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
mAltDown = PR_FALSE;
|
||||
break;
|
||||
case XK_Control_L:
|
||||
case XK_Control_R:
|
||||
mCtrlDown = PR_FALSE;
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
mShiftDown = PR_FALSE;
|
||||
break;
|
||||
case XK_Meta_L:
|
||||
case XK_Meta_R:
|
||||
mMetaDown = PR_FALSE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Dont dispatch events for modifier keys pressed ALONE
|
||||
if (nsKeyCode::KeyCodeIsModifier(event->xkey.keycode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nsKeyEvent keyEvent;
|
||||
|
||||
keyEvent.keyCode = nsKeyCode::ConvertKeySymToVirtualKey(keysym);
|
||||
keyEvent.charCode = 0;
|
||||
keyEvent.time = event->xkey.time;
|
||||
keyEvent.isShift = event->xkey.state & ShiftMask;
|
||||
keyEvent.isControl = (event->xkey.state & ControlMask) ? 1 : 0;
|
||||
keyEvent.isAlt = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.isMeta = (event->xkey.state & Mod1Mask) ? 1 : 0;
|
||||
keyEvent.point.x = event->xkey.x;
|
||||
keyEvent.point.y = event->xkey.y;
|
||||
keyEvent.message = NS_KEY_UP;
|
||||
keyEvent.window = aWindow;
|
||||
keyEvent.eventStructType = NS_KEY_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&keyEvent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleFocusInEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("FocusIn event for window 0x%lx\n",
|
||||
event->xfocus.window));
|
||||
nsGUIEvent focusEvent;
|
||||
|
||||
focusEvent.message = NS_GOTFOCUS;
|
||||
focusEvent.window = aWindow;
|
||||
|
||||
focusEvent.eventStructType = NS_GUI_EVENT;
|
||||
|
||||
focusEvent.time = 0;
|
||||
focusEvent.point.x = 0;
|
||||
focusEvent.point.y = 0;
|
||||
|
||||
// FIXME FIXME FIXME
|
||||
// We now have to tell the widget that is has focus here, this was
|
||||
// Previously done in cross platform code.
|
||||
// FIXME FIXME FIXME
|
||||
|
||||
|
||||
// aWindow->SetFocus();
|
||||
aWindow->DispatchEvent(&focusEvent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleFocusOutEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("FocusOut event for window 0x%lx\n",
|
||||
event->xfocus.window));
|
||||
nsGUIEvent focusEvent;
|
||||
|
||||
focusEvent.message = NS_DEACTIVATE;
|
||||
focusEvent.window = aWindow;
|
||||
|
||||
focusEvent.eventStructType = NS_GUI_EVENT;
|
||||
|
||||
focusEvent.time = 0;
|
||||
focusEvent.point.x = 0;
|
||||
focusEvent.point.y = 0;
|
||||
|
||||
aWindow->DispatchEvent(&focusEvent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleEnterEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Enter event for window 0x%lx\n",
|
||||
event->xcrossing.window));
|
||||
nsMouseEvent enterEvent;
|
||||
|
||||
if (mDragging) {
|
||||
HandleDragEnterEvent(event, aWindow);
|
||||
}
|
||||
|
||||
enterEvent.window = aWindow;
|
||||
|
||||
enterEvent.time = event->xcrossing.time;
|
||||
enterEvent.point.x = gfx_coord(event->xcrossing.x);
|
||||
enterEvent.point.y = gfx_coord(event->xcrossing.y);
|
||||
|
||||
enterEvent.message = NS_MOUSE_ENTER;
|
||||
enterEvent.eventStructType = NS_MOUSE_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&enterEvent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRunAppRun::HandleLeaveEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Leave event for window 0x%lx\n",
|
||||
event->xcrossing.window));
|
||||
|
||||
nsMouseEvent leaveEvent;
|
||||
|
||||
if (mDragging) {
|
||||
HandleDragLeaveEvent(event, aWindow);
|
||||
}
|
||||
|
||||
leaveEvent.window = aWindow;
|
||||
|
||||
leaveEvent.time = event->xcrossing.time;
|
||||
leaveEvent.point.x = gfx_coord(event->xcrossing.x);
|
||||
leaveEvent.point.y = gfx_coord(event->xcrossing.y);
|
||||
|
||||
leaveEvent.message = NS_MOUSE_EXIT;
|
||||
leaveEvent.eventStructType = NS_MOUSE_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&leaveEvent);
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleVisibilityNotifyEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("VisibilityNotify event for window 0x%lx ",
|
||||
event->xfocus.window));
|
||||
switch(event->xvisibility.state) {
|
||||
case VisibilityFullyObscured:
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Fully Obscured\n"));
|
||||
break;
|
||||
case VisibilityPartiallyObscured:
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Partially Obscured\n"));
|
||||
break;
|
||||
case VisibilityUnobscured:
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Unobscured\n"));
|
||||
}
|
||||
#endif
|
||||
// aWindow->SetVisibility(event->xvisibility.state);
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleMapNotifyEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("MapNotify event for window 0x%lx\n",
|
||||
event->xmap.window));
|
||||
// XXX set map status is gone now..
|
||||
// aWindow->SetMapStatus(PR_TRUE);
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleUnmapNotifyEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("UnmapNotifyEvent for window 0x%lx\n",
|
||||
event->xunmap.window));
|
||||
// XXX set map status is gone now..
|
||||
//aWindow->SetMapStatus(PR_FALSE);
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleClientMessageEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
|
||||
#if 0
|
||||
// check to see if it's a WM_DELETE message
|
||||
printf("handling client message\n");
|
||||
if (nsWindow::WMProtocolsInitialized) {
|
||||
if ((Atom)event->xclient.data.l[0] == nsWindow::WMDeleteWindow) {
|
||||
printf("got a delete window event\n");
|
||||
aWindow->OnDeleteWindow();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleSelectionRequestEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
nsGUIEvent ev;
|
||||
|
||||
ev.window = (nsIWindow *)aWindow;
|
||||
ev.nativeMsg = (void *)event;
|
||||
|
||||
aWindow->DispatchEvent(&ev);
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleDragMotionEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool currentlyDragging = PR_FALSE;
|
||||
|
||||
|
||||
#if 0
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService("component://netscape/widget/dragservice", &rv);
|
||||
nsCOMPtr<nsIDragSessionXlib> dragServiceXlib;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
dragServiceXlib = do_QueryInterface(dragService);
|
||||
if (dragServiceXlib) {
|
||||
dragServiceXlib->IsDragging(¤tlyDragging);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyDragging) {
|
||||
nsMouseEvent mevent;
|
||||
dragServiceXlib->UpdatePosition(event->xmotion.x, event->xmotion.y);
|
||||
mevent.window = aWindow;
|
||||
mevent.point.x = event->xmotion.x;
|
||||
mevent.point.y = event->xmotion.y;
|
||||
|
||||
mevent.message = NS_DRAGDROP_OVER;
|
||||
mevent.eventStructType = NS_DRAGDROP_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&mevent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleDragEnterEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool currentlyDragging = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService("component://netscape/widget/dragservice", &rv);
|
||||
|
||||
#if 0
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDragSessionXlib> dragServiceXlib;
|
||||
dragServiceXlib = do_QueryInterface(dragService);
|
||||
if (dragServiceXlib) {
|
||||
dragServiceXlib->IsDragging(¤tlyDragging);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyDragging) {
|
||||
nsMouseEvent enterEvent;
|
||||
enterEvent.window = aWindow;
|
||||
|
||||
enterEvent.point.x = event->xcrossing.x;
|
||||
enterEvent.point.y = event->xcrossing.y;
|
||||
|
||||
enterEvent.message = NS_DRAGDROP_ENTER;
|
||||
enterEvent.eventStructType = NS_DRAGDROP_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&enterEvent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleDragLeaveEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool currentlyDragging = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService("component://netscape/widget/dragservice", &rv);
|
||||
|
||||
#if 0
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDragSessionXlib> dragServiceXlib;
|
||||
dragServiceXlib = do_QueryInterface(dragService);
|
||||
if (dragServiceXlib) {
|
||||
dragServiceXlib->IsDragging(¤tlyDragging);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyDragging) {
|
||||
nsMouseEvent leaveEvent;
|
||||
leaveEvent.window = aWindow;
|
||||
|
||||
leaveEvent.point.x = event->xcrossing.x;
|
||||
leaveEvent.point.y = event->xcrossing.y;
|
||||
|
||||
leaveEvent.message = NS_DRAGDROP_EXIT;
|
||||
leaveEvent.eventStructType = NS_DRAGDROP_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&leaveEvent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsRunAppRun::HandleDragDropEvent(const XEvent *event, nsWindow *aWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool currentlyDragging = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDragService> dragService = do_GetService("component://netscape/widget/dragservice", &rv);
|
||||
|
||||
#if 0
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDragSessionXlib> dragServiceXlib;
|
||||
dragServiceXlib = do_QueryInterface(dragService);
|
||||
if (dragServiceXlib) {
|
||||
dragServiceXlib->IsDragging(¤tlyDragging);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentlyDragging) {
|
||||
nsMouseEvent mevent;
|
||||
mevent.window = aWindow;
|
||||
mevent.point.x = event->xbutton.x;
|
||||
mevent.point.y = event->xbutton.y;
|
||||
|
||||
mevent.message = NS_DRAGDROP_DROP;
|
||||
mevent.eventStructType = NS_DRAGDROP_EVENT;
|
||||
|
||||
aWindow->DispatchEvent(&mevent);
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
#include "nsIRunAppRun.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
class nsWindow;
|
||||
|
||||
#define NS_RUNAPPRUN_CID \
|
||||
{ /* 180455dc-1dd2-11b2-a8de-e81542e76a80 */ \
|
||||
0x180455dc, \
|
||||
0x1dd2, \
|
||||
0x11b2, \
|
||||
{0xa8, 0xde, 0xe8, 0x15, 0x42, 0xe7, 0x6a, 0x80} \
|
||||
}
|
||||
|
||||
class nsRunAppRun : public nsIRunAppRun
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIRUNAPPRUN
|
||||
|
||||
nsRunAppRun();
|
||||
virtual ~nsRunAppRun();
|
||||
/* additional members */
|
||||
|
||||
static Display *sDisplay;
|
||||
|
||||
private:
|
||||
void HandleXEvent(const XEvent *event);
|
||||
void HandleMotionNotifyEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleButtonEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleExposeEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleConfigureNotifyEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleKeyPressEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleKeyReleaseEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleFocusInEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleFocusOutEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleEnterEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleLeaveEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleVisibilityNotifyEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleMapNotifyEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleUnmapNotifyEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleClientMessageEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleSelectionRequestEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleDragMotionEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleDragEnterEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleDragLeaveEvent(const XEvent *event, nsWindow *aWindow);
|
||||
void HandleDragDropEvent(const XEvent *event, nsWindow *aWindow);
|
||||
|
||||
|
||||
static PRBool DieAppShellDie;
|
||||
static PRBool mClicked;
|
||||
static PRTime mClickTime;
|
||||
static PRInt16 mClicks;
|
||||
static PRUint16 mClickedButton;
|
||||
static Display * mDisplay;
|
||||
static PRBool mDragging;
|
||||
static PRBool mAltDown;
|
||||
static PRBool mShiftDown;
|
||||
static PRBool mCtrlDown;
|
||||
static PRBool mMetaDown;
|
||||
};
|
|
@ -1,210 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsTopLevelWindow.h"
|
||||
#include "nsWindowHelper.h"
|
||||
|
||||
#include "nsICursor.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
NS_IMPL_QUERY_HEAD(nsTopLevelWindow)
|
||||
NS_IMPL_QUERY_BODY(nsITopLevelWindow)
|
||||
NS_IMPL_QUERY_TAIL_INHERITING(nsWindow)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsTopLevelWindow, nsWindow)
|
||||
NS_IMPL_RELEASE_INHERITED(nsTopLevelWindow, nsWindow)
|
||||
|
||||
|
||||
#define ALL_EVENTS ( KeyPressMask | KeyReleaseMask | ButtonPressMask | \
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | \
|
||||
PointerMotionMask | PointerMotionHintMask | Button1MotionMask | \
|
||||
Button2MotionMask | Button3MotionMask | \
|
||||
Button4MotionMask | Button5MotionMask | ButtonMotionMask | \
|
||||
KeymapStateMask | ExposureMask | VisibilityChangeMask | \
|
||||
StructureNotifyMask | ResizeRedirectMask | \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask | \
|
||||
FocusChangeMask | PropertyChangeMask | \
|
||||
ColormapChangeMask | OwnerGrabButtonMask )
|
||||
|
||||
|
||||
long GetEventMask()
|
||||
{
|
||||
return (ButtonMotionMask |
|
||||
ButtonPressMask |
|
||||
ButtonReleaseMask |
|
||||
EnterWindowMask |
|
||||
ExposureMask |
|
||||
KeyPressMask |
|
||||
KeyReleaseMask |
|
||||
LeaveWindowMask |
|
||||
PointerMotionMask |
|
||||
StructureNotifyMask |
|
||||
VisibilityChangeMask |
|
||||
FocusChangeMask |
|
||||
OwnerGrabButtonMask);
|
||||
}
|
||||
|
||||
|
||||
nsTopLevelWindow::nsTopLevelWindow()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mDisplay = nsRunAppRun::sDisplay;
|
||||
}
|
||||
|
||||
nsTopLevelWindow::~nsTopLevelWindow()
|
||||
{
|
||||
SetDrawable((Drawable)0);
|
||||
|
||||
if (mWindow) {
|
||||
nsWindowHelper::RemoveWindow(mWindow);
|
||||
::XDestroyWindow(mDisplay, mWindow);
|
||||
}
|
||||
}
|
||||
|
||||
/* nsIWindow methods */
|
||||
NS_IMETHODIMP nsTopLevelWindow::Init(nsIWindow *aParent,
|
||||
gfx_coord aX,
|
||||
gfx_coord aY,
|
||||
gfx_dimension aWidth,
|
||||
gfx_dimension aHeight,
|
||||
PRInt32 aBorder)
|
||||
{
|
||||
mBounds.SetRect(aX, aY, aWidth, aHeight);
|
||||
mDepth = 24; // this could be wrong :)
|
||||
|
||||
Window parent = 0;
|
||||
|
||||
Screen *screen = DefaultScreenOfDisplay(mDisplay);
|
||||
|
||||
if (aParent) {
|
||||
mParent = getter_AddRefs(NS_GetWeakReference(aParent));
|
||||
|
||||
nsCOMPtr<nsPIWindowXlib> wx(do_QueryInterface(aParent));
|
||||
if (!wx)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
wx->GetNativeWindow(&parent);
|
||||
} else {
|
||||
parent = RootWindowOfScreen(screen);
|
||||
}
|
||||
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long attr_mask;
|
||||
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
attr.colormap = DefaultColormapOfScreen(screen);
|
||||
attr.event_mask = GetEventMask();
|
||||
attr_mask = CWBitGravity | CWColormap | CWEventMask;
|
||||
|
||||
mWindow = ::XCreateWindow(mDisplay, parent, aX, aY,
|
||||
aWidth, aHeight,
|
||||
0,
|
||||
CopyFromParent, // is this what we want here for depth?
|
||||
InputOutput,
|
||||
DefaultVisualOfScreen(screen),
|
||||
attr_mask, &attr);
|
||||
|
||||
nsWindowHelper::AddWindow(mWindow, this);
|
||||
|
||||
SetDrawable((Drawable)mWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void bringToTop (); */
|
||||
NS_IMETHODIMP nsTopLevelWindow::BringToTop()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring title; */
|
||||
NS_IMETHODIMP nsTopLevelWindow::GetTitle(PRUnichar * *aTitle)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsTopLevelWindow::SetTitle(const PRUnichar * aTitle)
|
||||
{
|
||||
// XXX do unicode conversion to COMPOUND_TEXT/etc
|
||||
|
||||
nsCAutoString title;
|
||||
title.AssignWithConversion(aTitle);
|
||||
|
||||
::XmbSetWMProperties(mDisplay, mWindow,
|
||||
title, title,
|
||||
NULL, 0,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void setIcon (in nsIImage image); */
|
||||
NS_IMETHODIMP nsTopLevelWindow::SetIcon(nsIImage *image)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute string windowClass; */
|
||||
NS_IMETHODIMP nsTopLevelWindow::GetWindowClass(char * *aWindowClass)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsTopLevelWindow::SetWindowClass(const char * aWindowClass)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setTransparency (in nsIPixmap mask); */
|
||||
NS_IMETHODIMP nsTopLevelWindow::SetTransparency(nsIPixmap *mask)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* attribute long sizeState; */
|
||||
NS_IMETHODIMP nsTopLevelWindow::GetSizeState(PRInt32 *aSizeState)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsTopLevelWindow::SetSizeState(PRInt32 aSizeState)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void constrainPosition (inout gfx_coord aX, inout gfx_coord aY); */
|
||||
NS_IMETHODIMP nsTopLevelWindow::ConstrainPosition(gfx_coord *aX, gfx_coord *aY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsTopLevelWindow_h___
|
||||
#define nsTopLevelWindow_h___
|
||||
|
||||
#include "nsITopLevelWindow.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
#define NS_TOPLEVELWINDOW_CID \
|
||||
{ /* ad24f1e2-1dd1-11b2-a613-df946decae20 */ \
|
||||
0xad24f1e2, \
|
||||
0x1dd1, \
|
||||
0x11b2, \
|
||||
{0xa6, 0x13, 0xdf, 0x94, 0x6d, 0xec, 0xae, 0x20} \
|
||||
}
|
||||
|
||||
class nsTopLevelWindow : public nsITopLevelWindow,
|
||||
public nsWindow
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITOPLEVELWINDOW
|
||||
|
||||
nsTopLevelWindow();
|
||||
virtual ~nsTopLevelWindow();
|
||||
|
||||
private:
|
||||
/* member variables */
|
||||
};
|
||||
|
||||
#endif // nsTopLevelWindow_h___
|
|
@ -1,287 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsWindow.h"
|
||||
#include "nsWindowHelper.h"
|
||||
|
||||
#include "nsCursor.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsRunAppRun.h"
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
NS_IMPL_QUERY_HEAD(nsWindow)
|
||||
NS_IMPL_QUERY_BODY(nsIWindow)
|
||||
NS_IMPL_QUERY_BODY(nsPIWindowXlib)
|
||||
NS_IMPL_QUERY_BODY(nsISupportsWeakReference)
|
||||
NS_IMPL_QUERY_TAIL_INHERITING(nsDrawable)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsWindow, nsDrawable)
|
||||
NS_IMPL_RELEASE_INHERITED(nsWindow, nsDrawable)
|
||||
|
||||
|
||||
nsWindow::nsWindow() :
|
||||
mWindow(0),
|
||||
mParent(nsnull),
|
||||
mMapped(PR_FALSE)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsWindow::~nsWindow()
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIWindow methods */
|
||||
/* attribute nsIGUIEventListener eventListener; */
|
||||
NS_IMETHODIMP nsWindow::GetEventListener(nsIGUIEventListener * *aEventListener)
|
||||
{
|
||||
*aEventListener = mEventListener;
|
||||
NS_IF_ADDREF(*aEventListener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsWindow::SetEventListener(nsIGUIEventListener * aEventListener)
|
||||
{
|
||||
mEventListener = aEventListener;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsIWindow parent; */
|
||||
NS_IMETHODIMP nsWindow::GetParent(nsIWindow * *aParent)
|
||||
{
|
||||
nsCOMPtr<nsIWindow> parent = do_QueryReferent(mParent);
|
||||
if (parent) {
|
||||
*aParent = parent;
|
||||
NS_ADDREF(*aParent);
|
||||
} else {
|
||||
*aParent = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsWindow::SetParent(nsIWindow * aParent)
|
||||
{
|
||||
/* what if we get a null parent .. is this right? */
|
||||
|
||||
Window newParent = 0;
|
||||
|
||||
if (aParent) {
|
||||
mParent = getter_AddRefs(NS_GetWeakReference(aParent));
|
||||
|
||||
newParent = NS_STATIC_CAST(nsWindow*, aParent)->mWindow;
|
||||
}
|
||||
|
||||
::XReparentWindow(mDisplay, mWindow, newParent, 0, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean isVisible; */
|
||||
NS_IMETHODIMP nsWindow::GetIsVisible(PRBool *aVisibility)
|
||||
{
|
||||
*aVisibility = mMapped;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void show ( ); */
|
||||
NS_IMETHODIMP nsWindow::Show()
|
||||
{
|
||||
::XRaiseWindow(mDisplay, mWindow);
|
||||
::XMapWindow(mDisplay, mWindow);
|
||||
|
||||
mMapped = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void show ( ); */
|
||||
NS_IMETHODIMP nsWindow::Hide()
|
||||
{
|
||||
::XUnmapWindow(mDisplay, mWindow);
|
||||
|
||||
mMapped = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void move (in gfx_coord aX, in gfx_coord aY); */
|
||||
NS_IMETHODIMP nsWindow::Move(gfx_coord aX, gfx_coord aY)
|
||||
{
|
||||
/* should we set these here or wait until the ConfigureNotify comes in? */
|
||||
mBounds.MoveTo(aX, aY);
|
||||
|
||||
::XMoveWindow(mDisplay, mWindow, aX, aY);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void resize (in gfx_dimension aWidth, in gfx_dimension aHeight, in boolean aRepaint); */
|
||||
NS_IMETHODIMP nsWindow::Resize(gfx_dimension aWidth, gfx_dimension aHeight, PRBool aRepaint)
|
||||
{
|
||||
/* should we set these here or wait until the ConfigureNotify comes in? */
|
||||
mBounds.SizeTo(aWidth, aHeight);
|
||||
|
||||
::XResizeWindow(mDisplay, mWindow, aWidth, aHeight);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void moveResize (in gfx_coord aX, in gfx_coord aY, in gfx_dimension aWidth, in gfx_dimension aHeight, in boolean aRepaint); */
|
||||
NS_IMETHODIMP nsWindow::MoveResize(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight, PRBool aRepaint)
|
||||
{
|
||||
/* should we set these here or wait until the ConfigureNotify comes in? */
|
||||
mBounds.SetRect(aX, aY, aWidth, aHeight);
|
||||
|
||||
::XMoveResizeWindow(mDisplay, mWindow, aX, aY, aWidth, aHeight);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getBounds (out gfx_coord aX, out gfx_coord aY, out gfx_dimension aWidth, out gfx_dimension aHeight); */
|
||||
NS_IMETHODIMP nsWindow::GetBounds(gfx_coord *aX, gfx_coord *aY, gfx_dimension *aWidth, gfx_dimension *aHeight)
|
||||
{
|
||||
*aX = mBounds.x;
|
||||
*aY = mBounds.y;
|
||||
*aWidth = mBounds.width;
|
||||
*aHeight = mBounds.height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute gfx_color winBackgroundColor; */
|
||||
NS_IMETHODIMP nsWindow::GetWinBackgroundColor(gfx_color *aBackgroundColor)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsWindow::SetWinBackgroundColor(gfx_color aBackgroundColor)
|
||||
{
|
||||
// do some kind of color transformation?
|
||||
::XSetWindowBackground(mDisplay, mWindow, aBackgroundColor);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsICursor cursor; */
|
||||
NS_IMETHODIMP nsWindow::GetCursor(nsICursor * *aCursor)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP nsWindow::SetCursor(nsICursor * aCursor)
|
||||
{
|
||||
if (!aCursor)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
Cursor cursor = NS_STATIC_CAST(nsCursor*, aCursor)->mCursor;
|
||||
|
||||
::XDefineCursor(mDisplay, mWindow, cursor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::WidgetToScreen(const nsRect2 & aOldRect, nsRect2 & aNewRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener *aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] void invalidateRect ([const] in nsRect2 aRect, in boolean aIsSynchronous); */
|
||||
NS_IMETHODIMP nsWindow::InvalidateRect(const nsRect2 * aRect, PRBool aIsSynchronous)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void invalidateRegion (in nsIRegion aRegion, in boolean aIsSynchronous); */
|
||||
NS_IMETHODIMP nsWindow::InvalidateRegion(nsIRegion *aRegion, PRBool aIsSynchronous)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void update (); */
|
||||
NS_IMETHODIMP nsWindow::Update()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void scroll (in gfx_coord aSrcX, in gfx_coord aSrcY, in gfx_coord aDestX, in gfx_coord aDestY, in gfx_dimension aWidth, in gfx_dimension aHeight); */
|
||||
NS_IMETHODIMP nsWindow::Scroll(gfx_coord aSrcX, gfx_coord aSrcY, gfx_coord aDestX, gfx_coord aDestY, gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* nsPIWindowXlib methods */
|
||||
|
||||
/* void initFromNative (in Window window); */
|
||||
NS_IMETHODIMP nsWindow::InitFromNative(Window window)
|
||||
{
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mWindow = window;
|
||||
Window rootWindow;
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
unsigned int border_width;
|
||||
::XGetGeometry(mDisplay, window, &rootWindow, &x, &y, &width, &height, &border_width,
|
||||
&NS_STATIC_CAST(unsigned int, mDepth));
|
||||
|
||||
mBounds.SetRect(x, y, width, height);
|
||||
|
||||
// only if its inputoutput, then we should SetDrawable()
|
||||
SetDrawable((Drawable)mWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute Window nativeWindow; */
|
||||
NS_IMETHODIMP nsWindow::GetNativeWindow(Window *aNativeWindow)
|
||||
{
|
||||
*aNativeWindow = mWindow;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void dispatchEvent (in nsGUIEvent aEvent); */
|
||||
NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent * aEvent)
|
||||
{
|
||||
if (!mEventListener)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWindow> kungFuDeathGrip(this);
|
||||
mEventListener->ProcessEvent(aEvent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsWindow_h___
|
||||
#define nsWindow_h___
|
||||
|
||||
#include "nsIWindow.h"
|
||||
#include "nsPIWindowXlib.h"
|
||||
#include "nsDrawable.h"
|
||||
|
||||
#include "nsIRegion.h"
|
||||
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#include "nsIGUIEventListener.h"
|
||||
|
||||
class nsWindow : public nsIWindow,
|
||||
public nsPIWindowXlib,
|
||||
public nsSupportsWeakReference,
|
||||
public nsDrawable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWINDOW
|
||||
NS_DECL_NSPIWINDOWXLIB
|
||||
|
||||
nsWindow();
|
||||
virtual ~nsWindow();
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
Window mWindow;
|
||||
nsWeakPtr mParent;
|
||||
|
||||
/* for exposes, invalidates, etc */
|
||||
nsCOMPtr<nsIRegion> mUpdateRegion;
|
||||
|
||||
/* state*/
|
||||
PRBool mMapped;
|
||||
|
||||
/* listeners */
|
||||
nsCOMPtr<nsIGUIEventListener> mEventListener;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsWindow_h___
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsWindowHelper.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIWindow.h"
|
||||
|
||||
static
|
||||
PLHashNumber WindowHashKey(Window key)
|
||||
{
|
||||
return (PLHashNumber) key;
|
||||
}
|
||||
|
||||
PLHashTable *nsWindowHelper::sWindowMapper = PL_NewHashTable(20, (PLHashFunction)WindowHashKey,
|
||||
PL_CompareValues, PL_CompareValues, 0, 0);
|
||||
|
||||
nsWindowHelper::nsWindowHelper()
|
||||
{
|
||||
}
|
||||
|
||||
nsWindowHelper::~nsWindowHelper()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* static methods */
|
||||
void nsWindowHelper::AddWindow(const Window aWindow, nsIWindow *aIWindow)
|
||||
{
|
||||
|
||||
PL_HashTableAdd(sWindowMapper, NS_REINTERPRET_CAST(const void *, aWindow), aIWindow);
|
||||
|
||||
}
|
||||
|
||||
void nsWindowHelper::RemoveWindow(const Window aWindow)
|
||||
{
|
||||
PL_HashTableRemove(sWindowMapper, NS_REINTERPRET_CAST(const void *, aWindow));
|
||||
}
|
||||
|
||||
nsIWindow *nsWindowHelper::FindIWindow(const Window aWindow)
|
||||
{
|
||||
/* should this addref? */
|
||||
return NS_STATIC_CAST(nsIWindow*, PL_HashTableLookup(sWindowMapper, NS_REINTERPRET_CAST(const void *, aWindow)));
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsWindowHelper_h___
|
||||
#define nsWindowHelper_h___
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
class nsIWindow;
|
||||
|
||||
#include "plhash.h"
|
||||
|
||||
class nsWindowHelper
|
||||
{
|
||||
public:
|
||||
nsWindowHelper();
|
||||
virtual ~nsWindowHelper();
|
||||
|
||||
static void AddWindow(const Window aWindow, nsIWindow *aIWindow);
|
||||
static void RemoveWindow(const Window aWindow);
|
||||
static nsIWindow *FindIWindow(const Window aWindow);
|
||||
|
||||
private:
|
||||
static PLHashTable *sWindowMapper;
|
||||
};
|
||||
|
||||
#endif // nsWindowHelper_h___
|
|
@ -1,177 +0,0 @@
|
|||
/* $XConsortium: region.h,v 11.13 91/09/10 08:21:49 rws Exp $ */
|
||||
/************************************************************************
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _XREGION_H
|
||||
#define _XREGION_H
|
||||
|
||||
typedef struct {
|
||||
short x1, x2, y1, y2;
|
||||
} Box, BOX, BoxRec, *BoxPtr;
|
||||
|
||||
typedef struct {
|
||||
short x, y, width, height;
|
||||
}RECTANGLE, RectangleRec, *RectanglePtr;
|
||||
|
||||
#ifdef TRUE
|
||||
#undef TRUE
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef MAXSHORT
|
||||
#define MAXSHORT 32767
|
||||
#endif
|
||||
#ifndef MINSHORT
|
||||
#define MINSHORT -MAXSHORT
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* clip region
|
||||
*/
|
||||
|
||||
typedef struct _XRegion {
|
||||
long size;
|
||||
long numRects;
|
||||
BOX *rects;
|
||||
BOX extents;
|
||||
} REGION;
|
||||
|
||||
/* Xutil.h contains the declaration:
|
||||
* typedef struct _XRegion *Region;
|
||||
*/
|
||||
|
||||
/* 1 if two BOXs overlap.
|
||||
* 0 if two BOXs do not overlap.
|
||||
* Remember, x2 and y2 are not in the region
|
||||
*/
|
||||
#define EXTENTCHECK(r1, r2) \
|
||||
((r1)->x2 > (r2)->x1 && \
|
||||
(r1)->x1 < (r2)->x2 && \
|
||||
(r1)->y2 > (r2)->y1 && \
|
||||
(r1)->y1 < (r2)->y2)
|
||||
|
||||
/*
|
||||
* update region extents
|
||||
*/
|
||||
#define EXTENTS(r,idRect){\
|
||||
if((r)->x1 < (idRect)->extents.x1)\
|
||||
(idRect)->extents.x1 = (r)->x1;\
|
||||
if((r)->y1 < (idRect)->extents.y1)\
|
||||
(idRect)->extents.y1 = (r)->y1;\
|
||||
if((r)->x2 > (idRect)->extents.x2)\
|
||||
(idRect)->extents.x2 = (r)->x2;\
|
||||
if((r)->y2 > (idRect)->extents.y2)\
|
||||
(idRect)->extents.y2 = (r)->y2;\
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if there is enough memory in the present region.
|
||||
*/
|
||||
#define MEMCHECK(reg, rect, firstrect){\
|
||||
if ((reg)->numRects >= ((reg)->size - 1)){\
|
||||
(firstrect) = (BOX *) Xrealloc \
|
||||
((char *)(firstrect), (unsigned) (2 * (sizeof(BOX)) * ((reg)->size)));\
|
||||
if ((firstrect) == 0)\
|
||||
return(0);\
|
||||
(reg)->size *= 2;\
|
||||
(rect) = &(firstrect)[(reg)->numRects];\
|
||||
}\
|
||||
}
|
||||
|
||||
/* this routine checks to see if the previous rectangle is the same
|
||||
* or subsumes the new rectangle to add.
|
||||
*/
|
||||
|
||||
#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
|
||||
(!(((Reg)->numRects > 0)&&\
|
||||
((R-1)->y1 == (Ry1)) &&\
|
||||
((R-1)->y2 == (Ry2)) &&\
|
||||
((R-1)->x1 <= (Rx1)) &&\
|
||||
((R-1)->x2 >= (Rx2))))
|
||||
|
||||
/* add a rectangle to the given Region */
|
||||
#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
|
||||
if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
|
||||
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
|
||||
(r)->x1 = (rx1);\
|
||||
(r)->y1 = (ry1);\
|
||||
(r)->x2 = (rx2);\
|
||||
(r)->y2 = (ry2);\
|
||||
EXTENTS((r), (reg));\
|
||||
(reg)->numRects++;\
|
||||
(r)++;\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* add a rectangle to the given Region */
|
||||
#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
|
||||
if ((rx1 < rx2) && (ry1 < ry2) &&\
|
||||
CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
|
||||
(r)->x1 = (rx1);\
|
||||
(r)->y1 = (ry1);\
|
||||
(r)->x2 = (rx2);\
|
||||
(r)->y2 = (ry2);\
|
||||
(reg)->numRects++;\
|
||||
(r)++;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define EMPTY_REGION(pReg) pReg->numRects = 0
|
||||
|
||||
#define REGION_NOT_EMPTY(pReg) pReg->numRects
|
||||
|
||||
#define INBOX(r, x, y) \
|
||||
( ( ((r).x2 > x)) && \
|
||||
( ((r).x1 <= x)) && \
|
||||
( ((r).y2 > y)) && \
|
||||
( ((r).y1 <= y)) )
|
||||
|
||||
/*
|
||||
* number of points to buffer before sending them off
|
||||
* to scanlines() : Must be an even number
|
||||
*/
|
||||
#define NUMPTSTOBUFFER 200
|
||||
|
||||
/*
|
||||
* used to allocate buffers for points and link
|
||||
* the buffers together
|
||||
*/
|
||||
typedef struct _POINTBLOCK {
|
||||
XPoint pts[NUMPTSTOBUFFER];
|
||||
struct _POINTBLOCK *next;
|
||||
} POINTBLOCK;
|
||||
|
||||
#endif
|
|
@ -1,2 +0,0 @@
|
|||
Makefile
|
||||
.deps
|
|
@ -1,24 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
const nsIWindow = Components.interfaces.nsIWindow;
|
||||
const nsITopLevelWindow = Components.interfaces.nsITopLevelWindow;
|
||||
const nsIChildWindow = Components.interfaces.nsIChildWindow;
|
||||
|
||||
var runapprun = Components.classes["@mozilla.org/gfx/run;2"].createInstance(Components.interfaces.nsIRunAppRun)
|
||||
|
||||
var twin = Components.classes["@mozilla.org/gfx/window/toplevel;2"].createInstance(nsITopLevelWindow)
|
||||
|
||||
twin.init(null, 0, 0, 400, 400, 0)
|
||||
twin.title = "window from js!"
|
||||
|
||||
var win = twin.QueryInterface(nsIWindow)
|
||||
var cwin = Components.classes["@mozilla.org/gfx/window/child;2"].createInstance(nsIChildWindow)
|
||||
cwin.init(win, 10, 10, 190, 190)
|
||||
|
||||
win = twin.QueryInterface(nsIWindow)
|
||||
win.show()
|
||||
|
||||
win = cwin.QueryInterface(nsIWindow)
|
||||
win.show()
|
||||
|
||||
runapprun.go()
|
|
@ -1,30 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
const nsIPixmap = Components.interfaces.nsIPixmap;
|
||||
const nsIWindow = Components.interfaces.nsIWindow;
|
||||
const nsIDrawable = Components.interfaces.nsIDrawable;
|
||||
const nsIGraphicsContext = Components.interfaces.nsIGraphicsContext;
|
||||
|
||||
runapprun = Components.classes["run"].createInstance(Components.interfaces.nsIRunAppRun)
|
||||
|
||||
pixmap = Components.classes["mozilla.gfx.pixmap.2"].createInstance(nsIPixmap)
|
||||
pixmap.init(null, 400, 400, 24)
|
||||
|
||||
drawable = pixmap.QueryInterface(nsIDrawable)
|
||||
|
||||
gc = Components.classes["mozilla.gfx.graphicscontext.2"].createInstance(nsIGraphicsContext)
|
||||
gc.init(drawable)
|
||||
|
||||
drawable.drawRectangle(gc, true, 0, 0, 199, 199)
|
||||
|
||||
win = Components.classes["mozilla.gfx.window.2"].createInstance(nsIWindow)
|
||||
win.init(null)
|
||||
|
||||
win.show()
|
||||
|
||||
drawable.copyTo(gc,
|
||||
win.QueryInterface(nsIDrawable),
|
||||
0, 0,
|
||||
0, 0, 199, 199)
|
||||
|
||||
runapprun.go()
|
|
@ -1,80 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
const SHOW_ALL = false;
|
||||
const DEBUG = true;
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
debug("Region testing - begin\n");
|
||||
|
||||
testCreation();
|
||||
|
||||
testSetToRect();
|
||||
|
||||
debug("Region testing - end\n");
|
||||
}
|
||||
|
||||
function testCreation()
|
||||
{
|
||||
debug("Testing region creation - begin\n");
|
||||
|
||||
var region = newRegion();
|
||||
assert(region.isEmpty(),
|
||||
"testCreation: region = newRegion() should be empty");
|
||||
|
||||
debug("Testing region creation - end\n");
|
||||
}
|
||||
|
||||
function testSetToRect()
|
||||
{
|
||||
debug("Testing region resizing - begin\n");
|
||||
|
||||
var region = newRegion();
|
||||
|
||||
region.setToRect(0, 0, 400, 400);
|
||||
assert(!region.isEmpty(),
|
||||
"testSetToRect: region.setToRect(0, 0, 400, 400) should not be empty");
|
||||
|
||||
region.init();
|
||||
assert(region.isEmpty(),
|
||||
"testSetToRect: region.init() should be empty");
|
||||
|
||||
region.setToRect(100, 100, 200, 200);
|
||||
assert(!region.isEmpty(),
|
||||
"testSetToRect: region.setToRect(100, 100, 200, 200) should not be empty");
|
||||
|
||||
// apparantly this adds a rect, not sets.
|
||||
region.setToRect(0, 0, 0, 0);
|
||||
assert(region.isEmpty(),
|
||||
"testSetToRect: region.setToRect(0, 0, 0, 0) should be empty");
|
||||
|
||||
region.setToRect(0, 0, 200, 200);
|
||||
assert(!region.isEmpty(),
|
||||
"testSetToRect: region.setToRect(0, 0, 200, 200) should not be empty");
|
||||
|
||||
debug("Testing region resizing - end\n");
|
||||
}
|
||||
|
||||
function newRegion()
|
||||
{
|
||||
const nsIRegion = Components.interfaces.nsIRegion;
|
||||
|
||||
var region = Components.classes["@mozilla.org/gfx/region;2"].createInstance(nsIRegion);
|
||||
return region;
|
||||
}
|
||||
|
||||
function debug(message)
|
||||
{
|
||||
if (DEBUG)
|
||||
dump(message);
|
||||
}
|
||||
|
||||
function assert(condition, message)
|
||||
{
|
||||
if (SHOW_ALL)
|
||||
dump(condition + " : "+message+"\n");
|
||||
|
||||
if (!condition)
|
||||
throw message;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
const nsIWindow = Components.interfaces.nsIWindow;
|
||||
const nsIDrawable = Components.interfaces.nsIDrawable;
|
||||
const nsIGraphicsContext = Components.interfaces.nsIGraphicsContext;
|
||||
|
||||
win = Components.classes["mozilla.gfx.window.2"].createInstance(nsIWindow)
|
||||
win.init(null)
|
||||
|
||||
drawable = win.QueryInterface(nsIDrawable)
|
||||
|
||||
gc = Components.classes["mozilla.gfx.graphicscontext.2"].createInstance(nsIGraphicsContext)
|
||||
gc.init(drawable)
|
||||
|
||||
drawable.drawRectangle(gc, true, 0, 0, 199, 199)
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = gfx2
|
||||
XPIDL_MODULE = gfx2_tmp_crap
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIMenuRollup.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
|
||||
[uuid(05c48880-0fcf-11d4-bb6f-d9f289fe803c)]
|
||||
interface nsIMenuRollup : nsISupports
|
||||
{
|
||||
// Walks up the menu parent chain of a submenu pulling out the widgets and
|
||||
// places them into a list. Useful for determining if a click is in a
|
||||
// parent menu.
|
||||
nsISupportsArray GetSubmenuWidgetChain ( ) ;
|
||||
|
||||
};
|
Загрузка…
Ссылка в новой задаче