Mercurial > projects > dwt-mac
comparison dwt/browser/FilePicker_1_8.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 649b8e223d5a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2003, 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 *******************************************************************************/ | |
11 module dwt.browser.FilePicker_1_8; | |
12 | |
13 import dwt.dwthelper.utils; | |
14 | |
15 import dwt.internal.mozilla.XPCOM; | |
16 import dwt.internal.mozilla.XPCOMObject; | |
17 | |
18 class FilePicker_1_8 extends FilePicker { | |
19 | |
20 void createCOMInterfaces () { | |
21 /* Create each of the interfaces that this object implements */ | |
22 supports = new XPCOMObject (new int[] {2, 0, 0}) { | |
23 public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} | |
24 public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} | |
25 public int /*long*/ method2 (int /*long*/[] args) {return Release ();} | |
26 }; | |
27 | |
28 filePicker = new XPCOMObject (new int[] {2, 0, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) { | |
29 public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} | |
30 public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} | |
31 public int /*long*/ method2 (int /*long*/[] args) {return Release ();} | |
32 public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], (short)args[2]);} | |
33 public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters ((int)/*64*/args[0]);} | |
34 public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);} | |
35 public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);} | |
36 public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);} | |
37 public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);} | |
38 public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);} | |
39 public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);} | |
40 public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex ((int)/*64*/args[0]);} | |
41 public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);} | |
42 public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);} | |
43 public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);} | |
44 public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args[0]);} | |
45 public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args[0]);} | |
46 public int /*long*/ method17 (int /*long*/[] args) {return Show (args[0]);} | |
47 }; | |
48 } | |
49 | |
50 /* | |
51 * As of Mozilla 1.8 some of nsIFilePicker's string arguments changed type. This method | |
52 * answers a java string based on the type of string that is appropriate for the Mozilla | |
53 * version being used. | |
54 */ | |
55 String parseAString (int /*long*/ string) { | |
56 if (string is 0) return null; | |
57 int length = XPCOM.nsEmbedString_Length (string); | |
58 int /*long*/ buffer = XPCOM.nsEmbedString_get (string); | |
59 char[] chars = new char[length]; | |
60 XPCOM.memmove (chars, buffer, length * 2); | |
61 return new String (chars); | |
62 } | |
63 } |