comparison dwt/internal/cocoa/NSFontPanel.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * 10 *
11 * Port to the D programming language: 11 * Port to the D programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSFontPanel; 14 module dwt.internal.cocoa.NSFontPanel;
15 15
16 import dwt.dwthelper.utils;
17 import cocoa = dwt.internal.cocoa.id;
16 import dwt.internal.cocoa.NSFont; 18 import dwt.internal.cocoa.NSFont;
17 import dwt.internal.cocoa.NSPanel; 19 import dwt.internal.cocoa.NSPanel;
18 import dwt.internal.cocoa.NSView;
19 import dwt.internal.cocoa.OS; 20 import dwt.internal.cocoa.OS;
20 import objc = dwt.internal.objc.runtime; 21 import objc = dwt.internal.objc.runtime;
21 22
22 public class NSFontPanel : NSPanel 23 public class NSFontPanel : NSPanel {
23 {
24 24
25 public this () 25 public this() {
26 { 26 super();
27 super(); 27 }
28 }
29 28
30 public this (objc.id id) 29 public this(objc.id id) {
31 { 30 super(id);
32 super(id); 31 }
33 }
34 32
35 public NSView accessoryView () 33 public this(cocoa.id id) {
36 { 34 super(id);
37 objc.id result = OS.objc_msgSend(this.id_, OS.sel_accessoryView); 35 }
38 return result !is null ? new NSView(result) : null;
39 }
40 36
41 public bool isEnabled () 37 public NSFont panelConvertFont(NSFont fontObj) {
42 { 38 objc.id result = OS.objc_msgSend(this.id, OS.sel_panelConvertFont_, fontObj !is null ? fontObj.id : null);
43 return OS.objc_msgSend(this.id_, OS.sel_isEnabled) !is null; 39 return result !is null ? new NSFont(result) : null;
44 } 40 }
45 41
46 public NSFont panelConvertFont (NSFont fontObj) 42 public void setPanelFont(NSFont fontObj, bool flag) {
47 { 43 OS.objc_msgSend(this.id, OS.sel_setPanelFont_isMultiple_, fontObj !is null ? fontObj.id : null, flag);
48 objc.id result = OS.objc_msgSend(this.id_, OS.sel_panelConvertFont_1, fontObj !is null ? fontObj.id_ : null); 44 }
49 return result !is null ? new NSFont(result) : null;
50 }
51 45
52 public void reloadDefaultFontFamilies () 46 public static NSFontPanel sharedFontPanel() {
53 { 47 objc.id result = OS.objc_msgSend(OS.class_NSFontPanel, OS.sel_sharedFontPanel);
54 OS.objc_msgSend(this.id_, OS.sel_reloadDefaultFontFamilies); 48 return result !is null ? new NSFontPanel(result) : null;
55 } 49 }
56
57 public void setAccessoryView (NSView aView)
58 {
59 OS.objc_msgSend(this.id_, OS.sel_setAccessoryView_1, aView !is null ? aView.id_ : null);
60 }
61
62 public void setEnabled (bool flag)
63 {
64 OS.objc_msgSend(this.id_, OS.sel_setEnabled_1, flag);
65 }
66
67 public void setPanelFont (NSFont fontObj, bool flag)
68 {
69 OS.objc_msgSend(this.id_, OS.sel_setPanelFont_1isMultiple_1, fontObj !is null ? fontObj.id_ : null, flag);
70 }
71
72 public static NSFontPanel sharedFontPanel ()
73 {
74 objc.id result = OS.objc_msgSend(OS.class_NSFontPanel, OS.sel_sharedFontPanel);
75 return result !is null ? new NSFontPanel(result) : null;
76 }
77
78 public static bool sharedFontPanelExists ()
79 {
80 return OS.objc_msgSend(OS.class_NSFontPanel, OS.sel_sharedFontPanelExists) !is null;
81 }
82
83 public bool worksWhenModal ()
84 {
85 return OS.objc_msgSend(this.id_, OS.sel_worksWhenModal) !is null;
86 }
87 50
88 } 51 }