javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Font.java
changeset 35 85266cc22c7f
parent 21 2a9601315dfc
equal deleted inserted replaced
26:dc7c549001d5 35:85266cc22c7f
   171 			return;
   171 			return;
   172         if(!OS.SwtFontCache_isCached(handle)) {
   172         if(!OS.SwtFontCache_isCached(handle)) {
   173             OS.QFont_delete(handle);
   173             OS.QFont_delete(handle);
   174         }
   174         }
   175         handle = 0;
   175         handle = 0;
   176 		if (device.tracking)
   176 		if (Device.tracking)
   177 			device.dispose_Object(this);
   177 			device.dispose_Object(this);
   178 		device = null;
   178 		device = null;
   179 	}
   179 	}
   180 
   180 
   181 	/**
   181 	/**
   258 
   258 
   259 	void init(Device device, String name, int height, int style) {
   259 	void init(Device device, String name, int height, int style) {
   260 		extraFontStyle = false;
   260 		extraFontStyle = false;
   261 		xlfd = null;
   261 		xlfd = null;
   262 		if (device == null)
   262 		if (device == null)
   263 			device = Device.getDevice();
       
   264 		if (device == null)
       
   265 			SWT.error(SWT.ERROR_NULL_ARGUMENT);
   263 			SWT.error(SWT.ERROR_NULL_ARGUMENT);
   266 		this.device = device;
   264 		this.device = device;
   267 		if (name == null)
   265 		if (name == null)
   268 			SWT.error(SWT.ERROR_NULL_ARGUMENT);
   266 			SWT.error(SWT.ERROR_NULL_ARGUMENT);
   269 		if (height < 0)
   267 		if (height < 0)
   270 			SWT.error(SWT.ERROR_INVALID_ARGUMENT);
   268 			SWT.error(SWT.ERROR_INVALID_ARGUMENT);
   271 
   269 
   272 		// Keep this after dealing with all exceptions!
   270 		// Keep this after dealing with all exceptions!
   273 		if (device.tracking)
   271 		if (Device.tracking)
   274 			device.new_Object(this);
   272 			device.new_Object(this);
   275 
   273 
   276 		boolean italic = (style & SWT.ITALIC) != 0;
   274 		boolean italic = (style & SWT.ITALIC) != 0;
   277 		int weight = OS.QT_FONTNORMAL;
   275 		int weight = OS.QT_FONTNORMAL;
   278 		if ((style & SWT.BOLD) != 0) {
   276 		if ((style & SWT.BOLD) != 0) {
   350 	 */
   348 	 */
   351 	static Font qt_new(Device device, int handle) {
   349 	static Font qt_new(Device device, int handle) {
   352 		if (handle <= 0)
   350 		if (handle <= 0)
   353 			return null;
   351 			return null;
   354 		if (device == null)
   352 		if (device == null)
   355 			device = Device.getDevice();
       
   356 		if (device == null)
       
   357 			SWT.error(SWT.ERROR_NULL_ARGUMENT);
   353 			SWT.error(SWT.ERROR_NULL_ARGUMENT);
   358 		Font font = new Font();
   354 		Font font = new Font();
   359 		font.handle = handle;
   355 		font.handle = handle;
   360 		font.device = device;
   356 		font.device = device;
   361 		return font;
   357 		return font;