Mercurial > projects > dwt-addons
comparison dwtx/novocode/ishell/internal/TitleBarButton.d @ 189:71ca5bcf2307
Replaced String alias with import dwt.dwthelper.util
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 26 Oct 2008 14:57:25 +0100 |
parents | e3780acbbf80 |
children | df4e66472aff |
comparison
equal
deleted
inserted
replaced
188:e3780acbbf80 | 189:71ca5bcf2307 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2005 Stefan Zeiger and others. | 2 * Copyright (c) 2005 Stefan Zeiger 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.novocode.com/legal/epl-v10.html | 6 * http://www.novocode.com/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * Stefan Zeiger (szeiger@novocode.com) - initial API and implementation | 9 * Stefan Zeiger (szeiger@novocode.com) - initial API and implementation |
10 *******************************************************************************/ | 10 *******************************************************************************/ |
11 | 11 |
12 module dwtx.novocode.ishell.internal.TitleBarButton; | 12 module dwtx.novocode.ishell.internal.TitleBarButton; |
57 darkShadowColor = display.getSystemColor(DWT.COLOR_WIDGET_DARK_SHADOW); | 57 darkShadowColor = display.getSystemColor(DWT.COLOR_WIDGET_DARK_SHADOW); |
58 gradEndColor = display.getSystemColor(DWT.COLOR_TITLE_BACKGROUND_GRADIENT); | 58 gradEndColor = display.getSystemColor(DWT.COLOR_TITLE_BACKGROUND_GRADIENT); |
59 inactiveGradEndColor = display.getSystemColor(DWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT); | 59 inactiveGradEndColor = display.getSystemColor(DWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT); |
60 widgetBackgroundColor = display.getSystemColor(DWT.COLOR_WIDGET_BACKGROUND); | 60 widgetBackgroundColor = display.getSystemColor(DWT.COLOR_WIDGET_BACKGROUND); |
61 widgetForegroundColor = display.getSystemColor(DWT.COLOR_WIDGET_FOREGROUND); | 61 widgetForegroundColor = display.getSystemColor(DWT.COLOR_WIDGET_FOREGROUND); |
62 | 62 |
63 if((style & (DWT.CLOSE | DWT.MAX)) !is 0) rightOff = 2; | 63 if((style & (DWT.CLOSE | DWT.MAX)) !is 0) rightOff = 2; |
64 else leftOff = 2; | 64 else leftOff = 2; |
65 | 65 |
66 activateListener = dgListener(&onActivateListener); | 66 activateListener = dgListener(&onActivateListener); |
67 deactivateListener = dgListener(&onDeactivateListener); | 67 deactivateListener = dgListener(&onDeactivateListener); |
68 shell.addListener(DWT.Activate, activateListener); | 68 shell.addListener(DWT.Activate, activateListener); |
69 shell.addListener(DWT.Deactivate, deactivateListener); | 69 shell.addListener(DWT.Deactivate, deactivateListener); |
70 | 70 |
71 addListener(DWT.Dispose, dgListener(&onDispose)); | 71 addListener(DWT.Dispose, dgListener(&onDispose)); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 private void onActivateListener(Event event) | 75 private void onActivateListener(Event event) |
94 public int getStyle() | 94 public int getStyle() |
95 { | 95 { |
96 return style; | 96 return style; |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 protected void onPaint(Event event, bool pressed) | 100 protected void onPaint(Event event, bool pressed) |
101 { | 101 { |
102 Point size = getSize(); | 102 Point size = getSize(); |
103 bool active = (shell is display.getActiveShell() && ishell.isActiveShell()); | 103 bool active = (shell is display.getActiveShell() && ishell.isActiveShell()); |
104 GC gc = event.gc; | 104 GC gc = event.gc; |
141 drawImage(gc, size, 1); | 141 drawImage(gc, size, 1); |
142 gc.setForeground(normalShadowColor); | 142 gc.setForeground(normalShadowColor); |
143 drawImage(gc, size, 0); | 143 drawImage(gc, size, 0); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 private void drawImage(GC gc, Point size, int pOff) | 148 private void drawImage(GC gc, Point size, int pOff) |
149 { | 149 { |
150 if((style & DWT.CLOSE) !is 0) drawCloseImage(gc, size, pOff); | 150 if((style & DWT.CLOSE) !is 0) drawCloseImage(gc, size, pOff); |
151 else if((style & DWT.MAX) !is 0) | 151 else if((style & DWT.MAX) !is 0) |
152 { | 152 { |
165 | 165 |
166 gc.setForeground(topleft); | 166 gc.setForeground(topleft); |
167 gc.drawLine(x, y, x + w - 1, y); | 167 gc.drawLine(x, y, x + w - 1, y); |
168 gc.drawLine(x, y, x, y + h - 1); | 168 gc.drawLine(x, y, x, y + h - 1); |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 private void drawCloseImage(GC gc, Point size, int pOff) | 172 private void drawCloseImage(GC gc, Point size, int pOff) |
173 { | 173 { |
174 gc.drawLine(pOff+leftOff+4, pOff+5, pOff+size.x-leftOff-rightOff-6, pOff+size.y-7); | 174 gc.drawLine(pOff+leftOff+4, pOff+5, pOff+size.x-leftOff-rightOff-6, pOff+size.y-7); |
175 gc.drawLine(pOff+leftOff+5, pOff+5, pOff+size.x-leftOff-rightOff-5, pOff+size.y-7); | 175 gc.drawLine(pOff+leftOff+5, pOff+5, pOff+size.x-leftOff-rightOff-5, pOff+size.y-7); |
176 gc.drawLine(pOff+leftOff+4, pOff+size.y-7, pOff+size.x-leftOff-rightOff-6, pOff+5); | 176 gc.drawLine(pOff+leftOff+4, pOff+size.y-7, pOff+size.x-leftOff-rightOff-6, pOff+5); |