Compare commits
9 Commits
test_mem
...
WIDGET_IDL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bacf018470 | ||
|
|
661845527f | ||
|
|
2695f743d2 | ||
|
|
383ba86d8b | ||
|
|
8c455b008e | ||
|
|
e09c15621a | ||
|
|
6b3eface10 | ||
|
|
e815a771b0 | ||
|
|
0605f9fbfb |
@@ -1 +0,0 @@
|
||||
Clobbering because preed says it'll fix the red.
|
||||
@@ -1,19 +0,0 @@
|
||||
#
|
||||
## hostname: fxdbug-linux-tbox.build.mozilla.org
|
||||
## uname: Linux fxdbug-linux-tbox.build.mozilla.org 2.6.18-8.el5 #1 SMP Thu Mar 15 19:57:35 EDT 2007 i686 athlon i386 GNU/Linux
|
||||
#
|
||||
|
||||
mk_add_options MOZ_CO_PROJECT=browser
|
||||
mk_add_options MOZ_CO_MODULE="mozilla/tools/trace-malloc"
|
||||
|
||||
ac_add_options --enable-application=browser
|
||||
|
||||
ac_add_options --disable-optimize
|
||||
ac_add_options --enable-debug
|
||||
|
||||
ac_add_options --enable-canvas
|
||||
ac_add_options --enable-svg
|
||||
ac_add_options --enable-pango
|
||||
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --disable-libxul
|
||||
@@ -1,190 +0,0 @@
|
||||
#
|
||||
## hostname: fxdbug-linux-tbox.build.mozilla.org
|
||||
## uname: Linux fxdbug-linux-tbox.build.mozilla.org 2.6.18-8.el5 #1 SMP Thu Mar 15 19:57:35 EDT 2007 i686 athlon i386 GNU/Linux
|
||||
#
|
||||
#- tinder-config.pl - Tinderbox configuration file.
|
||||
#- Uncomment the variables you need to set.
|
||||
#- The default values are the same as the commented variables.
|
||||
|
||||
#$ENV{PATH} = "/usr/local/binutils-2.13.2.1/bin:/usr/local/gcc-3.4.3/bin:" . $ENV{PATH};
|
||||
|
||||
$ENV{MOZ_CRASHREPORTER_NO_REPORT} = '1';
|
||||
# Disable the Gnome Bug Buddy so that it doesn't block us getting stacks
|
||||
$ENV{GNOME_DISABLE_CRASH_DIALOG} = '1';
|
||||
|
||||
|
||||
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
#$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
||||
#$BuildAdministrator = ($ENV{USER} || "cltbld") . "\@" . ($ENV{HOST} || "dhcp");
|
||||
$BuildAdministrator = 'build@mozilla.org';
|
||||
|
||||
#- You'll need to change these to suit your machine's needs
|
||||
$DisplayServer = ':0.0';
|
||||
|
||||
#- Default values of command-line opts
|
||||
#-
|
||||
#$BuildDepend = 1; # Depend or Clobber
|
||||
#$BuildDebug = 0; # Debug or Opt (Darwin)
|
||||
#$ReportStatus = 1; # Send results to server, or not
|
||||
#$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
||||
#$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
||||
#$BuildOnce = 0; # Build once, don't send results to server
|
||||
#$TestOnly = 0; # Only run tests, don't pull/build
|
||||
#$BuildEmbed = 0; # After building seamonkey, go build embed app.
|
||||
#$SkipMozilla = 0; # Use to debug post-mozilla.pl scripts.
|
||||
|
||||
# Tests
|
||||
$CleanProfile = 1;
|
||||
#$ResetHomeDirForTests = 1;
|
||||
$ProductName = "Firefox";
|
||||
$VendorName = "Mozilla";
|
||||
$ENV{NO_EM_RESTART} = '1';
|
||||
|
||||
#$RunMozillaTests = 1; # Allow turning off of all tests if needed.
|
||||
#$RegxpcomTest = 1;
|
||||
#$AliveTest = 1;
|
||||
#$JavaTest = 0;
|
||||
#$ViewerTest = 0;
|
||||
$BloatTest = 1; # warren memory bloat test
|
||||
$BloatTest2 = 1; # dbaron memory bloat test, require tracemalloc
|
||||
#$DomToTextConversionTest = 0;
|
||||
#$XpcomGlueTest = 0;
|
||||
#$CodesizeTest = 0; # Z, require mozilla/tools/codesighs
|
||||
#$EmbedCodesizeTest = 0; # mZ, require mozilla/tools/codesigns
|
||||
#$MailBloatTest = 0;
|
||||
#$EmbedTest = 0; # Assumes you wanted $BuildEmbed=1
|
||||
#$LayoutPerformanceTest = 0; # Tp
|
||||
#$QATest = 0;
|
||||
#$XULWindowOpenTest = 0; # Txul
|
||||
#$StartupPerformanceTest = 0; # Ts
|
||||
|
||||
$TestsPhoneHome = 1; # Should test report back to server?
|
||||
#$results_server = "axolotl.mozilla.org"; # was tegu
|
||||
#$pageload_server = "spider"; # localhost
|
||||
|
||||
#
|
||||
# Timeouts, values are in seconds.
|
||||
#
|
||||
|
||||
#$CreateProfileTimeout = 45;
|
||||
$RegxpcomTestTimeout = 60;
|
||||
|
||||
#$AliveTestTimeout = 45;
|
||||
#$ViewerTestTimeout = 45;
|
||||
#$EmbedTestTimeout = 45;
|
||||
$BloatTestTimeout = 1800; # seconds
|
||||
#$MailBloatTestTimeout = 120; # seconds
|
||||
#$JavaTestTimeout = 45;
|
||||
#$DomTestTimeout = 45; # seconds
|
||||
#$XpcomGlueTestTimeout = 15;
|
||||
#$CodesizeTestTimeout = 900; # seconds
|
||||
#$CodesizeTestType = "auto"; # {"auto"|"base"}
|
||||
#$LayoutPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$QATestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
#$StartupPerformanceTestTimeout = 60; # seconds
|
||||
#$XULWindowOpenTestTimeout = 150; # seconds
|
||||
|
||||
|
||||
#$MozConfigFileName = 'mozconfig';
|
||||
|
||||
#$UseMozillaProfile = 1;
|
||||
#$MozProfileName = 'default';
|
||||
|
||||
# This sets the value of the XPCOM_DEBUG_BREAK environment variable. We
|
||||
# default to 'warn', which suppresses the assertion dialogs on Windows
|
||||
# and gives platform parity. Use 'abort' for fatal assertions.
|
||||
$MozAssertBehavior = 'stack-and-abort';
|
||||
|
||||
#- Set these to what makes sense for your system
|
||||
#$Make = 'gmake'; # Must be GNU make
|
||||
#$MakeOverrides = '';
|
||||
#$mail = '/bin/mail';
|
||||
#$CVS = 'cvs -q';
|
||||
#$CVSCO = 'checkout -P';
|
||||
|
||||
# win32 usually doesn't have /bin/mail
|
||||
#$blat = 'c:/nstools/bin/blat';
|
||||
#$use_blat = 0;
|
||||
|
||||
# Set moz_cvsroot to something like:
|
||||
# :pserver:$ENV{USER}%netscape.com\@cvs.mozilla.org:/cvsroot
|
||||
# :pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot
|
||||
#
|
||||
# Note that win32 may not need \@, depends on ' or ".
|
||||
# :pserver:$ENV{USER}%netscape.com@cvs.mozilla.org:/cvsroot
|
||||
|
||||
$moz_cvsroot = ':ext:ffxbld@cvs.mozilla.org:/cvsroot';
|
||||
#$moz_cvsroot = ":pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot";
|
||||
|
||||
#- Set these proper values for your tinderbox server
|
||||
#$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
||||
|
||||
# Allow for non-client builds, e.g. camino.
|
||||
#$moz_client_mk = 'client.mk';
|
||||
|
||||
#- Set if you want to build in a separate object tree
|
||||
$ObjDir = 'obj';
|
||||
|
||||
# Extra build name, if needed.
|
||||
#$BuildNameExtra = 'GTK1 (gcc 3.4)';
|
||||
|
||||
# User comment, eg. ip address for dhcp builds.
|
||||
# ex: $UserComment = "ip = 208.12.36.108";
|
||||
#$UserComment = 0;
|
||||
|
||||
#-
|
||||
#- The rest should not need to be changed
|
||||
#-
|
||||
|
||||
#- Minimum wait period from start of build to start of next build in minutes.
|
||||
#$BuildSleep = 10;
|
||||
|
||||
#- Until you get the script working. When it works,
|
||||
#- change to the tree you're actually building
|
||||
#$BuildTree = 'MozillaTest';
|
||||
$BuildTree = 'Firefox3.0';
|
||||
|
||||
#$BuildName = '';
|
||||
#$BuildTag = '';
|
||||
#$BuildConfigDir = 'mozilla/config';
|
||||
#$Topsrcdir = 'mozilla';
|
||||
|
||||
$BinaryName = 'firefox-bin';
|
||||
|
||||
#
|
||||
# For embedding app, use:
|
||||
#$EmbedBinaryName = 'TestGtkEmbed';
|
||||
#$EmbedDistDir = 'dist/bin'
|
||||
|
||||
|
||||
#$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
#$ConfigureArgs = '';
|
||||
#$ConfigureEnvArgs = '';
|
||||
#$Compiler = 'gcc';
|
||||
#$NSPRArgs = '';
|
||||
#$ShellOverride = '';
|
||||
|
||||
# allow override of timezone value (for win32 POSIX::strftime)
|
||||
#$Timezone = '';
|
||||
|
||||
# Reboot the OS at the end of build-and-test cycle. This is primarily
|
||||
# intended for Win9x, which can't last more than a few cycles before
|
||||
# locking up (and testing would be suspect even after a couple of cycles).
|
||||
# Right now, there is only code to force the reboot for Win9x, so even
|
||||
# setting this to 1, will not have an effect on other platforms. Setting
|
||||
# up win9x to automatically logon and begin running tinderbox is left
|
||||
# as an exercise to the reader.
|
||||
#$RebootSystem = 0;
|
||||
|
||||
# LogCompression specifies the type of compression used on the log file.
|
||||
# Valid options are 'gzip', and 'bzip2'. Please make sure the binaries
|
||||
# for 'gzip' or 'bzip2' are in the user's path before setting this
|
||||
# option.
|
||||
$LogCompression = 'bzip2';
|
||||
|
||||
# LogEncoding specifies the encoding format used for the logs. Valid
|
||||
# options are 'base64', and 'uuencode'. If $LogCompression is set above,
|
||||
# this needs to be set to 'base64' or 'uuencode' to ensure that the
|
||||
# binary data is transferred properly.
|
||||
$LogEncoding = 'uuencode';
|
||||
@@ -1 +0,0 @@
|
||||
- trigger another clobber to test bug 388691
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
## hostname: bm-xservex08.build.mozilla.org
|
||||
## uname: Darwin bm-xserve08.build.mozilla.org 8.8.4 Darwin Kernel Version 8.8.4: Sun Oct 29 15:26:54 PST 2006; root:xnu-792.16.4.obj~1/RELEASE_I386 i386 i386
|
||||
#
|
||||
|
||||
#. $topsrcdir/build/macosx/universal/mozconfig
|
||||
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j4"
|
||||
mk_add_options MOZ_CO_PROJECT="browser"
|
||||
mk_add_options MOZ_CO_MODULE="mozilla/tools/trace-malloc"
|
||||
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../build
|
||||
|
||||
ac_add_options --enable-application=browser
|
||||
|
||||
ac_add_app_options ppc --enable-prebinding
|
||||
|
||||
ac_add_options --disable-optimize
|
||||
ac_add_options --enable-debug
|
||||
|
||||
ac_add_options --enable-canvas
|
||||
ac_add_options --enable-svg
|
||||
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-libxul
|
||||
@@ -1,192 +0,0 @@
|
||||
#
|
||||
## hostname: bm-xserve08.build.mozilla.org
|
||||
## uname: Darwin bm-xserve08.build.mozilla.org 8.8.4 Darwin Kernel Version 8.8.4: Sun Oct 29 15:26:54 PST 2006; root:xnu-792.16.4.obj~1/RELEASE_I386 i386 i386
|
||||
#
|
||||
|
||||
#
|
||||
#- tinder-config.pl - Tinderbox configuration file.
|
||||
#- Uncomment the variables you need to set.
|
||||
#- The default values are the same as the commented variables.
|
||||
|
||||
#$ENV{PATH} = "/usr/local/binutils-2.13.2.1/bin:/usr/local/gcc-3.4.3/bin:" . $ENV{PATH};
|
||||
|
||||
$ENV{MOZ_CRASHREPORTER_NO_REPORT} = '1';
|
||||
|
||||
#$MacUniversalBinary = 1;
|
||||
|
||||
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
#$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
||||
#$BuildAdministrator = ($ENV{USER} || "cltbld") . "\@" . ($ENV{HOST} || "dhcp");
|
||||
$BuildAdministrator = 'build@mozilla.org';
|
||||
|
||||
#- You'll need to change these to suit your machine's needs
|
||||
$DisplayServer = ':0.0';
|
||||
|
||||
#- Default values of command-line opts
|
||||
#-
|
||||
#$BuildDepend = 1; # Depend or Clobber
|
||||
$BuildDebug = 1; # Debug or Opt (Darwin)
|
||||
#$ReportStatus = 1; # Send results to server, or not
|
||||
#$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
||||
#$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
||||
#$BuildOnce = 0; # Build once, don't send results to server
|
||||
#$TestOnly = 0; # Only run tests, don't pull/build
|
||||
#$BuildEmbed = 0; # After building seamonkey, go build embed app.
|
||||
#$SkipMozilla = 0; # Use to debug post-mozilla.pl scripts.
|
||||
|
||||
# Tests
|
||||
$CleanProfile = 1;
|
||||
#$ResetHomeDirForTests = 1;
|
||||
$ProductName = "GranParadiso";
|
||||
$VendorName = "";
|
||||
$ENV{NO_EM_RESTART} = '1';
|
||||
|
||||
#$RunMozillaTests = 1; # Allow turning off of all tests if needed.
|
||||
#$RegxpcomTest = 1;
|
||||
#$AliveTest = 1;
|
||||
#$JavaTest = 0;
|
||||
#$ViewerTest = 0;
|
||||
$BloatTest = 1; # warren memory bloat test
|
||||
$BloatTest2 = 1; # dbaron memory bloat test, require tracemalloc
|
||||
#$DomToTextConversionTest = 0;
|
||||
#$XpcomGlueTest = 0;
|
||||
#$CodesizeTest = 0; # Z, require mozilla/tools/codesighs
|
||||
#$EmbedCodesizeTest = 0; # mZ, require mozilla/tools/codesigns
|
||||
#$MailBloatTest = 0;
|
||||
#$EmbedTest = 0; # Assumes you wanted $BuildEmbed=1
|
||||
#$LayoutPerformanceTest = 0; # Tp
|
||||
#$QATest = 0;
|
||||
#$XULWindowOpenTest = 0; # Txul
|
||||
#$StartupPerformanceTest = 0; # Ts
|
||||
|
||||
$TestsPhoneHome = 1; # Should test report back to server?
|
||||
#$results_server = "axolotl.mozilla.org"; # was tegu
|
||||
#$pageload_server = "spider"; # localhost
|
||||
|
||||
#
|
||||
# Timeouts, values are in seconds.
|
||||
#
|
||||
|
||||
#$CreateProfileTimeout = 45;
|
||||
$RegxpcomTestTimeout = 60;
|
||||
|
||||
#$AliveTestTimeout = 45;
|
||||
#$ViewerTestTimeout = 45;
|
||||
#$EmbedTestTimeout = 45;
|
||||
$BloatTestTimeout = 300; # seconds
|
||||
#$MailBloatTestTimeout = 120; # seconds
|
||||
#$JavaTestTimeout = 45;
|
||||
#$DomTestTimeout = 45; # seconds
|
||||
#$XpcomGlueTestTimeout = 15;
|
||||
#$CodesizeTestTimeout = 900; # seconds
|
||||
#$CodesizeTestType = "auto"; # {"auto"|"base"}
|
||||
#$LayoutPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$QATestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
#$StartupPerformanceTestTimeout = 60; # seconds
|
||||
#$XULWindowOpenTestTimeout = 150; # seconds
|
||||
|
||||
|
||||
#$MozConfigFileName = 'mozconfig';
|
||||
|
||||
#$UseMozillaProfile = 1;
|
||||
#$MozProfileName = 'default';
|
||||
|
||||
# This sets the value of the XPCOM_DEBUG_BREAK environment variable. We
|
||||
# default to 'warn', which suppresses the assertion dialogs on Windows
|
||||
# and gives platform parity. Use 'abort' (or, on trunk after 2007-08-10,
|
||||
# 'stack-and-abort') for fatal assertions.
|
||||
$MozAssertBehavior = 'stack-and-abort';
|
||||
|
||||
#- Set these to what makes sense for your system
|
||||
#$Make = 'gmake'; # Must be GNU make
|
||||
#$MakeOverrides = '';
|
||||
#$mail = '/bin/mail';
|
||||
#$CVS = 'cvs -q';
|
||||
#$CVSCO = 'checkout -P';
|
||||
|
||||
# win32 usually doesn't have /bin/mail
|
||||
#$blat = 'c:/nstools/bin/blat';
|
||||
#$use_blat = 0;
|
||||
|
||||
# Set moz_cvsroot to something like:
|
||||
# :pserver:$ENV{USER}%netscape.com\@cvs.mozilla.org:/cvsroot
|
||||
# :pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot
|
||||
#
|
||||
# Note that win32 may not need \@, depends on ' or ".
|
||||
# :pserver:$ENV{USER}%netscape.com@cvs.mozilla.org:/cvsroot
|
||||
|
||||
$moz_cvsroot = ':ext:ffxbld@cvs.mozilla.org:/cvsroot';
|
||||
#$moz_cvsroot = ":pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot";
|
||||
|
||||
#- Set these proper values for your tinderbox server
|
||||
#$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
||||
|
||||
# Allow for non-client builds, e.g. camino.
|
||||
#$moz_client_mk = 'client.mk';
|
||||
|
||||
#- Set if you want to build in a separate object tree
|
||||
$ObjDir = '../build';
|
||||
|
||||
# Extra build name, if needed.
|
||||
$BuildNameExtra = 'Debug + Leak Test';
|
||||
|
||||
# User comment, eg. ip address for dhcp builds.
|
||||
# ex: $UserComment = "ip = 208.12.36.108";
|
||||
#$UserComment = 0;
|
||||
|
||||
#-
|
||||
#- The rest should not need to be changed
|
||||
#-
|
||||
|
||||
#- Minimum wait period from start of build to start of next build in minutes.
|
||||
#$BuildSleep = 10;
|
||||
|
||||
#- Until you get the script working. When it works,
|
||||
#- change to the tree you're actually building
|
||||
#$BuildTree = 'MozillaTest';
|
||||
$BuildTree = 'Firefox3.0';
|
||||
|
||||
#$BuildName = '';
|
||||
#$BuildTag = '';
|
||||
#$BuildConfigDir = 'mozilla/config';
|
||||
#$Topsrcdir = 'mozilla';
|
||||
|
||||
$BinaryName = 'firefox-bin';
|
||||
|
||||
#
|
||||
# For embedding app, use:
|
||||
#$EmbedBinaryName = 'TestGtkEmbed';
|
||||
#$EmbedDistDir = 'dist/bin'
|
||||
|
||||
|
||||
#$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
#$ConfigureArgs = '';
|
||||
#$ConfigureEnvArgs = '';
|
||||
#$Compiler = 'gcc';
|
||||
#$NSPRArgs = '';
|
||||
#$ShellOverride = '';
|
||||
|
||||
# allow override of timezone value (for win32 POSIX::strftime)
|
||||
#$Timezone = '';
|
||||
|
||||
# Reboot the OS at the end of build-and-test cycle. This is primarily
|
||||
# intended for Win9x, which can't last more than a few cycles before
|
||||
# locking up (and testing would be suspect even after a couple of cycles).
|
||||
# Right now, there is only code to force the reboot for Win9x, so even
|
||||
# setting this to 1, will not have an effect on other platforms. Setting
|
||||
# up win9x to automatically logon and begin running tinderbox is left
|
||||
# as an exercise to the reader.
|
||||
#$RebootSystem = 0;
|
||||
|
||||
# LogCompression specifies the type of compression used on the log file.
|
||||
# Valid options are 'gzip', and 'bzip2'. Please make sure the binaries
|
||||
# for 'gzip' or 'bzip2' are in the user's path before setting this
|
||||
# option.
|
||||
$LogCompression = 'bzip2';
|
||||
|
||||
# LogEncoding specifies the encoding format used for the logs. Valid
|
||||
# options are 'base64', and 'uuencode'. If $LogCompression is set above,
|
||||
# this needs to be set to 'base64' or 'uuencode' to ensure that the
|
||||
# binary data is transferred properly.
|
||||
$LogEncoding = 'uuencode';
|
||||
@@ -1 +0,0 @@
|
||||
Clobber in case the intermittant leak is cruft-buildup
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
## hostname: fxdbug-win32-tbox
|
||||
## uname: MINGW32_NT-5.2 FX-WIN32-TBOX 1.0.11(0.46/3/2) 2007-01-12 12:05 i686 Msys
|
||||
#
|
||||
|
||||
mk_add_options MOZ_CO_PROJECT=browser
|
||||
mk_add_options MOZ_CO_MODULE="mozilla/tools/trace-malloc"
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j5"
|
||||
mk_add_options MOZ_PACKAGE_NSIS=1
|
||||
|
||||
ac_add_options --enable-application=browser
|
||||
ac_add_options --disable-optimize
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
@@ -1,221 +0,0 @@
|
||||
#
|
||||
## hostname: fxdbug-win32-tbox
|
||||
## uname: MINGW32_NT-5.2 FX-WIN32-TBOX 1.0.11(0.46/3/2) 2007-01-12 12:05 i686 Msys
|
||||
#
|
||||
|
||||
#- tinder-config.pl - Tinderbox configuration file.
|
||||
#- Uncomment the variables you need to set.
|
||||
#- The default values are the same as the commented variables.
|
||||
|
||||
$ENV{MOZ_INSTALLER_USE_7ZIP} = '1';
|
||||
$ENV{MOZ_PACKAGE_NSIS} = '1';
|
||||
$ENV{MOZ_CRASHREPORTER_NO_REPORT} = '1';
|
||||
$ENV{NO_EM_RESTART} = '1';
|
||||
|
||||
# $ENV{MOZ_PACKAGE_MSI}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: 0
|
||||
# Values: 0 | 1
|
||||
# Purpose: Controls whether a MSI package is made.
|
||||
# Requires: Windows and a local MakeMSI installation.
|
||||
#$ENV{MOZ_PACKAGE_MSI} = 0;
|
||||
|
||||
# $ENV{MOZ_SYMBOLS_TRANSFER_TYPE}
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default: scp
|
||||
# Values: scp | rsync
|
||||
# Purpose: Use scp or rsync to transfer symbols to the Talkback server.
|
||||
# Requires: The selected type requires the command be available both locally
|
||||
# and on the Talkback server.
|
||||
#$ENV{MOZ_SYMBOLS_TRANSFER_TYPE} = "scp";
|
||||
|
||||
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
||||
$BuildAdministrator = 'build@mozilla.org';
|
||||
#$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
||||
#$BuildAdministrator = ($ENV{USER} || "cltbld") . "\@" . ($ENV{HOST} || "dhcp");
|
||||
|
||||
#- You'll need to change these to suit your machine's needs
|
||||
#$DisplayServer = ':0.0';
|
||||
|
||||
#- Default values of command-line opts
|
||||
#-
|
||||
#$BuildDepend = 1; # Depend or Clobber
|
||||
#$BuildDebug = 0; # Debug or Opt (Darwin)
|
||||
#$ReportStatus = 1; # Send results to server, or not
|
||||
#$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
||||
#$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
||||
#$BuildOnce = 0; # Build once, don't send results to server
|
||||
#$TestOnly = 0; # Only run tests, don't pull/build
|
||||
#$BuildEmbed = 0; # After building seamonkey, go build embed app.
|
||||
#$SkipMozilla = 0; # Use to debug post-mozilla.pl scripts.
|
||||
#$BuildLocales = 0; # Do l10n packaging?
|
||||
|
||||
# Tests
|
||||
$CleanProfile = 1;
|
||||
#$ResetHomeDirForTests = 1;
|
||||
$ProductName = "Firefox";
|
||||
$VendorName = "Mozilla";
|
||||
|
||||
$RunMozillaTests = 1; # Allow turning off of all tests if needed.
|
||||
#$RegxpcomTest = 1;
|
||||
#$AliveTest = 1;
|
||||
#$JavaTest = 0;
|
||||
#$ViewerTest = 0;
|
||||
$BloatTest = 1; # warren memory bloat test
|
||||
$BloatTest2 = 1; # dbaron memory bloat test, require tracemalloc
|
||||
#$DomToTextConversionTest = 0;
|
||||
#$XpcomGlueTest = 0;
|
||||
#$CodesizeTest = 0; # Z, require mozilla/tools/codesighs
|
||||
#$EmbedCodesizeTest = 0; # mZ, require mozilla/tools/codesigns
|
||||
#$MailBloatTest = 0;
|
||||
#$EmbedTest = 0; # Assumes you wanted $BuildEmbed=1
|
||||
#$LayoutPerformanceTest = 0; # Tp
|
||||
#$DHTMLPerformanceTest = 0; # Tdhtml
|
||||
#$QATest = 0;
|
||||
#$XULWindowOpenTest = 0; # Txul
|
||||
#$StartupPerformanceTest = 0; # Ts
|
||||
#$NeckoUnitTest = 0;
|
||||
#$RenderPerformanceTest = 0; # Tgfx
|
||||
|
||||
$TestsPhoneHome = 1; # Should test report back to server?
|
||||
#$GraphNameOverride = 'fxdbug-win32-tbox';
|
||||
|
||||
# $results_server
|
||||
#----------------------------------------------------------------------------
|
||||
# Server on which test results will be accessible. This was originally tegu,
|
||||
# then became axolotl. Once we moved services from axolotl, it was time
|
||||
# to give this service its own hostname to make future transitions easier.
|
||||
# - cmp@mozilla.org
|
||||
#$results_server = "build-graphs.mozilla.org";
|
||||
|
||||
$pageload_server = "pageload.build.mozilla.org"; # localhost
|
||||
|
||||
#
|
||||
# Timeouts, values are in seconds.
|
||||
#
|
||||
#$CVSCheckoutTimeout = 3600;
|
||||
#$CreateProfileTimeout = 45;
|
||||
#$RegxpcomTestTimeout = 120;
|
||||
|
||||
#$AliveTestTimeout = 30;
|
||||
#$ViewerTestTimeout = 45;
|
||||
#$EmbedTestTimeout = 45;
|
||||
$BloatTestTimeout = 1800; # seconds
|
||||
#$MailBloatTestTimeout = 120; # seconds
|
||||
#$JavaTestTimeout = 45;
|
||||
#$DomTestTimeout = 45; # seconds
|
||||
#$XpcomGlueTestTimeout = 15;
|
||||
#$CodesizeTestTimeout = 900; # seconds
|
||||
#$CodesizeTestType = "auto"; # {"auto"|"base"}
|
||||
$LayoutPerformanceTestTimeout = 800; # entire test, seconds
|
||||
#$DHTMLPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
#$QATestTimeout = 1200; # entire test, seconds
|
||||
#$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
#$StartupPerformanceTestTimeout = 20; # seconds
|
||||
#$XULWindowOpenTestTimeout = 90; # seconds
|
||||
#$NeckoUnitTestTimeout = 30; # seconds
|
||||
$RenderPerformanceTestTimeout = 1800; # seconds
|
||||
|
||||
#$MozConfigFileName = 'mozconfig';
|
||||
|
||||
#$UseMozillaProfile = 1;
|
||||
#$MozProfileName = 'default';
|
||||
|
||||
# This sets the value of the XPCOM_DEBUG_BREAK environment variable. We
|
||||
# default to 'warn', which suppresses the assertion dialogs on Windows
|
||||
# and gives platform parity. Use 'abort' (or, on trunk after 2007-08-10,
|
||||
# 'stack-and-abort') for fatal assertions.
|
||||
$MozAssertBehavior = 'stack-and-abort';
|
||||
|
||||
#- Set these to what makes sense for your system
|
||||
$Make = 'make'; # Must be GNU make
|
||||
#$MakeOverrides = '';
|
||||
#$mail = '/bin/mail';
|
||||
#$CVS = 'cvs -q';
|
||||
#$CVSCO = 'checkout -P';
|
||||
|
||||
# win32 usually doesn't have /bin/mail
|
||||
$blat = '/d/mozilla-build/blat261/full/blat';
|
||||
$use_blat = 0;
|
||||
|
||||
# Set moz_cvsroot to something like:
|
||||
# :pserver:$ENV{USER}%netscape.com\@cvs.mozilla.org:/cvsroot
|
||||
# :pserver:anonymous\@cvs-mirror.mozilla.org:/cvsroot
|
||||
#
|
||||
# Note that win32 may not need \@, depends on ' or ".
|
||||
# :pserver:$ENV{USER}%netscape.com@cvs.mozilla.org:/cvsroot
|
||||
|
||||
#$moz_cvsroot = $ENV{CVSROOT};
|
||||
$moz_cvsroot = ':ext:ffxbld@cvs.mozilla.org:/cvsroot';
|
||||
|
||||
#- Set these proper values for your tinderbox server
|
||||
#$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
||||
|
||||
# Allow for non-client builds, e.g. camino.
|
||||
#$moz_client_mk = 'client.mk';
|
||||
|
||||
#- Set if you want to build in a separate object tree
|
||||
$ObjDir = 'obj-fx-trunk';
|
||||
|
||||
# Extra build name, if needed.
|
||||
$BuildNameExtra = 'Debug + Leak Test';
|
||||
|
||||
# User comment, eg. ip address for dhcp builds.
|
||||
# ex: $UserComment = "ip = 208.12.36.108";
|
||||
#$UserComment = 0;
|
||||
|
||||
#-
|
||||
#- The rest should not need to be changed
|
||||
#-
|
||||
|
||||
#- Minimum wait period from start of build to start of next build in minutes.
|
||||
#$BuildSleep = 10;
|
||||
|
||||
#- Until you get the script working. When it works,
|
||||
#- change to the tree you're actually building
|
||||
#$BuildTree = 'MozillaTest';
|
||||
$BuildTree = 'Firefox3.0';
|
||||
|
||||
#$BuildName = '';
|
||||
#$BuildTag = '';
|
||||
#$BuildConfigDir = 'mozilla/config';
|
||||
#$Topsrcdir = 'mozilla';
|
||||
|
||||
$BinaryName = 'firefox.exe';
|
||||
|
||||
#
|
||||
# For embedding app, use:
|
||||
#$EmbedBinaryName = 'TestGtkEmbed';
|
||||
#$EmbedDistDir = 'dist/bin'
|
||||
|
||||
|
||||
#$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
#$ConfigureArgs = '';
|
||||
#$ConfigureEnvArgs = '';
|
||||
#$Compiler = 'gcc';
|
||||
#$NSPRArgs = '';
|
||||
#$ShellOverride = '';
|
||||
|
||||
# allow override of timezone value (for win32 POSIX::strftime)
|
||||
#$Timezone = '';
|
||||
|
||||
# Reboot the OS at the end of build-and-test cycle. This is primarily
|
||||
# intended for Win9x, which can't last more than a few cycles before
|
||||
# locking up (and testing would be suspect even after a couple of cycles).
|
||||
# Right now, there is only code to force the reboot for Win9x, so even
|
||||
# setting this to 1, will not have an effect on other platforms. Setting
|
||||
# up win9x to automatically logon and begin running tinderbox is left
|
||||
# as an exercise to the reader.
|
||||
#$RebootSystem = 0;
|
||||
|
||||
# LogCompression specifies the type of compression used on the log file.
|
||||
# Valid options are 'gzip', and 'bzip2'. Please make sure the binaries
|
||||
# for 'gzip' or 'bzip2' are in the user's path before setting this
|
||||
# option.
|
||||
#$LogCompression = '';
|
||||
|
||||
# LogEncoding specifies the encoding format used for the logs. Valid
|
||||
# options are 'base64', and 'uuencode'. If $LogCompression is set above,
|
||||
# this needs to be set to 'base64' or 'uuencode' to ensure that the
|
||||
# binary data is transferred properly.
|
||||
#$LogEncoding = '';
|
||||
28
mozilla/widget/Makefile.in
Normal file
28
mozilla/widget/Makefile.in
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
21
mozilla/widget/build.bat
Executable file
21
mozilla/widget/build.bat
Executable file
@@ -0,0 +1,21 @@
|
||||
rem -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
rem
|
||||
rem The contents of this file are subject to the Netscape Public License
|
||||
rem Version 1.0 (the "NPL"); you may not use this file except in
|
||||
rem compliance with the NPL. You may obtain a copy of the NPL at
|
||||
rem http://www.mozilla.org/NPL/
|
||||
rem
|
||||
rem Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
rem WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
rem for the specific language governing rights and limitations under the
|
||||
rem NPL.
|
||||
rem
|
||||
rem The Initial Developer of this code under the NPL is Netscape
|
||||
rem Communications Corporation. Portions created by Netscape are
|
||||
rem Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
rem Reserved.
|
||||
rem
|
||||
|
||||
del s:\ns\raptor\ui\src\windows\win32_d.obj\%1.obj
|
||||
del s:\ns\raptor\ui\tests\windows\win32_d.obj\winmain.obj
|
||||
nmake -f makefile.win
|
||||
11
mozilla/widget/macbuild/Widget.prefix
Normal file
11
mozilla/widget/macbuild/Widget.prefix
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Widget.Prefix
|
||||
//
|
||||
// Global prefix file for the Widget project.
|
||||
//
|
||||
|
||||
#include "MacPrefix.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Events.h>
|
||||
#include <MacWindows.h>
|
||||
11
mozilla/widget/macbuild/WidgetDebug.prefix
Normal file
11
mozilla/widget/macbuild/WidgetDebug.prefix
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// WidgetDebug.Prefix
|
||||
//
|
||||
// Global prefix file for the debug Widget project.
|
||||
//
|
||||
|
||||
#include "MacPrefix_debug.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Events.h>
|
||||
#include <MacWindows.h>
|
||||
22
mozilla/widget/macbuild/WidgetSharedDebugPrefix.h
Normal file
22
mozilla/widget/macbuild/WidgetSharedDebugPrefix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_SHARED 1
|
||||
#define _IMPL_NS_WIDGET 1
|
||||
|
||||
#include "WidgetDebug.prefix"
|
||||
22
mozilla/widget/macbuild/WidgetSharedPrefix.h
Normal file
22
mozilla/widget/macbuild/WidgetSharedPrefix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_SHARED 1
|
||||
#define _IMPL_NS_WIDGET 1
|
||||
|
||||
#include "Widget.prefix"
|
||||
21
mozilla/widget/macbuild/WidgetStaticDebugPrefix.h
Normal file
21
mozilla/widget/macbuild/WidgetStaticDebugPrefix.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_STATIC 1
|
||||
|
||||
#include "WidgetDebug.prefix"
|
||||
21
mozilla/widget/macbuild/WidgetStaticPrefix.h
Normal file
21
mozilla/widget/macbuild/WidgetStaticPrefix.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_STATIC 1
|
||||
|
||||
#include "Widget.prefix"
|
||||
BIN
mozilla/widget/macbuild/widget.mcp
Normal file
BIN
mozilla/widget/macbuild/widget.mcp
Normal file
Binary file not shown.
35
mozilla/widget/macbuild/widget.toc
Normal file
35
mozilla/widget/macbuild/widget.toc
Normal file
@@ -0,0 +1,35 @@
|
||||
# target: widgetDebug.shlb
|
||||
mozilla/widget/src/mac/nsAppShell.cpp
|
||||
mozilla/widget/src/mac/nsButton.cpp
|
||||
mozilla/widget/src/mac/nsCheckButton.cpp
|
||||
mozilla/widget/src/mac/nsFileWidget.cpp
|
||||
mozilla/widget/src/mac/nsLookAndFeel.cpp
|
||||
mozilla/widget/src/mac/nsMacControl.cpp
|
||||
mozilla/widget/src/mac/nsMacEventHandler.cpp
|
||||
mozilla/widget/src/mac/nsMacMessagePump.cpp
|
||||
mozilla/widget/src/mac/nsMacMessageSink.cpp
|
||||
mozilla/widget/src/mac/nsMacWindow.cpp
|
||||
mozilla/widget/src/mac/nsMenu.cpp
|
||||
mozilla/widget/src/mac/nsMenuBar.cpp
|
||||
mozilla/widget/src/mac/nsMenuItem.cpp
|
||||
mozilla/widget/src/mac/nsRadioButton.cpp
|
||||
mozilla/widget/src/mac/nsScrollbar.cpp
|
||||
mozilla/widget/src/mac/nsTextAreaWidget.cpp
|
||||
mozilla/widget/src/mac/nsTextWidget.cpp
|
||||
mozilla/widget/src/mac/nsToolkit.cpp
|
||||
mozilla/widget/src/mac/nsWidgetFactory.cpp
|
||||
mozilla/widget/src/mac/nsWidgetSupport.cpp
|
||||
mozilla/widget/src/mac/nsWindow.cpp
|
||||
mozilla/widget/src/xpwidgets/nsBaseWidget.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTColumn.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTControlStripItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTDataModel.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsImageButton.cpp
|
||||
mozilla/widget/src/xpwidgets/nsMenuButton.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbar.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbarItemHolder.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbarManager.cpp
|
||||
mozilla/widget/src/xpwidgets/nsTreeView.cpp
|
||||
BIN
mozilla/widget/macbuild/widgetIDL.mcp
Normal file
BIN
mozilla/widget/macbuild/widgetIDL.mcp
Normal file
Binary file not shown.
23
mozilla/widget/makefile.win
Normal file
23
mozilla/widget/makefile.win
Normal file
@@ -0,0 +1,23 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..
|
||||
|
||||
|
||||
DIRS=public timer src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
33
mozilla/widget/public/MANIFEST
Normal file
33
mozilla/widget/public/MANIFEST
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:widget directory
|
||||
#
|
||||
|
||||
nsIDragSessionMac.h
|
||||
nsIWidget.h
|
||||
nsIKBStateControl.h
|
||||
nsIButton.h
|
||||
nsICheckButton.h
|
||||
nsIListWidget.h
|
||||
nsIComboBox.h
|
||||
nsITextWidget.h
|
||||
nsITextAreaWidget.h
|
||||
nsIComboBox.h
|
||||
nsIListBox.h
|
||||
nsIScrollbar.h
|
||||
nsGUIEvent.h
|
||||
nsIRadioButton.h
|
||||
nsIMouseListener.h
|
||||
nsIEventListener.h
|
||||
nsIFileWidget.h
|
||||
nsIMenuListener.h
|
||||
nsWidgetsCID.h
|
||||
nsILabel.h
|
||||
nsILookAndFeel.h
|
||||
nsWidgetSupport.h
|
||||
nsIMenu.h
|
||||
nsIMenuBar.h
|
||||
nsIMenuItem.h
|
||||
nsIPopUpMenu.h
|
||||
nsIKeyBindMgr.h
|
||||
nsStringUtil.h
|
||||
nsIContextMenu.h
|
||||
16
mozilla/widget/public/MANIFEST_IDL
Normal file
16
mozilla/widget/public/MANIFEST_IDL
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:idl directory
|
||||
#
|
||||
|
||||
nsIAppShell.idl
|
||||
nsIFilePicker.idl
|
||||
nsIFileSpecWithUI.idl
|
||||
nsISound.idl
|
||||
nsIToolkit.idl
|
||||
nsITransferable.idl
|
||||
nsIDragSession.idl
|
||||
nsIDragService.idl
|
||||
nsIFormatConverter.idl
|
||||
nsIClipboard.idl
|
||||
nsIClipboardOwner.idl
|
||||
nsIRollupListener.idl
|
||||
92
mozilla/widget/public/Makefile.in
Normal file
92
mozilla/widget/public/Makefile.in
Normal file
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = raptor
|
||||
XPIDL_MODULE = widget
|
||||
|
||||
EXPORTS = \
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIFileWidget.h \
|
||||
nsStringUtil.h \
|
||||
nsIKBStateControl.h \
|
||||
nsIButton.h \
|
||||
nsICheckButton.h \
|
||||
nsIListWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsITextWidget.h \
|
||||
nsITextAreaWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsIListBox.h \
|
||||
nsIScrollbar.h \
|
||||
nsGUIEvent.h \
|
||||
nsIRadioButton.h \
|
||||
nsIMouseListener.h \
|
||||
nsIEventListener.h \
|
||||
nsIMenuListener.h \
|
||||
nsWidgetsCID.h \
|
||||
nsILookAndFeel.h \
|
||||
nsILabel.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIContextMenu.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAppShell.idl \
|
||||
nsIFilePicker.idl \
|
||||
nsIFileSpecWithUI.idl \
|
||||
nsIToolkit.idl \
|
||||
nsISound.idl \
|
||||
nsITransferable.idl \
|
||||
nsIDragSession.idl \
|
||||
nsIDragService.idl \
|
||||
nsIFormatConverter.idl \
|
||||
nsIClipboard.idl \
|
||||
nsIClipboardOwner.idl \
|
||||
nsIRollupListener.idl \
|
||||
nsIWidget.idl \
|
||||
nsIWindow.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_UI
|
||||
|
||||
78
mozilla/widget/public/makefile.win
Normal file
78
mozilla/widget/public/makefile.win
Normal file
@@ -0,0 +1,78 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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):
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
|
||||
DEFINES=-D_IMPL_NS_UI
|
||||
MODULE=raptor
|
||||
XPIDL_MODULE=widget
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIAppShell.idl \
|
||||
.\nsIFilePicker.idl \
|
||||
.\nsIFileSpecWithUI.idl \
|
||||
.\nsISound.idl \
|
||||
.\nsIToolkit.idl \
|
||||
.\nsITransferable.idl \
|
||||
.\nsIDragSession.idl \
|
||||
.\nsIDragService.idl \
|
||||
.\nsIFormatConverter.idl \
|
||||
.\nsIClipboard.idl \
|
||||
.\nsIClipboardOwner.idl \
|
||||
.\nsIRollupListener.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS=\
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIFileWidget.h \
|
||||
nsIWidget.h \
|
||||
nsIKBStateControl.h \
|
||||
nsIButton.h \
|
||||
nsICheckButton.h \
|
||||
nsIListWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsITextWidget.h \
|
||||
nsITextAreaWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsIListBox.h \
|
||||
nsIScrollbar.h \
|
||||
nsGUIEvent.h \
|
||||
nsIRadioButton.h \
|
||||
nsIMouseListener.h \
|
||||
nsIEventListener.h \
|
||||
nsIMenuListener.h \
|
||||
nsWidgetsCID.h \
|
||||
nsStringUtil.h \
|
||||
nsILookAndFeel.h \
|
||||
nsILabel.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIContextMenu.h \
|
||||
nsIPopUpMenu.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
509
mozilla/widget/public/nsGUIEvent.h
Normal file
509
mozilla/widget/public/nsGUIEvent.h
Normal file
@@ -0,0 +1,509 @@
|
||||
/* -*- 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 nsGUIEvent_h__
|
||||
#define nsGUIEvent_h__
|
||||
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIRenderingContext;
|
||||
class nsIRegion;
|
||||
class nsIWidget;
|
||||
class nsIMenuItem;
|
||||
|
||||
/**
|
||||
* Return status for event processors.
|
||||
*/
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
/**
|
||||
* General event
|
||||
*/
|
||||
|
||||
struct nsEvent {
|
||||
/// See event struct types
|
||||
PRUint8 eventStructType;
|
||||
/// See GUI MESSAGES,
|
||||
PRUint32 message;
|
||||
/// in widget relative coordinates, modified to be relative to current view in layout.
|
||||
nsPoint point;
|
||||
// in widget relative coordinates, not modified by layout code.
|
||||
nsPoint 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;
|
||||
};
|
||||
|
||||
/**
|
||||
* General graphic user interface event
|
||||
*/
|
||||
|
||||
struct nsGUIEvent : public nsEvent {
|
||||
/// Originator of the event
|
||||
nsIWidget* widget;
|
||||
/// Internal platform specific message.
|
||||
void* nativeMsg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window resize event
|
||||
*/
|
||||
|
||||
struct nsSizeEvent : public nsGUIEvent {
|
||||
/// x,y width, height in pixels (client area)
|
||||
nsRect *windowSize;
|
||||
/// width of entire window (in pixels)
|
||||
PRInt32 mWinWidth;
|
||||
/// height of entire window (in pixels)
|
||||
PRInt32 mWinHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window repaint event
|
||||
*/
|
||||
|
||||
struct nsPaintEvent : public nsGUIEvent {
|
||||
/// Context to paint in.
|
||||
nsIRenderingContext *renderingContext;
|
||||
/// area to paint (should be used instead of rect)
|
||||
nsIRegion *region;
|
||||
/// x,y, width, height in pixels of area to paint
|
||||
nsRect *rect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar event
|
||||
*/
|
||||
|
||||
struct nsScrollbarEvent : public nsGUIEvent {
|
||||
/// ranges between scrollbar 0 and (maxRange - thumbSize). See nsIScrollbar
|
||||
PRUint32 position;
|
||||
};
|
||||
|
||||
|
||||
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 : public nsInputEvent {
|
||||
/// The number of mouse clicks
|
||||
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 : public nsInputEvent {
|
||||
/// see NS_VK codes
|
||||
PRUint32 keyCode;
|
||||
/// OS translated Unicode char
|
||||
PRUint32 charCode;
|
||||
// indicates whether the event signifies a printable character
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
/**
|
||||
* IME Related Events
|
||||
*/
|
||||
struct nsTextRange {
|
||||
PRUint32 mStartOffset;
|
||||
PRUint32 mEndOffset;
|
||||
PRUint32 mRangeType;
|
||||
};
|
||||
|
||||
typedef struct nsTextRange nsTextRange;
|
||||
typedef nsTextRange* nsTextRangeArray;
|
||||
|
||||
struct nsTextEventReply {
|
||||
nsPoint mCursorPosition;
|
||||
PRBool mCursorIsCollapsed;
|
||||
};
|
||||
|
||||
typedef struct nsTextEventReply nsTextEventReply;
|
||||
|
||||
struct nsTextEvent : public nsInputEvent {
|
||||
PRUnichar* theText;
|
||||
nsTextEventReply theReply;
|
||||
PRUint32 rangeCount;
|
||||
nsTextRangeArray rangeArray;
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
struct nsCompositionEvent : public nsInputEvent {
|
||||
PRUint32 compositionMessage;
|
||||
nsTextEventReply theReply;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tooltip event
|
||||
*/
|
||||
struct nsTooltipEvent : public nsGUIEvent {
|
||||
/// Index of tooltip area which generated the event. @see SetTooltips in nsIWidget
|
||||
PRUint32 tipIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem event
|
||||
*
|
||||
* When this event occurs the widget field in nsGUIEvent holds the "target"
|
||||
* for the event
|
||||
*/
|
||||
|
||||
struct nsMenuEvent : public nsGUIEvent {
|
||||
nsIMenuItem * mMenuItem;
|
||||
PRUint32 mCommand;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event status for D&D Event
|
||||
*/
|
||||
enum nsDragDropEventStatus {
|
||||
/// The event is a enter
|
||||
nsDragDropEventStatus_eDragEntered,
|
||||
/// The event is exit
|
||||
nsDragDropEventStatus_eDragExited,
|
||||
/// The event is drop
|
||||
nsDragDropEventStatus_eDrop
|
||||
};
|
||||
|
||||
/**
|
||||
* Event Struct Types
|
||||
*/
|
||||
#define NS_EVENT 1
|
||||
#define NS_GUI_EVENT 2
|
||||
#define NS_SIZE_EVENT 3
|
||||
#define NS_PAINT_EVENT 4
|
||||
#define NS_SCROLLBAR_EVENT 5
|
||||
#define NS_INPUT_EVENT 6
|
||||
#define NS_KEY_EVENT 7
|
||||
#define NS_MOUSE_EVENT 8
|
||||
|
||||
#define NS_MENU_EVENT 10
|
||||
#define NS_DRAGDROP_EVENT 11
|
||||
#define NS_TEXT_EVENT 12
|
||||
#define NS_COMPOSITION_START 13
|
||||
#define NS_COMPOSITION_END 14
|
||||
|
||||
/**
|
||||
* GUI MESSAGES
|
||||
*/
|
||||
//@{
|
||||
|
||||
#define NS_WINDOW_START 100
|
||||
|
||||
// Widget is being created
|
||||
#define NS_CREATE (NS_WINDOW_START)
|
||||
// Widget is being destroyed
|
||||
#define NS_DESTROY (NS_WINDOW_START + 1)
|
||||
// Widget was resized
|
||||
#define NS_SIZE (NS_WINDOW_START + 2)
|
||||
// Widget gained focus
|
||||
#define NS_GOTFOCUS (NS_WINDOW_START + 3)
|
||||
// Widget lost focus
|
||||
#define NS_LOSTFOCUS (NS_WINDOW_START + 4)
|
||||
// Widget got activated
|
||||
#define NS_ACTIVATE (NS_WINDOW_START + 5)
|
||||
// Widget got deactivated
|
||||
#define NS_DEACTIVATE (NS_WINDOW_START + 6)
|
||||
// Widget needs to be repainted
|
||||
#define NS_PAINT (NS_WINDOW_START + 30)
|
||||
// Key is pressed within a window
|
||||
#define NS_KEY_PRESS (NS_WINDOW_START + 31)
|
||||
// Key is released within a window
|
||||
#define NS_KEY_UP (NS_WINDOW_START + 32)
|
||||
// Key is pressed within a window
|
||||
#define NS_KEY_DOWN (NS_WINDOW_START + 33)
|
||||
// Window has been moved to a new location.
|
||||
// The events point contains the x, y location in screen coordinates
|
||||
#define NS_MOVE (NS_WINDOW_START + 34)
|
||||
|
||||
// Tab control's selected tab has changed
|
||||
#define NS_TABCHANGE (NS_WINDOW_START + 35)
|
||||
|
||||
|
||||
|
||||
// Menu item selected
|
||||
#define NS_MENU_SELECTED (NS_WINDOW_START + 38)
|
||||
|
||||
// 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
|
||||
#define NS_DISPLAYCHANGED (NS_WINDOW_START + 40)
|
||||
|
||||
|
||||
#define NS_MOUSE_MESSAGE_START 300
|
||||
#define NS_MOUSE_MOVE (NS_MOUSE_MESSAGE_START)
|
||||
#define NS_MOUSE_LEFT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 1)
|
||||
#define NS_MOUSE_LEFT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 2)
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_UP (NS_MOUSE_MESSAGE_START + 10)
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 11)
|
||||
#define NS_MOUSE_RIGHT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 20)
|
||||
#define NS_MOUSE_RIGHT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 21)
|
||||
#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_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)
|
||||
|
||||
// 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)
|
||||
//@}
|
||||
|
||||
|
||||
#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_MOVE))
|
||||
|
||||
#define NS_IS_KEY_EVENT(evnt) \
|
||||
(((evnt)->message == NS_KEY_DOWN) || \
|
||||
((evnt)->message == NS_KEY_PRESS) || \
|
||||
((evnt)->message == NS_KEY_UP))
|
||||
|
||||
/*
|
||||
* Virtual key bindings for keyboard events
|
||||
* NOTE: These are repeated in nsIDOMEvent.h and must be kept in sync
|
||||
*/
|
||||
|
||||
#define NS_VK_CANCEL 0x03
|
||||
#define NS_VK_BACK 0x08
|
||||
#define NS_VK_TAB 0x09
|
||||
#define NS_VK_CLEAR 0x0C
|
||||
#define NS_VK_RETURN 0x0D
|
||||
#define NS_VK_ENTER 0x0E
|
||||
#define NS_VK_SHIFT 0x10
|
||||
#define NS_VK_CONTROL 0x11
|
||||
#define NS_VK_ALT 0x12
|
||||
#define NS_VK_PAUSE 0x13
|
||||
#define NS_VK_CAPS_LOCK 0x14
|
||||
#define NS_VK_ESCAPE 0x1B
|
||||
#define NS_VK_SPACE 0x20
|
||||
#define NS_VK_PAGE_UP 0x21
|
||||
#define NS_VK_PAGE_DOWN 0x22
|
||||
#define NS_VK_END 0x23
|
||||
#define NS_VK_HOME 0x24
|
||||
#define NS_VK_LEFT 0x25
|
||||
#define NS_VK_UP 0x26
|
||||
#define NS_VK_RIGHT 0x27
|
||||
#define NS_VK_DOWN 0x28
|
||||
#define NS_VK_PRINTSCREEN 0x2C
|
||||
#define NS_VK_INSERT 0x2D
|
||||
#define NS_VK_DELETE 0x2E
|
||||
|
||||
// NS_VK_0 - NS_VK_9 match their ascii values
|
||||
#define NS_VK_0 0x30
|
||||
#define NS_VK_1 0x31
|
||||
#define NS_VK_2 0x32
|
||||
#define NS_VK_3 0x33
|
||||
#define NS_VK_4 0x34
|
||||
#define NS_VK_5 0x35
|
||||
#define NS_VK_6 0x36
|
||||
#define NS_VK_7 0x37
|
||||
#define NS_VK_8 0x38
|
||||
#define NS_VK_9 0x39
|
||||
|
||||
#define NS_VK_SEMICOLON 0x3B
|
||||
#define NS_VK_EQUALS 0x3D
|
||||
|
||||
// NS_VK_A - NS_VK_Z match their ascii values
|
||||
#define NS_VK_A 0x41
|
||||
#define NS_VK_B 0x42
|
||||
#define NS_VK_C 0x43
|
||||
#define NS_VK_D 0x44
|
||||
#define NS_VK_E 0x45
|
||||
#define NS_VK_F 0x46
|
||||
#define NS_VK_G 0x47
|
||||
#define NS_VK_H 0x48
|
||||
#define NS_VK_I 0x49
|
||||
#define NS_VK_J 0x4A
|
||||
#define NS_VK_K 0x4B
|
||||
#define NS_VK_L 0x4C
|
||||
#define NS_VK_M 0x4D
|
||||
#define NS_VK_N 0x4E
|
||||
#define NS_VK_O 0x4F
|
||||
#define NS_VK_P 0x50
|
||||
#define NS_VK_Q 0x51
|
||||
#define NS_VK_R 0x52
|
||||
#define NS_VK_S 0x53
|
||||
#define NS_VK_T 0x54
|
||||
#define NS_VK_U 0x55
|
||||
#define NS_VK_V 0x56
|
||||
#define NS_VK_W 0x57
|
||||
#define NS_VK_X 0x58
|
||||
#define NS_VK_Y 0x59
|
||||
#define NS_VK_Z 0x5A
|
||||
|
||||
#define NS_VK_NUMPAD0 0x60
|
||||
#define NS_VK_NUMPAD1 0x61
|
||||
#define NS_VK_NUMPAD2 0x62
|
||||
#define NS_VK_NUMPAD3 0x63
|
||||
#define NS_VK_NUMPAD4 0x64
|
||||
#define NS_VK_NUMPAD5 0x65
|
||||
#define NS_VK_NUMPAD6 0x66
|
||||
#define NS_VK_NUMPAD7 0x67
|
||||
#define NS_VK_NUMPAD8 0x68
|
||||
#define NS_VK_NUMPAD9 0x69
|
||||
#define NS_VK_MULTIPLY 0x6A
|
||||
#define NS_VK_ADD 0x6B
|
||||
#define NS_VK_SEPARATOR 0x6C
|
||||
#define NS_VK_SUBTRACT 0x6D
|
||||
#define NS_VK_DECIMAL 0x6E
|
||||
#define NS_VK_DIVIDE 0x6F
|
||||
#define NS_VK_F1 0x70
|
||||
#define NS_VK_F2 0x71
|
||||
#define NS_VK_F3 0x72
|
||||
#define NS_VK_F4 0x73
|
||||
#define NS_VK_F5 0x74
|
||||
#define NS_VK_F6 0x75
|
||||
#define NS_VK_F7 0x76
|
||||
#define NS_VK_F8 0x77
|
||||
#define NS_VK_F9 0x78
|
||||
#define NS_VK_F10 0x79
|
||||
#define NS_VK_F11 0x7A
|
||||
#define NS_VK_F12 0x7B
|
||||
#define NS_VK_F13 0x7C
|
||||
#define NS_VK_F14 0x7D
|
||||
#define NS_VK_F15 0x7E
|
||||
#define NS_VK_F16 0x7F
|
||||
#define NS_VK_F17 0x80
|
||||
#define NS_VK_F18 0x81
|
||||
#define NS_VK_F19 0x82
|
||||
#define NS_VK_F20 0x83
|
||||
#define NS_VK_F21 0x84
|
||||
#define NS_VK_F22 0x85
|
||||
#define NS_VK_F23 0x86
|
||||
#define NS_VK_F24 0x87
|
||||
|
||||
#define NS_VK_NUM_LOCK 0x90
|
||||
#define NS_VK_SCROLL_LOCK 0x91
|
||||
|
||||
#define NS_VK_COMMA 0xBC
|
||||
#define NS_VK_PERIOD 0xBE
|
||||
#define NS_VK_SLASH 0xBF
|
||||
#define NS_VK_BACK_QUOTE 0xC0
|
||||
#define NS_VK_OPEN_BRACKET 0xDB
|
||||
#define NS_VK_BACK_SLASH 0xDC
|
||||
#define NS_VK_CLOSE_BRACKET 0xDD
|
||||
#define NS_VK_QUOTE 0xDE
|
||||
|
||||
#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
|
||||
|
||||
// IME Constants -- keep in synch with nsIDOMTextRange.h
|
||||
#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__
|
||||
|
||||
122
mozilla/widget/public/nsIAppShell.idl
Normal file
122
mozilla/widget/public/nsIAppShell.idl
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- 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>
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
native int(int);
|
||||
[ptr] native nsDispatchListener(nsDispatchListener);
|
||||
[ptr] native nsIEventQueue(nsIEventQueue);
|
||||
[ptr] native UndefinednsIWidget(nsIWidget);
|
||||
[ref] native PRBoolRef(PRBool);
|
||||
[ref] native voidStarRef(void *);
|
||||
|
||||
%{ C++
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
/**
|
||||
* Flags for the getNativeData function.
|
||||
* See GetNativeData()
|
||||
*/
|
||||
#define NS_NATIVE_SHELL 0
|
||||
|
||||
/**
|
||||
* During the nsIAppShell Run method notify this listener
|
||||
* after each message dispatch.
|
||||
* @see SetDispatchListener member function of nsIAppShell
|
||||
*/
|
||||
class nsDispatchListener {
|
||||
public:
|
||||
virtual void AfterDispatch() = 0;
|
||||
};
|
||||
|
||||
class nsIWidget;
|
||||
%}
|
||||
|
||||
|
||||
[uuid(a0757c31-eeac-11d1-9ec1-00aa002fb821)]
|
||||
interface nsIAppShell : nsISupports
|
||||
{
|
||||
/**
|
||||
* Creates an application shell
|
||||
*/
|
||||
|
||||
void Create(inout int argc, inout string argv);
|
||||
|
||||
/**
|
||||
* Enter an event loop.
|
||||
* Don't leave until application exits.
|
||||
*/
|
||||
|
||||
void Run();
|
||||
|
||||
/**
|
||||
* Prepare to process events.
|
||||
*/
|
||||
|
||||
void Spinup();
|
||||
|
||||
/**
|
||||
* Prepare to stop processing events.
|
||||
*/
|
||||
|
||||
void Spindown();
|
||||
|
||||
/**
|
||||
* An event queue has been created or destroyed. Hook or unhook it from
|
||||
* your system, as necessary.
|
||||
* @param aQueue the queue in question
|
||||
* @param aListen PR_TRUE for a new queue wanting hooking up. PR_FALSE
|
||||
* for a queue wanting to be unhooked.
|
||||
*/
|
||||
void ListenToEventQueue(in nsIEventQueue aQueue, in PRBool aListen);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void GetNativeEvent(in PRBoolRef aRealEvent, in voidStarRef aEvent);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void DispatchNativeEvent(in PRBool aRealEvent, in voidStar aEvent);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void SetDispatchListener(in nsDispatchListener aDispatchListener);
|
||||
|
||||
/**
|
||||
* Exit the handle event loop
|
||||
*/
|
||||
|
||||
void Exit();
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIAppShell_h__
|
||||
|
||||
|
||||
63
mozilla/widget/public/nsIButton.h
Normal file
63
mozilla/widget/public/nsIButton.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- 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 nsIButton_h__
|
||||
#define nsIButton_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {18032AD0-B265-11d1-AA2A-000000000000}
|
||||
#define NS_IBUTTON_IID \
|
||||
{ 0x18032ad0, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
* Push button widget.
|
||||
* Automatically shows itself as depressed when clicked on.
|
||||
*/
|
||||
class nsIButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the label
|
||||
*
|
||||
* @param Set the label to aText
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
81
mozilla/widget/public/nsICheckButton.h
Normal file
81
mozilla/widget/public/nsICheckButton.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- 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 nsICheckButton_h__
|
||||
#define nsICheckButton_h__
|
||||
|
||||
// {961085F5-BD28-11d1-97EF-00609703C14E}
|
||||
#define NS_ICHECKBUTTON_IID \
|
||||
{ 0x961085f5, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
/**
|
||||
* Checkbox widget.
|
||||
* Can show itself in a checked or unchecked state.
|
||||
* The checkbox widget does not automatically show itself checked or unchecked when clicked on.
|
||||
*/
|
||||
class nsICheckButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHECKBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the button label
|
||||
*
|
||||
* @param aText button label
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Set the check state.
|
||||
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetState(const PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Get the check state.
|
||||
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetState(PRBool& aState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsICheckButton_h__
|
||||
|
||||
88
mozilla/widget/public/nsIClipboard.idl
Normal file
88
mozilla/widget/public/nsIClipboard.idl
Normal file
@@ -0,0 +1,88 @@
|
||||
/* -*- Mode: IDL; 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 "nsISupportsArray.idl"
|
||||
#include "nsITransferable.idl"
|
||||
#include "nsIClipboardOwner.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BA-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsIClipboard : nsISupports
|
||||
{
|
||||
/**
|
||||
* Given a transferable, set the data on the native clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @param anOwner The owner of the transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void setData ( in nsITransferable aTransferable, in nsIClipboardOwner anOwner) ;
|
||||
|
||||
/**
|
||||
* Given a transferable, get the clipboard data.
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void getData ( in nsITransferable aTransferable ) ;
|
||||
|
||||
/**
|
||||
* This empties the clipboard and notifies the clipboard owner.
|
||||
* This empties the "logical" clipboard. It does not clear the native clipboard.
|
||||
*
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
|
||||
void emptyClipboard ( ) ;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
|
||||
void forceDataToClipboard ( ) ;
|
||||
|
||||
/**
|
||||
* This provides a way to give correct UI feedback about, for instance, a paste
|
||||
* should be allowed. 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.
|
||||
*
|
||||
* @aFlavorList - nsISupportsString's in a nsISupportsArray (for JavaScript).
|
||||
* @outResult - if data is present matching one of
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
boolean hasDataMatchingFlavors ( in nsISupportsArray aFlavorList ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
45
mozilla/widget/public/nsIClipboardOwner.idl
Normal file
45
mozilla/widget/public/nsIClipboardOwner.idl
Normal file
@@ -0,0 +1,45 @@
|
||||
/* -*- Mode: IDL; 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 "nsITransferable.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(5A31C7A1-E122-11d2-9A57-000064657374)]
|
||||
interface nsIClipboardOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the owner of the clipboard transferable that the
|
||||
* transferable is being removed from the clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void LosingOwnership ( in nsITransferable aTransferable ) ;
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
141
mozilla/widget/public/nsIComboBox.h
Normal file
141
mozilla/widget/public/nsIComboBox.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- 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 nsIComboBox_h__
|
||||
#define nsIComboBox_h__
|
||||
|
||||
#include "nsIListWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {961085F6-BD28-11d1-97EF-00609703C14E}
|
||||
#define NS_ICOMBOBOX_IID \
|
||||
{ 0x961085f6, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Initialize combobox data
|
||||
*/
|
||||
|
||||
struct nsComboBoxInitData : public nsWidgetInitData {
|
||||
nsComboBoxInitData()
|
||||
: mDropDownHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
PRUint32 mDropDownHeight; // in pixels
|
||||
};
|
||||
|
||||
/**
|
||||
* Single selection drop down list. See nsIListWidget for capabilities
|
||||
*/
|
||||
|
||||
class nsIComboBox : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMBOBOX_IID);
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIComboBox_h__
|
||||
|
||||
|
||||
|
||||
148
mozilla/widget/public/nsIContextMenu.h
Normal file
148
mozilla/widget/public/nsIContextMenu.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* -*- 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 nsIContextMenu_h__
|
||||
#define nsIContextMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
class nsIMenuItem;
|
||||
class nsIMenuListener;
|
||||
|
||||
//Generate this!
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_ICONTEXTMENU_IID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Menu widget
|
||||
*/
|
||||
class nsIContextMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTEXTMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the context menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment, const nsString& anAnchorAlignment) = 0;
|
||||
|
||||
/**
|
||||
* Get the context menu's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds a context menu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsISupports* aItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of context menu items
|
||||
* This does count separators as items
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu or Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void** aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set location
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
70
mozilla/widget/public/nsIDragService.idl
Normal file
70
mozilla/widget/public/nsIDragService.idl
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- Mode: IDL; 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 "nsISupportsArray.idl"
|
||||
#include "nsIDragSession.idl"
|
||||
#include "nsIScriptableRegion.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BB-DB01-11d2-96CE-0060B0FB9956)]
|
||||
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 aTransferables - an array of transferables to be dragged
|
||||
* @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 nsISupportsArray aTransferables,
|
||||
in nsIScriptableRegion 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 ( ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
80
mozilla/widget/public/nsIDragSession.idl
Normal file
80
mozilla/widget/public/nsIDragSession.idl
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: IDL; 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 "nsISupportsArray.idl"
|
||||
#include "nsITransferable.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsSize.h"
|
||||
%}
|
||||
|
||||
native nsSize (nsSize);
|
||||
|
||||
|
||||
[scriptable, uuid(CBA22C53-FCCE-11d2-96D4-0060B0FB9956)]
|
||||
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
|
||||
*/
|
||||
attribute nsSize targetSize;
|
||||
|
||||
/**
|
||||
* Get the number items that were dropped
|
||||
*/
|
||||
readonly attribute unsigned long numDropItems;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @result NS_OK if if the data flavor is supported and, NS_ERROR_FAILURE is it is not
|
||||
*/
|
||||
boolean isDataFlavorSupported ( in string aDataFlavor ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
51
mozilla/widget/public/nsIDragSessionMac.h
Normal file
51
mozilla/widget/public/nsIDragSessionMac.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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 nsIDragSessionMac_h__
|
||||
#define nsIDragSessionMac_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include <Drag.h>
|
||||
|
||||
|
||||
#define NS_IDRAGSESSIONMAC_IID \
|
||||
{ 0x36c4c380, 0x09e2, 0x11d3, { 0xb0, 0x33, 0xa4, 0x20, 0xf4, 0x2c, 0xfd, 0x7c } };
|
||||
|
||||
|
||||
class nsIDragSessionMac : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDRAGSESSIONMAC_IID)
|
||||
|
||||
/**
|
||||
* Since the drag may originate in an external application, we need some way of
|
||||
* communicating the DragManager's DragRef to the session so it can use it
|
||||
* when filling in data requests.
|
||||
*
|
||||
* @param aDragRef the MacOS DragManager's ref number for the current drag
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetDragReference ( DragReference aDragRef ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
52
mozilla/widget/public/nsIEventListener.h
Normal file
52
mozilla/widget/public/nsIEventListener.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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 nsIEventListener_h__
|
||||
#define nsIEventListener_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
/**
|
||||
* Event listener interface.
|
||||
* Alternative to a callback for recieving events.
|
||||
*/
|
||||
|
||||
// {c83f6b80-d7ce-11d2-8360-c4c894c4917c}
|
||||
#define NS_IEVENTLISTENER_IID \
|
||||
{ 0xc83f6b80, 0xd7ce, 0x11d2, { 0x83, 0x60, 0xc4, 0xc8, 0x94, 0xc4, 0x91, 0x7c } }
|
||||
|
||||
class nsIEventListener : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes all events.
|
||||
* If a mouse listener is registered this method will not process mouse events.
|
||||
* @param anEvent the event to process. See nsGUIEvent.h for event types.
|
||||
*/
|
||||
|
||||
virtual nsEventStatus ProcessEvent(const nsGUIEvent & anEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIEventListener_h__
|
||||
75
mozilla/widget/public/nsIFileDialogsMgr.h
Normal file
75
mozilla/widget/public/nsIFileDialogsMgr.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
#ifndef nsIFileDialogsMgr_h__
|
||||
#define nsIFileDialogsMgr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
// {0ef98781-e34b-11d2-b345-00a0cc3c1cde}
|
||||
#define NS_IFILEDIALOGSMGR_IID \
|
||||
{ 0xef98781, 0xe34b, 0x11d2, { 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
#define NS_FILEDIALOGSMGR_CID \
|
||||
{ 0xef98784, 0xe34b, 0x11d2, { 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
enum nsFileDlgResults {
|
||||
nsFileDlgResults_Cancel, // User hit cancel, ignore selection
|
||||
nsFileDlgResults_OK, // User hit Ok, process selection
|
||||
nsFileDlgResults_Replace // User acknowledged file already exists so ok to replace, process selection
|
||||
};
|
||||
|
||||
/**
|
||||
* (native) File Dialogs utility.
|
||||
* Provides an XP wrapper to platform native file dialogs:
|
||||
* GetFile - Presents a file browser and returns an nsFileSpec for the selected file
|
||||
* GetFolder - Presents a folder/path selection dialog and returns an nsFileSpec
|
||||
* PutFile - Presents a file save dialog to the user and returns an nsFileSpec with
|
||||
* the name and path to save the file
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIFileDialogsMgr : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILEDIALOGSMGR_IID)
|
||||
|
||||
NS_IMETHOD GetFile(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the file selection dialog prompt
|
||||
const nsString * promptString, // Window title for file selection dialog
|
||||
void * filterList) = 0;
|
||||
|
||||
NS_IMETHOD GetFolder(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the folder selection dialog prompt
|
||||
const nsString * promptString) = 0; // Window title for folder selection dialog
|
||||
|
||||
NS_IMETHOD PutFile(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the file save dialog prompt
|
||||
const nsString * promptString) = 0; // Window title for file save dialog
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIFileDialogsMgr_h__
|
||||
96
mozilla/widget/public/nsIFilePicker.idl
Normal file
96
mozilla/widget/public/nsIFilePicker.idl
Normal file
@@ -0,0 +1,96 @@
|
||||
/* -*- 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>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, uuid(c47de916-1dd1-11b2-8141-82507fa02b21)]
|
||||
interface nsIFilePicker : nsISupports
|
||||
{
|
||||
const short modeLoad = 0; // Load a file or directory
|
||||
const short modeSave = 1; // Save a file or directory
|
||||
const short modeGetFolder = 2; // Select a fodler/directory
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Create the file widget.
|
||||
*
|
||||
* @param parent nsIDOMWindow 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 create(in nsIDOMWindow parent, in wstring title, in short mode);
|
||||
|
||||
/**
|
||||
* Set the list of file filters
|
||||
*
|
||||
* @param titles array of filter titles
|
||||
* @param filters array of filters to associate with titles
|
||||
* @param numberOfFilters number of filters.
|
||||
*
|
||||
*/
|
||||
void setFilterList(in long numberOfFilters,
|
||||
[array, size_is(numberOfFilters)] in wstring titles,
|
||||
[array, size_is(numberOfFilters)] in wstring filters);
|
||||
|
||||
/**
|
||||
* Get the index into the filter list for the type of file the user wants to save
|
||||
*
|
||||
* @param selectedFilter the index of the selected item in the filter list
|
||||
*
|
||||
*/
|
||||
readonly attribute long selectedFilter;
|
||||
|
||||
/* 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 nsIFileSpec displayDirectory;
|
||||
|
||||
|
||||
/**
|
||||
* Get the nsFileSpec for the file or directory.
|
||||
*
|
||||
* @return Returns the file currently selected
|
||||
*/
|
||||
readonly attribute nsIFileSpec file;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return returnOK if the user selects OK, returnCancel if the user selects cancel
|
||||
*
|
||||
*/
|
||||
short show();
|
||||
};
|
||||
112
mozilla/widget/public/nsIFileSpecWithUI.idl
Normal file
112
mozilla/widget/public/nsIFileSpecWithUI.idl
Normal file
@@ -0,0 +1,112 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
// This is the only correct cross-platform way to specify a file.
|
||||
// Strings are not such a way. If you grew up on windows or unix, you
|
||||
// may think they are. Welcome to reality.
|
||||
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
%{C++
|
||||
#include "nscore.h" // for NS_WIDGET
|
||||
#include "nsIComponentManager.h"
|
||||
%}
|
||||
native StandardFilterMask(nsIFileSpecWithUI::StandardFilterMask);
|
||||
|
||||
[scriptable, uuid(8ddf7681-139a-11d3-915f-dc1f8c138b7c)]
|
||||
interface nsIFileSpecWithUI : nsIFileSpec
|
||||
{
|
||||
%{C++
|
||||
//
|
||||
// The "choose" functions present the file picker UI in order to set the
|
||||
// value of the file spec.
|
||||
%}
|
||||
|
||||
%{C++
|
||||
// The mask for standard filters is given as follows:
|
||||
enum StandardFilterMask
|
||||
{
|
||||
eAllReadable = (1<<0)
|
||||
, eHTMLFiles = (1<<1)
|
||||
, eXMLFiles = (1<<2)
|
||||
, eImageFiles = (1<<3)
|
||||
, eMailFiles = (1<<4)
|
||||
, eTextFiles = (1<<5)
|
||||
, eAllFiles = (1<<6)
|
||||
|
||||
// Mask containing all the above default filters
|
||||
, eAllStandardFilters = (
|
||||
eAllReadable
|
||||
| eHTMLFiles
|
||||
| eXMLFiles
|
||||
| eImageFiles
|
||||
| eMailFiles
|
||||
| eTextFiles
|
||||
| eAllFiles)
|
||||
, eAllMailOutputFilters = (
|
||||
eHTMLFiles
|
||||
| eMailFiles
|
||||
| eTextFiles)
|
||||
|
||||
// The "extra filter" bit should be set if the "extra filter"
|
||||
// is passed in to chooseInputFile.
|
||||
, eExtraFilter = (1<<31)
|
||||
};
|
||||
enum { kNumStandardFilters = 7, kNumMailFilters = 3 };
|
||||
%}
|
||||
[noscript] void chooseInputFile(
|
||||
in string title
|
||||
, in StandardFilterMask standardFilterMask
|
||||
, in string extraFilterTitle
|
||||
, in string extraFilter
|
||||
);
|
||||
|
||||
[noscript] void chooseOutputFile(in string windowTitle,
|
||||
in string suggestedLeafName,
|
||||
in StandardFilterMask standardFilterMask);
|
||||
|
||||
string chooseFile(in string title);
|
||||
string chooseDirectory(in string title);
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Define Progid and CID
|
||||
// {e3326a80-2816-11d3-a7e5-98cb48c74f3c}
|
||||
#define NS_FILESPECWITHUI_CID \
|
||||
{ 0xe3326a80, 0x2816, 0x11d3, { 0xa7, 0xe5, 0x98, 0xcb, 0x48, 0xc7, 0x4f, 0x3c } }
|
||||
|
||||
#define NS_FILESPECWITHUI_PROGID "component://netscape/filespecwithui"
|
||||
#define NS_FILESPECWITHUI_CLASSNAME "nsIFileSpecWithUI"
|
||||
|
||||
// Factory methods
|
||||
inline nsIFileSpecWithUI* NS_CreateFileSpecWithUI()
|
||||
{
|
||||
nsIFileSpecWithUI* spec = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(
|
||||
(const char*)NS_FILESPECWITHUI_PROGID,
|
||||
(nsISupports*)nsnull,
|
||||
(const nsID&)nsIFileSpecWithUI::GetIID(),
|
||||
(void**)&spec);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a file spec.");
|
||||
return spec;
|
||||
}
|
||||
%}
|
||||
178
mozilla/widget/public/nsIFileWidget.h
Normal file
178
mozilla/widget/public/nsIFileWidget.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/* -*- 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 nsIFileWidget_h__
|
||||
#define nsIFileWidget_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
class nsIWidget;
|
||||
class nsIDeviceContext;
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
|
||||
// {F8030015-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_IFILEWIDGET_IID \
|
||||
{ 0xf8030015, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* File selector mode
|
||||
*/
|
||||
|
||||
enum nsFileDlgMode {
|
||||
/// Load a file or directory
|
||||
eMode_load,
|
||||
/// Save a file or directory
|
||||
eMode_save,
|
||||
/// Select a fodler/directory
|
||||
eMode_getfolder
|
||||
};
|
||||
|
||||
|
||||
enum nsFileDlgResults {
|
||||
nsFileDlgResults_Cancel, // User hit cancel, ignore selection
|
||||
nsFileDlgResults_OK, // User hit Ok, process selection
|
||||
nsFileDlgResults_Replace // User acknowledged file already exists so ok to replace, process selection
|
||||
};
|
||||
|
||||
/**
|
||||
* File selector widget.
|
||||
* Modally selects files for loading or saving from a list.
|
||||
*/
|
||||
|
||||
class nsIFileWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILEWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Create the file filter. This differs from the standard
|
||||
* widget Create method because it passes in the mode
|
||||
*
|
||||
* @param aParent the parent to place this widget into
|
||||
* @param aTitle The title for the file widget
|
||||
* @param aMode load or save
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
void *aInitData = nsnull) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the list of file filters
|
||||
*
|
||||
* @param aNumberOfFilter number of filters.
|
||||
* @param aTitle array of filter titles
|
||||
* @param aFilter array of filters to associate with titles
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[]) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the index into the filter list for the type of file the user wants to save
|
||||
*
|
||||
* @param theType the index into the filter list
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelectedType(PRInt16& theType) = 0;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return PR_TRUE if user selects OK, PR_FALSE if user selects CANCEL
|
||||
*
|
||||
*/
|
||||
|
||||
virtual PRBool Show() = 0;
|
||||
|
||||
/**
|
||||
* Get the nsFileSpec for the file or directory.
|
||||
*
|
||||
* @param aFile on exit it contains the file or directory selected
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the default string that appears in file open/save dialog
|
||||
*
|
||||
* @param aString the name of the file
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDefaultString(const nsString& aString) = 0;
|
||||
|
||||
/**
|
||||
* Set the directory that the file open/save dialog initially displays
|
||||
*
|
||||
* @param aDirectory the name of the directory
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory) = 0;
|
||||
|
||||
/**
|
||||
* Get the directory that the file open/save dialog was last displaying
|
||||
*
|
||||
* @param aDirectory the name of the directory
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory) = 0;
|
||||
|
||||
|
||||
virtual nsFileDlgResults GetFile(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
virtual nsFileDlgResults GetFolder(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
virtual nsFileDlgResults PutFile(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIFileWidget_h__
|
||||
|
||||
51
mozilla/widget/public/nsIFontNameIterator.h
Normal file
51
mozilla/widget/public/nsIFontNameIterator.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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 nsIFontNameIterator_h__
|
||||
#define nsIFontNameIterator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsString;
|
||||
|
||||
// {CEEB39D1-0949-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTNAMEITERATOR_IID \
|
||||
{ 0xceeb39d1, 0x949, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontNameIterator : public nsISupports
|
||||
// Fonts are identified by strings, |Get| and |Advance| are distinct to facility wrapping
|
||||
// with C++ objects as standard iterators.
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTNAMEITERATOR_IID)
|
||||
|
||||
NS_IMETHOD Reset() = 0;
|
||||
// does not need to be called initially, returns iterator to initial state
|
||||
|
||||
NS_IMETHOD Get( nsString* aFontName ) = 0;
|
||||
// returns an error when no more names are available
|
||||
|
||||
NS_IMETHOD Advance() = 0;
|
||||
// returns an error when no more names are available
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
50
mozilla/widget/public/nsIFontRetrieverService.h
Normal file
50
mozilla/widget/public/nsIFontRetrieverService.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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 nsIFontRetrieverService_h__
|
||||
#define nsIFontRetrieverService_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIFontNameIterator;
|
||||
class nsIFontSizeIterator;
|
||||
class nsString;
|
||||
|
||||
// {285EF9B2-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTRETRIEVERSERVICE_IID \
|
||||
{ 0x285ef9b2, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontRetrieverService : public nsISupports
|
||||
// This (singleton) service exists soley as a factory to manufacture iterators
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTRETRIEVERSERVICE_IID)
|
||||
|
||||
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator ) = 0;
|
||||
|
||||
NS_IMETHOD CreateFontSizeIterator( const nsString &aFontName, nsIFontSizeIterator** aIterator ) = 0;
|
||||
|
||||
NS_IMETHOD IsFontScalable( const nsString &aFontName, PRBool* aResult ) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
51
mozilla/widget/public/nsIFontSizeIterator.h
Normal file
51
mozilla/widget/public/nsIFontSizeIterator.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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 nsIFontSizeIterator_h__
|
||||
#define nsIFontSizeIterator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsString;
|
||||
|
||||
// {285EF9B1-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTSIZEITERATOR_IID \
|
||||
{ 0x285ef9b1, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontSizeIterator : public nsISupports
|
||||
// Font sizes are identified with doubles (e.g., for the possibility of fractional sizes from MM, etc.).
|
||||
// |Get| and |Advance| are distinct to facility wrapping with C++ objects as standard iterators.
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTSIZEITERATOR_IID)
|
||||
|
||||
NS_IMETHOD Reset() = 0;
|
||||
// does not need to be called initially, returns iterator to initial state
|
||||
|
||||
NS_IMETHOD Get( double* aFontSize ) = 0;
|
||||
// returns an error when no more sizes are available
|
||||
|
||||
NS_IMETHOD Advance() = 0;
|
||||
// returns an error when no more sizes are available
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
69
mozilla/widget/public/nsIFormatConverter.idl
Normal file
69
mozilla/widget/public/nsIFormatConverter.idl
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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 "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(948A0023-E3A7-11d2-96CF-0060B0FB9956)]
|
||||
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 ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
60
mozilla/widget/public/nsIKeyBindMgr.h
Normal file
60
mozilla/widget/public/nsIKeyBindMgr.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
#ifndef nsIKeyBindMgr_h__
|
||||
#define nsIKeyBindMgr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
// {a91c0821-de58-11d2-b345-00a0cc3c1cde}
|
||||
#define NS_IKEYBINDMGR_IID \
|
||||
{ 0xa91c0821, 0xde58, 0x11d2, \
|
||||
{ 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
// {8B5314BD-DB01-11d2-96CE-0060B0FB9977}
|
||||
#define NS_KEYBINDMGR_CID \
|
||||
{ 0x8b5314bd, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x77 } }
|
||||
|
||||
/**
|
||||
* Keyboard Binding utility.
|
||||
* Given a key event and a DOM node to search executes any 'key' command
|
||||
* that matches the event
|
||||
*/
|
||||
|
||||
class nsIKeyBindMgr : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IKEYBINDMGR_IID)
|
||||
|
||||
NS_IMETHOD ProcessKeyEvent(
|
||||
nsIDOMDocument * domDoc,
|
||||
const nsKeyEvent & theEvent,
|
||||
nsIWebShell * webShell,
|
||||
nsEventStatus & theStatus) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIKeyBindMgr_h__
|
||||
91
mozilla/widget/public/nsILabel.h
Normal file
91
mozilla/widget/public/nsILabel.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- 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 nsILabel_h__
|
||||
#define nsILabel_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/* F3131891-3DC7-11d2-8DB8-00609703C14E */
|
||||
#define NS_ILABEL_IID \
|
||||
{ 0xf3131891, 0x3dc7, 0x11d2, \
|
||||
{ 0x8d, 0xb8, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Label Alignments
|
||||
*/
|
||||
|
||||
enum nsLabelAlignment {
|
||||
eAlign_Right,
|
||||
eAlign_Left,
|
||||
eAlign_Center
|
||||
};
|
||||
|
||||
struct nsLabelInitData : public nsWidgetInitData {
|
||||
nsLabelInitData()
|
||||
: mAlignment(eAlign_Left)
|
||||
{
|
||||
}
|
||||
|
||||
nsLabelAlignment mAlignment;
|
||||
};
|
||||
|
||||
/**
|
||||
* Label widget.
|
||||
* Automatically shows itself as depressed when clicked on.
|
||||
*/
|
||||
class nsILabel : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILABEL_IID)
|
||||
|
||||
/**
|
||||
* Set the label
|
||||
*
|
||||
* @param Set the label to aText
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the Label Alignemnt for creation
|
||||
*
|
||||
* @param aAlignment the alignment
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
183
mozilla/widget/public/nsIListBox.h
Normal file
183
mozilla/widget/public/nsIListBox.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- 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 nsIListBox_h__
|
||||
#define nsIListBox_h__
|
||||
|
||||
#include "nsIListWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030014-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ILISTBOX_IID \
|
||||
{ 0xf8030014, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list box data
|
||||
*/
|
||||
|
||||
struct nsListBoxInitData : public nsWidgetInitData {
|
||||
nsListBoxInitData()
|
||||
: mMultiSelect(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mMultiSelect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Single or multi selection list of items.
|
||||
* Unlike a nsIWidget, The the list widget must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
* The listbox always has a vertical scrollbar. It never has a
|
||||
* horizontal scrollbar.
|
||||
*/
|
||||
|
||||
class nsIListBox : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILISTBOX_IID)
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the listbox to be multi-select.
|
||||
* @param aMultiple PR_TRUE can have multiple selections. PR_FALSE single
|
||||
* selections only.
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections) = 0;
|
||||
|
||||
/**
|
||||
* Return the number of selected items. For single selection list box this
|
||||
* @return the number of selected items
|
||||
* can be 1 or 0.
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedCount() = 0;
|
||||
|
||||
/**
|
||||
* Retrieves the indices of the selected items.
|
||||
* @param aIndices Array to hold the selected items. Use GetSelectedCount to
|
||||
* determine how large the array needs to be.
|
||||
* @param aSize Size of the aIndices array
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Sets the indices of the selected items.
|
||||
* @param aIndices Array to hold the selected items. Use GetSelectedCount to
|
||||
* determine how large the array needs to be.
|
||||
* @param aSize Size of the aIndices array
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIListBox_h__
|
||||
|
||||
|
||||
|
||||
130
mozilla/widget/public/nsIListWidget.h
Normal file
130
mozilla/widget/public/nsIListWidget.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/* -*- 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 nsIListWidget_h__
|
||||
#define nsIListWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030013-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ILISTWIDGET_IID \
|
||||
{ 0xf8030013, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
*
|
||||
* Base class for nsIListBox and nsIComboBox
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIListWidget : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILISTWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIListWidget_h__
|
||||
|
||||
|
||||
|
||||
161
mozilla/widget/public/nsILookAndFeel.h
Normal file
161
mozilla/widget/public/nsILookAndFeel.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 __nsILookAndFeel
|
||||
#define __nsILookAndFeel
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#include "nsSize.h"
|
||||
#endif
|
||||
|
||||
|
||||
// {21B51DE1-21A3-11d2-B6E0-00805F8A2676}
|
||||
#define NS_ILOOKANDFEEL_IID \
|
||||
{ 0x21b51de1, 0x21a3, 0x11d2, \
|
||||
{ 0xb6, 0xe0, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } }
|
||||
|
||||
class nsILookAndFeel: public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILOOKANDFEEL_IID)
|
||||
|
||||
typedef enum {
|
||||
eColor_WindowBackground,
|
||||
eColor_WindowForeground,
|
||||
eColor_WidgetBackground,
|
||||
eColor_WidgetForeground,
|
||||
eColor_WidgetSelectBackground,
|
||||
eColor_WidgetSelectForeground,
|
||||
eColor_Widget3DHighlight,
|
||||
eColor_Widget3DShadow,
|
||||
eColor_TextBackground,
|
||||
eColor_TextForeground,
|
||||
eColor_TextSelectBackground,
|
||||
eColor_TextSelectForeground,
|
||||
|
||||
// New CSS 2 color definitions
|
||||
eColor_activeborder,
|
||||
eColor_activecaption,
|
||||
eColor_appworkspace,
|
||||
eColor_background,
|
||||
eColor_buttonface,
|
||||
eColor_buttonhighlight,
|
||||
eColor_buttonshadow,
|
||||
eColor_buttontext,
|
||||
eColor_captiontext,
|
||||
eColor_graytext,
|
||||
eColor_highlight,
|
||||
eColor_highlighttext,
|
||||
eColor_inactiveborder,
|
||||
eColor_inactivecaption,
|
||||
eColor_inactivecaptiontext,
|
||||
eColor_infobackground,
|
||||
eColor_infotext,
|
||||
eColor_menu,
|
||||
eColor_menutext,
|
||||
eColor_scrollbar,
|
||||
eColor_threeddarkshadow,
|
||||
eColor_threedface,
|
||||
eColor_threedhighlight,
|
||||
eColor_threedlightshadow,
|
||||
eColor_threedshadow,
|
||||
eColor_window,
|
||||
eColor_windowframe,
|
||||
eColor_windowtext
|
||||
|
||||
} nsColorID;
|
||||
|
||||
typedef enum {
|
||||
eMetric_WindowTitleHeight,
|
||||
eMetric_WindowBorderWidth,
|
||||
eMetric_WindowBorderHeight,
|
||||
eMetric_Widget3DBorder,
|
||||
eMetric_TextFieldBorder, // Native border size
|
||||
eMetric_TextFieldHeight,
|
||||
eMetric_TextVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_TextShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_TextHorizontalInsideMinimumPadding,
|
||||
eMetric_TextShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
|
||||
eMetric_ButtonHorizontalInsidePaddingNavQuirks,
|
||||
eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks,
|
||||
eMetric_CheckboxSize,
|
||||
eMetric_RadioboxSize,
|
||||
|
||||
eMetric_ListShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
|
||||
eMetric_ListHorizontalInsideMinimumPadding,
|
||||
|
||||
eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_ListVerticalInsidePadding, // needed only because of GTK
|
||||
|
||||
eMetric_CaretBlinkTime, // default, may be overriden by OS
|
||||
eMetric_CaretWidthTwips
|
||||
} nsMetricID;
|
||||
|
||||
typedef enum {
|
||||
eMetricFloat_TextFieldVerticalInsidePadding,
|
||||
eMetricFloat_TextFieldHorizontalInsidePadding,
|
||||
eMetricFloat_TextAreaVerticalInsidePadding,
|
||||
eMetricFloat_TextAreaHorizontalInsidePadding,
|
||||
eMetricFloat_ListVerticalInsidePadding,
|
||||
eMetricFloat_ListHorizontalInsidePadding,
|
||||
eMetricFloat_ButtonVerticalInsidePadding,
|
||||
eMetricFloat_ButtonHorizontalInsidePadding
|
||||
} nsMetricFloatID;
|
||||
|
||||
|
||||
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric) = 0;
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric) = 0;
|
||||
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
typedef enum {
|
||||
eMetricSize_TextField = 0,
|
||||
eMetricSize_TextArea = 1,
|
||||
eMetricSize_ListBox = 2,
|
||||
eMetricSize_ComboBox = 3,
|
||||
eMetricSize_Radio = 4,
|
||||
eMetricSize_CheckBox = 5,
|
||||
eMetricSize_Button = 6
|
||||
} nsMetricNavWidgetID;
|
||||
|
||||
typedef enum {
|
||||
eMetricSize_Courier = 0,
|
||||
eMetricSize_SansSerif = 1
|
||||
} nsMetricNavFontID;
|
||||
|
||||
// This method returns the actual (or nearest estimate)
|
||||
// of the Navigator size for a given form control for a given font
|
||||
// and font size. This is used in NavQuirks mode to see how closely
|
||||
// we match its size
|
||||
NS_IMETHOD GetNavSize(const nsMetricNavWidgetID aWidgetID,
|
||||
const nsMetricNavFontID aFontID,
|
||||
const PRInt32 aFontSize,
|
||||
nsSize &aSize) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define nsLAF nsILookAndFeel
|
||||
|
||||
#endif /* __nsILookAndFeel */
|
||||
190
mozilla/widget/public/nsIMenu.h
Normal file
190
mozilla/widget/public/nsIMenu.h
Normal file
@@ -0,0 +1,190 @@
|
||||
/* -*- 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 nsIMenu_h__
|
||||
#define nsIMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
class nsIMenuItem;
|
||||
class nsIMenuListener;
|
||||
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_IMENU_IID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Menu widget
|
||||
*/
|
||||
class nsIMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the Menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu Access Key
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAccessKey(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu Access Key
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetAccessKey(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu enabled state
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu enabled state
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetEnabled(PRBool* aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Query if this is the help menu. Mostly for MacOS voodoo.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsHelpMenu(PRBool* aIsHelpMenu) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Menu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsISupports* aItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menu items
|
||||
* This does count separators as items
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu or Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void** aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
120
mozilla/widget/public/nsIMenuBar.h
Normal file
120
mozilla/widget/public/nsIMenuBar.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- 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 nsIMenuBar_h__
|
||||
#define nsIMenuBar_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUBAR_IID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* MenuBar widget
|
||||
*/
|
||||
class nsIMenuBar : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUBAR_IID)
|
||||
|
||||
/**
|
||||
* Creates the MenuBar
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget * aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuBar's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsIWidget *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Set the MenuBar's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetParent(nsIWidget *aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds the Menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menus
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetMenuCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetMenuAt(const PRUint32 aCount, nsIMenu *& aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertMenuAt(const PRUint32 aCount, nsIMenu *& aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenu(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menus
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle. Temporary hack for mac until
|
||||
* nsMenuBar does it's own construction
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Draw the menubar
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Paint() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
189
mozilla/widget/public/nsIMenuItem.h
Normal file
189
mozilla/widget/public/nsIMenuItem.h
Normal file
@@ -0,0 +1,189 @@
|
||||
/* -*- 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 nsIMenuItem_h__
|
||||
#define nsIMenuItem_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
// {7F045771-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUITEM_IID \
|
||||
{ 0x7f045771, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
class nsIMenu;
|
||||
class nsIPopUpMenu;
|
||||
class nsIWidget;
|
||||
class nsIMenuListener;
|
||||
|
||||
enum {
|
||||
knsMenuItemNoModifier = 0,
|
||||
knsMenuItemShiftModifier = (1 << 0),
|
||||
knsMenuItemAltModifier = (1 << 1),
|
||||
knsMenuItemControlModifier = (1 << 2),
|
||||
knsMenuItemCommandModifier = (1 << 3)
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem widget
|
||||
*/
|
||||
class nsIMenuItem : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUITEM_IID)
|
||||
|
||||
/**
|
||||
* Creates the MenuItem
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent,
|
||||
const nsString & aLabel,
|
||||
PRBool isSeparator) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuItem label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuItem label
|
||||
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu shortcut char
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetShortcutChar(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu shortcut char
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetShortcutChar(nsString &aText) = 0;
|
||||
/**
|
||||
* Sets whether the item is enabled or disabled
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is enabled or disabled
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetEnabled(PRBool *aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Sets whether the item is checked or not
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetChecked(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is checked or not
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetChecked(PRBool *aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Sets whether the item is a checkbox type
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetCheckboxType(PRBool aIsCheckbox) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is a checkbox type
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCheckboxType(PRBool *aIsCheckbox) = 0;
|
||||
|
||||
/**
|
||||
* Gets the MenuItem Command identifier
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCommand(PRUint32 & aCommand) = 0;
|
||||
|
||||
/**
|
||||
* Gets the target for MenuItem
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetTarget(nsIWidget *& aTarget) = 0;
|
||||
|
||||
/**
|
||||
* Gets Native Menu Handle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Indicates whether it is a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep) = 0;
|
||||
|
||||
/**
|
||||
* Sets the JavaScript Command to be invoked when a "gui" event occurs on a source widget
|
||||
* @param aStrCmd the JS command to be cached for later execution
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd) = 0;
|
||||
|
||||
/**
|
||||
* Executes the "cached" JavaScript Command
|
||||
* @return NS_OK if the command was executed properly, otherwise an error code
|
||||
*/
|
||||
NS_IMETHOD DoCommand() = 0;
|
||||
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aDOMNode) = 0;
|
||||
NS_IMETHOD GetDOMNode(nsIDOMNode ** aDOMNode) = 0;
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement) = 0;
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement) = 0;
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetModifiers(PRUint8 aModifiers) = 0;
|
||||
NS_IMETHOD GetModifiers(PRUint8 * aModifiers) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
85
mozilla/widget/public/nsIMenuListener.h
Normal file
85
mozilla/widget/public/nsIMenuListener.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- 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 nsIMenuListener_h__
|
||||
#define nsIMenuListener_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// TODO: This needs to be generated!
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENULISTENER_IID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x9e } }
|
||||
|
||||
static NS_DEFINE_IID(kIMenuListenerIID, NS_IMENULISTENER_IID);
|
||||
|
||||
/**
|
||||
*
|
||||
* Menu event listener
|
||||
* This interface should only be implemented by the menu manager
|
||||
* These are registered with nsWindows to recieve menu events
|
||||
*/
|
||||
|
||||
class nsIMenuListener : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENULISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a menu item selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu deselect event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
virtual nsEventStatus MenuConstruct(
|
||||
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
|
||||
nsIWidget * aParentWindow,
|
||||
|
||||
void * menubarNode,
|
||||
|
||||
void * aWebShell) = 0;
|
||||
|
||||
|
||||
|
||||
virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIMenuListener_h__
|
||||
75
mozilla/widget/public/nsIMouseListener.h
Normal file
75
mozilla/widget/public/nsIMouseListener.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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 nsIMouseListener_h__
|
||||
#define nsIMouseListener_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
|
||||
// {c83f6b81-d7ce-11d2-8360-c4c894c4917c}
|
||||
#define NS_IMOUSELISTENER_IID \
|
||||
{ 0xc83f6b81, 0xd7ce, 0x11d2, { 0x83, 0x60, 0xc4, 0xc8, 0x94, 0xc4, 0x91, 0x7c } }
|
||||
|
||||
class nsIMouseListener : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMOUSELISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a mouse pressed event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MousePressed(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse release event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MouseReleased(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse clicked event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*
|
||||
*/
|
||||
virtual nsEventStatus MouseClicked(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse moved event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MouseMoved(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIMouseListener_h__
|
||||
138
mozilla/widget/public/nsIPopUpMenu.h
Normal file
138
mozilla/widget/public/nsIPopUpMenu.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* -*- 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 nsIPopUpMenu_h__
|
||||
#define nsIPopUpMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMenuItem.h"
|
||||
|
||||
class nsIMenu;
|
||||
class nsIWidget;
|
||||
|
||||
// {F6CD4F21-53AF-11d2-8DC4-00609703C14E}
|
||||
#define NS_IPOPUPMENU_IID \
|
||||
{ 0xf6cd4f21, 0x53af, 0x11d2, \
|
||||
{ 0x8d, 0xc4, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* PopUpMenu widget
|
||||
*/
|
||||
class nsIPopUpMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPOPUPMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the PopUpMenu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget * aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds a PopUpMenu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Adds a PopUpMenu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsIMenuItem * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Cascading PopUpMenu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Adds Separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menu items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Creates and inserts a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName) = 0;
|
||||
|
||||
/**
|
||||
* Creates and inserts a Separator at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertSeparator(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes an PopUpMenu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the PopUpMenu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Shows menu and waits for action
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ShowMenu(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Gets parent widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsIWidget *& aParent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
80
mozilla/widget/public/nsIRadioButton.h
Normal file
80
mozilla/widget/public/nsIRadioButton.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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 nsIRadioButton_h__
|
||||
#define nsIRadioButton_h__
|
||||
|
||||
#include "nsIButton.h"
|
||||
|
||||
#define NS_IRADIOBUTTON_IID \
|
||||
{ 0x18032ad4, 0xb265, 0x11d2, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
* RadioButton widget. Can show itself in a checked or unchecked state.
|
||||
* The RadioButton widget automatically shows itself checked or unchecked when clicked on.
|
||||
*/
|
||||
|
||||
class nsIRadioButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRADIOBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the button label
|
||||
*
|
||||
* @param aText button label
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Set the check state.
|
||||
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetState(const PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Get the check state.
|
||||
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetState(PRBool& aState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIRadioButton_h__
|
||||
|
||||
|
||||
35
mozilla/widget/public/nsIRollupListener.idl
Normal file
35
mozilla/widget/public/nsIRollupListener.idl
Normal file
@@ -0,0 +1,35 @@
|
||||
/* -*- 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"
|
||||
|
||||
[uuid(23C2BA03-6C76-11d3-96ED-0060B0FB9956)]
|
||||
interface nsIRollupListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the object to rollup
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
void Rollup();
|
||||
};
|
||||
124
mozilla/widget/public/nsIScrollbar.h
Normal file
124
mozilla/widget/public/nsIScrollbar.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/* -*- 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 nsIScrollbar_h__
|
||||
#define nsIScrollbar_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
|
||||
// {18032AD2-B265-11d1-AA2A-000000000000}
|
||||
#define NS_ISCROLLBAR_IID \
|
||||
{ 0x18032ad2, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Scrollbar, converts mouse input into values that can be used
|
||||
* to shift the contents of a window.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class nsIScrollbar : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLBAR_IID)
|
||||
|
||||
/**
|
||||
* Set the scrollbar range
|
||||
* @param aEndRange set range for scrollbar from 0 to aEndRange
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetMaxRange(PRUint32 aEndRange) = 0;
|
||||
|
||||
/**
|
||||
* Get the scrollbar range
|
||||
* @return the upper end of the scrollbar range
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetMaxRange(PRUint32& aMaxRange) = 0;
|
||||
|
||||
/**
|
||||
* Set the thumb position.
|
||||
* @param aPos a value between (startRange) and (endRange - thumbSize)
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetPosition(PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Get the thumb position.
|
||||
* @return a value between (startRange) and (endRange - thumbSize)
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetPosition(PRUint32& aPos) = 0;
|
||||
|
||||
/**
|
||||
* Set the thumb size.
|
||||
* @param aSize size of the thumb. Must be a value between
|
||||
* startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetThumbSize(PRUint32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the thumb size.
|
||||
* @return size of the thumb. The value is between
|
||||
* startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetThumbSize(PRUint32& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the line increment.
|
||||
* @param aSize size of the line increment. The value must
|
||||
* be between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetLineIncrement(PRUint32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the line increment.
|
||||
* @return size of the line increment. The value is
|
||||
* between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetLineIncrement(PRUint32& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set all scrollbar parameters at once
|
||||
* @param aMaxRange set range for scrollbar from 0 to aMaxRange
|
||||
* @param aThumbSize size of the thumb. Must be a value between
|
||||
* startRange and endRange
|
||||
* @param aPosition a value between (startRange) and (endRange - thumbSize)
|
||||
* @param aLineIncrement size of the line increment. The value must
|
||||
* be between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIScrollbar_h__
|
||||
43
mozilla/widget/public/nsISound.idl
Normal file
43
mozilla/widget/public/nsISound.idl
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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 "nsISupports.idl"
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
[scriptable, uuid(B148EED1-236D-11d3-B35C-00A0CC3C1CDE)]
|
||||
interface nsISound : nsISupports
|
||||
{
|
||||
void Init();
|
||||
|
||||
void Play(in nsIFileSpec filespec);
|
||||
// void Stop();
|
||||
|
||||
void Beep();
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
extern nsresult
|
||||
NS_NewSound(nsISound** aSound);
|
||||
|
||||
%}
|
||||
158
mozilla/widget/public/nsITextAreaWidget.h
Normal file
158
mozilla/widget/public/nsITextAreaWidget.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/* -*- 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 nsITextAreaWidget_h__
|
||||
#define nsITextAreaWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030012-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ITEXTAREAWIDGET_IID \
|
||||
{ 0xf8030012, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Multi-line text editor.
|
||||
* See nsITextWidget for capabilities.
|
||||
* Displays a scrollbar when the text content exceeds the number of lines
|
||||
* displayed.
|
||||
* Unlike a nsIWidget, The textarea must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
*/
|
||||
|
||||
class nsITextAreaWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTAREAWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Get the text of this component.
|
||||
*
|
||||
* @param aTextBuffer on return contains the text of this component
|
||||
* @param aBufferSize the size of the buffer passed in
|
||||
* @param aActualSize the number of char copied
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the text of this component.
|
||||
*
|
||||
* @param aText -- an object containing a copy of the text
|
||||
* @return the number of chars in the text string
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Insert text into this component.
|
||||
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
||||
* When aStartPos and aEndPos are equal this function performs an insert.
|
||||
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
||||
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
||||
*
|
||||
* @param aText the text to set
|
||||
* @param aStartPos starting position for inserting text
|
||||
* @param aEndPos ending position for inserting text
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Remove any content from this text widget
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD RemoveText(void) = 0;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters the widget can hold
|
||||
*
|
||||
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the text widget to be read-only
|
||||
*
|
||||
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
||||
* PR_FALSE indicates the widget is writable.
|
||||
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
||||
|
||||
/**
|
||||
* Select all of the contents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
|
||||
/**
|
||||
* Set the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Get the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Set the caret position
|
||||
* @param aPosition caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret position
|
||||
* @return caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
||||
};
|
||||
|
||||
#endif // nsITextAreaWidget_h__
|
||||
|
||||
179
mozilla/widget/public/nsITextWidget.h
Normal file
179
mozilla/widget/public/nsITextWidget.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* -*- 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 nsITextWidget_h__
|
||||
#define nsITextWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030011-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ITEXTWIDGET_IID \
|
||||
{ 0xf8030011, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
struct nsTextWidgetInitData : public nsWidgetInitData {
|
||||
nsTextWidgetInitData()
|
||||
: mIsPassword(PR_FALSE),
|
||||
mIsReadOnly(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mIsPassword;
|
||||
PRBool mIsReadOnly;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Single line text editor.
|
||||
* Unlike a nsIWidget, The text editor must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
*
|
||||
*/
|
||||
|
||||
class nsITextWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Get the text of this component.
|
||||
*
|
||||
* @param aTextBuffer on return contains the text of this component
|
||||
* @param aBufferSize the size of the buffer passed in
|
||||
* @param aActualSize the number of char copied
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the text of this component.
|
||||
*
|
||||
* @param aText -- an object containing a copy of the text
|
||||
* @return the number of chars in the text string
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Insert text into this component.
|
||||
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
||||
* When aStartPos and aEndPos are equal this function performs an insert.
|
||||
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
||||
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
||||
*
|
||||
* @param aText the text to set
|
||||
* @param aStartPos starting position for inserting text
|
||||
* @param aEndPos ending position for inserting text
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Remove any content from this text widget
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD RemoveText(void) = 0;
|
||||
|
||||
/**
|
||||
* Indicates a password will be entered.
|
||||
*
|
||||
* @param aIsPassword PR_TRUE shows contents as asterisks. PR_FALSE shows
|
||||
* contents as normal text.
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetPassword(PRBool aIsPassword) = 0;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters the widget can hold
|
||||
*
|
||||
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the text widget to be read-only
|
||||
*
|
||||
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
||||
* PR_FALSE indicates the widget is writable.
|
||||
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
||||
|
||||
/**
|
||||
* Select all of the contents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
|
||||
/**
|
||||
* Set the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Get the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Set the caret position
|
||||
* @param aPosition caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret position
|
||||
* @return caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsITextWidget_h__
|
||||
|
||||
50
mozilla/widget/public/nsIToolkit.idl
Normal file
50
mozilla/widget/public/nsIToolkit.idl
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include "prthread.h"
|
||||
%}
|
||||
|
||||
[ptr] native PRThread(PRThread);
|
||||
|
||||
|
||||
[uuid(18032BD0-B265-11d1-AA2A-000000000000)]
|
||||
interface nsIToolkit : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize this toolkit with aThread.
|
||||
* @param aThread The thread passed in runs the message pump.
|
||||
* NULL can be passed in, in which case a new thread gets created
|
||||
* and a message pump will run in that thread
|
||||
*
|
||||
*/
|
||||
void Init(in PRThread aThread);
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
extern NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult);
|
||||
%}
|
||||
123
mozilla/widget/public/nsITransferable.idl
Normal file
123
mozilla/widget/public/nsITransferable.idl
Normal file
@@ -0,0 +1,123 @@
|
||||
/* -*- Mode: IDL; 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 "nsISupportsArray.idl"
|
||||
#include "nsIFormatConverter.idl"
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
// these probably shouldn't live here, but in some central repository shared
|
||||
// by the entire app.
|
||||
#define kTextMime "text/plain"
|
||||
#define kXIFMime "text/xif"
|
||||
#define kUnicodeMime "text/unicode"
|
||||
#define kHTMLMime "text/html"
|
||||
#define kAOLMailMime "AOLMAIL"
|
||||
#define kPNGImageMime "image/png"
|
||||
#define kJPEGImageMime "image/jpg"
|
||||
#define kGIFImageMime "image/gif"
|
||||
#define kDropFilesMime "text/dropfiles"
|
||||
|
||||
%}
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BC-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsITransferable : nsISupports
|
||||
{
|
||||
/**
|
||||
* Computes a list of flavors (mime types as nsISupportsString) that the transferable
|
||||
* can export, either through intrinsic knowledge or output data converters.
|
||||
*
|
||||
* @param aDataFlavorList fills list with supported flavors. This is a copy of
|
||||
* the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
nsISupportsArray flavorsTransferableCanExport ( ) ;
|
||||
|
||||
/**
|
||||
* Given a flavor retrieve the data.
|
||||
*
|
||||
* @param aFlavor (in parameter) 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 (out parameter) 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 ) ;
|
||||
|
||||
/**
|
||||
* Returns true if the data is large.
|
||||
*/
|
||||
boolean isLargeDataSet ( ) ;
|
||||
|
||||
///////////////////////////////
|
||||
// Setter part of interface
|
||||
///////////////////////////////
|
||||
|
||||
/**
|
||||
* Computes a list of flavors (mime types as nsISupportsString) that the transferable can
|
||||
* accept into it, either through intrinsic knowledge or input data converters.
|
||||
*
|
||||
* @param outFlavorList fills list with supported flavors. This is a copy of
|
||||
* the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
nsISupportsArray flavorsTransferableCanImport ( ) ;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
};
|
||||
|
||||
725
mozilla/widget/public/nsIWidget.h
Normal file
725
mozilla/widget/public/nsIWidget.h
Normal file
@@ -0,0 +1,725 @@
|
||||
/* -*- 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 nsIWidget_h__
|
||||
#define nsIWidget_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
class nsIFontMetrics;
|
||||
class nsIToolkit;
|
||||
class nsIRenderingContext;
|
||||
class nsIEnumerator;
|
||||
class nsIDeviceContext;
|
||||
struct nsRect;
|
||||
struct nsFont;
|
||||
class nsIMenuBar;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
|
||||
/**
|
||||
* Callback function that processes events.
|
||||
* The argument is actually a subtype (subclass) of nsEvent which carries
|
||||
* platform specific information about the event. Platform specific code knows
|
||||
* how to deal with it.
|
||||
* The return value determines whether or not the default action should take place.
|
||||
*/
|
||||
|
||||
typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
|
||||
/**
|
||||
* Flags for the getNativeData function.
|
||||
* See getNativeData()
|
||||
*/
|
||||
#define NS_NATIVE_WINDOW 0
|
||||
#define NS_NATIVE_GRAPHIC 1
|
||||
#define NS_NATIVE_COLORMAP 2
|
||||
#define NS_NATIVE_WIDGET 3
|
||||
#define NS_NATIVE_DISPLAY 4
|
||||
#define NS_NATIVE_REGION 5
|
||||
#define NS_NATIVE_OFFSETX 6
|
||||
#define NS_NATIVE_OFFSETY 7
|
||||
#define NS_NATIVE_PLUGIN_PORT 8
|
||||
#define NS_NATIVE_SCREEN 9
|
||||
|
||||
// {18032AD5-B265-11d1-AA2A-000000000000}
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x18032ad5, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
// Hide the native window systems real window type so as to avoid
|
||||
// including native window system types and api's. This is necessary
|
||||
// to ensure cross-platform code.
|
||||
typedef void* nsNativeWidget;
|
||||
|
||||
/**
|
||||
* Border styles
|
||||
*/
|
||||
|
||||
enum nsWindowType {
|
||||
// default top level window
|
||||
eWindowType_toplevel,
|
||||
// top level window but usually handled differently by the OS
|
||||
eWindowType_dialog,
|
||||
// used for combo boxes, etc
|
||||
eWindowType_popup,
|
||||
// child windows (contained inside a window on the desktop (has no border))
|
||||
eWindowType_child
|
||||
};
|
||||
|
||||
|
||||
enum nsBorderStyle
|
||||
{
|
||||
// no border, titlebar, etc.. opposite of all
|
||||
eBorderStyle_none = 0,
|
||||
|
||||
// all window decorations
|
||||
eBorderStyle_all = 1 << 0,
|
||||
|
||||
// enables the border on the window. these are only for decoration and are not resize hadles
|
||||
eBorderStyle_border = 1 << 1,
|
||||
|
||||
// enables the resize handles for the window. if this is set, border is implied to also be set
|
||||
eBorderStyle_resizeh = 1 << 2,
|
||||
|
||||
// enables the titlebar for the window
|
||||
eBorderStyle_title = 1 << 3,
|
||||
|
||||
// enables the window menu button on the title bar. this being on should force the title bar to display
|
||||
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
|
||||
eBorderStyle_minimize = 1 << 5,
|
||||
|
||||
// enables the maxmize button so the user can maximize the window
|
||||
eBorderStyle_maximize = 1 << 6,
|
||||
|
||||
// show the close button
|
||||
eBorderStyle_close = 1 << 7,
|
||||
|
||||
// whatever the OS wants... i.e. don't do anything
|
||||
eBorderStyle_default = -1
|
||||
};
|
||||
|
||||
/**
|
||||
* Cursor types.
|
||||
*/
|
||||
|
||||
enum nsCursor { ///(normal cursor, usually rendered as an arrow)
|
||||
eCursor_standard,
|
||||
///(system is busy, usually rendered as a hourglass or watch)
|
||||
eCursor_wait,
|
||||
///(Selecting something, usually rendered as an IBeam)
|
||||
eCursor_select,
|
||||
///(can hyper-link, usually rendered as a human hand)
|
||||
eCursor_hyperlink,
|
||||
///(west/east sizing, usually rendered as ->||<-)
|
||||
eCursor_sizeWE,
|
||||
///(north/south sizing, usually rendered as sizeWE rotated 90 degrees)
|
||||
eCursor_sizeNS,
|
||||
eCursor_arrow_north,
|
||||
eCursor_arrow_north_plus,
|
||||
eCursor_arrow_south,
|
||||
eCursor_arrow_south_plus,
|
||||
eCursor_arrow_west,
|
||||
eCursor_arrow_west_plus,
|
||||
eCursor_arrow_east,
|
||||
eCursor_arrow_east_plus,
|
||||
eCursor_crosshair,
|
||||
//Don't know what 'move' cursor should be. See CSS2.
|
||||
eCursor_move,
|
||||
eCursor_help
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Basic struct for widget initialization data.
|
||||
* @see Create member function of nsIWidget
|
||||
*/
|
||||
|
||||
struct nsWidgetInitData {
|
||||
nsWidgetInitData()
|
||||
: clipChildren(PR_FALSE), clipSiblings(PR_FALSE),
|
||||
mWindowType(eWindowType_child),
|
||||
mBorderStyle(eBorderStyle_default)
|
||||
{
|
||||
}
|
||||
|
||||
// when painting exclude area occupied by child windows and sibling windows
|
||||
PRPackedBool clipChildren, clipSiblings;
|
||||
nsWindowType mWindowType;
|
||||
nsBorderStyle mBorderStyle;
|
||||
};
|
||||
|
||||
/**
|
||||
* The base class for all the widgets. It provides the interface for
|
||||
* all basic and necessary functionality.
|
||||
*/
|
||||
class nsIWidget : public nsISupports {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Create and initialize a widget.
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param parent or null if it's a top level window
|
||||
* @param aRect the widget dimension
|
||||
* @param aHandleEventFunction the event handler callback function
|
||||
* @param aContext
|
||||
* @param aAppShell the parent application shell. If nsnull,
|
||||
* the parent window's application shell will be used.
|
||||
* @param aToolkit
|
||||
* @param aInitData data that is used for widget initialization
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Create and initialize a widget with a native window parent
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event.
|
||||
*
|
||||
* @param aParent native window.
|
||||
* @param aRect the widget dimension
|
||||
* @param aHandleEventFunction the event handler callback function
|
||||
*/
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Accessor functions to get and set the client data associated with the
|
||||
* widget.
|
||||
*/
|
||||
//@{
|
||||
NS_IMETHOD GetClientData(void*& aClientData) = 0;
|
||||
NS_IMETHOD SetClientData(void* aClientData) = 0;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Close and destroy the internal native window.
|
||||
* This method does not delete the widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD Destroy(void) = 0;
|
||||
|
||||
/**
|
||||
* Return the parent Widget of this Widget or nsnull if this is a
|
||||
* top level window
|
||||
*
|
||||
* @return the parent widget or nsnull if it does not have a parent
|
||||
*
|
||||
*/
|
||||
virtual nsIWidget* GetParent(void) = 0;
|
||||
|
||||
/**
|
||||
* Return an nsEnumerator over the children of this widget.
|
||||
*
|
||||
* @return an enumerator over the list of children or nsnull if it does not
|
||||
* have any children
|
||||
*
|
||||
*/
|
||||
virtual nsIEnumerator* GetChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Show or hide this widget
|
||||
*
|
||||
* @param aState PR_TRUE to show the Widget, PR_FALSE to hide it
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Show(PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Make the window modal
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetModal(PRBool aModal) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether the window is visible
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsVisible(PRBool & aState) = 0;
|
||||
|
||||
/**
|
||||
* Move this widget.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Resize this widget.
|
||||
*
|
||||
* @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 widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Move or resize this widget.
|
||||
*
|
||||
* @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 widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Set's the widget's z-index.
|
||||
*/
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Get's the widget's z-index.
|
||||
*/
|
||||
NS_IMETHOD GetZIndex(PRInt32* aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Enable or disable this Widget
|
||||
*
|
||||
* @param aState PR_TRUE to enable the Widget, PR_FALSE to disable it.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Enable(PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Give focus to this widget.
|
||||
*/
|
||||
NS_IMETHOD SetFocus(void) = 0;
|
||||
|
||||
/**
|
||||
* Get this widget's outside dimensions relative to it's parent widget
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of this widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetBounds(nsRect &aRect) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get this widget's client area dimensions, if the window has a 3D border appearance
|
||||
* this returns the area inside the border, The x and y are always zero
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of the client area of this widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetClientBounds(nsRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Gets the width and height of the borders
|
||||
* @param aWidth the width of the border
|
||||
* @param aHeight the height of the border
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Get the foreground color for this widget
|
||||
*
|
||||
* @return this widget's foreground color
|
||||
*
|
||||
*/
|
||||
virtual nscolor GetForegroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the foreground color for this widget
|
||||
*
|
||||
* @param aColor the new foreground color
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetForegroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the background color for this widget
|
||||
*
|
||||
* @return this widget's background color
|
||||
*
|
||||
*/
|
||||
|
||||
virtual nscolor GetBackgroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the background color for this widget
|
||||
*
|
||||
* @param aColor the new background color
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the font for this widget
|
||||
*
|
||||
* @return the font metrics
|
||||
*/
|
||||
|
||||
virtual nsIFontMetrics* GetFont(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the font for this widget
|
||||
*
|
||||
* @param aFont font to display. See nsFont for allowable fonts
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetFont(const nsFont &aFont) = 0;
|
||||
|
||||
/**
|
||||
* Get the cursor for this widget.
|
||||
*
|
||||
* @return this widget's cursor.
|
||||
*/
|
||||
|
||||
virtual nsCursor GetCursor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the cursor for this widget
|
||||
*
|
||||
* @param aCursor the new cursor for this widget
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate the widget and repaint it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate a specified region for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Force a synchronous repaint of the window if there are dirty rects.
|
||||
*
|
||||
* @see Invalidate()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Update() = 0;
|
||||
|
||||
/**
|
||||
* Adds a mouse listener to this widget
|
||||
* Any existing mouse listener is replaced
|
||||
*
|
||||
* @param aListener mouse listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddMouseListener(nsIMouseListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Adds an event listener to this widget
|
||||
* Any existing event listener is replaced
|
||||
*
|
||||
* @param aListener event listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddEventListener(nsIEventListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Adds a menu listener to this widget
|
||||
* Any existing menu listener is replaced
|
||||
*
|
||||
* @param aListener menu listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Return the widget's toolkit
|
||||
*
|
||||
* @return the toolkit this widget was created in. See nsToolkit.
|
||||
*/
|
||||
|
||||
virtual nsIToolkit* GetToolkit() = 0;
|
||||
|
||||
/**
|
||||
* Set the color map for this widget
|
||||
*
|
||||
* @param aColorMap color map for displaying this widget
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap) = 0;
|
||||
|
||||
/**
|
||||
* Scroll this widget.
|
||||
*
|
||||
* @param aDx amount to scroll along the x-axis
|
||||
* @param aDy amount to scroll along the y-axis.
|
||||
* @param aClipRect clipping rectangle to limit the scroll to.
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) = 0;
|
||||
|
||||
/**
|
||||
* Scroll an area of this widget.
|
||||
*
|
||||
* @param aRect source rectangle to scroll in the widget
|
||||
* @param aDx x offset from the source
|
||||
* @param aDy y offset from the source
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
|
||||
|
||||
/**
|
||||
* Internal methods
|
||||
*/
|
||||
|
||||
//@{
|
||||
virtual void AddChild(nsIWidget* aChild) = 0;
|
||||
virtual void RemoveChild(nsIWidget* aChild) = 0;
|
||||
virtual void* GetNativeData(PRUint32 aDataType) = 0;
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) = 0;//~~~
|
||||
virtual nsIRenderingContext* GetRenderingContext() = 0;
|
||||
virtual nsIDeviceContext* GetDeviceContext() = 0;
|
||||
virtual nsIAppShell *GetAppShell() = 0;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Set border style
|
||||
* Must be called before Create.
|
||||
* @param aBorderStyle @see nsBorderStyle
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's title.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aTitle string displayed as the title of the widget
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aMenuBar the menubar
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar's visibility
|
||||
*
|
||||
* @param aShow PR_TRUE to show, PR_FALSE to hide
|
||||
*/
|
||||
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow) = 0;
|
||||
|
||||
/**
|
||||
* Convert from this widget coordinates to screen coordinates.
|
||||
*
|
||||
* @param aOldRect widget coordinates stored in the x,y members
|
||||
* @param aNewRect screen coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) = 0;
|
||||
|
||||
/**
|
||||
* Convert from screen coordinates to this widget's coordinates.
|
||||
*
|
||||
* @param aOldRect screen coordinates stored in the x,y members
|
||||
* @param aNewRect widget's coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect) = 0;
|
||||
|
||||
/**
|
||||
* When adjustments are to made to a whole set of child widgets, call this
|
||||
* before resizing/positioning the child windows to minimize repaints. Must
|
||||
* be followed by EndResizingChildren() after child windows have been
|
||||
* adjusted.
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD BeginResizingChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Call this when finished adjusting child windows. Must be preceded by
|
||||
* BeginResizingChildren().
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD EndResizingChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Returns the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Set the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Dispatches and event to the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) = 0;
|
||||
|
||||
|
||||
#ifdef LOSER
|
||||
/**
|
||||
* FSets the vertical scrollbar widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For printing and lightweight widgets
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect) = 0;
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD EnableDragDrop(PRBool aEnable) = 0;
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system mouse capture.
|
||||
* @param aCapture PR_TRUE enables mouse capture, PR_FALSE disables mouse capture
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture) = 0;
|
||||
|
||||
/**
|
||||
* 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 aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
* @param aConsumeRollupEvent PR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent) = 0;
|
||||
|
||||
/**
|
||||
* Determine whether a given event should be processed assuming we are
|
||||
* the currently active modal window.
|
||||
* Note that the exact semantics of this method are platform-dependent.
|
||||
* The Macintosh, for instance, cares deeply that this method do exactly
|
||||
* as advertised. Gtk, for instance, handles modality in a completely
|
||||
* different fashion and does little if anything with this method.
|
||||
* @param aRealEvent event is real or a null placeholder (Macintosh)
|
||||
* @param aEvent void pointer to native event structure
|
||||
* @param aForWindow return value. PR_TRUE iff event should be processed.
|
||||
*/
|
||||
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
556
mozilla/widget/public/nsIWidget.idl
Normal file
556
mozilla/widget/public/nsIWidget.idl
Normal file
@@ -0,0 +1,556 @@
|
||||
/* -*- 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>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIScriptableRegion.idl"
|
||||
#include "nsIRollupListener.idl"
|
||||
#include "nsIToolkit.idl"
|
||||
#include "nsIAppShell.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsRect.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
class nsIRenderingContext;
|
||||
class nsIEnumerator;
|
||||
class nsIDeviceContext;
|
||||
struct nsRect;
|
||||
struct nsFont;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
%}
|
||||
|
||||
[ptr] native nsGUIEvent(nsGUIEvent);
|
||||
[ptr] native nsIMouseListener(nsIMouseListener);
|
||||
[ptr] native nsIEventListener(nsIEventListener);
|
||||
[ptr] native nsIMenuListener(nsIMenuListener);
|
||||
[ptr] native nsIRegion(nsIRegion);
|
||||
[ptr] native nsRect(nsRect);
|
||||
[ref] native nsRectRef(nsRect);
|
||||
[ptr] native nsFont(nsFont);
|
||||
[ptr] native nsColorMap(nsColorMap);
|
||||
|
||||
[ptr] native nsIRenderingContext(nsIRenderingContext);
|
||||
[ptr] native nsIDeviceContext(nsIDeviceContext);
|
||||
|
||||
native nscolor(nscolor);
|
||||
native nscoord(nscoord);
|
||||
native nsEventStatus(nsEventStatus);
|
||||
[ref] native nsEventStatusRef(nsEventStatus);
|
||||
native PR_CALLBACK(PR_CALLBACKK);
|
||||
native EVENT_CALLBACK(EVENT_CALLBACK);
|
||||
|
||||
typedef long nsCursor;
|
||||
|
||||
|
||||
/*
|
||||
* Hide the native window systems real window type so as to avoid
|
||||
* including native window system types and api's. This is necessary
|
||||
* to ensure cross-platform code.
|
||||
*/
|
||||
typedef voidStar nsNativeWidget;
|
||||
|
||||
|
||||
%{ C++
|
||||
typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
|
||||
|
||||
/**
|
||||
* Basic struct for widget initialization data.
|
||||
* @see Create member function of nsIWidget
|
||||
*/
|
||||
|
||||
struct nsWidgetInitData {
|
||||
nsWidgetInitData()
|
||||
: clipChildren(PR_FALSE), clipSiblings(PR_FALSE)
|
||||
// mWindowType(eWindowType_child),
|
||||
// mBorderStyle(eBorderStyle_default)
|
||||
{
|
||||
}
|
||||
|
||||
// when painting exclude area occupied by child windows and sibling windows
|
||||
PRPackedBool clipChildren, clipSiblings;
|
||||
// nsWindowType mWindowType;
|
||||
// nsBorderStyle mBorderStyle;
|
||||
};
|
||||
%}
|
||||
|
||||
|
||||
[uuid(18032AD5-B265-11d1-AA2A-000000000000)]
|
||||
interface nsIWidget : nsISupports
|
||||
{
|
||||
|
||||
/*
|
||||
* Flags for GetNativeData()
|
||||
*/
|
||||
const short NS_NATIVE_WINDOW = 0;
|
||||
const short NS_NATIVE_GRAPHIC = 1;
|
||||
const short NS_NATIVE_COLORMAP = 2;
|
||||
const short NS_NATIVE_WIDGET = 3;
|
||||
const short NS_NATIVE_DISPLAY = 4;
|
||||
const short NS_NATIVE_REGION = 5;
|
||||
const short NS_NATIVE_OFFSETX = 6;
|
||||
const short NS_NATIVE_OFFSETY = 7;
|
||||
const short NS_NATIVE_PLUGIN_PORT = 8;
|
||||
const short NS_NATIVE_SCREEN = 9;
|
||||
|
||||
|
||||
/**
|
||||
* Cursor types.
|
||||
*/
|
||||
|
||||
//(normal cursor, usually rendered as an arrow)
|
||||
const long eCursor_standard = 0;
|
||||
//(system is busy, usually rendered as a hourglass or watch)
|
||||
const long eCursor_wait = 1;
|
||||
//(Selecting something, usually rendered as an IBeam)
|
||||
const long eCursor_select = 2;
|
||||
//(can hyper-link, usually rendered as a human hand)
|
||||
const long eCursor_hyperlink = 3;
|
||||
//(west/east sizing, usually rendered as ->||<-)
|
||||
const long eCursor_sizeWE = 4;
|
||||
//(north/south sizing, usually rendered as sizeWE rotated 90 degrees)
|
||||
const long eCursor_sizeNS = 5;
|
||||
const long eCursor_arrow_north = 6;
|
||||
const long eCursor_arrow_north_plus = 7;
|
||||
const long eCursor_arrow_south = 8;
|
||||
const long eCursor_arrow_south_plus = 9;
|
||||
const long eCursor_arrow_west = 10;
|
||||
const long eCursor_arrow_west_plus = 11;
|
||||
const long eCursor_arrow_east = 12;
|
||||
const long eCursor_arrow_east_plus = 13;
|
||||
const long eCursor_crosshair = 14;
|
||||
//Don't know what 'move' cursor should be. See CSS2.
|
||||
const long eCursor_move = 15;
|
||||
const long eCursor_help = 16;
|
||||
|
||||
|
||||
/**
|
||||
* initialize a widget
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param aAppShell the parent application shell. If nsnull,
|
||||
* the parent window's application shell will be used.
|
||||
* @param aToolkit toolkit
|
||||
* @param aContext device context
|
||||
* @param aEventFunction the event handler callback function
|
||||
*
|
||||
*/
|
||||
void initWidget(in nsIAppShell aAppShell,
|
||||
in nsIToolkit aToolkit,
|
||||
in nsIDeviceContext aContext,
|
||||
in EVENT_CALLBACK aEventFunction);
|
||||
|
||||
/**
|
||||
* Get some kind of native data
|
||||
*/
|
||||
voidStar getNativeData(in PRUint32 aDataType);
|
||||
|
||||
/**
|
||||
* Move this widget.
|
||||
*
|
||||
* @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 PRInt32 aX, in PRInt32 aY);
|
||||
|
||||
/**
|
||||
* Resize this widget.
|
||||
*
|
||||
* @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 widget should be repainted
|
||||
*
|
||||
*/
|
||||
void resize(in PRInt32 aWidth,
|
||||
in PRInt32 aHeight,
|
||||
in PRBool aRepaint);
|
||||
|
||||
/**
|
||||
* Move and resize this widget.
|
||||
*
|
||||
* @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 widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
void moveResize(in PRInt32 aX,
|
||||
in PRInt32 aY,
|
||||
in PRInt32 aWidth,
|
||||
in PRInt32 aHeight,
|
||||
in PRBool aRepaint);
|
||||
|
||||
/**
|
||||
* Enable or disable this Widget
|
||||
*
|
||||
* @param aState PR_TRUE to enable the Widget, PR_FALSE to disable it.
|
||||
*
|
||||
*/
|
||||
void enable(in PRBool aState);
|
||||
|
||||
|
||||
// XXX GO AWAY
|
||||
|
||||
/**
|
||||
* Get this widget's outside dimensions relative to it's parent widget
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of this widget
|
||||
*
|
||||
*/
|
||||
// readonly attribute nsRect Bounds;
|
||||
|
||||
// this is really out..
|
||||
void getBounds(in nsRectRef aRect);
|
||||
|
||||
|
||||
// XXX keep this, but make it ints
|
||||
/**
|
||||
* Get this widget's client area dimensions, if the window has a 3D border appearance
|
||||
* this returns the area inside the border, The x and y are always zero
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of the client area of this widget
|
||||
*
|
||||
*/
|
||||
// readonly attribute nsRect ClientBounds;
|
||||
|
||||
// this is really out..
|
||||
void getClientBounds(in nsRectRef aRect);
|
||||
|
||||
|
||||
|
||||
// Is this still used?
|
||||
/**
|
||||
* Returns the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
void getPreferredSize(out PRInt32 aWidth,
|
||||
out PRInt32 aHeight);
|
||||
|
||||
/**
|
||||
* Set the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
void setPreferredSize(in PRInt32 aWidth, in PRInt32 aHeight);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Invalidate the widget and repaint it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
void invalidate(in PRBool aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
void invalidateRect([const] in nsRect aRect, in PRBool aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
// void InvalidateRegion([const] in nsIScriptableRegion aRegion, in PRBool aIsSynchronous);
|
||||
void invalidateRegion([const] in nsIRegion aRegion, in PRBool aIsSynchronous);
|
||||
|
||||
/**
|
||||
* Force a synchronous repaint of the window if there are dirty rects.
|
||||
*
|
||||
* @see Invalidate()
|
||||
*/
|
||||
void update();
|
||||
|
||||
|
||||
/**
|
||||
* Convert from this widget coordinates to screen coordinates.
|
||||
*
|
||||
* @param aOldRect widget coordinates stored in the x,y members
|
||||
* @param aNewRect screen coordinates stored in the x,y members
|
||||
*/
|
||||
void widgetToScreen([const] in nsRect aOldRect, out nsRect aNewRect);
|
||||
|
||||
/**
|
||||
* Convert from screen coordinates to this widget's coordinates.
|
||||
*
|
||||
* @param aOldRect screen coordinates stored in the x,y members
|
||||
* @param aNewRect widget's coordinates stored in the x,y members
|
||||
*/
|
||||
void screenToWidget([const] in nsRect aOldRect, out nsRect aNewRect);
|
||||
|
||||
// is this used?
|
||||
void convertToDeviceCoordinates(inout nscoord aX, inout nscoord aY);
|
||||
|
||||
|
||||
// can this go away?
|
||||
/**
|
||||
* For printing and lightweight widgets
|
||||
*
|
||||
*/
|
||||
void paint(in nsIRenderingContext aRenderingContext,
|
||||
[const] in nsRect aDirtyRect);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
*/
|
||||
void enableDragDrop(in PRBool aEnable);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enables/Disables system mouse capture.
|
||||
* @param aCapture PR_TRUE enables mouse capture, PR_FALSE disables mouse capture
|
||||
*
|
||||
*/
|
||||
void captureMouse(in PRBool aCapture);
|
||||
|
||||
/**
|
||||
* 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 aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
* @param aConsumeRollupEvent PR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event
|
||||
*
|
||||
*/
|
||||
void captureRollupEvents(in nsIRollupListener aListener, in PRBool aDoCapture, in PRBool aConsumeRollupEvent);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adds a mouse listener to this widget
|
||||
* Any existing mouse listener is replaced
|
||||
*
|
||||
* @param aListener mouse listener to add to this widget.
|
||||
*/
|
||||
void addMouseListener(in nsIMouseListener aListener);
|
||||
|
||||
/**
|
||||
* Adds an event listener to this widget
|
||||
* Any existing event listener is replaced
|
||||
*
|
||||
* @param aListener event listener to add to this widget.
|
||||
*/
|
||||
void addEventListener(in nsIEventListener aListener);
|
||||
|
||||
/**
|
||||
* Adds a menu listener to this widget
|
||||
* Any existing menu listener is replaced
|
||||
*
|
||||
* @param aListener menu listener to add to this widget.
|
||||
*/
|
||||
void addMenuListener(in nsIMenuListener aListener);
|
||||
|
||||
|
||||
// is this an internal method?
|
||||
/**
|
||||
* Dispatches and event to the widget
|
||||
*
|
||||
*/
|
||||
void dispatchEvent(in nsGUIEvent event, in nsEventStatusRef aStatus);
|
||||
|
||||
|
||||
/**
|
||||
* Internal methods
|
||||
*/
|
||||
void addChild(in nsIWidget aChild);
|
||||
void removeChild(in nsIWidget aChild);
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
|
||||
/**
|
||||
* Device Context used to do printing... probably shouldn't be here
|
||||
*/
|
||||
readonly attribute nsIDeviceContext deviceContext;
|
||||
|
||||
/* attributes */
|
||||
|
||||
/**
|
||||
* Get the AppShell
|
||||
*/
|
||||
readonly attribute nsIAppShell appShell;
|
||||
|
||||
/**
|
||||
* Get the nsIToolkit
|
||||
*/
|
||||
readonly attribute nsIToolkit toolkit;
|
||||
|
||||
/**
|
||||
* callback for the event
|
||||
*/
|
||||
[noscript] readonly attribute EVENT_CALLBACK eventFunction;
|
||||
|
||||
|
||||
/* things that MUST be set AFTER the widget is created */
|
||||
|
||||
/**
|
||||
* Get and Set the widget's z-index.
|
||||
*/
|
||||
attribute PRInt32 zIndex;
|
||||
|
||||
/**
|
||||
* Set/Get the foreground color for this widget
|
||||
*
|
||||
* @param aColor the new foreground color
|
||||
*
|
||||
*/
|
||||
attribute nscolor foregroundColor;
|
||||
|
||||
/**
|
||||
* Set/Get the background color for this widget
|
||||
*
|
||||
* @param aColor the new background color
|
||||
*
|
||||
*/
|
||||
attribute nscolor backgroundColor;
|
||||
|
||||
/**
|
||||
* Set/Get the font for this widget
|
||||
*
|
||||
* @param aFont font to display. See nsFont for allowable fonts
|
||||
*/
|
||||
attribute nsFont font;
|
||||
|
||||
/**
|
||||
* Set/Get the cursor for this widget
|
||||
*
|
||||
* @param aCursor the new cursor for this widget
|
||||
*/
|
||||
|
||||
attribute nsCursor cursor;
|
||||
|
||||
/**
|
||||
* Set the color map for this widget
|
||||
*
|
||||
* @param aColorMap color map for displaying this widget
|
||||
*
|
||||
*/
|
||||
attribute nsColorMap colorMap;
|
||||
|
||||
/**
|
||||
* Accessor functions to get and set the client data associated with the
|
||||
* widget.
|
||||
*/
|
||||
attribute voidStar clientData;
|
||||
|
||||
/**
|
||||
* Return an nsEnumerator over the children of this widget.
|
||||
*
|
||||
* @return an enumerator over the list of children or nsnull if it does not
|
||||
* have any children
|
||||
*
|
||||
*/
|
||||
readonly attribute nsIEnumerator children;
|
||||
|
||||
%{ C++
|
||||
/* backwards compat stuff */
|
||||
NS_IMETHOD Show(PRBool aShow) = 0;
|
||||
|
||||
NS_IMETHOD IsVisible(PRBool & aState) = 0;
|
||||
NS_IMETHOD Resize(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
virtual nscolor GetForegroundColor(void) = 0;
|
||||
virtual nscolor GetBackgroundColor(void) = 0;
|
||||
|
||||
NS_IMETHOD SetFont(const nsFont &aFont) = 0;
|
||||
virtual nsIFontMetrics* GetFont(void) = 0;
|
||||
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous) = 0;
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight) = 0;
|
||||
|
||||
virtual nsIWidget* GetParent(void) = 0;
|
||||
|
||||
virtual nsIEnumerator* GetChildren(void) = 0;
|
||||
|
||||
virtual void* GetNativeData(PRUint32 aDataType) = 0;
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) = 0;
|
||||
virtual nsIRenderingContext* GetRenderingContext() = 0;
|
||||
virtual nsIDeviceContext* GetDeviceContext() = 0;
|
||||
virtual nsIAppShell *GetAppShell() = 0;
|
||||
virtual nsIToolkit* GetToolkit() = 0;
|
||||
|
||||
/* the big ugly ones */
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
%}
|
||||
|
||||
};
|
||||
|
||||
203
mozilla/widget/public/nsIWindow.idl
Normal file
203
mozilla/widget/public/nsIWindow.idl
Normal file
@@ -0,0 +1,203 @@
|
||||
/* -*- 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>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Kevin McCluskey <kmcclusk@netscape.com>
|
||||
* Mike Pinkerton <pinkerton@netscape.com>
|
||||
* ... and other people
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIWidget.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsRect.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
struct nsRect;
|
||||
class nsIMenuBar;
|
||||
%}
|
||||
|
||||
[ptr] native nsIMenuBar(nsIMenuBar);
|
||||
|
||||
typedef long nsBorderStyle;
|
||||
typedef long nsWindowType;
|
||||
|
||||
|
||||
[uuid(491359ea-1dd2-11b2-af7c-bb0346efd9b6)]
|
||||
interface nsIWindow : nsIWidget
|
||||
{
|
||||
/*
|
||||
* types of windows
|
||||
*/
|
||||
const long eWindowType_toplevel = 0;
|
||||
const long eWindowType_dialog = 1;
|
||||
const long eWindowType_popup = 2;
|
||||
const long eWindowType_child = 3;
|
||||
|
||||
|
||||
/*
|
||||
* Border styles
|
||||
*/
|
||||
// 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. these are only for decoration and are not resize hadles
|
||||
const long eBorderStyle_border = 1 << 1;
|
||||
|
||||
// enables the resize handles for the window. 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;
|
||||
|
||||
// whatever the OS wants... i.e. don't do anything
|
||||
const long eBorderStyle_default = -1;
|
||||
|
||||
|
||||
/**
|
||||
* initialize a window
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param aWindowType type of window to create
|
||||
* @param aBorderStyle border style of the window to create
|
||||
*
|
||||
*/
|
||||
void initWindowStyle(in nsWindowType aWindowType,
|
||||
in nsBorderStyle aBorderStyle);
|
||||
|
||||
/**
|
||||
* Make the window modal
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
void setModal(in boolean modal);
|
||||
|
||||
/**
|
||||
* Gets the width and height of the borders
|
||||
* @param aWidth the width of the border
|
||||
* @param aHeight the height of the border
|
||||
*
|
||||
*/
|
||||
void getBorderSize(out PRInt32 aWidth, out PRInt32 aHeight);
|
||||
|
||||
/**
|
||||
* Scroll this widget.
|
||||
*
|
||||
* @param aDx amount to scroll along the x-axis
|
||||
* @param aDy amount to scroll along the y-axis.
|
||||
* @param aClipRect clipping rectangle to limit the scroll to.
|
||||
*
|
||||
*/
|
||||
void scroll(in PRInt32 aDx, in PRInt32 aDy, in nsRect aClipRect);
|
||||
|
||||
/**
|
||||
* Scroll an area of this widget.
|
||||
*
|
||||
* @param aRect source rectangle to scroll in the widget
|
||||
* @param aDx x offset from the source
|
||||
* @param aDy y offset from the source
|
||||
*
|
||||
*/
|
||||
void scrollRect(in nsRectRef aSrcRect, in PRInt32 aDx, in PRInt32 aDy);
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aMenuBar the menubar
|
||||
*/
|
||||
void setMenuBar(in nsIMenuBar aMenuBar);
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar's visibility
|
||||
*
|
||||
* @param aShow PR_TRUE to show, PR_FALSE to hide
|
||||
*/
|
||||
void showMenuBar(in PRBool aShow);
|
||||
|
||||
/**
|
||||
* When adjustments are to made to a whole set of child widgets, call this
|
||||
* before resizing/positioning the child windows to minimize repaints. Must
|
||||
* be followed by EndResizingChildren() after child windows have been
|
||||
* adjusted.
|
||||
*
|
||||
*/
|
||||
void beginResizingChildren();
|
||||
|
||||
/**
|
||||
* Call this when finished adjusting child windows. Must be preceded by
|
||||
* BeginResizingChildren().
|
||||
*
|
||||
*/
|
||||
void endResizingChildren();
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
|
||||
/**
|
||||
* Window type
|
||||
*/
|
||||
readonly attribute nsWindowType windowType;
|
||||
|
||||
/**
|
||||
* Border style
|
||||
*/
|
||||
readonly attribute nsBorderStyle borderStyle;
|
||||
|
||||
};
|
||||
64
mozilla/widget/public/nsRepeater.h
Normal file
64
mozilla/widget/public/nsRepeater.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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 nsRepeater_h___
|
||||
#define nsRepeater_h___
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
class EventRecord;
|
||||
|
||||
class NS_BASE Repeater {
|
||||
public:
|
||||
|
||||
Repeater();
|
||||
virtual ~Repeater();
|
||||
|
||||
virtual void RepeatAction(const EventRecord &aMacEvent) = 0;
|
||||
|
||||
void StartRepeating();
|
||||
void StopRepeating();
|
||||
void StartIdling();
|
||||
void StopIdling();
|
||||
|
||||
static void DoRepeaters(const EventRecord &aMacEvent);
|
||||
static void DoIdlers(const EventRecord &aMacEvent);
|
||||
|
||||
protected:
|
||||
|
||||
void AddToRepeatList();
|
||||
void RemoveFromRepeatList();
|
||||
void AddToIdleList();
|
||||
void RemoveFromIdleList();
|
||||
|
||||
static Repeater* sRepeaters;
|
||||
static Repeater* sIdlers;
|
||||
|
||||
bool mRepeating;
|
||||
bool mIdling;
|
||||
Repeater* mPrevRptr;
|
||||
Repeater* mNextRptr;
|
||||
Repeater* mPrevIdlr;
|
||||
Repeater* mNextIdlr;
|
||||
};
|
||||
|
||||
#endif
|
||||
54
mozilla/widget/public/nsStringUtil.h
Normal file
54
mozilla/widget/public/nsStringUtil.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
// Convience macros for converting nsString's to chars +
|
||||
// creating temporary char[] bufs.
|
||||
|
||||
#ifndef NS_STR_UTIL_H
|
||||
#define NS_STR_UTIL_H
|
||||
|
||||
// nsString to temporary char[] macro
|
||||
|
||||
// Convience MACROS to convert an nsString to a char * which use a
|
||||
// static char array if possible to reduce memory fragmentation,
|
||||
// otherwise they allocate a char[] which must be freed.
|
||||
// REMEMBER to always use the NS_FREE_STR_BUF after using the
|
||||
// NS_ALLOC_STR_BUF. You can not nest NS_ALLOC_STR_BUF's.
|
||||
|
||||
#define NS_ALLOC_CHAR_BUF(aBuf, aSize, aActualSize) \
|
||||
int _ns_tmpActualSize = aActualSize; \
|
||||
char _ns_smallBuffer[aSize]; \
|
||||
char * const aBuf = _ns_tmpActualSize <= aSize ? _ns_smallBuffer : new char[_ns_tmpActualSize];
|
||||
|
||||
#define NS_FREE_CHAR_BUF(aBuf) \
|
||||
if (aBuf != _ns_smallBuffer) \
|
||||
delete[] aBuf;
|
||||
|
||||
#define NS_ALLOC_STR_BUF(aBuf, aStrName, aTempSize) \
|
||||
NS_ALLOC_CHAR_BUF(aBuf, aTempSize, aStrName.Length()+1); \
|
||||
aStrName.ToCString(aBuf, aStrName.Length()+1);
|
||||
|
||||
#define NS_FREE_STR_BUF(aBuf) \
|
||||
NS_FREE_CHAR_BUF(aBuf)
|
||||
|
||||
|
||||
#endif // NSStringUtil
|
||||
141
mozilla/widget/public/nsWidgetSupport.h
Normal file
141
mozilla/widget/public/nsWidgetSupport.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- 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 nsWidgetSupport_h__
|
||||
#define nsWidgetSupport_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
struct nsRect;
|
||||
class nsITextAreaWidget;
|
||||
class nsIFileWidget;
|
||||
class nsIAppShell;
|
||||
class nsIButton;
|
||||
class nsIComboBox;
|
||||
class nsIEventListener;
|
||||
class nsILabel;
|
||||
class nsIListBox;
|
||||
class nsIListWidget;
|
||||
class nsILookAndFeel;
|
||||
class nsIMouseListener;
|
||||
class nsIToolkit;
|
||||
class nsIWidget;
|
||||
class nsICheckButton;
|
||||
class nsIScrollbar;
|
||||
class nsIRadioButton;
|
||||
class nsITextWidget;
|
||||
class nsIBrowserWindow;
|
||||
|
||||
// These are a series of support methods which help in the creation
|
||||
// of widgets. They are not needed, but are provided as a convenience
|
||||
// mechanism when creating widgets
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateButton( nsISupports* aParent,
|
||||
nsIButton* aButton,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateCheckButton( nsISupports* aParent,
|
||||
nsICheckButton* aCheckButton,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateRadioButton( nsISupports* aParent,
|
||||
nsIRadioButton* aButton,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateLabel( nsISupports* aParent,
|
||||
nsILabel* aLabel,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateTextWidget(nsISupports* aParent,
|
||||
nsITextWidget* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateTextAreaWidget(nsISupports* aParent,
|
||||
nsITextAreaWidget* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateListBox(nsISupports* aParent,
|
||||
nsIListBox* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateComboBox(nsISupports* aParent,
|
||||
nsIComboBox* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
const nsFont* aFont = nsnull);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_CreateScrollBar(nsISupports* aParent,
|
||||
nsIScrollbar* aWidget,
|
||||
const nsRect& aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_ShowWidget(nsISupports* aWidget, PRBool aShow);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_MoveWidget(nsISupports* aWidget, PRUint32 aX, PRUint32 aY);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_EnableWidget(nsISupports* aWidget, PRBool aEnable);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_SetFocusToWidget(nsISupports* aWidget);
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_GetWidgetNativeData(nsISupports* aWidget, void** aNativeData);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
200
mozilla/widget/public/nsWidgetsCID.h
Normal file
200
mozilla/widget/public/nsWidgetsCID.h
Normal file
@@ -0,0 +1,200 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/* 2d96b3d0-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_WINDOW_CID \
|
||||
{ 0x2d96b3d0, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9}}
|
||||
|
||||
/* 2d96b3d1-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_CHILD_CID \
|
||||
{ 0x2d96b3d1, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
|
||||
/* BA7DE611-6088-11d3-A83E-00105A183419 */
|
||||
#define NS_POPUP_CID \
|
||||
{ 0xba7de611, 0x6088, 0x11d3, \
|
||||
{ 0xa8, 0x3e, 0x0, 0x10, 0x5a, 0x18, 0x34, 0x19 } }
|
||||
|
||||
|
||||
/* 2d96b3d2-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_BUTTON_CID \
|
||||
{ 0x2d96b3d2, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3d3-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_CHECKBUTTON_CID \
|
||||
{ 0x2d96b3d3, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3d4-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_COMBOBOX_CID \
|
||||
{ 0x2d96b3d4, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3d5-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_FILEWIDGET_CID \
|
||||
{ 0x2d96b3d5, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3d6-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_LISTBOX_CID \
|
||||
{ 0x2d96b3d6, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3d7-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_RADIOBUTTON_CID \
|
||||
{ 0x2d96b3d7, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3d9-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_HORZSCROLLBAR_CID \
|
||||
{ 0x2d96b3d9, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3da-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_VERTSCROLLBAR_CID \
|
||||
{ 0x2d96b3da, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3db-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_TEXTAREA_CID \
|
||||
{ 0x2d96b3db, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3dc-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_TEXTFIELD_CID \
|
||||
{ 0x2d96b3dc, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3df-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_APPSHELL_CID \
|
||||
{ 0x2d96b3df, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* 2d96b3e0-c051-11d1-a827-0040959a28c9 */
|
||||
#define NS_TOOLKIT_CID \
|
||||
{ 0x2d96b3e0, 0xc051, 0x11d1, \
|
||||
{0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9} }
|
||||
|
||||
/* XXX the following CID's are not in order. This needs
|
||||
to be fixed. */
|
||||
|
||||
/* 21B51DE0-21A3-11d2-B6E0-00805F8A2676 */
|
||||
#define NS_LOOKANDFEEL_CID \
|
||||
{ 0x21b51de0, 0x21a3, 0x11d2, \
|
||||
{ 0xb6, 0xe0, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } }
|
||||
|
||||
/* 4A781D61-3D28-11d2-8DB8-00609703C14E */
|
||||
#define NS_DIALOG_CID \
|
||||
{ 0x4a781d61, 0x3d28, 0x11d2, \
|
||||
{ 0x8d, 0xb8, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/* F3131891-3DC7-11d2-8DB8-00609703C14E */
|
||||
#define NS_LABEL_CID \
|
||||
{ 0xf3131891, 0x3dc7, 0x11d2, \
|
||||
{ 0x8d, 0xb8, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Menus
|
||||
//-----------------------------------------------------------
|
||||
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_MENUBAR_CID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_MENU_CID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
// {7F045771-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_MENUITEM_CID \
|
||||
{ 0x7f045771, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
// {1677DAE1-04E2-11d3-B35C-00A0CC3C1CDE}
|
||||
#define NS_CONTEXTMENU_CID \
|
||||
{ 0x1677dae1, 0x4e2, 0x11d3, \
|
||||
{ 0xb3, 0x5c, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
//f58c2550-4a7c-11d2-bee2-00805f8a8dbd
|
||||
#define NS_IMAGEBUTTON_CID \
|
||||
{ 0xf58c2550, 0x4a7c, 0x11d2, \
|
||||
{0xbe, 0xe2, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// {F6CD4F21-53AF-11d2-8DC4-00609703C14E}
|
||||
#define NS_POPUPMENU_CID \
|
||||
{ 0xf6cd4f21, 0x53af, 0x11d2, \
|
||||
{ 0x8d, 0xc4, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
#define NS_MENUBUTTON_CID \
|
||||
{ 0x67b8e261, 0x53c3, 0x11d2, \
|
||||
{ 0x8d, 0xc4, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
// {D3C3B8B2-55B5-11d2-9A2A-000000000000}
|
||||
#define NS_IMAGEBUTTONLISTENER_CID \
|
||||
{ 0xd3c3b8b2, 0x55b5, 0x11d2, \
|
||||
{ 0x9a, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
// {285EF9B2-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_FONTRETRIEVERSERVICE_CID \
|
||||
{ 0x285ef9b2, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } }
|
||||
|
||||
//-----------------------------------------------------------
|
||||
//Drag & Drop & Clipboard
|
||||
//-----------------------------------------------------------
|
||||
// {8B5314BB-DB01-11d2-96CE-0060B0FB9956}
|
||||
#define NS_DRAGSERVICE_CID \
|
||||
{ 0x8b5314bb, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
|
||||
|
||||
// {8B5314BC-DB01-11d2-96CE-0060B0FB9956}
|
||||
#define NS_TRANSFERABLE_CID \
|
||||
{ 0x8b5314bc, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
|
||||
|
||||
// {8B5314BA-DB01-11d2-96CE-0060B0FB9956}
|
||||
#define NS_CLIPBOARD_CID \
|
||||
{ 0x8b5314ba, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
|
||||
|
||||
// {8B5314BD-DB01-11d2-96CE-0060B0FB9956}
|
||||
#define NS_DATAFLAVOR_CID \
|
||||
{ 0x8b5314bd, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
|
||||
|
||||
// {948A0023-E3A7-11d2-96CF-0060B0FB9956}
|
||||
#define NS_XIFFORMATCONVERTER_CID \
|
||||
{ 0x948a0023, 0xe3a7, 0x11d2, { 0x96, 0xcf, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
|
||||
|
||||
#define NS_DATAOBJ_CID \
|
||||
{ 0x1bba7640, 0xdf52, 0x11cf, { 0x82, 0x7b, 0, 0xa0, 0x24, 0x3a, 0xe5, 0x05 } }
|
||||
|
||||
// {E93E73B1-0197-11d3-96D4-0060B0FB9956}
|
||||
#define NS_FILELISTTRANSFERABLE_CID \
|
||||
{ 0xe93e73b1, 0x197, 0x11d3, { 0x96, 0xd4, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
|
||||
|
||||
//-----------------------------------------------------------
|
||||
//Other
|
||||
//-----------------------------------------------------------
|
||||
// {B148EED2-236D-11d3-B35C-00A0CC3C1CDE}
|
||||
#define NS_SOUND_CID \
|
||||
{ 0xb148eed2, 0x236d, 0x11d3, { 0xb3, 0x5c, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
62
mozilla/widget/src/Makefile.in
Normal file
62
mozilla/widget/src/Makefile.in
Normal file
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = xpwidgets support
|
||||
|
||||
#
|
||||
# Dont build the DSO under the 'build' directory as windows does.
|
||||
#
|
||||
# The DSOs get built in the toolkit dir itself. Do this so that
|
||||
# multiple implementations of widget can be built on the same
|
||||
# source tree.
|
||||
#
|
||||
ifndef MOZ_MONOLITHIC_TOOLKIT
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
DIRS += gtk
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_MOTIF
|
||||
DIRS += motif
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XLIB
|
||||
DIRS += xlib
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_QT
|
||||
DIRS += qt
|
||||
endif
|
||||
|
||||
else
|
||||
DIRS += $(MOZ_WIDGET_TOOLKIT)
|
||||
endif
|
||||
|
||||
# unix_services are only useful in unix, duh...
|
||||
ifeq (,$(filter beos os2 rhapsody photon,$(MOZ_WIDGET_TOOLKIT)))
|
||||
DIRS += unix_services
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
75
mozilla/widget/src/beos/Makefile.in
Normal file
75
mozilla/widget/src/beos/Makefile.in
Normal file
@@ -0,0 +1,75 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = widget_beos
|
||||
|
||||
REQUIRES = util img xpcom raptor netlib
|
||||
|
||||
CPPSRCS = \
|
||||
nsAppShell.cpp \
|
||||
nsButton.cpp \
|
||||
nsCheckButton.cpp \
|
||||
nsClipboard.cpp \
|
||||
nsComboBox.cpp \
|
||||
nsDragService.cpp \
|
||||
nsFileWidget.cpp \
|
||||
nsFontRetrieverService.cpp \
|
||||
nsFontSizeIterator.cpp \
|
||||
nsLabel.cpp \
|
||||
nsListBox.cpp \
|
||||
nsLookAndFeel.cpp \
|
||||
nsMenu.cpp \
|
||||
nsMenuBar.cpp \
|
||||
nsMenuItem.cpp \
|
||||
nsObject.cpp \
|
||||
nsPopUpMenu.cpp \
|
||||
nsRadioButton.cpp \
|
||||
nsScrollbar.cpp \
|
||||
nsSound.cpp \
|
||||
nsTextAreaWidget.cpp \
|
||||
nsTextHelper.cpp \
|
||||
nsTextWidget.cpp \
|
||||
nsToolkit.cpp \
|
||||
nsWidgetFactory.cpp \
|
||||
nsWindow.cpp \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = $(DIST)/lib/libraptorbasewidget_s.a
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(TOOLKIT_DSO_LDOPTS) \
|
||||
$(MKSHLIB_FORCE_ALL) \
|
||||
$(SHARED_LIBRARY_LIBS) \
|
||||
$(MKSHLIB_UNFORCE_ALL) \
|
||||
$(TK_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_WIDGET -I$(srcdir)/../xpwidgets -I$(srcdir)
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
||||
$(LIBRARY) $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) Makefile
|
||||
|
||||
332
mozilla/widget/src/beos/nsAppShell.cpp
Normal file
332
mozilla/widget/src/beos/nsAppShell.cpp
Normal file
@@ -0,0 +1,332 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsSwitchToUIThread.h"
|
||||
#include "plevent.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <AppKit.h>
|
||||
#include <AppFileInfo.h>
|
||||
|
||||
struct ThreadInterfaceData
|
||||
{
|
||||
void *data;
|
||||
int32 sync;
|
||||
};
|
||||
|
||||
static sem_id my_find_sem(const char *name)
|
||||
{
|
||||
sem_id ret = B_ERROR;
|
||||
|
||||
/* Get the sem_info for every sempahore in this team. */
|
||||
sem_info info;
|
||||
int32 cookie = 0;
|
||||
|
||||
while(get_next_sem_info(0, &cookie, &info) == B_OK)
|
||||
if(strcmp(name, info.name) == 0)
|
||||
{
|
||||
ret = info.sem;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsISupports implementation macro
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
NS_IMPL_ISUPPORTS(nsAppShell,kIAppShellIID);
|
||||
|
||||
static bool GetAppSig(char *sig)
|
||||
{
|
||||
app_info appInfo;
|
||||
BFile file;
|
||||
BAppFileInfo appFileInfo;
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
*sig = 0;
|
||||
return get_next_image_info(0, &cookie, &info) == B_OK &&
|
||||
file.SetTo(info.name, B_READ_ONLY) == B_OK &&
|
||||
appFileInfo.SetTo(&file) == B_OK &&
|
||||
appFileInfo.GetSignature(sig) == B_OK;
|
||||
}
|
||||
|
||||
class nsBeOSApp : public BApplication
|
||||
{
|
||||
sem_id init;
|
||||
public:
|
||||
nsBeOSApp(const char *signature, sem_id initsem);
|
||||
virtual void ReadyToRun(void);
|
||||
};
|
||||
|
||||
nsBeOSApp::nsBeOSApp(const char *signature, sem_id initsem)
|
||||
: BApplication(signature), init(initsem)
|
||||
{
|
||||
}
|
||||
|
||||
void nsBeOSApp::ReadyToRun(void)
|
||||
{
|
||||
release_sem(init);
|
||||
}
|
||||
|
||||
int32 bapp_thread(void *arg)
|
||||
{
|
||||
// create and start BApplication
|
||||
char sig[B_MIME_TYPE_LENGTH + 1];
|
||||
GetAppSig(sig);
|
||||
nsBeOSApp *app = new nsBeOSApp(sig, (sem_id)arg);
|
||||
app->Run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsAppShell constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsAppShell::nsAppShell()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mDispatchListener = 0;
|
||||
|
||||
sem_id initsem = create_sem(0, "bapp init");
|
||||
resume_thread(spawn_thread(bapp_thread, "BApplication", B_NORMAL_PRIORITY, (void *)initsem));
|
||||
acquire_sem(initsem);
|
||||
delete_sem(initsem);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Create the application shell
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsAppShell::Create(int* argc, char ** argv)
|
||||
{
|
||||
// system wide unique names
|
||||
// NOTE: this needs to be run from within the main application thread
|
||||
char portname[64];
|
||||
char semname[64];
|
||||
sprintf(portname, "event%lx", PR_GetCurrentThread());
|
||||
sprintf(semname, "sync%lx", PR_GetCurrentThread());
|
||||
|
||||
if((eventport = find_port(portname)) < 0)
|
||||
{
|
||||
// we're here first
|
||||
eventport = create_port(100, portname);
|
||||
syncsem = create_sem(0, semname);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the PLEventQueue stuff (in plevent.c) created the queue before we started
|
||||
syncsem = my_find_sem(semname);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
|
||||
{
|
||||
mDispatchListener = aDispatchListener;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Enter a message handler loop
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
nsresult nsAppShell::Run()
|
||||
{
|
||||
int32 code;
|
||||
ThreadInterfaceData id;
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
while(read_port(eventport, &code, &id, sizeof(id)) >= 0)
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case 'WMti' :
|
||||
extern void nsTimerExpired(void *); // hack: this is in gfx
|
||||
nsTimerExpired(id.data);
|
||||
break;
|
||||
|
||||
case WM_CALLMETHOD :
|
||||
{
|
||||
MethodInfo *mInfo = (MethodInfo *)id.data;
|
||||
mInfo->Invoke();
|
||||
if(! id.sync)
|
||||
delete mInfo;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'natv' : // native queue PLEvent
|
||||
{
|
||||
PREventQueue *queue = (PREventQueue *)id.data;
|
||||
PR_ProcessPendingEvents(queue);
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
printf("nsAppShell::Run - UNKNOWN EVENT\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if(mDispatchListener)
|
||||
mDispatchListener->AfterDispatch();
|
||||
|
||||
if(id.sync)
|
||||
release_sem(syncsem);
|
||||
}
|
||||
|
||||
Release();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Exit a message handler loop
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsAppShell::Exit()
|
||||
{
|
||||
// interrupt message flow
|
||||
close_port(eventport);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsAppShell destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsAppShell::~nsAppShell()
|
||||
{
|
||||
if(be_app->Lock())
|
||||
be_app->Quit();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// GetNativeData
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void* nsAppShell::GetNativeData(PRUint32 aDataType)
|
||||
{
|
||||
if (aDataType == NS_NATIVE_SHELL) {
|
||||
return NULL;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Spinup - do any preparation necessary for running a message loop
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsAppShell::Spinup()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Spindown - do any cleanup necessary for finishing a message loop
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsAppShell::Spindown()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// PushThreadEventQueue - begin processing events from a new queue
|
||||
// note this is the Windows implementation and may suffice, but
|
||||
// this is untested on beos.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsAppShell::PushThreadEventQueue()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// push a nested event queue for event processing from netlib
|
||||
// onto our UI thread queue stack.
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = eQueueService->PushThreadEventQueue();
|
||||
else
|
||||
NS_ERROR("Appshell unable to obtain eventqueue service.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// PopThreadEventQueue - stop processing on a previously pushed event queue
|
||||
// note this is the Windows implementation and may suffice, but
|
||||
// this is untested on beos.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsAppShell::PopThreadEventQueue()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = eQueueService->PopThreadEventQueue();
|
||||
else
|
||||
NS_ERROR("Appshell unable to obtain eventqueue service.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
||||
{
|
||||
printf("nsAppShell::GetNativeEvent - FIXME: not implemented\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent)
|
||||
{
|
||||
printf("nsAppShell::DispatchNativeEvent - FIXME: not implemented\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget, PRBool *aForWindow)
|
||||
{
|
||||
printf("nsAppShell::EventIsForModalWindow - FIXME: not implemented\n");
|
||||
*aForWindow = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
60
mozilla/widget/src/beos/nsAppShell.h
Normal file
60
mozilla/widget/src/beos/nsAppShell.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsAppShell_h__
|
||||
#define nsAppShell_h__
|
||||
|
||||
#include "nsObject.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include <OS.h>
|
||||
|
||||
/**
|
||||
* Native BeOS Application shell wrapper
|
||||
*/
|
||||
|
||||
class nsAppShell : public nsIAppShell
|
||||
{
|
||||
public:
|
||||
nsAppShell();
|
||||
virtual ~nsAppShell();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAppShellInterface
|
||||
|
||||
NS_IMETHOD Create(int* argc, char ** argv);
|
||||
virtual nsresult Run();
|
||||
NS_IMETHOD Spinup();
|
||||
NS_IMETHOD Spindown();
|
||||
NS_IMETHOD PushThreadEventQueue();
|
||||
NS_IMETHOD PopThreadEventQueue();
|
||||
NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent);
|
||||
NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent);
|
||||
NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent,
|
||||
nsIWidget *aWidget, PRBool *aForWindow);
|
||||
NS_IMETHOD Exit();
|
||||
NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener);
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
|
||||
private:
|
||||
nsDispatchListener *mDispatchListener;
|
||||
port_id eventport;
|
||||
sem_id syncsem;
|
||||
};
|
||||
|
||||
#endif // nsAppShell_h__
|
||||
282
mozilla/widget/src/beos/nsButton.cpp
Normal file
282
mozilla/widget/src/beos/nsButton.cpp
Normal file
@@ -0,0 +1,282 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsButton.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsButton)
|
||||
NS_IMPL_RELEASE(nsButton)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsButton constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsButton::nsButton() : nsWindow() , nsIButton()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsButton destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsButton::~nsButton()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID
|
||||
* @modify gpk 8/4/98
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIButton, NS_IBUTTON_IID);
|
||||
if (aIID.Equals(kIButton)) {
|
||||
*aInstancePtr = (void*) ((nsIButton*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWindow::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsButton::SetLabel(const nsString& aText)
|
||||
{
|
||||
mLabel = aText;
|
||||
if(NULL == mView) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ALLOC_STR_BUF(label, aText, 256);
|
||||
if(mButton)
|
||||
{
|
||||
if(mButton->Looper())
|
||||
mButton->LockLooper();
|
||||
|
||||
mButton->SetLabel(label);
|
||||
|
||||
if(mButton->Looper())
|
||||
mButton->UnlockLooper();
|
||||
}
|
||||
NS_FREE_STR_BUF(label);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsButton::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
aBuffer = mLabel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// move, paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsButton::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsButton::OnPaint(nsRect &r)
|
||||
{
|
||||
//printf("** nsButton::OnPaint **\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsButton::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Button for Printing
|
||||
*
|
||||
**/
|
||||
NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
float appUnits;
|
||||
float devUnits;
|
||||
float scale;
|
||||
nsIDeviceContext * context;
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetAppUnitsToDevUnits(devUnits);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
|
||||
nsRect rect;
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
|
||||
nscolor bgColor = NS_RGB(255,255,255);
|
||||
nscolor fgColor = NS_RGB(0,0,0);
|
||||
nscolor hltColor = NS_RGB(240,240,240);
|
||||
nscolor sdwColor = NS_RGB(128,128,128);
|
||||
|
||||
nsILookAndFeel * lookAndFeel;
|
||||
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetBackground, bgColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetForeground, fgColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DShadow, sdwColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DHighlight, hltColor);
|
||||
}
|
||||
|
||||
aRenderingContext.SetColor(bgColor);
|
||||
aRenderingContext.FillRect(rect);
|
||||
|
||||
/*aRenderingContext.SetColor(bgColor);
|
||||
for (int i=0;i<int(scale);i++) {
|
||||
aRenderingContext.DrawRect(rect);
|
||||
rect.x += 3;
|
||||
rect.y += 3;
|
||||
rect.width -= 6;
|
||||
rect.height -= 6;
|
||||
}*/
|
||||
|
||||
nscoord onePixel = nscoord(scale);
|
||||
nscoord twoPixels = nscoord(scale*2);
|
||||
|
||||
rect.x += onePixel;
|
||||
rect.y += onePixel;
|
||||
rect.width -= twoPixels;
|
||||
rect.height -= twoPixels;
|
||||
|
||||
nscoord right = rect.x+rect.width;
|
||||
nscoord bottom = rect.y+rect.height;
|
||||
|
||||
|
||||
// Draw Left & Top
|
||||
aRenderingContext.SetColor(NS_RGB(225,225,225));
|
||||
DrawScaledLine(aRenderingContext, rect.x, rect.y, right, rect.y, scale, appUnits, PR_TRUE); // top
|
||||
DrawScaledLine(aRenderingContext, rect.x, rect.y, rect.x, bottom, scale, appUnits, PR_FALSE); // left
|
||||
|
||||
//DrawScaledLine(aRenderingContext, rect.x+onePixel, rect.y+onePixel, right-onePixel, rect.y+onePixel, scale, appUnits, PR_TRUE); // top + 1
|
||||
//DrawScaledLine(aRenderingContext, rect.x+onePixel, rect.y+onePixel, rect.x+onePixel, bottom-onePixel, scale, appUnits, PR_FALSE); // left + 1
|
||||
|
||||
// Draw Right & Bottom
|
||||
aRenderingContext.SetColor(NS_RGB(128,128,128));
|
||||
DrawScaledLine(aRenderingContext, right, rect.y+onePixel, right, bottom, scale, appUnits, PR_FALSE); // right
|
||||
DrawScaledLine(aRenderingContext, rect.x+onePixel, bottom, right, bottom, scale, appUnits, PR_TRUE); // bottom
|
||||
|
||||
//DrawScaledLine(aRenderingContext, right-onePixel, rect.y+twoPixels, right-onePixel, bottom, scale, appUnits, PR_FALSE); // right + 1
|
||||
//DrawScaledLine(aRenderingContext, rect.x+twoPixels, bottom-onePixel, right, bottom-onePixel, scale, appUnits, PR_TRUE); // bottom + 1
|
||||
|
||||
aRenderingContext.SetFont(*mFont);
|
||||
|
||||
nscoord textWidth;
|
||||
nscoord textHeight;
|
||||
aRenderingContext.GetWidth(mLabel, textWidth);
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
context->GetMetricsFor(*mFont, metrics);
|
||||
metrics->GetMaxAscent(textHeight);
|
||||
|
||||
nscoord x = ((rect.width - textWidth) / 2) + rect.x;
|
||||
nscoord y = ((rect.height - textHeight) / 2) + rect.y;
|
||||
aRenderingContext.DrawString(mLabel, x, y);
|
||||
|
||||
|
||||
NS_RELEASE(context);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
BView *nsButton::CreateBeOSView()
|
||||
{
|
||||
return mButton = new nsButtonBeOS(this, BRect(0, 0, 0, 0), "", "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Sub-class of BeOS Button
|
||||
//-------------------------------------------------------------------------
|
||||
nsButtonBeOS::nsButtonBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *aName, const char *aLabel, uint32 aResizingMode, uint32 aFlags )
|
||||
: BButton( aFrame, aName, aLabel, new BMessage('clik'), aResizingMode, aFlags ),
|
||||
nsIWidgetStore( aWidgetWindow )
|
||||
{
|
||||
}
|
||||
|
||||
void nsButtonBeOS::AttachedToWindow()
|
||||
{
|
||||
SetTarget(this);
|
||||
}
|
||||
|
||||
void nsButtonBeOS::MessageReceived(BMessage *msg)
|
||||
{
|
||||
switch(msg->what)
|
||||
{
|
||||
case 'clik' :
|
||||
{
|
||||
nsWindow *w = (nsWindow *)GetMozillaWidget();
|
||||
nsToolkit *t;
|
||||
if(w && (t = w->GetToolkit()) != 0)
|
||||
{
|
||||
uint32 args[5];
|
||||
args[0] = NS_MOUSE_LEFT_CLICK;
|
||||
args[1] = (uint32)0;
|
||||
args[2] = (uint32)0;
|
||||
args[3] = 1;
|
||||
args[4] = modifiers();
|
||||
MethodInfo *info = new MethodInfo(w, w, nsWindow::BTNCLICK, 5, args);
|
||||
t->CallMethodAsync(info);
|
||||
NS_RELEASE(t);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
BButton::MessageReceived(msg);
|
||||
}
|
||||
}
|
||||
|
||||
77
mozilla/widget/src/beos/nsButton.h
Normal file
77
mozilla/widget/src/beos/nsButton.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsButton_h__
|
||||
#define nsButton_h__
|
||||
|
||||
#include "nsdefs.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsSwitchToUIThread.h"
|
||||
|
||||
#include "nsIButton.h"
|
||||
|
||||
#include <Button.h>
|
||||
|
||||
/**
|
||||
* Native Win32 button wrapper
|
||||
*/
|
||||
|
||||
class nsButton : public nsWindow,
|
||||
public nsIButton
|
||||
{
|
||||
|
||||
public:
|
||||
nsButton();
|
||||
virtual ~nsButton();
|
||||
|
||||
//nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIButton part
|
||||
NS_IMETHOD SetLabel(const nsString& aText);
|
||||
NS_IMETHOD GetLabel(nsString& aBuffer);
|
||||
|
||||
// nsBaseWidget
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsRect &r);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
protected:
|
||||
nsString mLabel;
|
||||
virtual BView *CreateBeOSView();
|
||||
BButton *mButton;
|
||||
};
|
||||
|
||||
//
|
||||
// A BButton subclass
|
||||
//
|
||||
class nsButtonBeOS : public BButton, public nsIWidgetStore {
|
||||
public:
|
||||
nsButtonBeOS( nsIWidget *aWidgetWindow, BRect aFrame, const char *aName,
|
||||
const char *aLabel, uint32 aResizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 aFlags = B_WILL_DRAW | B_NAVIGABLE );
|
||||
void AttachedToWindow();
|
||||
void MessageReceived(BMessage *msg);
|
||||
};
|
||||
|
||||
#endif // nsButton_h__
|
||||
102
mozilla/widget/src/beos/nsCList.h
Normal file
102
mozilla/widget/src/beos/nsCList.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef CLIST_H
|
||||
#define CLIST_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
// Simple circular linked-list implementation...
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Foreward declarations...
|
||||
struct CList;
|
||||
|
||||
#define OBJECT_PTR_FROM_CLIST(className, listElement) \
|
||||
((char*)listElement - offsetof(className, m_link))
|
||||
|
||||
|
||||
struct CList {
|
||||
CList *next;
|
||||
CList *prev;
|
||||
|
||||
CList() {
|
||||
next = prev = this;
|
||||
}
|
||||
|
||||
~CList() {
|
||||
Remove();
|
||||
}
|
||||
|
||||
//
|
||||
// Append an element to the end of this list
|
||||
//
|
||||
void Append(CList &element) {
|
||||
element.next = this;
|
||||
element.prev = prev;
|
||||
prev->next = &element;
|
||||
prev = &element;
|
||||
}
|
||||
|
||||
//
|
||||
// Add an element to the beginning of this list
|
||||
//
|
||||
void Add(CList &element) {
|
||||
element.next = next;
|
||||
element.prev = this;
|
||||
next->prev = &element;
|
||||
next = &element;
|
||||
}
|
||||
|
||||
//
|
||||
// Append this element to the end of a list
|
||||
//
|
||||
void AppendToList(CList &list) {
|
||||
list.Append(*this);
|
||||
}
|
||||
|
||||
//
|
||||
// Add this element to the beginning of a list
|
||||
//
|
||||
void AddToList(CList &list) {
|
||||
list.Add(*this);
|
||||
}
|
||||
|
||||
//
|
||||
// Remove this element from the list and re-initialize
|
||||
//
|
||||
void Remove(void) {
|
||||
prev->next = next;
|
||||
next->prev = prev;
|
||||
|
||||
next = prev = this;
|
||||
}
|
||||
|
||||
//
|
||||
// Is this list empty ?
|
||||
//
|
||||
bool IsEmpty(void) {
|
||||
return (next == this);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CLIST_H
|
||||
|
||||
237
mozilla/widget/src/beos/nsCheckButton.cpp
Normal file
237
mozilla/widget/src/beos/nsCheckButton.cpp
Normal file
@@ -0,0 +1,237 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsCheckButton.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIDeviceContext.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsCheckButton)
|
||||
NS_IMPL_RELEASE(nsCheckButton)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsCheckButton constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsCheckButton::nsCheckButton() : nsWindow() , nsICheckButton(),
|
||||
mState(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsCheckButton destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsCheckButton::~nsCheckButton()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID
|
||||
* @modify gpk 8/4/98
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kICheckButtonIID, NS_ICHECKBUTTON_IID);
|
||||
if (aIID.Equals(kICheckButtonIID)) {
|
||||
*aInstancePtr = (void*) ((nsICheckButton*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return nsWindow::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::SetState(const PRBool aState)
|
||||
{
|
||||
mState = aState;
|
||||
if(mCheckBox && mCheckBox->LockLooper())
|
||||
{
|
||||
mCheckBox->SetValue(aState ? 1 : 0);
|
||||
mCheckBox->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::GetState(PRBool& aState)
|
||||
{
|
||||
aState = mState;
|
||||
if(mCheckBox && mCheckBox->LockLooper())
|
||||
{
|
||||
aState = mCheckBox->Value() ? PR_TRUE : PR_FALSE;
|
||||
mCheckBox->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::SetLabel(const nsString& aText)
|
||||
{
|
||||
char label[256];
|
||||
aText.ToCString(label, 256);
|
||||
label[255] = '\0';
|
||||
if(mCheckBox && mCheckBox->LockLooper())
|
||||
{
|
||||
mCheckBox->SetLabel(label);
|
||||
mCheckBox->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
if(mCheckBox && mCheckBox->LockLooper())
|
||||
{
|
||||
aBuffer.SetLength(0);
|
||||
aBuffer.Append(mCheckBox->Label());
|
||||
mCheckBox->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// move, paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsCheckButton::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsCheckButton::OnPaint(nsRect &r)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsCheckButton::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the CheckButton for Printing
|
||||
*
|
||||
**/
|
||||
NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsRect rect;
|
||||
float appUnits;
|
||||
float scale;
|
||||
nsIDeviceContext * context;
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
nscoord one = nscoord(PRFloat64(rect.height) * 1.0/20.0);
|
||||
nscoord three = nscoord(PRFloat64(rect.width) * 3.0/20.0);
|
||||
nscoord five = nscoord(PRFloat64(rect.width) * 5.0/20.0);
|
||||
nscoord six = nscoord(PRFloat64(rect.height) * 5.0/20.0);
|
||||
nscoord eight = nscoord(PRFloat64(rect.height) * 7.0/20.0);
|
||||
nscoord nine = nscoord(PRFloat64(rect.width) * 9.0/20.0);
|
||||
nscoord ten = nscoord(PRFloat64(rect.height) * 9.0/20.0);
|
||||
|
||||
rect.x += three;
|
||||
rect.y += nscoord(PRFloat64(rect.height) * 3.5 /20.0);
|
||||
rect.width = nscoord(PRFloat64(rect.width) * 12.0/20.0);
|
||||
rect.height = nscoord(PRFloat64(rect.height) * 12.0/20.0);
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
|
||||
nscoord onePixel = nscoord((appUnits+0.6F));
|
||||
DrawScaledRect(aRenderingContext, rect, scale, appUnits);
|
||||
nscoord x = rect.x;
|
||||
nscoord y = rect.y;
|
||||
|
||||
if (mState) {
|
||||
nscoord inc = nscoord(PRFloat64(rect.height) * 0.75/20.0);
|
||||
nscoord yy = 0;
|
||||
for (nscoord i=0;i<4;i++) {
|
||||
DrawScaledLine(aRenderingContext, x+three, y+eight+yy, x+five, y+ten+yy, scale, appUnits, PR_FALSE); // top
|
||||
DrawScaledLine(aRenderingContext, x+five, y+ten+yy, x+nine, y+six+yy, scale, appUnits, PR_FALSE); // top
|
||||
//aRenderingContext.DrawLine(x+three, y+eight+yy, x+five, y+ten+yy);
|
||||
//aRenderingContext.DrawLine(x+five, y+ten+yy, x+nine, y+six+yy);
|
||||
yy += nscoord(scale);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(context);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
BView *nsCheckButton::CreateBeOSView()
|
||||
{
|
||||
return mCheckBox = new nsCheckBoxBeOS(this, BRect(0, 0, 0, 0), "", "", NULL);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Sub-class of BeOS CheckBox
|
||||
//-------------------------------------------------------------------------
|
||||
nsCheckBoxBeOS::nsCheckBoxBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *aName, const char *aLabel, BMessage *aMessage,
|
||||
uint32 aResizingMode, uint32 aFlags )
|
||||
: BCheckBox( aFrame, aName, aLabel, aMessage, aResizingMode, aFlags ),
|
||||
nsIWidgetStore( aWidgetWindow )
|
||||
{
|
||||
}
|
||||
77
mozilla/widget/src/beos/nsCheckButton.h
Normal file
77
mozilla/widget/src/beos/nsCheckButton.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsCheckButton_h__
|
||||
#define nsCheckButton_h__
|
||||
|
||||
#include "nsdefs.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsSwitchToUIThread.h"
|
||||
|
||||
#include "nsICheckButton.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
|
||||
/**
|
||||
* Native Win32 Checkbox wrapper
|
||||
*/
|
||||
|
||||
class nsCheckButton : public nsWindow,
|
||||
public nsICheckButton
|
||||
{
|
||||
|
||||
public:
|
||||
nsCheckButton();
|
||||
virtual ~nsCheckButton();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsICheckButton part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer);
|
||||
NS_IMETHOD SetState(const PRBool aState);
|
||||
NS_IMETHOD GetState(PRBool& aState);
|
||||
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsRect &r);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
|
||||
protected:
|
||||
PRBool mState;
|
||||
virtual BView *CreateBeOSView();
|
||||
BCheckBox *mCheckBox;
|
||||
};
|
||||
|
||||
//
|
||||
// A BCheckBox subclass
|
||||
//
|
||||
class nsCheckBoxBeOS : public BCheckBox, public nsIWidgetStore {
|
||||
public:
|
||||
nsCheckBoxBeOS( nsIWidget *aWidgetWindow, BRect aFrame, const char *aName,
|
||||
const char *aLabel, BMessage *aMessage, uint32 aResizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 aFlags = B_WILL_DRAW | B_NAVIGABLE );
|
||||
};
|
||||
|
||||
#endif // nsCheckButton_h__
|
||||
523
mozilla/widget/src/beos/nsClipboard.cpp
Normal file
523
mozilla/widget/src/beos/nsClipboard.cpp
Normal file
@@ -0,0 +1,523 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsClipboard.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIClipboardOwner.h"
|
||||
#include "nsITransferable.h" // kTextMime
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
#include <View.h>
|
||||
|
||||
// The class statics:
|
||||
BView *nsClipboard::sView = 0;
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsClipboard, nsBaseClipboard)
|
||||
NS_IMPL_RELEASE_INHERITED(nsClipboard, nsBaseClipboard)
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
|
||||
#if defined(DEBUG_akkana) || defined(DEBUG_mcafee)
|
||||
#define DEBUG_CLIPBOARD
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsClipboard constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsClipboard::nsClipboard() : nsBaseClipboard()
|
||||
{
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::nsClipboard()\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
|
||||
//NS_INIT_REFCNT();
|
||||
mIgnoreEmptyNotification = PR_FALSE;
|
||||
mClipboardOwner = nsnull;
|
||||
mTransferable = nsnull;
|
||||
// mSelectionData.data = nsnull;
|
||||
// mSelectionData.length = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsClipboard destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsClipboard::~nsClipboard()
|
||||
{
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::~nsClipboard()\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
|
||||
// // Remove all our event handlers:
|
||||
// if (sView &&
|
||||
// gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == sWidget->window)
|
||||
// gtk_selection_remove_all(sWidget);
|
||||
//
|
||||
// // free the selection data, if any
|
||||
// if (mSelectionData.data != nsnull)
|
||||
// g_free(mSelectionData.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsClipboard::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NOINTERFACE;
|
||||
|
||||
if (aIID.Equals(nsIClipboard::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIClipboard*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
void nsClipboard::SetTopLevelView(BView *v)
|
||||
{
|
||||
// Don't set up any more event handlers if we're being called twice
|
||||
// for the same toplevel widget
|
||||
if (sView == v)
|
||||
return;
|
||||
|
||||
if (sView != 0 && sView->Window() != 0)
|
||||
return;
|
||||
|
||||
if(v == 0 || v->Window() == 0)
|
||||
{
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::SetTopLevelView: widget passed in is null or has no window!\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::SetTopLevelView\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
|
||||
// // If we're changing from one widget to another
|
||||
// // (shouldn't generally happen), clear the old event handlers:
|
||||
// if (sView &&
|
||||
// gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == sWidget->window)
|
||||
// gtk_selection_remove_all(sWidget);
|
||||
//
|
||||
// sWidget = w;
|
||||
//
|
||||
// // Get the clipboard from the service manager.
|
||||
// nsresult rv;
|
||||
// NS_WITH_SERVICE(nsIClipboard, clipboard, kCClipboardCID, &rv);
|
||||
//
|
||||
// if (!NS_SUCCEEDED(rv)) {
|
||||
// printf("Couldn't get clipboard service!\n");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Handle selection requests if we called gtk_selection_add_target:
|
||||
// gtk_signal_connect(GTK_OBJECT(sWidget), "selection_get",
|
||||
// GTK_SIGNAL_FUNC(nsClipboard::SelectionGetCB),
|
||||
// clipboard);
|
||||
//
|
||||
// // When someone else takes the selection away:
|
||||
// gtk_signal_connect(GTK_OBJECT(sWidget), "selection_clear_event",
|
||||
// GTK_SIGNAL_FUNC(nsClipboard::SelectionClearCB),
|
||||
// clipboard);
|
||||
//
|
||||
// // Set up the paste handler:
|
||||
// gtk_signal_connect(GTK_OBJECT(sWidget), "selection_received",
|
||||
// GTK_SIGNAL_FUNC(nsClipboard::SelectionReceivedCB),
|
||||
// clipboard);
|
||||
//
|
||||
//#if 0
|
||||
// // Handle selection requests if we called gtk_selection_add_targets:
|
||||
// gtk_signal_connect(GTK_OBJECT(sWidget), "selection_request_event",
|
||||
// GTK_SIGNAL_FUNC(nsClipboard::SelectionRequestCB),
|
||||
// clipboard);
|
||||
//
|
||||
// // Watch this, experimenting with Gtk :-)
|
||||
// gtk_signal_connect(GTK_OBJECT(sWidget), "selection_notify_event",
|
||||
// GTK_SIGNAL_FUNC(nsClipboard::SelectionNotifyCB),
|
||||
// clipboard);
|
||||
//#endif
|
||||
//
|
||||
// // Hmm, sometimes we need this, sometimes not. I'm not clear why.
|
||||
// // See also long comment above on why we don't register a whole target list.
|
||||
//
|
||||
// // Register all the target types we handle:
|
||||
// gtk_selection_add_target(sWidget,
|
||||
// GDK_SELECTION_PRIMARY,
|
||||
// GDK_SELECTION_TYPE_STRING,
|
||||
// GDK_SELECTION_TYPE_STRING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsClipboard::SetNativeClipboardData()
|
||||
{
|
||||
mIgnoreEmptyNotification = PR_TRUE;
|
||||
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::SetNativeClipboardData()\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
|
||||
// make sure we have a good transferable
|
||||
if (nsnull == mTransferable) {
|
||||
printf(" SetNativeClipboardData: no transferable!\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// // If we're already the selection owner, don't need to do anything,
|
||||
// // we'll already get the events:
|
||||
// if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == sWidget->window)
|
||||
// return NS_OK;
|
||||
//
|
||||
// // Clear the native clipboard
|
||||
// if (sWidget &&
|
||||
// gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == sWidget->window)
|
||||
// gtk_selection_remove_all(sWidget);
|
||||
//
|
||||
//
|
||||
// // register as the selection owner:
|
||||
// gint have_selection =
|
||||
// gtk_selection_owner_set(sWidget,
|
||||
// GDK_SELECTION_PRIMARY,
|
||||
// GDK_CURRENT_TIME);
|
||||
// if (have_selection == 0)
|
||||
// return NS_ERROR_FAILURE;
|
||||
|
||||
mIgnoreEmptyNotification = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// The blocking Paste routine
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::GetNativeClipboardData()\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
|
||||
// make sure we have a good transferable
|
||||
if (nsnull == aTransferable) {
|
||||
printf(" GetNativeClipboardData: Transferable is null!\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Dunno why we need to do this, copying the win32 code ...
|
||||
nsCOMPtr<nsITransferable> trans = do_QueryInterface(aTransferable);
|
||||
if (!trans)
|
||||
return rv;
|
||||
|
||||
// //
|
||||
// // We can't call the copy callback when we're blocking on the paste callback;
|
||||
// // so if this app is already the selection owner, we need to copy our own
|
||||
// // data without going through the X server.
|
||||
// //
|
||||
// if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == sWidget->window)
|
||||
// {
|
||||
// // XXX only support text/plain for now
|
||||
// nsAutoString dataFlavor(kTextMime);
|
||||
//
|
||||
// // Get data out of our existing transferable.
|
||||
// void *clipboardData;
|
||||
// PRUint32 dataLength;
|
||||
// rv = mTransferable->GetTransferData(&dataFlavor,
|
||||
// &clipboardData,
|
||||
// &dataLength);
|
||||
// if (NS_SUCCEEDED(rv))
|
||||
// rv = trans->SetTransferData(&dataFlavor,
|
||||
// clipboardData, dataLength);
|
||||
// return rv;
|
||||
// }
|
||||
//
|
||||
//#define ONLY_SUPPORT_PLAIN_TEXT 1
|
||||
//#ifdef ONLY_SUPPORT_PLAIN_TEXT
|
||||
// gtk_selection_convert(sWidget, GDK_SELECTION_PRIMARY,
|
||||
// GDK_SELECTION_TYPE_STRING, GDK_CURRENT_TIME);
|
||||
// // Tried to use straight Xlib call but this would need more work:
|
||||
// //XConvertSelection(GDK_WINDOW_XDISPLAY(sWidget->window),
|
||||
// // XA_PRIMARY, XA_STRING, gdk_selection_property,
|
||||
// // GDK_WINDOW_XWINDOW(sWidget->window), GDK_CURRENT_TIME);
|
||||
//
|
||||
//#else /* ONLY_SUPPORT_PLAIN_TEXT */
|
||||
// //
|
||||
// // XXX This code isn't implemented for Unix yet!
|
||||
// // Instead of SetTransferData it will have to call gtk_selection_convert.
|
||||
// //
|
||||
//
|
||||
// // Get the transferable list of data flavors
|
||||
// nsVoidArray * dfList;
|
||||
// aTransferable->GetTransferDataFlavors(&dfList);
|
||||
//
|
||||
// // Walk through flavors and see which flavor matches the one being pasted:
|
||||
// PRUint32 i;
|
||||
// PRUint32 cnt = 0;
|
||||
// nsresult rv = dfList->Count(&cnt);
|
||||
// NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
|
||||
// for (i=0;i<cnt;i++) {
|
||||
// nsString * df = (nsString *)dfList->ElementAt(i);
|
||||
// if (nsnull != df) {
|
||||
// UINT format = GetFormat(*df);
|
||||
//
|
||||
// void * data;
|
||||
// PRUint32 dataLen;
|
||||
//
|
||||
// if (nsnull != aDataObject) {
|
||||
// res = GetNativeDataOffClipboard(aDataObject, format, &data, &dataLen);
|
||||
// if (NS_OK == res) {
|
||||
// trans->SetTransferData(df, data, dataLen);
|
||||
// }
|
||||
// } else if (nsnull != aWindow) {
|
||||
// res = GetNativeDataOffClipboard(aWindow, format, &data, &dataLen);
|
||||
// if (NS_OK == res) {
|
||||
// trans->SetTransferData(df, data, dataLen);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//#endif /* ONLY_SUPPORT_PLAIN_TEXT */
|
||||
//
|
||||
// //
|
||||
// // We've told X what type to send, and we just have to wait
|
||||
// // for the callback saying that the data have been transferred.
|
||||
// //
|
||||
//
|
||||
// // Set a flag saying that we're blocking waiting for the callback:
|
||||
// mBlocking = PR_TRUE;
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf("Waiting for the callback\n");
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//
|
||||
// // Now we need to wait until the callback comes in ...
|
||||
// // i is in case we get a runaway (yuck).
|
||||
// for (int i=0; mBlocking == PR_TRUE && i < 10000; ++i)
|
||||
// {
|
||||
// gtk_main_iteration_do(PR_TRUE);
|
||||
// }
|
||||
//
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf("Got the callback: '%s', %d\n",
|
||||
// mSelectionData.data, mSelectionData.length);
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//
|
||||
// // We're back from the callback, no longer blocking:
|
||||
// mBlocking = PR_FALSE;
|
||||
//
|
||||
// //
|
||||
// // Now we have data in mSelectionData.data.
|
||||
// // We just have to copy it to the transferable.
|
||||
// //
|
||||
// nsAutoString dataFlavor(kTextMime);
|
||||
// trans->SetTransferData(&dataFlavor, mSelectionData.data, mSelectionData.length);
|
||||
//
|
||||
// // Can't free the selection data -- the transferable just saves a pointer.
|
||||
// // But the transferable is responsible for freeing it, so we have to
|
||||
// // consider it freed now:
|
||||
// //g_free(mSelectionData.data);
|
||||
// mSelectionData.data = nsnull;
|
||||
// mSelectionData.length = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// Called when the data from a paste comes in:
|
||||
//
|
||||
//void
|
||||
//nsClipboard::SelectionReceivedCB (GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// gpointer aData)
|
||||
//{
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf(" nsClipboard::SelectionReceivedCB\n");
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//
|
||||
// // ARGHH! GTK doesn't pass the arg to the callback, so we can't
|
||||
// // get "this" back! Until we solve this, get it from the service mgr:
|
||||
// nsresult rv;
|
||||
// NS_WITH_SERVICE(nsIClipboard, iclipboard, kCClipboardCID, &rv);
|
||||
//
|
||||
// if (NS_FAILED(rv)) {
|
||||
// printf("Couldn't get clipboard service!\n");
|
||||
// return;
|
||||
// }
|
||||
// nsClipboard* clipboard = (nsClipboard*)iclipboard;
|
||||
// if (!clipboard) {
|
||||
// printf("couldn't convert nsIClipboard to nsClipboard\n");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// clipboard->SelectionReceiver(aWidget, aSelectionData);
|
||||
//}
|
||||
//
|
||||
//void
|
||||
//nsClipboard::SelectionReceiver (GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData)
|
||||
//{
|
||||
// mBlocking = PR_FALSE;
|
||||
//
|
||||
// if (aSelectionData->length < 0)
|
||||
// {
|
||||
// printf("Error retrieving selection: length was %d\n",
|
||||
// aSelectionData->length);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// switch (aSelectionData->type)
|
||||
// {
|
||||
// case GDK_SELECTION_TYPE_STRING:
|
||||
// mSelectionData = *aSelectionData;
|
||||
// mSelectionData.data = g_new(guchar, aSelectionData->length + 1);
|
||||
// memcpy(mSelectionData.data,
|
||||
// aSelectionData->data, aSelectionData->length);
|
||||
// // Null terminate in case anyone cares,
|
||||
// // and so we can print the string for debugging:
|
||||
// mSelectionData.data[aSelectionData->length] = '\0';
|
||||
// mSelectionData.length = aSelectionData->length;
|
||||
// return;
|
||||
//
|
||||
// default:
|
||||
// printf("Can't convert type %s (%ld) to string\n",
|
||||
// gdk_atom_name (aSelectionData->type), aSelectionData->type);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
/**
|
||||
* No-op.
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsClipboard::ForceDataToClipboard()
|
||||
{
|
||||
#ifdef DEBUG_CLIPBOARD
|
||||
printf(" nsClipboard::ForceDataToClipboard()\n");
|
||||
#endif /* DEBUG_CLIPBOARD */
|
||||
|
||||
// make sure we have a good transferable
|
||||
if (nsnull == mTransferable) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
//// This is the callback which is called when another app
|
||||
//// requests the selection.
|
||||
////
|
||||
//void nsClipboard::SelectionGetCB(GtkWidget *widget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// guint /*info*/,
|
||||
// guint /*time*/,
|
||||
// gpointer aData)
|
||||
//{
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf(" nsClipboard::SelectionGetCB\n");
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//
|
||||
// nsClipboard *clipboard = (nsClipboard *)aData;
|
||||
//
|
||||
// void *clipboardData;
|
||||
// PRUint32 dataLength;
|
||||
// nsresult rv;
|
||||
//
|
||||
// // Make sure we have a transferable:
|
||||
// if (!clipboard->mTransferable) {
|
||||
// printf("Clipboard has no transferable!\n");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // XXX hack, string-only for now.
|
||||
// // Create string data-flavor.
|
||||
// nsString dataFlavor (kTextMime);
|
||||
//
|
||||
// // Get data out of transferable.
|
||||
// rv = clipboard->mTransferable->GetTransferData(&dataFlavor,
|
||||
// &clipboardData,
|
||||
// &dataLength);
|
||||
//
|
||||
// // Currently we only offer the data in GDK_SELECTION_TYPE_STRING format.
|
||||
// if (NS_SUCCEEDED(rv) && clipboardData && dataLength > 0) {
|
||||
// gtk_selection_data_set(aSelectionData,
|
||||
// GDK_SELECTION_TYPE_STRING, 8,
|
||||
// (unsigned char *)clipboardData,
|
||||
// dataLength);
|
||||
// }
|
||||
// else
|
||||
// printf("Transferable didn't support the data flavor\n");
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
//// Called when another app requests selection ownership:
|
||||
//void nsClipboard::SelectionClearCB(GtkWidget *widget,
|
||||
// GdkEventSelection *event,
|
||||
// gpointer data)
|
||||
//{
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf(" nsClipboard::SelectionClearCB\n");
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//}
|
||||
//
|
||||
//
|
||||
//// The routine called when another app asks for the content of the selection
|
||||
//void
|
||||
//nsClipboard::SelectionRequestCB (GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// gpointer aData)
|
||||
//{
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf(" nsClipboard::SelectionRequestCB\n");
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//}
|
||||
//
|
||||
//void
|
||||
//nsClipboard::SelectionNotifyCB (GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// gpointer aData)
|
||||
//{
|
||||
//#ifdef DEBUG_CLIPBOARD
|
||||
// printf(" nsClipboard::SelectionNotifyCB\n");
|
||||
//#endif /* DEBUG_CLIPBOARD */
|
||||
//}
|
||||
88
mozilla/widget/src/beos/nsClipboard.h
Normal file
88
mozilla/widget/src/beos/nsClipboard.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsClipboard_h__
|
||||
#define nsClipboard_h__
|
||||
|
||||
#include "nsBaseClipboard.h"
|
||||
#include <Clipboard.h>
|
||||
|
||||
class nsITransferable;
|
||||
class nsIClipboardOwner;
|
||||
class nsIWidget;
|
||||
|
||||
/**
|
||||
* Native BeOS Clipboard wrapper
|
||||
*/
|
||||
|
||||
class nsClipboard : public nsBaseClipboard
|
||||
{
|
||||
|
||||
public:
|
||||
nsClipboard();
|
||||
virtual ~nsClipboard();
|
||||
|
||||
//nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIClipboard
|
||||
NS_IMETHOD ForceDataToClipboard();
|
||||
|
||||
static void SetTopLevelView(BView *v);
|
||||
|
||||
|
||||
protected:
|
||||
NS_IMETHOD SetNativeClipboardData();
|
||||
NS_IMETHOD GetNativeClipboardData(nsITransferable * aTransferable);
|
||||
|
||||
PRBool mIgnoreEmptyNotification;
|
||||
|
||||
static BView *sView;
|
||||
|
||||
// // Used for communicating pasted data
|
||||
// // from the asynchronous X routines back to a blocking paste:
|
||||
// GtkSelectionData mSelectionData;
|
||||
// PRBool mBlocking;
|
||||
//
|
||||
// void SelectionReceiver(GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData);
|
||||
//
|
||||
// static void SelectionGetCB(GtkWidget *widget,
|
||||
// GtkSelectionData *selection_data,
|
||||
// guint /*info*/,
|
||||
// guint /*time*/,
|
||||
// gpointer data);
|
||||
//
|
||||
// static void SelectionClearCB(GtkWidget *widget,
|
||||
// GdkEventSelection *event,
|
||||
// gpointer data );
|
||||
//
|
||||
// static void SelectionRequestCB(GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// gpointer aData);
|
||||
//
|
||||
// static void SelectionReceivedCB(GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// gpointer aData);
|
||||
//
|
||||
// static void SelectionNotifyCB(GtkWidget *aWidget,
|
||||
// GtkSelectionData *aSelectionData,
|
||||
// gpointer aData);
|
||||
};
|
||||
|
||||
#endif // nsClipboard_h__
|
||||
380
mozilla/widget/src/beos/nsComboBox.cpp
Normal file
380
mozilla/widget/src/beos/nsComboBox.cpp
Normal file
@@ -0,0 +1,380 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsComboBox.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
NS_IMPL_ADDREF(nsComboBox)
|
||||
NS_IMPL_RELEASE(nsComboBox)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsComboBox constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsComboBox::nsComboBox() : nsWindow(), nsIListWidget(), nsIComboBox()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mBackground = NS_RGB(124, 124, 124);
|
||||
mDropDownHeight = 60; // Default to 60 pixels for drop-down list height
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsComboBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
|
||||
{
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
NS_ALLOC_STR_BUF(val, aItem, 256);
|
||||
mMenuField->Menu()->AddItem(new BMenuItem(val, 0), aPosition);
|
||||
NS_FREE_STR_BUF(val);
|
||||
mMenuField->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Finds an item at a postion
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsComboBox::FindItem(nsString &aItem, PRInt32 aStartPos)
|
||||
{
|
||||
#if 0
|
||||
NS_ALLOC_STR_BUF(val, aItem, 256);
|
||||
int index = ::SendMessage(mWnd, CB_FINDSTRINGEXACT, (int)aStartPos, (LPARAM)(LPCTSTR)val);
|
||||
NS_FREE_STR_BUF(val);
|
||||
|
||||
return index;
|
||||
#endif
|
||||
printf("nsListBox::FindItem not implemented\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// CountItems - Get Item Count
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsComboBox::GetItemCount()
|
||||
{
|
||||
PRInt32 result = 0;
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
result = mMenuField->Menu()->CountItems();
|
||||
mMenuField->UnlockLooper();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Removes an Item at a specified location
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsComboBox::RemoveItemAt(PRInt32 aPosition)
|
||||
{
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
BMenuItem *it = mMenuField->Menu()->RemoveItem(aPosition);
|
||||
delete it;
|
||||
mMenuField->UnlockLooper();
|
||||
return it ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Removes an Item at a specified location
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsComboBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
anItem.SetLength(0);
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
BMenuItem *it = mMenuField->Menu()->ItemAt(aPosition);
|
||||
anItem.Append(it->Label());
|
||||
mMenuField->UnlockLooper();
|
||||
result = PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Gets the selected of selected item
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsComboBox::GetSelectedItem(nsString& aItem)
|
||||
{
|
||||
GetItemAt(aItem, GetSelectedIndex());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Gets the list of selected otems
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsComboBox::GetSelectedIndex()
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
BMenuItem *it = mMenuField->Menu()->FindMarked();
|
||||
index = it ? mMenuField->Menu()->IndexOf(it) : -1;
|
||||
mMenuField->UnlockLooper();
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// SelectItem
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsComboBox::SelectItem(PRInt32 aPosition)
|
||||
{
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
BMenuItem *it = mMenuField->Menu()->ItemAt(aPosition);
|
||||
if(it)
|
||||
it->SetMarked(true);
|
||||
mMenuField->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Deselect
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsComboBox::Deselect()
|
||||
{
|
||||
if(mMenuField && mMenuField->LockLooper())
|
||||
{
|
||||
BMenuItem *it = mMenuField->Menu()->FindMarked();
|
||||
if(it)
|
||||
it->SetMarked(false);
|
||||
mMenuField->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsComboBox::~nsComboBox()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsComboBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
static NS_DEFINE_IID(kInsComboBoxIID, NS_ICOMBOBOX_IID);
|
||||
static NS_DEFINE_IID(kInsListWidgetIID, NS_ILISTWIDGET_IID);
|
||||
|
||||
if (aIID.Equals(kInsComboBoxIID)) {
|
||||
*aInstancePtr = (void*) ((nsIComboBox*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kInsListWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsIListWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsWindow::QueryInterface(aIID,aInstancePtr);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// move, paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsComboBox::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsComboBox::OnPaint(nsRect &r)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsComboBox::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Cache the drop down list height in mDropDownHeight
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsComboBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
nsComboBoxInitData* comboData = (nsComboBoxInitData*)aInitData;
|
||||
mDropDownHeight = comboData->mDropDownHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Modify the height passed to create and resize to be
|
||||
// the combo box drop down list height. (Note: Windows uses
|
||||
// the height of the window to specify the drop-down list size,
|
||||
// not the height of combobox text area.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRInt32 nsComboBox::GetHeight(PRInt32 aProposedHeight)
|
||||
{
|
||||
return(mDropDownHeight);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsComboBox::GetBounds(nsRect &aRect)
|
||||
{
|
||||
#if 0
|
||||
nsWindow::GetNonClientBounds(aRect);
|
||||
#endif
|
||||
printf("nsListBox::GetBounds not wrong\n"); // the following is just a placeholder
|
||||
nsWindow::GetClientBounds(aRect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the TextWidget for Printing
|
||||
*
|
||||
**/
|
||||
NS_METHOD nsComboBox::Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsBaseWidget::Paint(aRenderingContext, aDirtyRect);
|
||||
/*nsRect rect;
|
||||
GetBoundsAppUnits(rect, aTwipsConversion);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
|
||||
nscolor bgColor = NS_RGB(255,255,255);
|
||||
nscolor fgColor = NS_RGB(0,0,0);
|
||||
nscolor hltColor = NS_RGB(240,240,240);
|
||||
nscolor sdwColor = NS_RGB(128,128,128);
|
||||
nsILookAndFeel * lookAndFeel;
|
||||
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetBackground, bgColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetForeground, fgColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DShadow, sdwColor);
|
||||
lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DHighlight, hltColor);
|
||||
}
|
||||
|
||||
nsIDeviceContext * context;
|
||||
//nsDrawingSurface surface;
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
//context->GetDrawingSurface(aRenderingContext, surface);
|
||||
|
||||
//HDC the_hdc = ((nsDrawingSurfaceWin *)&surface)->mDC;
|
||||
|
||||
//::SendMessage(mWnd, WM_PAINT, (WPARAM)the_hdc, NULL);
|
||||
|
||||
|
||||
// shrink by one pixel
|
||||
|
||||
nscoord onePixel = nscoord((aTwipsConversion+0.6F));
|
||||
nscoord twoPixels = onePixel*2;
|
||||
|
||||
nsString text("(ComboBox)");
|
||||
//GetSelectedItem(text);
|
||||
|
||||
|
||||
aRenderingContext.SetColor(bgColor);
|
||||
aRenderingContext.FillRect(rect);
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
aRenderingContext.DrawRect(rect);
|
||||
|
||||
|
||||
aRenderingContext.SetFont(*mFont);
|
||||
|
||||
nscoord textWidth;
|
||||
nscoord textHeight;
|
||||
aRenderingContext.GetWidth(text, textWidth);
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
context->GetMetricsFor(*mFont, metrics);
|
||||
metrics->GetMaxAscent(textHeight);
|
||||
|
||||
nscoord x = (twoPixels * 2) + rect.x;
|
||||
nscoord y = ((rect.height - textHeight) / 2) + rect.y;
|
||||
//aRenderingContext.DrawString(text, x, y);
|
||||
*/
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
BView *nsComboBox::CreateBeOSView()
|
||||
{
|
||||
return mMenuField = new nsMenuFieldBeOS((nsIWidget *)this, BRect(0, 0, 0, 0), "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Sub-class of BeOS MenuField
|
||||
//-------------------------------------------------------------------------
|
||||
nsMenuFieldBeOS::nsMenuFieldBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *aName, uint32 aResizingMode, uint32 aFlags )
|
||||
: BMenuField( aFrame, aName, "", new BPopUpMenu(""), aResizingMode, aFlags ),
|
||||
nsIWidgetStore( aWidgetWindow )
|
||||
{
|
||||
SetDivider(0);
|
||||
}
|
||||
93
mozilla/widget/src/beos/nsComboBox.h
Normal file
93
mozilla/widget/src/beos/nsComboBox.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsComboBox_h__
|
||||
#define nsComboBox_h__
|
||||
|
||||
#include "nsdefs.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsSwitchToUIThread.h"
|
||||
#include "nsIComboBox.h"
|
||||
|
||||
#include <MenuItem.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <MenuField.h>
|
||||
|
||||
/**
|
||||
* Native Win32 Combobox wrapper
|
||||
*/
|
||||
|
||||
class nsComboBox : public nsWindow,
|
||||
public nsIListWidget,
|
||||
public nsIComboBox
|
||||
{
|
||||
|
||||
public:
|
||||
nsComboBox();
|
||||
~nsComboBox();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIWidget overrides
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsRect &r);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
// nsIWidget
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
// nsIComboBox interface
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition);
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos);
|
||||
virtual PRInt32 GetItemCount();
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition);
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition);
|
||||
NS_IMETHOD GetSelectedItem(nsString& aItem);
|
||||
virtual PRInt32 GetSelectedIndex();
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition);
|
||||
NS_IMETHOD Deselect() ;
|
||||
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
protected:
|
||||
|
||||
// Modify the height passed to create and resize to be
|
||||
// the combo box drop down list height.
|
||||
PRInt32 GetHeight(PRInt32 aProposedHeight);
|
||||
PRInt32 mDropDownHeight;
|
||||
BView *CreateBeOSView();
|
||||
BMenuField *mMenuField;
|
||||
};
|
||||
|
||||
//
|
||||
// A BMenuField subclass
|
||||
//
|
||||
class nsMenuFieldBeOS : public BMenuField, public nsIWidgetStore {
|
||||
public:
|
||||
nsMenuFieldBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *name, uint32 aResizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 aFlags = B_WILL_DRAW | B_NAVIGABLE );
|
||||
};
|
||||
|
||||
#endif // nsComboBox_h__
|
||||
165
mozilla/widget/src/beos/nsDialog.cpp
Normal file
165
mozilla/widget/src/beos/nsDialog.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsDialog.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsTransform2D.h"
|
||||
#include "nsStringUtil.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "resource.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsDialog)
|
||||
NS_IMPL_RELEASE(nsDialog)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsDialog constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsDialog::nsDialog() : nsWindow(), nsIDialog()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Create the proper widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsDialog::Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
{
|
||||
return nsWindow::Create(aParent,aRect,aHandleEventFunction,aContext,aAppShell,aToolkit,aInitData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsDialog destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsDialog::~nsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsDialog::SetLabel(const nsString& aText)
|
||||
{
|
||||
#if 0
|
||||
NS_ALLOC_STR_BUF(label, aText, 256);
|
||||
VERIFY(::SetWindowText(mWnd, label));
|
||||
NS_FREE_STR_BUF(label);
|
||||
#endif
|
||||
printf("nsDialog::SetLabel not implemented\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsDialog::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
#if 0
|
||||
int actualSize = ::GetWindowTextLength(mWnd)+1;
|
||||
NS_ALLOC_CHAR_BUF(label, 256, actualSize);
|
||||
::GetWindowText(mWnd, label, actualSize);
|
||||
aBuffer.SetLength(0);
|
||||
aBuffer.Append(label);
|
||||
NS_FREE_CHAR_BUF(label);
|
||||
#endif
|
||||
printf("nsDialog::SetLabel not implemented\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsDialog::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWindow::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsDialogIID, NS_IDIALOG_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kInsDialogIID)) {
|
||||
*aInstancePtr = (void*) ((nsIDialog*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// move, paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsDialog::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsDialog::OnPaint(nsRect &r)
|
||||
{
|
||||
return nsWindow::OnPaint(r);
|
||||
}
|
||||
|
||||
PRBool nsDialog::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return nsWindow::OnResize(aWindowRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsDialog::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
230
mozilla/widget/src/beos/nsDragService.cpp
Normal file
230
mozilla/widget/src/beos/nsDragService.cpp
Normal file
@@ -0,0 +1,230 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsDragService.h"
|
||||
#include "nsITransferable.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDragServiceIID, NS_IDRAGSERVICE_IID);
|
||||
static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
|
||||
|
||||
// The class statics:
|
||||
BView *nsDragService::sView = 0;
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// static variables
|
||||
//-------------------------------------------------------------------------
|
||||
//static PRBool gHaveDrag = PR_FALSE;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// DragService constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsDragService::nsDragService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// DragService destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsDragService::~nsDragService()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsDragService::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NOINTERFACE;
|
||||
|
||||
if (aIID.Equals(nsIDragService::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIDragService*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::StartDragSession (nsITransferable * aTransferable, PRUint32 aActionType)
|
||||
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable,
|
||||
PRUint32 aItemIndex)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void nsDragService::SetTopLevelView(BView *v)
|
||||
{
|
||||
printf(" nsDragService::SetTopLevelWidget\n");
|
||||
|
||||
// Don't set up any more event handlers if we're being called twice
|
||||
// for the same toplevel widget
|
||||
if (sView == v)
|
||||
return;
|
||||
|
||||
sView = v;
|
||||
|
||||
// Get the DragService from the service manager.
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIDragService, dragService, kCDragServiceCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
gtk_signal_connect (GTK_OBJECT (pixmap), "drag_leave",
|
||||
GTK_SIGNAL_FUNC (nsDragService::DragLeave), dragService);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (pixmap), "drag_motion",
|
||||
GTK_SIGNAL_FUNC (nsDragService::DragMotion), dragService);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (pixmap), "drag_drop",
|
||||
GTK_SIGNAL_FUNC (nsDragService::DragDrop), dragService);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (pixmap), "drag_data_received",
|
||||
GTK_SIGNAL_FUNC (nsDragService::DragDataReceived), dragService);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//void
|
||||
//nsDragService::DragLeave (GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// guint time)
|
||||
//{
|
||||
// g_print("leave\n");
|
||||
// //gHaveDrag = PR_FALSE;
|
||||
//}
|
||||
//
|
||||
////-------------------------------------------------------------------------
|
||||
//PRBool
|
||||
//nsDragService::DragMotion(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gint x,
|
||||
// gint y,
|
||||
// guint time)
|
||||
//{
|
||||
// g_print("drag motion\n");
|
||||
// GtkWidget *source_widget;
|
||||
//
|
||||
//#if 0
|
||||
// if (!gHaveDrag) {
|
||||
// gHaveDrag = PR_TRUE;
|
||||
// }
|
||||
//#endif
|
||||
//
|
||||
// source_widget = gtk_drag_get_source_widget (context);
|
||||
// g_print("motion, source %s\n", source_widget ?
|
||||
// gtk_type_name (GTK_OBJECT (source_widget)->klass->type) :
|
||||
// "unknown");
|
||||
//
|
||||
// gdk_drag_status (context, context->suggested_action, time);
|
||||
//
|
||||
// return PR_TRUE;
|
||||
//}
|
||||
//
|
||||
////-------------------------------------------------------------------------
|
||||
//PRBool
|
||||
//nsDragService::DragDrop(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gint x,
|
||||
// gint y,
|
||||
// guint time)
|
||||
//{
|
||||
// g_print("drop\n");
|
||||
// //gHaveDrag = PR_FALSE;
|
||||
//
|
||||
// if (context->targets){
|
||||
// gtk_drag_get_data (widget, context,
|
||||
// GPOINTER_TO_INT (context->targets->data),
|
||||
// time);
|
||||
// return PR_TRUE;
|
||||
// }
|
||||
//
|
||||
// return PR_FALSE;
|
||||
//}
|
||||
//
|
||||
////-------------------------------------------------------------------------
|
||||
//void
|
||||
//nsDragService::DragDataReceived (GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gint x,
|
||||
// gint y,
|
||||
// GtkSelectionData *data,
|
||||
// guint info,
|
||||
// guint time)
|
||||
//{
|
||||
// if ((data->length >= 0) && (data->format == 8)) {
|
||||
// g_print ("Received \"%s\"\n", (gchar *)data->data);
|
||||
// gtk_drag_finish (context, PR_TRUE, PR_FALSE, time);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// gtk_drag_finish (context, PR_FALSE, PR_FALSE, time);
|
||||
//}
|
||||
//
|
||||
////-------------------------------------------------------------------------
|
||||
//void
|
||||
//nsDragService::DragDataGet(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// GtkSelectionData *selection_data,
|
||||
// guint info,
|
||||
// guint time,
|
||||
// gpointer data)
|
||||
//{
|
||||
// gtk_selection_data_set (selection_data,
|
||||
// selection_data->target,
|
||||
// 8, (guchar *)"I'm Data!", 9);
|
||||
//}
|
||||
//
|
||||
////-------------------------------------------------------------------------
|
||||
//void
|
||||
//nsDragService::DragDataDelete(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gpointer data)
|
||||
//{
|
||||
// g_print ("Delete the data!\n");
|
||||
//}
|
||||
91
mozilla/widget/src/beos/nsDragService.h
Normal file
91
mozilla/widget/src/beos/nsDragService.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsDragService_h__
|
||||
#define nsDragService_h__
|
||||
|
||||
#include "nsBaseDragService.h"
|
||||
#include <View.h>
|
||||
|
||||
|
||||
/**
|
||||
* Native BeOS DragService wrapper
|
||||
*/
|
||||
|
||||
class nsDragService : public nsBaseDragService
|
||||
{
|
||||
|
||||
public:
|
||||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
//nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
||||
//nsIDragService
|
||||
NS_IMETHOD StartDragSession (nsITransferable * aTransferable,
|
||||
PRUint32 aActionType);
|
||||
|
||||
// Native Impl.
|
||||
NS_IMETHOD GetData (nsITransferable * aTransferable, PRUint32 aItemIndex);
|
||||
|
||||
static void SetTopLevelView(BView *v);
|
||||
|
||||
static BView *sView;
|
||||
|
||||
protected:
|
||||
static PRBool gHaveDrag;
|
||||
|
||||
// static void DragLeave(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// guint time);
|
||||
//
|
||||
// static PRBool DragMotion(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gint x,
|
||||
// gint y,
|
||||
// guint time);
|
||||
//
|
||||
// static PRBool DragDrop(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gint x,
|
||||
// gint y,
|
||||
// guint time);
|
||||
//
|
||||
// static void DragDataReceived(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gint x,
|
||||
// gint y,
|
||||
// GtkSelectionData *data,
|
||||
// guint info,
|
||||
// guint time);
|
||||
//
|
||||
// static void DragDataGet(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// GtkSelectionData *selection_data,
|
||||
// guint info,
|
||||
// guint time,
|
||||
// gpointer data);
|
||||
//
|
||||
// static void DragDataDelete(GtkWidget *widget,
|
||||
// GdkDragContext *context,
|
||||
// gpointer data);
|
||||
};
|
||||
|
||||
#endif // nsDragService_h__
|
||||
251
mozilla/widget/src/beos/nsDropTarget.cpp
Normal file
251
mozilla/widget/src/beos/nsDropTarget.cpp
Normal file
@@ -0,0 +1,251 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*-
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
//#include "stdafx.h"
|
||||
//#include "olebase.h"
|
||||
//#include "idropsrc.h"
|
||||
#include "nsDropTarget.h"
|
||||
//#include "contndoc.h"
|
||||
#include "stdio.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
#include "nsWindow.h"
|
||||
//Don't forget to RegisterDragDrop and to
|
||||
//CoLockObjectExternal.
|
||||
//You must RevokeDragDrop before destroying this object
|
||||
//
|
||||
nsDropTarget::nsDropTarget(nsIWidget * aWindow)
|
||||
{
|
||||
printf("nsDropTarget::nsDropTarget\n");
|
||||
m_refs = 0;
|
||||
m_pWin = aWindow;
|
||||
NS_ADDREF(aWindow);
|
||||
}
|
||||
|
||||
//Destructor for nsDropTarget
|
||||
//Doesn't do a whole lot!
|
||||
//
|
||||
nsDropTarget::~nsDropTarget()
|
||||
{
|
||||
printf("nsDropTarget::Drop\n");
|
||||
;
|
||||
}
|
||||
|
||||
//QueryInterface for IDropTarget
|
||||
//Notice that this QueryInterface does not refer to another object's QueryInterface,
|
||||
//this is a totally stand-alone separate object
|
||||
//
|
||||
STDMETHODIMP nsDropTarget::QueryInterface(REFIID riid, LPVOID FAR* ppv)
|
||||
{
|
||||
printf("nsDropTarget::QueryInterface\n");
|
||||
if (riid == IID_IUnknown)
|
||||
*ppv = this;
|
||||
else if (riid == IID_IDropTarget)
|
||||
*ppv = this;
|
||||
else{
|
||||
*ppv = NULL;
|
||||
}
|
||||
if (*ppv != NULL){
|
||||
((LPUNKNOWN)(*ppv))->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
//If for some reason our constructor did not create the requested interface
|
||||
//don't pass the NULL interface without telling the caller that we don't support
|
||||
//the requested interface.
|
||||
return ResultFromScode(E_NOINTERFACE);
|
||||
}
|
||||
|
||||
//A private AddRef for IDropTarget
|
||||
//
|
||||
STDMETHODIMP_(ULONG) nsDropTarget::AddRef(void)
|
||||
{
|
||||
printf("nsDropTarget::AddRef\n");
|
||||
return ++m_refs;
|
||||
}
|
||||
|
||||
//A private Release for IDropTarget
|
||||
//
|
||||
STDMETHODIMP_(ULONG) nsDropTarget::Release(void)
|
||||
{
|
||||
printf("nsDropTarget::Release\n");
|
||||
if(--m_refs == 0){
|
||||
//And now we can delete this object
|
||||
delete this;
|
||||
}
|
||||
|
||||
return m_refs;
|
||||
}
|
||||
|
||||
//
|
||||
//This helper function tells us what the drag/drop effect would be at
|
||||
//the point pointl. Since our object accepts being a drop target anywhere
|
||||
//in the window, we will ignore pointl
|
||||
//
|
||||
DWORD nsDropTarget::FindDragDropEffect(DWORD grfKeyState, POINTL /* pointl */)
|
||||
{
|
||||
printf("nsDropTarget::FindDragDropEffect\n");
|
||||
DWORD dwRet;
|
||||
|
||||
// no modifier -- DROPEFFECT_MOVE or source default
|
||||
// SHIFT -- DROPEFFECT_MOVE
|
||||
// CTRL -- DROPEFFECT_COPY
|
||||
// CTRL-SHIFT -- DROPEFFECT_LINK
|
||||
|
||||
dwRet = 0;//OleStdGetDropEffect(grfKeyState);
|
||||
if (dwRet == 0)
|
||||
dwRet = DROPEFFECT_COPY;
|
||||
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
|
||||
//Notification that a DropSource is over the current DropTarget
|
||||
//
|
||||
STDMETHODIMP nsDropTarget::DragEnter (LPDATAOBJECT pDataObj,
|
||||
DWORD grfKeyState,
|
||||
POINTL pointl,
|
||||
LPDWORD pdwEffect)
|
||||
{
|
||||
printf("nsDropTarget::DragEnter\n");
|
||||
*pdwEffect = FindDragDropEffect(grfKeyState, pointl);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
//Provides user feedback when a DropSource is over a DropTarget
|
||||
//
|
||||
STDMETHODIMP nsDropTarget::DragOver (DWORD grfKeyState,
|
||||
POINTL pointl,
|
||||
LPDWORD pdwEffect)
|
||||
{
|
||||
printf("nsDropTarget::DragOver\n");
|
||||
*pdwEffect = FindDragDropEffect(grfKeyState, pointl);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
||||
//The DropSource is leaving our target window
|
||||
//so its cleanup time!!!
|
||||
//
|
||||
STDMETHODIMP nsDropTarget::DragLeave (void)
|
||||
{
|
||||
printf("nsDropTarget::DragLeave\n");
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
//Drops the DropSource
|
||||
//
|
||||
STDMETHODIMP nsDropTarget::Drop (LPDATAOBJECT pIDataObject,
|
||||
DWORD grfKeyState,
|
||||
POINTL pointl,
|
||||
LPDWORD pdwEffect)
|
||||
{
|
||||
printf("nsDropTarget::Drop\n");
|
||||
printf("pIDataObject 0x%x\n", pIDataObject);
|
||||
pIDataObject->AddRef();
|
||||
if (nsnull != m_pWin) {
|
||||
nsEventStatus status;
|
||||
nsDragDropEvent event;
|
||||
((nsWindow *)m_pWin)->InitEvent(event, NS_DRAGDROP_EVENT);
|
||||
event.mType = nsDragDropEventStatus_eDrop;
|
||||
event.mIsFileURL = PR_FALSE;
|
||||
event.mURL = nsnull;
|
||||
m_pWin->DispatchEvent(&event, status);
|
||||
}
|
||||
|
||||
//pdwEffect = FindDragDropEffect(grfKeyState, pointl);
|
||||
|
||||
|
||||
if (pIDataObject != NULL) {
|
||||
IDataObject * presistStorage;
|
||||
//printf("QueryInterface for persist\n");
|
||||
pIDataObject->QueryInterface(IID_IDataObject,(LPVOID *)&presistStorage);
|
||||
//printf("Done QueryInterface for persist\n");
|
||||
if (presistStorage != NULL) {
|
||||
printf("$$$$$$$$$$$$$$$ Got it!\n");
|
||||
FORMATETC pFE;
|
||||
presistStorage->QueryGetData(&pFE);
|
||||
|
||||
pFE.tymed = TYMED_FILE;
|
||||
|
||||
STGMEDIUM pSTM;
|
||||
HRESULT st = presistStorage->GetDataHere(&pFE, &pSTM);
|
||||
printf("st 0x%X\n", st);
|
||||
if (NOERROR != st) {
|
||||
return FALSE;
|
||||
}
|
||||
//TYMED_STORAGE, TYMED_STREAM, TYMED_HGLOBAL, or TYMED_FILE
|
||||
//printf("%s\n", pSTM.lpszFileName);
|
||||
{
|
||||
|
||||
//HRESULT hr = pIDataObject->GetData(&pFE, &pSTM);
|
||||
//printf("hr 0x%X\n", hr);
|
||||
//if (NOERROR != hr) {
|
||||
// return FALSE;
|
||||
//}
|
||||
|
||||
const CLIPFORMAT format = pFE.cfFormat;
|
||||
switch(format) {
|
||||
case CF_BITMAP:
|
||||
//hr = SetBitmap(*pFE, stm);
|
||||
break;
|
||||
case CF_DIB:
|
||||
//hr = SetDib(*pFE, stm);
|
||||
break;
|
||||
case CF_TEXT:
|
||||
//hr = SetText(*pFE, stm);
|
||||
break;
|
||||
case CF_METAFILEPICT:
|
||||
//hr = SetMetafilePict(*pFE, stm);
|
||||
break;
|
||||
default:
|
||||
//if (format == GetRcfFormat()) {
|
||||
// hr = SetRcf(*pFE, stm);
|
||||
//}
|
||||
break;
|
||||
}
|
||||
|
||||
//return (SUCCEEDED(hr));
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
printf("^^^^^^^^^^^^^^^^^ Didn't!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* if (m_pContainDoc->m_pOleSiteObject)
|
||||
delete m_pContainDoc->m_pOleSiteObject;
|
||||
m_pContainDoc->m_pOleSiteObject = new COleSiteObject(m_pContainDoc);
|
||||
FORMATETC fmtetc;
|
||||
fmtetc.cfFormat = NULL;
|
||||
fmtetc.ptd = NULL;
|
||||
fmtetc.lindex = -1;
|
||||
fmtetc.dwAspect = DVASPECT_CONTENT;
|
||||
fmtetc.tymed = TYMED_NULL;
|
||||
m_pContainDoc->m_pOleSiteObject->AddSiteFromData(m_pContainDoc,
|
||||
pIDataObject,
|
||||
&fmtetc);
|
||||
*/
|
||||
pIDataObject->Release();
|
||||
|
||||
DragLeave();
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
277
mozilla/widget/src/beos/nsFileWidget.cpp
Normal file
277
mozilla/widget/src/beos/nsFileWidget.cpp
Normal file
@@ -0,0 +1,277 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
// Define so header files for openfilename are included
|
||||
#ifdef WIN32_LEAN_AND_MEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include "nsFileWidget.h"
|
||||
|
||||
//NS_IMPL_ISUPPORTS(nsFileWidget, NS_IFILEWIDGET_IID)
|
||||
NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID);
|
||||
NS_IMPL_ISUPPORTS(nsFileWidget, kIFileWidgetIID);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsFileWidget constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsFileWidget::nsFileWidget() : nsIFileWidget()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
// mWnd = NULL;
|
||||
mNumberOfFilters = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Show - Display the file dialog
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsFileWidget::Show()
|
||||
{
|
||||
printf("nsFileWidget::Show not implemented\n");
|
||||
#if 0
|
||||
char fileBuffer[MAX_PATH+1] = "";
|
||||
mDefault.ToCString(fileBuffer,MAX_PATH);
|
||||
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
|
||||
nsString filterList;
|
||||
GetFilterListArray(filterList);
|
||||
char *filterBuffer = filterList.ToNewCString();
|
||||
char *title = mTitle.ToNewCString();
|
||||
char *initialDir = mDisplayDirectory.ToNewCString();
|
||||
if (mDisplayDirectory.Length() > 0) {
|
||||
ofn.lpstrInitialDir = initialDir;
|
||||
}
|
||||
|
||||
ofn.lpstrTitle = title;
|
||||
ofn.lpstrFilter = filterBuffer;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.hwndOwner = mWnd;
|
||||
ofn.lpstrFile = fileBuffer;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.Flags = OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
|
||||
|
||||
PRBool result;
|
||||
|
||||
// Save current directory, so we can reset if it changes.
|
||||
char* currentDirectory = new char[MAX_PATH+1];
|
||||
VERIFY(::GetCurrentDirectory(MAX_PATH, currentDirectory) > 0);
|
||||
|
||||
if (mMode == eMode_load) {
|
||||
result = GetOpenFileName(&ofn);
|
||||
}
|
||||
else if (mMode == eMode_save) {
|
||||
result = GetSaveFileName(&ofn);
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(0, "Only load and save are supported modes");
|
||||
}
|
||||
|
||||
// Store the current directory in mDisplayDirectory
|
||||
char* newCurrentDirectory = new char[MAX_PATH+1];
|
||||
VERIFY(::GetCurrentDirectory(MAX_PATH, newCurrentDirectory) > 0);
|
||||
mDisplayDirectory.SetLength(0);
|
||||
mDisplayDirectory.Append(newCurrentDirectory);
|
||||
delete newCurrentDirectory;
|
||||
|
||||
|
||||
VERIFY(::SetCurrentDirectory(currentDirectory));
|
||||
delete currentDirectory;
|
||||
|
||||
// Clean up filter buffers
|
||||
delete filterBuffer;
|
||||
delete title;
|
||||
delete initialDir;
|
||||
|
||||
// Set user-selected location of file or directory
|
||||
mFile.SetLength(0);
|
||||
if (result == PR_TRUE) {
|
||||
mFile.Append(fileBuffer);
|
||||
}
|
||||
|
||||
return((PRBool)result);
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Convert filter titles + filters into a Windows filter string
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsFileWidget::GetFilterListArray(nsString& aFilterList)
|
||||
{
|
||||
aFilterList.SetLength(0);
|
||||
for (PRUint32 i = 0; i < mNumberOfFilters; i++) {
|
||||
const nsString& title = mTitles[i];
|
||||
const nsString& filter = mFilters[i];
|
||||
|
||||
aFilterList.Append(title);
|
||||
aFilterList.Append('\0');
|
||||
aFilterList.Append(filter);
|
||||
aFilterList.Append('\0');
|
||||
}
|
||||
aFilterList.Append('\0');
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set the list of filters
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[])
|
||||
{
|
||||
mNumberOfFilters = aNumberOfFilters;
|
||||
mTitles = aTitles;
|
||||
mFilters = aFilters;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get the file + path
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
{
|
||||
aFile = mFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get the file + path
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
{
|
||||
mDefault = aString;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
{
|
||||
mDisplayDirectory = aDirectory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
{
|
||||
aDirectory = mDisplayDirectory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
void *aInitData = nsnull)
|
||||
{
|
||||
// mWnd = (HWND) ((aParent) ? aParent->GetNativeData(NS_NATIVE_WINDOW) : 0);
|
||||
mTitle.SetLength(0);
|
||||
mTitle.Append(aTitle);
|
||||
mMode = aMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsFileWidget destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsFileWidget::~nsFileWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFile(nsIWidget *aParent,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec)
|
||||
{
|
||||
Create(aParent, promptString, eMode_load, nsnull, nsnull);
|
||||
if (Show() == PR_TRUE)
|
||||
{
|
||||
GetFile(theFileSpec);
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
|
||||
return nsFileDlgResults_Cancel;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFolder(nsIWidget *aParent,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec)
|
||||
{
|
||||
Create(aParent, promptString, eMode_getfolder, nsnull, nsnull);
|
||||
if (Show() == PR_TRUE)
|
||||
{
|
||||
GetFile(theFileSpec);
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
|
||||
return nsFileDlgResults_Cancel;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::PutFile(nsIWidget *aParent,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec)
|
||||
{
|
||||
Create(aParent, promptString, eMode_save, nsnull, nsnull);
|
||||
if (Show() == PR_TRUE)
|
||||
{
|
||||
GetFile(theFileSpec);
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
return nsFileDlgResults_Cancel;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetSelectedType(PRInt16& theType)
|
||||
{
|
||||
theType = mSelectedType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
94
mozilla/widget/src/beos/nsFileWidget.h
Normal file
94
mozilla/widget/src/beos/nsFileWidget.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsFileWidget_h__
|
||||
#define nsFileWidget_h__
|
||||
|
||||
#include "nsObject.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIFileWidget.h"
|
||||
|
||||
/**
|
||||
* Native Win32 FileSelector wrapper
|
||||
*/
|
||||
|
||||
class nsFileWidget : public nsIFileWidget
|
||||
{
|
||||
public:
|
||||
nsFileWidget();
|
||||
virtual ~nsFileWidget();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
PRBool OnPaint(nsRect &r);
|
||||
|
||||
// nsIWidget interface
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
void *aInitData = nsnull);
|
||||
|
||||
// nsIFileWidget part
|
||||
virtual PRBool Show();
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
NS_IMETHOD SetDefaultString(const nsString& aFile);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,
|
||||
const nsString aTitles[],
|
||||
const nsString aFilters[]);
|
||||
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory);
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory);
|
||||
|
||||
virtual nsFileDlgResults GetFile(nsIWidget *aParent,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec);
|
||||
|
||||
virtual nsFileDlgResults GetFolder(nsIWidget *aParent,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec);
|
||||
|
||||
virtual nsFileDlgResults PutFile(nsIWidget *aParent,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec);
|
||||
|
||||
|
||||
NS_IMETHOD GetSelectedType(PRInt16& theType);
|
||||
|
||||
protected:
|
||||
|
||||
// HWND mWnd;
|
||||
nsString mTitle;
|
||||
nsFileDlgMode mMode;
|
||||
nsString mFile;
|
||||
PRUint32 mNumberOfFilters;
|
||||
const nsString* mTitles;
|
||||
const nsString* mFilters;
|
||||
nsString mDefault;
|
||||
nsFileSpec mDisplayDirectory;
|
||||
PRInt16 mSelectedType;
|
||||
|
||||
|
||||
void GetFilterListArray(nsString& aFilterList);
|
||||
};
|
||||
|
||||
#endif // nsFileWidget_h__
|
||||
418
mozilla/widget/src/beos/nsFontRetrieverService.cpp
Normal file
418
mozilla/widget/src/beos/nsFontRetrieverService.cpp
Normal file
@@ -0,0 +1,418 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsFontRetrieverService.h"
|
||||
#include "nsIWidget.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "nsFont.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsFontSizeIterator.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsFontRetrieverService)
|
||||
NS_IMPL_RELEASE(nsFontRetrieverService)
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
nsFontRetrieverService::nsFontRetrieverService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mFontList = nsnull;
|
||||
mSizeIter = nsnull;
|
||||
mNameIterInx = 0;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
nsFontRetrieverService::~nsFontRetrieverService()
|
||||
{
|
||||
if (nsnull != mFontList) {
|
||||
for (PRInt32 i=0;i<mFontList->Count();i++) {
|
||||
FontInfo * font = (FontInfo *)mFontList->ElementAt(i);
|
||||
if (font->mSizes) {
|
||||
delete font->mSizes;
|
||||
}
|
||||
delete font;
|
||||
}
|
||||
delete mFontList;
|
||||
}
|
||||
NS_IF_RELEASE(mSizeIter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsFontRetrieverService::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NOINTERFACE;
|
||||
|
||||
if (aIID.Equals(nsIFontRetrieverService::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIFontRetrieverService*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsIFontNameIterator::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIFontNameIterator*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- nsIFontRetrieverService
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::CreateFontNameIterator( nsIFontNameIterator** aIterator )
|
||||
{
|
||||
if (nsnull == aIterator) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (nsnull == mFontList) {
|
||||
LoadFontList();
|
||||
}
|
||||
*aIterator = this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::CreateFontSizeIterator( const nsString & aFontName,
|
||||
nsIFontSizeIterator** aIterator )
|
||||
{
|
||||
// save value in case someone externally is using it
|
||||
PRInt32 saveIterInx = mNameIterInx;
|
||||
|
||||
PRBool found = PR_FALSE;
|
||||
Reset();
|
||||
do {
|
||||
nsAutoString name;
|
||||
Get(&name);
|
||||
if (name.Equals(aFontName)) {
|
||||
found = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
} while (Advance() == NS_OK);
|
||||
|
||||
if (found) {
|
||||
if (nsnull == mSizeIter) {
|
||||
mSizeIter = new nsFontSizeIterator();
|
||||
}
|
||||
NS_ASSERTION( nsnull != mSizeIter, "nsFontSizeIterator instance pointer is null");
|
||||
|
||||
*aIterator = (nsIFontSizeIterator *)mSizeIter;
|
||||
NS_ADDREF(mSizeIter);
|
||||
|
||||
FontInfo * fontInfo = (FontInfo *)mFontList->ElementAt(mNameIterInx);
|
||||
mSizeIter->SetFontInfo(fontInfo);
|
||||
mNameIterInx = saveIterInx;
|
||||
return NS_OK;
|
||||
}
|
||||
mNameIterInx = saveIterInx;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- nsIFontNameIterator
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::Reset()
|
||||
{
|
||||
mNameIterInx = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::Get( nsString* aFontName )
|
||||
{
|
||||
if (mNameIterInx < mFontList->Count()) {
|
||||
FontInfo * fontInfo = (FontInfo *)mFontList->ElementAt(mNameIterInx);
|
||||
*aFontName = fontInfo->mName;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::Advance()
|
||||
{
|
||||
if (mNameIterInx < mFontList->Count()-1) {
|
||||
mNameIterInx++;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
static FontInfo * GetFontInfo(nsVoidArray * aFontList, char * aName)
|
||||
{
|
||||
nsAutoString name(aName);
|
||||
PRInt32 i;
|
||||
PRInt32 cnt = aFontList->Count();
|
||||
for (i=0;i<cnt;i++) {
|
||||
FontInfo * fontInfo = (FontInfo *)aFontList->ElementAt(i);
|
||||
if (fontInfo->mName.Equals(name)) {
|
||||
return fontInfo;
|
||||
}
|
||||
}
|
||||
|
||||
FontInfo * fontInfo = new FontInfo();
|
||||
fontInfo->mName = aName;
|
||||
//printf("Adding [%s]\n", aName);fflush(stdout);
|
||||
fontInfo->mIsScalable = PR_FALSE; // X fonts aren't scalable right??
|
||||
fontInfo->mSizes = nsnull;
|
||||
aFontList->AppendElement(fontInfo);
|
||||
return fontInfo;
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
static void AddSizeToFontInfo(FontInfo * aFontInfo, PRInt32 aSize)
|
||||
{
|
||||
nsVoidArray * sizes;
|
||||
if (nsnull == aFontInfo->mSizes) {
|
||||
sizes = new nsVoidArray();
|
||||
aFontInfo->mSizes = sizes;
|
||||
} else {
|
||||
sizes = aFontInfo->mSizes;
|
||||
}
|
||||
PRInt32 i;
|
||||
PRInt32 cnt = sizes->Count();
|
||||
for (i=0;i<cnt;i++) {
|
||||
PRInt32 size = (int)sizes->ElementAt(i);
|
||||
if (size == aSize) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sizes->AppendElement((void *)aSize);
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
// XXX - Hack - Parts of this will need to be reworked
|
||||
//
|
||||
// This method does brute force parcing for 4 different formats:
|
||||
//
|
||||
// 1) The format -*-*-*-*-*-* etc.
|
||||
// -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-8
|
||||
//
|
||||
// 2) Name-size format
|
||||
// lucidasans-10
|
||||
//
|
||||
// 3) Name-style-size
|
||||
// lucidasans-bold-10
|
||||
//
|
||||
// 4) Name only (implicit size)
|
||||
// 6x13
|
||||
//
|
||||
//--------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::LoadFontList()
|
||||
{
|
||||
// char * pattern = "*";
|
||||
// int nnames = 1024;
|
||||
//
|
||||
// int available = nnames+1;
|
||||
// int i;
|
||||
// char **fonts;
|
||||
// XFontStruct *info;
|
||||
//
|
||||
// if (nsnull == mFontList) {
|
||||
// mFontList = new nsVoidArray();
|
||||
// if (nsnull == mFontList) {
|
||||
// return NS_ERROR_FAILURE;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /* Get list of fonts matching pattern */
|
||||
// for (;;) {
|
||||
// // the following line is VERY slow to return
|
||||
// fonts = XListFontsWithInfo(GDK_DISPLAY(), pattern, nnames,
|
||||
// &available, &info);
|
||||
// if (fonts == NULL || available < nnames)
|
||||
// break;
|
||||
//
|
||||
// XFreeFontInfo(fonts, info, available);
|
||||
// nnames = available * 2;
|
||||
// }
|
||||
//
|
||||
// if (fonts == NULL) {
|
||||
// fprintf(stderr, "pattern \"%s\" unmatched\n", pattern);
|
||||
// return NS_ERROR_FAILURE;
|
||||
// }
|
||||
//
|
||||
//#if 0 // debug
|
||||
// // print out all the retrieved fonts
|
||||
// printf("-----------------------------\n");
|
||||
// for (i=0; i<available; i++) {
|
||||
// printf("[%s]i\n", fonts[i]);
|
||||
// }
|
||||
// printf("-----------------------------\n");
|
||||
//#endif
|
||||
//
|
||||
// // this code assumes all like fonts are grouped together
|
||||
// // currentName is the current name of the font we are gathering
|
||||
// // sizes for, when the name changes we create a new FontInfo object
|
||||
// // but it also takes into account fonts of similar names when it
|
||||
// // goes to add then and disregards duplicates
|
||||
// char buffer[1024];
|
||||
// char currentName[1024];
|
||||
// FontInfo * font = nsnull;
|
||||
//
|
||||
// currentName[0] = 0;
|
||||
// for (i=0; i<available; i++) {
|
||||
//
|
||||
// // This is kind of lame, but it will have to do for now
|
||||
// strcpy(buffer, fonts[i]);
|
||||
//
|
||||
// // Start by checking to see if the name begins with a dash
|
||||
// char * ptr = buffer;
|
||||
// if (buffer[0] == '-') { //Format #1
|
||||
//
|
||||
// PRInt32 cnt = 0;
|
||||
// // skip first two '-'
|
||||
// do {
|
||||
// if (*ptr == '-') cnt++;
|
||||
// ptr++;
|
||||
// } while (cnt < 2);
|
||||
//
|
||||
// // find the dash at the end of the name
|
||||
// char * end = strchr(ptr, '-');
|
||||
// if (end) {
|
||||
// *end = 0;
|
||||
//
|
||||
// // Check to see if we need to create a new FontInfo obj
|
||||
// // and set the currentName var to this guys font name
|
||||
// if (strcmp(currentName, ptr) || NULL == font) {
|
||||
// font = GetFontInfo(mFontList, ptr);
|
||||
// strcpy(currentName, ptr);
|
||||
// }
|
||||
// if (nsnull == font->mSizes) {
|
||||
// font->mSizes = new nsVoidArray();
|
||||
// }
|
||||
// ptr = end+1; // skip past the dash that was set to zero
|
||||
//
|
||||
// cnt = 0;
|
||||
// // now skip ahead 4 dashes
|
||||
// do {
|
||||
// if (*ptr == '-') cnt++;
|
||||
// ptr++;
|
||||
// } while (cnt < 4);
|
||||
//
|
||||
// // find the dash after the size
|
||||
// end = strchr(ptr, '-');
|
||||
//
|
||||
// if (end) {
|
||||
// *end = 0;
|
||||
// PRInt32 size;
|
||||
// sscanf(ptr, "%d", &size);
|
||||
// AddSizeToFontInfo(font, size);
|
||||
// }
|
||||
// }
|
||||
// } else { // formats 2,3,4
|
||||
//
|
||||
// // no leading dash means the start of the
|
||||
// // buffer is the start of the name
|
||||
// // this checks for a dash at the end of the font name
|
||||
// // which means there is a size at the end
|
||||
// char * end = strchr(buffer, '-');
|
||||
// if (end) { // Format 2,3
|
||||
// *end = 0;
|
||||
// // Check to see if we need to create a new FontInfo obj
|
||||
// // and set the currentName var to this guys font name
|
||||
// if (strcmp(currentName, buffer) || NULL == font) {
|
||||
// font = GetFontInfo(mFontList, buffer);
|
||||
// strcpy(currentName, buffer);
|
||||
// }
|
||||
// end++; // advance past the dash
|
||||
// // check to see if we have a number
|
||||
// ptr = end;
|
||||
// if (isalpha(*ptr)) { // Format 3
|
||||
// // skip until next dash
|
||||
// end = strchr(ptr, '-');
|
||||
// if (end) {
|
||||
// *end = 0;
|
||||
// ptr = end+1;
|
||||
// }
|
||||
// }
|
||||
// PRInt32 size;
|
||||
// // yes, it has a dash at the end so it must have the size
|
||||
// // check to see if the size is terminated by a dash
|
||||
// // it shouldn't be
|
||||
// char * end2 = strchr(ptr, '-');
|
||||
// if (end2) *end2 = 0; // put terminator at the dash
|
||||
// sscanf(end, "%d", &size);
|
||||
// AddSizeToFontInfo(font, size);
|
||||
//
|
||||
// } else { // Format #4
|
||||
// // The font has an implicit size,
|
||||
// // so there is nothing to parse for size
|
||||
// // so we can't really do much here
|
||||
// // Check to see if we need to create a new FontInfo obj
|
||||
// // and set the currentName var to this guys font name
|
||||
// if (strcmp(currentName, buffer) || NULL == font) {
|
||||
// font = GetFontInfo(mFontList, buffer);
|
||||
// strcpy(currentName, buffer);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// XFreeFontInfo(fonts, info, available);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontRetrieverService::IsFontScalable(const nsString & aFontName,
|
||||
PRBool* aResult )
|
||||
{
|
||||
// save value in case someone externally is using it
|
||||
PRInt32 saveIterInx = mNameIterInx;
|
||||
|
||||
PRBool found = PR_FALSE;
|
||||
Reset();
|
||||
do {
|
||||
nsAutoString name;
|
||||
Get(&name);
|
||||
if (name.Equals(aFontName)) {
|
||||
found = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
} while (Advance() == NS_OK);
|
||||
|
||||
if (found) {
|
||||
FontInfo * fontInfo = (FontInfo *)mFontList->ElementAt(mNameIterInx);
|
||||
*aResult = fontInfo->mIsScalable;
|
||||
mNameIterInx = saveIterInx;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mNameIterInx = saveIterInx;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
60
mozilla/widget/src/beos/nsFontRetrieverService.h
Normal file
60
mozilla/widget/src/beos/nsFontRetrieverService.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsFontRetrieverService
|
||||
#define __nsFontRetrieverService
|
||||
|
||||
#include "nsIFontRetrieverService.h"
|
||||
#include "nsIFontNameIterator.h"
|
||||
|
||||
class nsVoidArray;
|
||||
class nsFontSizeIterator;
|
||||
|
||||
class nsFontRetrieverService: public nsIFontRetrieverService,
|
||||
public nsIFontNameIterator {
|
||||
public:
|
||||
nsFontRetrieverService();
|
||||
virtual ~nsFontRetrieverService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFontRetrieverService
|
||||
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator );
|
||||
|
||||
NS_IMETHOD CreateFontSizeIterator( const nsString & aFontName, nsIFontSizeIterator** aIterator );
|
||||
NS_IMETHOD IsFontScalable( const nsString & aFontName, PRBool* aResult );
|
||||
|
||||
// nsIFontNameIterator
|
||||
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD Get( nsString* aFontName );
|
||||
NS_IMETHOD Advance();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
NS_IMETHOD LoadFontList();
|
||||
|
||||
nsVoidArray * mFontList;
|
||||
|
||||
PRInt32 mNameIterInx;
|
||||
|
||||
nsFontSizeIterator * mSizeIter;
|
||||
};
|
||||
|
||||
#endif
|
||||
84
mozilla/widget/src/beos/nsFontSizeIterator.cpp
Normal file
84
mozilla/widget/src/beos/nsFontSizeIterator.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsFontSizeIterator.h"
|
||||
|
||||
#include "nsFont.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsFontSizeIterator)
|
||||
NS_IMPL_RELEASE(nsFontSizeIterator)
|
||||
NS_IMPL_QUERY_INTERFACE(nsFontSizeIterator, nsIFontSizeIterator::GetIID())
|
||||
|
||||
//----------------------------------------------------------
|
||||
nsFontSizeIterator::nsFontSizeIterator()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mFontInfo = nsnull;
|
||||
mSizeIterInx = 0;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
nsFontSizeIterator::~nsFontSizeIterator()
|
||||
{
|
||||
}
|
||||
|
||||
///----------------------------------------------------------
|
||||
//-- nsIFontNameIterator
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontSizeIterator::Reset()
|
||||
{
|
||||
mSizeIterInx = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontSizeIterator::Get( double* aFontSize )
|
||||
{
|
||||
if (nsnull != mFontInfo->mSizes &&
|
||||
mFontInfo->mSizes->Count() > 0 &&
|
||||
mSizeIterInx < mFontInfo->mSizes->Count()) {
|
||||
PRUint32 size = (PRUint32)mFontInfo->mSizes->ElementAt(mSizeIterInx);
|
||||
*aFontSize = (double)size;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontSizeIterator::Advance()
|
||||
{
|
||||
if (nsnull != mFontInfo->mSizes &&
|
||||
mFontInfo->mSizes->Count() > 0 &&
|
||||
mSizeIterInx < mFontInfo->mSizes->Count()-2) {
|
||||
mSizeIterInx++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
NS_IMETHODIMP nsFontSizeIterator::SetFontInfo( FontInfo * aFontInfo )
|
||||
{
|
||||
mFontInfo = aFontInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
55
mozilla/widget/src/beos/nsFontSizeIterator.h
Normal file
55
mozilla/widget/src/beos/nsFontSizeIterator.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsFontSizeIterator
|
||||
#define __nsFontSizeIterator
|
||||
|
||||
#include "nsIFontSizeIterator.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsVoidArray;
|
||||
|
||||
typedef struct {
|
||||
nsString mName;
|
||||
PRBool mIsScalable;
|
||||
nsVoidArray * mSizes;
|
||||
} FontInfo;
|
||||
|
||||
|
||||
class nsFontSizeIterator: public nsIFontSizeIterator {
|
||||
public:
|
||||
nsFontSizeIterator();
|
||||
virtual ~nsFontSizeIterator();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFontSizeIterator
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD Get( double* aFontSize );
|
||||
NS_IMETHOD Advance();
|
||||
|
||||
// Native impl
|
||||
NS_IMETHOD SetFontInfo( FontInfo * aFontInfo );
|
||||
|
||||
protected:
|
||||
|
||||
FontInfo * mFontInfo;
|
||||
PRInt32 mSizeIterInx; // current index of iter
|
||||
};
|
||||
|
||||
#endif
|
||||
222
mozilla/widget/src/beos/nsLabel.cpp
Normal file
222
mozilla/widget/src/beos/nsLabel.cpp
Normal file
@@ -0,0 +1,222 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsLabel.h"
|
||||
#include "nsILabel.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsLabel)
|
||||
NS_IMPL_RELEASE(nsLabel)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsLabel constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsLabel::nsLabel() : nsWindow(), nsILabel()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mAlignment = eAlign_Left;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
if (nsnull != aInitData) {
|
||||
nsLabelInitData* data = (nsLabelInitData *) aInitData;
|
||||
mAlignment = data->mAlignment;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsLabel destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsLabel::~nsLabel()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWindow::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kILabelIID)) {
|
||||
*aInstancePtr = (void*) ((nsILabel*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
{
|
||||
mAlignment = aAlignment;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::SetLabel(const nsString& aText)
|
||||
{
|
||||
char label[256];
|
||||
aText.ToCString(label, 256);
|
||||
label[255] = '\0';
|
||||
if(mStringView && mStringView->LockLooper())
|
||||
{
|
||||
mStringView->SetText(label);
|
||||
mStringView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
if(mStringView && mStringView->LockLooper())
|
||||
{
|
||||
aBuffer.SetLength(0);
|
||||
aBuffer.Append(mStringView->Text());
|
||||
mStringView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// move, paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsLabel::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsLabel::OnPaint(nsRect &r)
|
||||
{
|
||||
//printf("** nsLabel::OnPaint **\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsLabel::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsLabel::GetBounds(nsRect &aRect)
|
||||
{
|
||||
return nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
{
|
||||
if (nsnull == mContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
//nsIFontMetrics * fm = GetFont();;
|
||||
// mDeviceContext->GetMetricsFor(mFont, &fm);
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
mContext->GetMetricsFor(*mFont, metrics);
|
||||
|
||||
nsString text;
|
||||
GetLabel(text);
|
||||
|
||||
nsIRenderingContext *cx;
|
||||
mContext->CreateRenderingContext(this, cx);
|
||||
cx->SetFont(metrics);
|
||||
nscoord string_height, string_width;
|
||||
metrics->GetHeight(string_height);
|
||||
cx->GetWidth(text, string_width);
|
||||
NS_RELEASE(cx);
|
||||
NS_RELEASE(metrics);
|
||||
|
||||
if (mPreferredWidth != 0) {
|
||||
aWidth = mPreferredWidth;
|
||||
} else {
|
||||
aWidth = string_width+8;
|
||||
}
|
||||
|
||||
if (mPreferredHeight != 0) {
|
||||
aHeight = mPreferredHeight;
|
||||
} else {
|
||||
aHeight = string_height+8;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
mPreferredWidth = aWidth;
|
||||
mPreferredHeight = aHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
BView *nsLabel::CreateBeOSView()
|
||||
{
|
||||
return mStringView = new nsStringViewBeOS(this, BRect(0, 0, 0, 0), "", "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Sub-class of BeOS StringView
|
||||
//-------------------------------------------------------------------------
|
||||
nsStringViewBeOS::nsStringViewBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *aName, const char *text, uint32 aResizingMode, uint32 aFlags )
|
||||
: BStringView( aFrame, aName, text, aResizingMode, aFlags ),
|
||||
nsIWidgetStore( aWidgetWindow )
|
||||
{
|
||||
}
|
||||
78
mozilla/widget/src/beos/nsLabel.h
Normal file
78
mozilla/widget/src/beos/nsLabel.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsLabel_h__
|
||||
#define nsLabel_h__
|
||||
|
||||
#include "nsdefs.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsSwitchToUIThread.h"
|
||||
|
||||
#include "nsILabel.h"
|
||||
|
||||
#include <StringView.h>
|
||||
|
||||
/**
|
||||
* Native Win32 Label wrapper
|
||||
*/
|
||||
|
||||
class nsLabel : public nsWindow,
|
||||
public nsILabel
|
||||
{
|
||||
|
||||
public:
|
||||
nsLabel();
|
||||
virtual ~nsLabel();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsILabel part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer);
|
||||
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsRect &r);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
protected:
|
||||
nsLabelAlignment mAlignment;
|
||||
BStringView *mStringView;
|
||||
BView *CreateBeOSView();
|
||||
};
|
||||
|
||||
//
|
||||
// A BStringView subclass
|
||||
//
|
||||
class nsStringViewBeOS : public BStringView, public nsIWidgetStore {
|
||||
public:
|
||||
nsStringViewBeOS( nsIWidget *aWidgetWindow, BRect aFrame, const char *aName,
|
||||
const char *text, uint32 aResizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 aFlags = B_WILL_DRAW | B_NAVIGABLE );
|
||||
};
|
||||
|
||||
#endif // nsLabel_h__
|
||||
389
mozilla/widget/src/beos/nsListBox.cpp
Normal file
389
mozilla/widget/src/beos/nsListBox.cpp
Normal file
@@ -0,0 +1,389 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsListBox.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsListBox)
|
||||
NS_IMPL_RELEASE(nsListBox)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// initializer
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
|
||||
{
|
||||
mMultiSelect = aMultipleSelections;
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
mListView->SetListType(aMultipleSelections ? B_MULTIPLE_SELECTION_LIST : B_SINGLE_SELECTION_LIST);
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
{
|
||||
if (nsnull != aInitData) {
|
||||
nsListBoxInitData* data = (nsListBoxInitData *) aInitData;
|
||||
mMultiSelect = data->mMultiSelect;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsListBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
|
||||
{
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
NS_ALLOC_STR_BUF(val, aItem, 256);
|
||||
mListView->AddItem(new BStringItem(val), aPosition);
|
||||
NS_FREE_STR_BUF(val);
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Finds an item at a postion
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsListBox::FindItem(nsString &aItem, PRInt32 aStartPos)
|
||||
{
|
||||
#if 0
|
||||
NS_ALLOC_STR_BUF(val, aItem, 256);
|
||||
int index = ::SendMessage(mWnd, LB_FINDSTRINGEXACT, (int)aStartPos, (LPARAM)(LPCTSTR)val);
|
||||
NS_FREE_STR_BUF(val);
|
||||
|
||||
return index;
|
||||
#endif
|
||||
printf("nsListBox::FindItem not implemented\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// CountItems - Get Item Count
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsListBox::GetItemCount()
|
||||
{
|
||||
PRInt32 result = 0;
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
result = mListView->CountItems();
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Removes an Item at a specified location
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsListBox::RemoveItemAt(PRInt32 aPosition)
|
||||
{
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
BListItem *it = mListView->RemoveItem(aPosition);
|
||||
delete it;
|
||||
mListView->UnlockLooper();
|
||||
return it ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Removes an Item at a specified location
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
anItem.SetLength(0);
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
BListItem *it = mListView->ItemAt(aPosition);
|
||||
BStringItem *str;
|
||||
if((str = dynamic_cast<BStringItem *>(it)) != 0)
|
||||
{
|
||||
anItem.Append(str->Text());
|
||||
result = PR_TRUE;
|
||||
}
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Gets the selected of selected item
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::GetSelectedItem(nsString& aItem)
|
||||
{
|
||||
if (!mMultiSelect) {
|
||||
GetItemAt(aItem, GetSelectedIndex());
|
||||
} else {
|
||||
NS_ASSERTION(0, "Multi selection list box does not support GetSelectedItem()");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Gets the list of selected otems
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsListBox::GetSelectedIndex()
|
||||
{
|
||||
if (!mMultiSelect)
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
index = mListView->CurrentSelection();
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return index;
|
||||
} else {
|
||||
NS_ASSERTION(0, "Multi selection list box does not support GetSelectedIndex()");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// SelectItem
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::SelectItem(PRInt32 aPosition)
|
||||
{
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
mListView->Select(aPosition);
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// GetSelectedCount
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRInt32 nsListBox::GetSelectedCount()
|
||||
{
|
||||
if (!mMultiSelect) {
|
||||
PRInt32 inx = GetSelectedIndex();
|
||||
return (inx == -1? 0 : 1);
|
||||
} else {
|
||||
PRInt32 count = 0;
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
int index = 0;
|
||||
while((index = mListView->CurrentSelection(index)) != -1)
|
||||
count++;
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// GetSelectedIndices
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
{
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
int index = 0;
|
||||
for(int i = 0; i < aSize; i++)
|
||||
{
|
||||
if(index != -1)
|
||||
index = mListView->CurrentSelection(index);
|
||||
aIndices[i] = index;
|
||||
}
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// SetSelectedIndices
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
|
||||
{
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
mListView->Select(aIndices[0], false);
|
||||
for(int i = 1; i < aSize; i++)
|
||||
mListView->Select(aIndices[i], true);
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Deselect
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsListBox::Deselect()
|
||||
{
|
||||
if(mListView && mListView->LockLooper())
|
||||
{
|
||||
mListView->DeselectAll();
|
||||
mListView->UnlockLooper();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsListBox constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsListBox::nsListBox() : nsWindow(), nsIListWidget(), nsIListBox()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mMultiSelect = PR_FALSE;
|
||||
mBackground = NS_RGB(124, 124, 124);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsListBox:: destructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsListBox::~nsListBox()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsListBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
nsresult result = nsWindow::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
static NS_DEFINE_IID(kInsListBoxIID, NS_ILISTBOX_IID);
|
||||
static NS_DEFINE_IID(kInsListWidgetIID, NS_ILISTWIDGET_IID);
|
||||
if (result == NS_NOINTERFACE) {
|
||||
if (aIID.Equals(kInsListBoxIID)) {
|
||||
*aInstancePtr = (void*) ((nsIListBox*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kInsListWidgetIID)) {
|
||||
*aInstancePtr = (void*) ((nsIListWidget*)this);
|
||||
NS_ADDREF_THIS();
|
||||
result = NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// move, paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsListBox::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsListBox::OnPaint(nsRect &r)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsListBox::OnResize(nsRect &aWindowRect)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Clear window before paint
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
PRBool nsListBox::AutoErase()
|
||||
{
|
||||
return(PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsListBox::GetBounds(nsRect &aRect)
|
||||
{
|
||||
#if 0
|
||||
nsWindow::GetNonClientBounds(aRect);
|
||||
#endif
|
||||
printf("nsListBox::GetBounds not wrong\n"); // the following is just a placeholder
|
||||
nsWindow::GetClientBounds(aRect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
BView *nsListBox::CreateBeOSView()
|
||||
{
|
||||
return mListView = new nsListViewBeOS((nsIWidget *)this, BRect(0, 0, 0, 0), "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Sub-class of BeOS ListView
|
||||
//-------------------------------------------------------------------------
|
||||
nsListViewBeOS::nsListViewBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *aName, uint32 aResizingMode, uint32 aFlags )
|
||||
: BListView( aFrame, aName,
|
||||
((nsListBox *)aWidgetWindow)->mMultiSelect ? B_MULTIPLE_SELECTION_LIST : B_SINGLE_SELECTION_LIST,
|
||||
aResizingMode, aFlags ),
|
||||
nsIWidgetStore( aWidgetWindow )
|
||||
{
|
||||
}
|
||||
91
mozilla/widget/src/beos/nsListBox.h
Normal file
91
mozilla/widget/src/beos/nsListBox.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsListBox_h__
|
||||
#define nsListBox_h__
|
||||
|
||||
#include "nsdefs.h"
|
||||
#include "nsWindow.h"
|
||||
#include "nsSwitchToUIThread.h"
|
||||
#include "nsIListBox.h"
|
||||
|
||||
#include <ListView.h>
|
||||
#include <ListItem.h>
|
||||
|
||||
/**
|
||||
* Native Win32 Listbox wrapper
|
||||
*/
|
||||
|
||||
class nsListBox : public nsWindow,
|
||||
public nsIListWidget,
|
||||
public nsIListBox
|
||||
{
|
||||
|
||||
public:
|
||||
nsListBox();
|
||||
virtual ~nsListBox();
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsRect &r);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
|
||||
NS_IMETHOD GetBounds(nsRect &aRect);
|
||||
|
||||
|
||||
// nsIListBox interface
|
||||
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections);
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition);
|
||||
PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos);
|
||||
PRInt32 GetItemCount();
|
||||
PRBool RemoveItemAt(PRInt32 aPosition);
|
||||
PRBool GetItemAt(nsString& anItem, PRInt32 aPosition);
|
||||
NS_IMETHOD GetSelectedItem(nsString& aItem);
|
||||
PRInt32 GetSelectedIndex();
|
||||
PRInt32 GetSelectedCount();
|
||||
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize);
|
||||
NS_IMETHOD SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize);
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition);
|
||||
NS_IMETHOD Deselect() ;
|
||||
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
// nsWindow interface
|
||||
virtual PRBool AutoErase();
|
||||
protected:
|
||||
PRBool mMultiSelect;
|
||||
virtual BView *CreateBeOSView();
|
||||
BListView *mListView;
|
||||
|
||||
friend class nsListViewBeOS;
|
||||
};
|
||||
|
||||
//
|
||||
// A BListView subclass
|
||||
//
|
||||
class nsListViewBeOS : public BListView, public nsIWidgetStore {
|
||||
public:
|
||||
nsListViewBeOS( nsIWidget *aWidgetWindow, BRect aFrame,
|
||||
const char *name, uint32 aResizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 aFlags = B_WILL_DRAW | B_NAVIGABLE );
|
||||
};
|
||||
|
||||
#endif // nsListBox_h__
|
||||
190
mozilla/widget/src/beos/nsLookAndFeel.cpp
Normal file
190
mozilla/widget/src/beos/nsLookAndFeel.cpp
Normal file
@@ -0,0 +1,190 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsLookAndFeel.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
//static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
//NS_IMPL_ISUPPORTS(nsLookAndFeel, NS_ILOOKANDFEEL_IID)
|
||||
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
NS_IMPL_ISUPPORTS(nsLookAndFeel, kILookAndFeelIID);
|
||||
|
||||
nsLookAndFeel::nsLookAndFeel() : nsILookAndFeel()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsLookAndFeel::~nsLookAndFeel()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
int idx;
|
||||
switch (aID) {
|
||||
case eColor_WindowBackground:
|
||||
aColor = NS_RGB(0xff,0xff,0xff);
|
||||
break;
|
||||
case eColor_WindowForeground:
|
||||
aColor = NS_RGB(0x00,0x00,0x00);
|
||||
break;
|
||||
case eColor_WidgetBackground:
|
||||
aColor = NS_RGB(192, 192, 192);
|
||||
break;
|
||||
case eColor_WidgetForeground:
|
||||
aColor = NS_RGB(0x00,0x00,0x00);
|
||||
break;
|
||||
case eColor_WidgetSelectBackground:
|
||||
aColor = NS_RGB(0x80,0x80,0x80);
|
||||
break;
|
||||
case eColor_WidgetSelectForeground:
|
||||
aColor = NS_RGB(0x00,0x00,0x80);
|
||||
break;
|
||||
case eColor_Widget3DHighlight:
|
||||
aColor = NS_RGB(0xa0,0xa0,0xa0);
|
||||
break;
|
||||
case eColor_Widget3DShadow:
|
||||
aColor = NS_RGB(0x40,0x40,0x40);
|
||||
break;
|
||||
case eColor_TextBackground:
|
||||
aColor = NS_RGB(0xff,0xff,0xff);
|
||||
break;
|
||||
case eColor_TextForeground:
|
||||
aColor = NS_RGB(0x00,0x00,0x00);
|
||||
break;
|
||||
case eColor_TextSelectBackground:
|
||||
aColor = NS_RGB(0x00,0x00,0x80);
|
||||
break;
|
||||
case eColor_TextSelectForeground:
|
||||
aColor = NS_RGB(0xff,0xff,0xff);
|
||||
break;
|
||||
default:
|
||||
aColor = NS_RGB(0xff,0xff,0xff);
|
||||
res = NS_ERROR_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
switch (aID) {
|
||||
case eMetric_WindowTitleHeight:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_WindowBorderWidth:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_WindowBorderHeight:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_Widget3DBorder:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_TextFieldHeight:
|
||||
aMetric = 24;
|
||||
break;
|
||||
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
|
||||
aMetric = 10;
|
||||
break;
|
||||
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
|
||||
aMetric = 8;
|
||||
break;
|
||||
case eMetric_CheckboxSize:
|
||||
aMetric = 12;
|
||||
break;
|
||||
case eMetric_RadioboxSize:
|
||||
aMetric = 12;
|
||||
break;
|
||||
case eMetric_TextHorizontalInsideMinimumPadding:
|
||||
aMetric = 3;
|
||||
break;
|
||||
case eMetric_TextVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_TextShouldUseVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
|
||||
aMetric = 1;
|
||||
break;
|
||||
case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_ListHorizontalInsideMinimumPadding:
|
||||
aMetric = 3;
|
||||
break;
|
||||
case eMetric_ListShouldUseVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1;
|
||||
res = NS_ERROR_FAILURE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
switch (aID) {
|
||||
case eMetricFloat_TextFieldVerticalInsidePadding:
|
||||
aMetric = 0.25f;
|
||||
break;
|
||||
case eMetricFloat_TextFieldHorizontalInsidePadding:
|
||||
aMetric = 0.95f;
|
||||
break;
|
||||
case eMetricFloat_TextAreaVerticalInsidePadding:
|
||||
aMetric = 0.40f;
|
||||
break;
|
||||
case eMetricFloat_TextAreaHorizontalInsidePadding:
|
||||
aMetric = 0.40f;
|
||||
break;
|
||||
case eMetricFloat_ListVerticalInsidePadding:
|
||||
aMetric = 0.10f;
|
||||
break;
|
||||
case eMetricFloat_ListHorizontalInsidePadding:
|
||||
aMetric = 0.40f;
|
||||
break;
|
||||
case eMetricFloat_ButtonVerticalInsidePadding:
|
||||
aMetric = 0.25f;
|
||||
break;
|
||||
case eMetricFloat_ButtonHorizontalInsidePadding:
|
||||
aMetric = 0.25f;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1.0;
|
||||
res = NS_ERROR_FAILURE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
36
mozilla/widget/src/beos/nsLookAndFeel.h
Normal file
36
mozilla/widget/src/beos/nsLookAndFeel.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __nsLookAndFeel
|
||||
#define __nsLookAndFeel
|
||||
#include "nsObject.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
class nsLookAndFeel: public nsILookAndFeel {
|
||||
public:
|
||||
nsLookAndFeel();
|
||||
virtual ~nsLookAndFeel();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user