001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Pavel Dolgov
019: * @version $Revision$
020: */package org.apache.harmony.awt.wtk.linux;
021:
022: import java.awt.Font;
023: import java.awt.SystemColor;
024: import java.awt.font.TextAttribute;
025: import java.awt.im.InputMethodHighlight;
026: import java.util.Map;
027:
028: import org.apache.harmony.awt.wtk.SystemProperties;
029:
030: /**
031: * LinuxSystemProperties
032: */
033:
034: public class LinuxSystemProperties implements SystemProperties {
035:
036: final LinuxWindowFactory factory;
037:
038: LinuxSystemProperties(LinuxWindowFactory factory) {
039: this .factory = factory;
040: }
041:
042: public int getSystemColorARGB(int index) {
043: switch (index) {
044: // Grey-blue
045: case SystemColor.ACTIVE_CAPTION:
046: return 0xff336699;
047: case SystemColor.ACTIVE_CAPTION_BORDER:
048: return 0xffcccccc;
049: case SystemColor.ACTIVE_CAPTION_TEXT:
050: return 0xffffffff;
051: // Light grey
052: case SystemColor.CONTROL:
053: return 0xffdddddd;
054: // Dark grey
055: case SystemColor.CONTROL_DK_SHADOW:
056: return 0xff777777;
057: // Almost white
058: case SystemColor.CONTROL_HIGHLIGHT:
059: return 0xffeeeeee;
060: // White
061: case SystemColor.CONTROL_LT_HIGHLIGHT:
062: return 0xffffffff;
063: // Grey
064: case SystemColor.CONTROL_SHADOW:
065: return 0xff999999;
066: // Black
067: case SystemColor.CONTROL_TEXT:
068: return 0xff000000;
069: // Dark blue
070: case SystemColor.DESKTOP:
071: return 0xff224466;
072: // Another grey
073: case SystemColor.INACTIVE_CAPTION:
074: return 0xff888888;
075: // Grey
076: case SystemColor.INACTIVE_CAPTION_BORDER:
077: return 0xffcccccc;
078: // Light grey
079: case SystemColor.INACTIVE_CAPTION_TEXT:
080: return 0xffdddddd;
081: // Almost white
082: case SystemColor.INFO:
083: return 0xffeeeeee;
084: case SystemColor.INFO_TEXT:
085: return 0xff222222;
086: // Light grey
087: case SystemColor.MENU:
088: return 0xffdddddd;
089: // Black
090: case SystemColor.MENU_TEXT:
091: return 0xff000000;
092: // Grey
093: case SystemColor.SCROLLBAR:
094: return 0xffcccccc;
095: // White
096: case SystemColor.TEXT:
097: return 0xffffffff;
098: // Grey blue
099: case SystemColor.TEXT_HIGHLIGHT:
100: return 0xff336699;
101: // White
102: case SystemColor.TEXT_HIGHLIGHT_TEXT:
103: return 0xffffffff;
104: // Almost white
105: case SystemColor.TEXT_INACTIVE_TEXT:
106: return 0xffdddddd;
107: // Black
108: case SystemColor.TEXT_TEXT:
109: return 0xff000000;
110: // White
111: case SystemColor.WINDOW:
112: return 0xffffffff;
113: // Black
114: case SystemColor.WINDOW_BORDER:
115: return 0xff000000;
116: // Black
117: case SystemColor.WINDOW_TEXT:
118: return 0xff000000;
119: }
120: // Black
121: return 0xFF000000;
122: }
123:
124: public Font getDefaultFont() {
125: // Default font parameters are described
126: // in java.awt.Font specification
127: return new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$
128: }
129:
130: public void init(Map desktopProperties) {
131: }
132:
133: public void mapInputMethodHighlight(InputMethodHighlight highlight,
134: Map map) {
135: TextAttribute key = TextAttribute.SWAP_COLORS;
136: if (highlight.isSelected()) {
137: map.put(key, TextAttribute.SWAP_COLORS_ON);
138: return;
139: }
140: switch (highlight.getState()) {
141: case InputMethodHighlight.RAW_TEXT:
142: key = TextAttribute.WEIGHT;
143: map.put(key, TextAttribute.WEIGHT_BOLD);
144: break;
145: case InputMethodHighlight.CONVERTED_TEXT:
146: key = TextAttribute.INPUT_METHOD_UNDERLINE;
147: map.put(key, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
148: break;
149: }
150: }
151: }
|