⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os.java

📁 源码为Eclipse开源开发平台桌面开发工具SWT的源代码,
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html *  * Contributors: *     IBM Corporation - initial API and implementation *******************************************************************************/package org.eclipse.swt.internal.win32;import org.eclipse.swt.internal.*;public class OS {	static {		Library.loadLibrary ("swt"); //$NON-NLS-1$	}		/*	* SWT Windows flags	*/	public static final boolean IsWin32s;	public static final boolean IsWin95;	public static final boolean IsWinNT;	public static final boolean IsWinCE;	public static final boolean IsPPC;	public static final boolean IsHPC;	public static final boolean IsSP;	public static final boolean IsDBLocale;	public static final boolean IsUnicode;	public static final int WIN32_MAJOR, WIN32_MINOR;	public static final int COMCTL32_MAJOR, COMCTL32_MINOR;	public static final int SHELL32_MAJOR, SHELL32_MINOR;	/*	* Flags for Window API GetVersionEx()	*/	public static final int VER_PLATFORM_WIN32s = 0;	public static final int VER_PLATFORM_WIN32_WINDOWS = 1;	public static final int VER_PLATFORM_WIN32_NT = 2;	public static final int VER_PLATFORM_WIN32_CE = 3;		/* Get the Windows version and the flags */	static {		/*		* Try the UNICODE version of GetVersionEx first		* and then the ANSI version.  The UNICODE version		* is present on all versions of Windows but is not		* implemented on Win95/98/ME.		* 		* NOTE: The value of OSVERSIONINFO.sizeof cannot		* be static final because it relies on the Windows		* platform version to be initialized and IsUnicode		* has not been calculated.  It must be initialized		* here, after the platform is determined in order		* for the value to be correct.		*/		OSVERSIONINFO info = new OSVERSIONINFOW ();		info.dwOSVersionInfoSize = OSVERSIONINFOW.sizeof;		if (!OS.GetVersionExW ((OSVERSIONINFOW)info)) {			info = new OSVERSIONINFOA ();			info.dwOSVersionInfoSize = OSVERSIONINFOA.sizeof;			OS.GetVersionExA ((OSVERSIONINFOA)info);		}		OSVERSIONINFO.sizeof = info.dwOSVersionInfoSize;				IsWin32s = info.dwPlatformId == VER_PLATFORM_WIN32s;		IsWin95 = info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;		IsWinNT = info.dwPlatformId == VER_PLATFORM_WIN32_NT;		IsWinCE = info.dwPlatformId == VER_PLATFORM_WIN32_CE;		IsSP = IsSP();		IsPPC = IsPPC();		IsHPC = IsWinCE && !IsPPC && !IsSP;			WIN32_MAJOR = info.dwMajorVersion;		WIN32_MINOR = info.dwMinorVersion;		IsUnicode = !IsWin32s && !IsWin95;		/* Get the DBCS flag */		int index = 0;		while (index <= 0xFF) {			if (OS.IsDBCSLeadByte ((byte) index)) break;			index++;		}		IsDBLocale = index <= 0xFF;	}		/* Get the COMCTL32.DLL version */	static {		DLLVERSIONINFO dvi = new DLLVERSIONINFO ();		dvi.cbSize = DLLVERSIONINFO.sizeof;		dvi.dwMajorVersion = 4;		dvi.dwMinorVersion = 0;		TCHAR lpLibFileName = new TCHAR (0, "comctl32.dll", true); //$NON-NLS-1$		int hModule = OS.LoadLibrary (lpLibFileName);		if (hModule != 0) {			String name = "DllGetVersion\0"; //$NON-NLS-1$			byte [] lpProcName = new byte [name.length ()];			for (int i=0; i<lpProcName.length; i++) {				lpProcName [i] = (byte) name.charAt (i);			}			int DllGetVersion = OS.GetProcAddress (hModule, lpProcName);			if (DllGetVersion != 0) OS.Call (DllGetVersion, dvi);			OS.FreeLibrary (hModule);		}		COMCTL32_MAJOR = dvi.dwMajorVersion;		COMCTL32_MINOR = dvi.dwMinorVersion;	}		/* Get the Shell32.DLL version */	static {		DLLVERSIONINFO dvi = new DLLVERSIONINFO ();		dvi.cbSize = DLLVERSIONINFO.sizeof;		dvi.dwMajorVersion = 4;		TCHAR lpLibFileName = new TCHAR (0, "Shell32.dll", true); //$NON-NLS-1$		int hModule = OS.LoadLibrary (lpLibFileName);		if (hModule != 0) {			String name = "DllGetVersion\0"; //$NON-NLS-1$			byte [] lpProcName = new byte [name.length ()];			for (int i=0; i<lpProcName.length; i++) {				lpProcName [i] = (byte) name.charAt (i);			}			int DllGetVersion = OS.GetProcAddress (hModule, lpProcName);			if (DllGetVersion != 0) OS.Call (DllGetVersion, dvi);			OS.FreeLibrary (hModule);		}		SHELL32_MAJOR = dvi.dwMajorVersion;		SHELL32_MINOR = dvi.dwMinorVersion;	}	/* Flag used on WinCE */	static final int SYS_COLOR_INDEX_FLAG = OS.IsWinCE ? 0x40000000 : 0x0;	/*	* NOTE:  There is a bug in JVM 1.2 where loading 	* a class with a large number of constants causes	* a segment fault to occur sometime later after	* the class is loaded.  The fix is to break the	* class up into a hierarchy of classes that each	* contain a smaller number of constants.  This	* fix is not necessary at this time but is required	* when all constants are uncommented.  We have not	* done the research to determine the limit.	*/	/* Constants */	public static final int ALTERNATE = 1;	public static final int BFFM_INITIALIZED = 0x1;	public static final int BFFM_SETSELECTION = IsUnicode ? 0x467 : 0x466;	public static final int BFFM_VALIDATEFAILED = IsUnicode ? 0x4 : 0x3;	public static final int BFFM_VALIDATEFAILEDW = 0x4;	public static final int BFFM_VALIDATEFAILEDA = 0x3;	public static final int BF_BOTTOM = 0x8;	public static final int BF_RIGHT = 0x4;	public static final int BIF_EDITBOX = 0x10;	public static final int BIF_NEWDIALOGSTYLE = 0x40;	public static final int BIF_RETURNONLYFSDIRS = 0x1;	public static final int BIF_VALIDATE = 0x20;	public static final int BITSPIXEL = 0xc;	public static final int BI_BITFIELDS = 3;	public static final int BI_RGB = 0;	public static final int BLACKNESS = 0x42;	public static final int BM_CLICK = 0xf5;	public static final int BM_GETCHECK = 0xf0;	public static final int BM_SETCHECK = 0xf1;	public static final int BM_SETIMAGE = 0xf7;	public static final int BM_SETSTYLE = 0xf4;	public static final int BN_CLICKED = 0x0;	public static final int BN_DOUBLECLICKED = 0x5;	public static final int BST_CHECKED = 0x1;	public static final int BST_UNCHECKED = 0x0;	public static final int BS_BITMAP = 0x80;	public static final int BS_CENTER = 0x300;	public static final int BS_CHECKBOX = 0x2;	public static final int BS_DEFPUSHBUTTON = 0x1;	public static final int BS_FLAT = 0x8000;	public static final int BS_GROUPBOX = 0x7;	public static final int BS_ICON = 0x40;	public static final int BS_LEFT = 0x100;	public static final int BS_NOTIFY = 0x4000;	public static final int BS_OWNERDRAW = 0xb;	public static final int BS_PUSHBUTTON = 0x0;	public static final int BS_PUSHLIKE = 0x1000;	public static final int BS_RADIOBUTTON = 0x4;	public static final int BS_RIGHT = 0x200;	public static final int BS_SOLID = 0x0;	public static final int BTNS_AUTOSIZE = 0x10;	public static final int BTNS_BUTTON = 0x0;	public static final int BTNS_CHECK = 0x2;	public static final int BTNS_CHECKGROUP = 0x6;	public static final int BTNS_DROPDOWN = 0x8;	public static final int BTNS_GROUP = 0x4;	public static final int BTNS_SEP = 0x1;	public static final int BTNS_SHOWTEXT = 0x40;	public static final int CBN_EDITCHANGE = 0x5;	public static final int CBN_KILLFOCUS = 0x4;	public static final int CBN_SELCHANGE = 0x1;	public static final int CBN_SETFOCUS = 0x3;	public static final int CBS_AUTOHSCROLL = 0x40;	public static final int CBS_DROPDOWN = 0x2;	public static final int CBS_DROPDOWNLIST = 0x3;	public static final int CBS_NOINTEGRALHEIGHT = 0x400;	public static final int CBS_SIMPLE = 0x1;	public static final int CB_ADDSTRING = 0x143;	public static final int CB_DELETESTRING = 0x144;	public static final int CB_ERR = 0xffffffff;	public static final int CB_ERRSPACE = 0xfffffffe;	public static final int CB_FINDSTRINGEXACT = 0x158;	public static final int CB_GETCOUNT = 0x146;	public static final int CB_GETCURSEL = 0x147;	public static final int CB_GETDROPPEDCONTROLRECT = 0x152;	public static final int CB_GETDROPPEDSTATE = 0x157;	public static final int CB_GETEDITSEL = 0x140;	public static final int CB_GETITEMHEIGHT = 0x154;	public static final int CB_GETLBTEXT = 0x148;	public static final int CB_GETLBTEXTLEN = 0x149;	public static final int CB_INSERTSTRING = 0x14a;	public static final int CB_LIMITTEXT = 0x141;	public static final int CB_RESETCONTENT = 0x14b;	public static final int CB_SELECTSTRING = 0x14d;	public static final int CB_SETCURSEL = 0x14e;	public static final int CB_SETEDITSEL = 0x142;	public static final int CB_SHOWDROPDOWN = 0x14f;	public static final int CCM_FIRST = 0x2000;	public static final int CCM_SETBKCOLOR = 0x2001;	public static final int CCM_SETVERSION = 0x2007;	public static final int CCS_NODIVIDER = 0x40;	public static final int CCS_NORESIZE = 0x4;	public static final int CC_ANYCOLOR = 0x100;	public static final int CC_ENABLEHOOK = 0x10;	public static final int CC_RGBINIT = 0x1;	public static final int CDDS_POSTERASE = 0x00000004;	public static final int CDDS_PREERASE = 0x00000003;	public static final int CDDS_PREPAINT = 0x00000001;	public static final int CDDS_ITEM = 0x00010000;	public static final int CDDS_ITEMPREPAINT = CDDS_ITEM | CDDS_PREPAINT;	public static final int CDDS_SUBITEM = 0x00020000;	public static final int CDRF_DODEFAULT = 0x00000000;	public static final int CDRF_NEWFONT = 0x00000002;	public static final int CDRF_NOTIFYITEMDRAW = 0x00000020;	public static final int CDRF_NOTIFYPOSTERASE = 0x00000040;	public static final int CDRF_NOTIFYSUBITEMDRAW = 0x00000020;	public static final int CFE_AUTOCOLOR = 0x40000000;	public static final int CFE_ITALIC = 0x2;	public static final int CFE_STRIKEOUT = 0x8;	public static final int CFE_UNDERLINE = 0x4;	public static final int CFM_BOLD = 0x1;	public static final int CFM_CHARSET = 0x8000000;	public static final int CFM_COLOR = 0x40000000;	public static final int CFM_FACE = 0x20000000;	public static final int CFM_ITALIC = 0x2;	public static final int CFM_SIZE = 0x80000000;	public static final int CFM_STRIKEOUT = 0x8;	public static final int CFM_UNDERLINE = 0x4;	public static final int CFM_WEIGHT = 0x400000;	public static final int CFS_POINT = 0x2;	public static final int CF_EFFECTS = 0x100;	public static final int CF_INITTOLOGFONTSTRUCT = 0x40;	public static final int CF_SCREENFONTS = 0x1;	public static final int CF_TEXT = 0x1;	public static final int CF_UNICODETEXT = 13;	public static final int CF_USESTYLE = 0x80;	public static final int CLR_DEFAULT = 0xff000000;	public static final int CLR_INVALID = 0xffffffff;	public static final int COLORONCOLOR = 0x3;	public static final int COLOR_3DDKSHADOW = 0x15 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_3DFACE = 0xf | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_3DHIGHLIGHT = 0x14 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_3DHILIGHT = 0x14 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_3DLIGHT = 0x16 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_3DSHADOW = 0x10 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_ACTIVECAPTION = 0x2 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_BTNFACE = 0xf | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_BTNHIGHLIGHT = 0x14 | SYS_COLOR_INDEX_FLAG;	public static final int COLOR_BTNSHADOW = 0x10 | SYS_COLOR_INDEX_FLAG;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -