diff --git a/resources/images/images.properties b/resources/images/images.properties index 762de5dbc..df885dab0 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -40,6 +40,8 @@ service.gui.icons.FONT_ICON=resources/images/impl/gui/buttons/fontIcon.png service.gui.icons.ADD_CONTACT_CHAT_ICON=resources/images/impl/gui/buttons/addContactChatIcon.png service.gui.icons.CHAT_CONFIGURE_ICON=resources/images/impl/gui/buttons/chatConfigureIcon.png service.gui.icons.WARNING_ICON=resources/images/impl/gui/common/warning.png +service.gui.icons.TAB_UNREAD_FORWARD_ICON=resources/images/impl/gui/common/tabForward.png +service.gui.icons.TAB_UNREAD_BACKWARD_ICON=resources/images/impl/gui/common/tabBackward.png service.gui.icons.ERROR_ICON=resources/images/impl/gui/common/error.png service.gui.icons.INFO_ICON=resources/images/impl/gui/common/info.png service.gui.icons.SEND_MESSAGE_16x16_ICON=resources/images/impl/gui/common/sendMessage16x16.png diff --git a/resources/images/impl/gui/common/tabBackward.png b/resources/images/impl/gui/common/tabBackward.png new file mode 100644 index 000000000..2bdb3dd07 Binary files /dev/null and b/resources/images/impl/gui/common/tabBackward.png differ diff --git a/resources/images/impl/gui/common/tabForward.png b/resources/images/impl/gui/common/tabForward.png new file mode 100644 index 000000000..2ee82f5bf Binary files /dev/null and b/resources/images/impl/gui/common/tabForward.png differ diff --git a/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneEnhancedUI.java b/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneEnhancedUI.java index 0710c3bf2..1a1954d23 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneEnhancedUI.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneEnhancedUI.java @@ -412,17 +412,96 @@ public void paint(Graphics g) // Draw the arrow size = Math.min((h - 4) / 3, (w - 4) / 3); size = Math.max(size, 2); - paintTriangle(g, (w - size) / 2, (h - size) / 2, size, direction, - isEnabled); + + boolean highlight = false; + + if(!highlightedTabs.isEmpty() && + ((direction == WEST + && tabScroller.scrollBackwardButton.isEnabled()) + || (direction == EAST + && tabScroller.scrollForwardButton.isEnabled()))) + { + Rectangle viewRect = tabScroller.viewport.getViewRect(); + + if(direction == WEST) + { + int leadingTabIndex = getClosestTab(viewRect.x, viewRect.y); + + for(int i = 0; i < leadingTabIndex; i++) + { + if(highlightedTabs.contains(i) + && !isScrollTabVisible(i)) + { + highlight = true; + break; + } + } + } + else + { + int leadingTabIndex = + getClosestTab(viewRect.x + viewRect.y, viewRect.y); + + for(int i = leadingTabIndex; i < tabPane.getTabCount(); i++) + { + if(highlightedTabs.contains(i) + && !isScrollTabVisible(i)) + { + highlight = true; + break; + } + } + } + + if(highlight) + { + Image img = DesktopUtilActivator.getImage( + direction == WEST ? + "service.gui.icons.TAB_UNREAD_BACKWARD_ICON" + : "service.gui.icons.TAB_UNREAD_FORWARD_ICON"); + + int wi = img.getWidth(null); + + g.drawImage(img, + (w - wi)/2, + (h - size) / 2 - 2/* 2 borders 1px width*/, + null); + } + } + + if(!highlight) + paintTriangle(g, (w - size) / 2, (h - size) / 2, + size, direction, isEnabled); // Reset the Graphics back to it's original settings if (isPressed) { g.translate(-1, -1); } g.setColor(origColor); - } + } + /** + * Checks whether the tabIndex is visible in the scrollable + * tabs list. + * + * @param tabIndex the tab index to check. + * @return whether tabIndex is visible in the list of scrollable + * tabs. + */ + private boolean isScrollTabVisible(int tabIndex) + { + Rectangle tabRect = rects[tabIndex]; + Rectangle viewRect = tabScroller.viewport.getViewRect(); + if ((tabRect.x + tabRect.width - BUTTONSIZE < viewRect.x) + || (tabRect.x + BUTTONSIZE > viewRect.x + viewRect.width)) + { + return false; + } + else + { + return true; + } } @Override diff --git a/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java b/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java index 8afc0ec11..bbe944904 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java @@ -863,7 +863,7 @@ public int getOverTabIndex() * Returns the index of the tab closest to the passed in location, note that * the returned tab may not contain the location x,y. */ - private int getClosestTab(int x, int y) + protected int getClosestTab(int x, int y) { int min = 0; int tabCount = Math.min(rects.length, tabPane.getTabCount()); @@ -1358,7 +1358,7 @@ protected void calculateTabRects(int tabPlacement, int tabCount) } } - private class ScrollableTabSupport implements ChangeListener + protected class ScrollableTabSupport implements ChangeListener { public ScrollableTabViewport viewport; @@ -1471,7 +1471,7 @@ public String toString() } - private static class ScrollableTabViewport + protected static class ScrollableTabViewport extends JViewport implements UIResource {