1 /*
   2  * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifndef AWT_DESKTOP_PROPERTIES_H
  27 #define AWT_DESKTOP_PROPERTIES_H
  28 
  29 #include "awt.h"
  30 #include "jni.h"
  31 
  32 class AwtDesktopProperties {
  33     public:
  34         enum {
  35             MAX_PROPERTIES = 100,
  36             AWT_DESKTOP_PROPERTIES_1_3 = 1, // properties version for Java 2 SDK 1.3
  37             // NOTE: MUST INCREMENT this whenever you add new
  38             // properties for a given public release
  39             AWT_DESKTOP_PROPERTIES_1_4 = 2, // properties version for Java 2 SDK 1.4
  40             AWT_DESKTOP_PROPERTIES_1_5 = 3, // properties version for Java 2 SDK 1.5
  41             AWT_DESKTOP_PROPERTIES_VERSION = AWT_DESKTOP_PROPERTIES_1_5
  42         };
  43 
  44         AwtDesktopProperties(jobject self);
  45         ~AwtDesktopProperties();
  46 
  47         void GetWindowsParameters();
  48         void PlayWindowsSound(LPCTSTR eventName);
  49         static BOOL IsXPStyle();
  50 
  51         static jfieldID pDataID;
  52         static jmethodID setStringPropertyID;
  53         static jmethodID setIntegerPropertyID;
  54         static jmethodID setBooleanPropertyID;
  55         static jmethodID setColorPropertyID;
  56         static jmethodID setFontPropertyID;
  57         static jmethodID setSoundPropertyID;
  58 
  59     private:
  60         void GetXPStyleProperties();
  61         void GetSystemProperties();
  62         void GetNonClientParameters();
  63         void GetIconParameters();
  64         void GetColorParameters();
  65         void GetOtherParameters();
  66         void GetSoundEvents();
  67         void GetCaretParameters();
  68 
  69         static BOOL GetBooleanParameter(UINT spi);
  70         static UINT GetIntegerParameter(UINT spi);
  71 
  72         void SetBooleanProperty(LPCTSTR, BOOL);
  73         void SetIntegerProperty(LPCTSTR, int);
  74         void SetStringProperty(LPCTSTR, LPTSTR);
  75         void SetColorProperty(LPCTSTR, DWORD);
  76         void SetFontProperty(HDC, int, LPCTSTR);
  77         void SetFontProperty(LPCTSTR, const LOGFONT &);
  78         void SetSoundProperty(LPCTSTR, LPCTSTR);
  79 
  80         JNIEnv * GetEnv() {
  81             return (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  82         }
  83 
  84         jobject         self;
  85 };
  86 
  87 #endif // AWT_DESKTOP_PROPERTIES_H