Ignore:
Timestamp:
01/08/14 10:37:24 (10 years ago)
Author:
jts21
Message:

Add tooltip template to settings, and make _tooltipItem a static variable of the Item class which is set to whichever tooltip needs to be displayed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Item.java

    r656 r664  
    159159       
    160160        private String _tooltip = null;
    161         private Text _tooltipItem = null;
     161        private static Text _tooltipItem = null;
     162        private static Item _tooltipOwner = null;
    162163
    163164        public static void DuplicateItem(Item source, Item dest) {
     
    11291130        public void setTooltip(String tooltip) {
    11301131                _tooltip = tooltip;
    1131                 _tooltipItem = null;
    11321132        }
    11331133       
     
    11361136        }
    11371137       
     1138        public static void clearTooltipOwner() {
     1139                _tooltipOwner = null;
     1140        }
     1141       
    11381142        public void paintTooltip(Graphics2D g) {
    1139                 // don't try to show an empty tooltip
     1143                if(_tooltipOwner != this) {
     1144                        _tooltipItem = null;
     1145                        _tooltipOwner = this;
     1146                }
     1147                // generate tooltip item
    11401148                if(_tooltipItem == null) {
    11411149                        if(_tooltip != null && _tooltip.trim().length() != 0) {
    1142                                 _tooltipItem = (Text) getParentOrCurrentFrame().getStatsTextItem(_tooltip);
     1150                                _tooltipItem = (Text) getParentOrCurrentFrame().getTooltipTextItem(_tooltip);
    11431151                                _tooltipItem.setWidth(300);
    11441152                        } else {
Note: See TracChangeset for help on using the changeset viewer.