Skip to content

Commit 60d2429

Browse files
author
zhourenjian
committed
1. Support different colors in title bar to indicate different selection status of given window
2. Does not list child Shell in task bar 3. Use system default highlight theme for task bar and quick launch bar.
1 parent d18f330 commit 60d2429

File tree

6 files changed

+69
-14
lines changed

6 files changed

+69
-14
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Decorations.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,20 @@ void addMenu (Menu menu) {
204204
}
205205

206206
void bringToTop () {
207+
bringToTop(true, true);
208+
}
209+
210+
void bringToTop (boolean parentShell, boolean childShells) {
211+
if (parentShell && childShells) {
212+
Display.deactivateAllTitleBarShells();
213+
}
214+
if (parentShell && parent != null && parent instanceof Decorations) {
215+
((Decorations) parent).bringToTop(true, false);
216+
}
217+
if (titleBar != null) {
218+
titleBar.style.backgroundColor = "activecaption";
219+
shellTitle.style.color = "captiontext";
220+
}
207221
/*
208222
* This code is intentionally commented. On some platforms,
209223
* the ON_TOP style creates a shell that will stay on top
@@ -261,6 +275,16 @@ void bringToTop () {
261275
}
262276
// widget could be disposed at this point
263277
// }
278+
if (childShells && this instanceof Shell) {
279+
Shell sh = (Shell) this;
280+
Shell[] children = sh.getShells();
281+
for (int i = 0; i < children.length; i++) {
282+
Shell s = children[i];
283+
if ((s.style & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) != 0) {
284+
s.bringToTop(false, true);
285+
}
286+
}
287+
}
264288
}
265289

266290
static int checkStyle (int style) {

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Display.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ public Display () {
480480
*/
481481
public Display (DeviceData data) {
482482
super (data);
483-
System.out.println("hi...");
484483
}
485484

486485
/*
@@ -4538,6 +4537,23 @@ static Shell getTopShell() {
45384537
return lastShell;
45394538
}
45404539

4540+
static void deactivateAllTitleBarShells() {
4541+
Shell lastShell = null;
4542+
int lastZIndex = 0;
4543+
Display[] disps = Displays;
4544+
for (int k = 0; k < disps.length; k++) {
4545+
if (disps[k] == null) continue;
4546+
Shell[] ss = disps[k].getShells ();
4547+
for (int i = 0; i < ss.length; i++) {
4548+
if (!ss[i].isDisposed () && ss[i].titleBar != null
4549+
&& ss[i].handle.style.display != "none") {
4550+
ss[i].titleBar.style.backgroundColor = "inactivecaption";
4551+
ss[i].shellTitle.style.color = "inactivecaptiontext";
4552+
}
4553+
}
4554+
}
4555+
}
4556+
45414557
static Shell getTopMaximizedShell() {
45424558
// find the top maximized shell
45434559
Shell lastShell = null;

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/QuickLaunch.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
}
4343
.shortcut-item:hover, a.shortcut-item:hover .shortcut-item-highlight {
4444
border:1px solid navy;
45-
opacity:0.95;
46-
filter:Alpha(Opacity=95);
45+
background-color:highlight;
46+
color:highlighttext;
47+
opacity:0.85;
48+
filter:Alpha(Opacity=85);
4749
}
4850
.shortcut-active-item {
4951
/*border:1px solid darkred;*/
@@ -52,8 +54,10 @@
5254
}
5355
.shortcut-active-item:hover, a.shortcut-active-item:hover {
5456
/*border:1px solid navy;*/
55-
opacity:0.6;
56-
filter:Alpha(Opacity=60);
57+
background-color:highlight;
58+
color:highlighttext;
59+
opacity:0.85;
60+
filter:Alpha(Opacity=85);
5761
}
5862
.swt-widgets-quicklaunch {
5963
width:324px;

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Shell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ void setToolTipText (NMTTDISPINFO lpnmtdi, char [] buffer) {
13831383
public void setVisible (boolean visible) {
13841384
checkWidget ();
13851385

1386-
if ((this.getStyle() & SWT.TOOL) == 0 && display.taskBar != null) {
1386+
if (this.parent == null && (this.getStyle() & SWT.TOOL) == 0 && display.taskBar != null) {
13871387
TaskBar taskBar = display.taskBar;
13881388
if (!visible) {
13891389
taskBar.removeShellItem(this);

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/TaskBar.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@
4242
filter:Alpha(Opacity=55);
4343
}
4444
.shell-item:hover, a.shell-item:hover {
45+
background-color:highlight;
46+
color:highlighttext;
4547
border:1px solid navy;
46-
opacity:0.95;
47-
filter:Alpha(Opacity=95);
48+
opacity:0.85;
49+
filter:Alpha(Opacity=85);
4850
}
4951
.shell-top-item {
5052
/*border:1px solid darkred;*/
@@ -53,15 +55,19 @@
5355
}
5456
.shell-top-item:hover, a.shell-top-item:hover {
5557
/*border:1px solid navy;*/
56-
opacity:0.55;
57-
filter:Alpha(Opacity=55);
58+
background-color:highlight;
59+
color:highlighttext;
60+
opacity:0.85;
61+
filter:Alpha(Opacity=85);
62+
/*opacity:0.55;
63+
filter:Alpha(Opacity=55);*/
5864
}
5965
a.shell-item:focus {
6066
background-color:buttonhighlight;
6167
}
6268
.shell-item-icon {
6369
float:left;
64-
background-color:buttonface;
70+
/*background-color:buttonface;*/
6571
background-repeat:no-repeat;
6672
background-position:center center;
6773
background-image:url('images/shell-packed.gif');

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/TaskBar.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,14 @@ public void updateItems() {
332332
handleStyle.filter = "";
333333
}
334334
}
335-
item.itemHandle.style.borderColor = item.shell.getMinimized() ? "buttonshadow"
336-
: "";
337-
if (item.shell == topShell) {
335+
item.itemHandle.style.borderColor = item.shell.getMinimized() ? "buttonshadow" : "";
336+
boolean isTopShell = item.shell == topShell;
337+
Shell sh = topShell;
338+
while (!isTopShell && sh != null) {
339+
isTopShell = item.shell == sh;
340+
sh = (Shell) sh.parent;
341+
}
342+
if (isTopShell) {
338343
OS.addCSSClass(item.itemHandle, "shell-top-item");
339344
} else {
340345
OS.removeCSSClass(item.itemHandle, "shell-top-item");

0 commit comments

Comments
 (0)