1 package com.tapina.robe.swi.wimp; 2 3 import com.tapina.robe.swi.os.SpriteArea; 4 5 import java.awt.*; 6 import java.util.ArrayList; 7 import java.util.Iterator; 8 9 /*** 10 * This class holds a RISC OS Wimp window block. A window block is the definition of a window, either created or not. 11 */ 12 public class WindowBlock { 13 /*** Special constant for handleOfWindowAbove */ 14 public static final int TOP = -1, BOTTOM = -2, ICONISED = -3; 15 /*** Window flags constant */ 16 public static final int OLD_TITLE_BAR = 1, MOVEABLE = 2, OLD_VERTICAL_SCROLL_BAR = 4, OLD_HORIZONTAL_SCROLL_BAR = 8, 17 NO_USER_REDRAW = 16, PANE = 32, UNBOUNDED_MOVE = 64, OLD_NO_CLOSE = 128, SCROLL_REQUEST_AUTO = 256, 18 SCROLL_REQUEST_NON_AUTO = 512, GCOL_COLOURS = 1024, BACKGROUND_WINDOW = 2048, TRAP_KEYPRESSES = 4096, 19 KEEP_ON_SCREEN = 8192, NO_RESIZE_RIGHT = 1<<14, NO_RESIZE_DOWN = 1<<15, OPEN = 1<<16, FULLY_VISIBLE = 1<<17, 20 FULL_SIZE = 1<<18, OPEN_WINDOW_REQUEST = 1<<19, HAS_INPUT_FOCUS = 1<<20, FORCE_TO_SCREEN = 1<<21, TOGGLE_METHOD = 1<<22, 21 FURNITURE_WINDOW = 1<<23, FOREGROUND_WINDOW = 1<<23, BACK_ICON = 1<<24, CLOSE_ICON = 1<<25, TITLE_BAR = 1<<26, 22 TOGGLE_SIZE = 1<<27, VERTICAL_SCROLL_BAR = 1<<28, ADJUST_SIZE = 1<<29, HORIZONTAL_SCROLL_BAR = 1<<30, NEW_FORMAT = 1<<31; 23 /*** Special constant for titleForegroundColour */ 24 public static final int NO_FRAME = 0xff; 25 /*** Special constant for workAreaBackgroundColour */ 26 public static final int NO_WIMP_CLEAR = 0xff; 27 /*** Window extra flags constant */ 28 public static final int USE_24_BIT_COLOUR = 1, NO_3D_BORDER = 4, FORCE_3D_BORDER = 8; 29 30 private Rectangle visibleArea; 31 private Rectangle workArea; 32 private Point scrollOffset; 33 private int handleOfWindowAbove; 34 private int windowFlags; 35 private int windowExtraFlags; 36 private int titleForegroundColour; 37 private int titleBackgroundColour; 38 private int workAreaForegroundColour; 39 private int workAreaBackgroundColour; 40 private int scrollBarOuterColour; 41 private int scrollBarInnerColour; 42 private int activeTitleBackgroundColour; 43 private int titleBarIconFlags; 44 private int workAreaButtonFlags; 45 private SpriteArea spriteArea; 46 private Dimension minimumSize; 47 private String titleText; 48 private int titleIndirectAddress; 49 private java.util.List icons = new ArrayList(); 50 51 public String getTitleText() { 52 return titleText; 53 } 54 55 public void setTitleText(String titleText) { 56 this.titleText = titleText; 57 } 58 59 public int getTitleIndirectAddress() { 60 return titleIndirectAddress; 61 } 62 63 public void setTitleIndirectAddress(int titleIndirectAddress) { 64 this.titleIndirectAddress = titleIndirectAddress; 65 } 66 67 public Rectangle getVisibleArea() { 68 return visibleArea; 69 } 70 71 public void setVisibleArea(Rectangle visibleArea) { 72 this.visibleArea = visibleArea; 73 } 74 75 public Rectangle getWorkArea() { 76 return workArea; 77 } 78 79 public void setWorkArea(Rectangle workArea) { 80 this.workArea = workArea; 81 } 82 83 public Point getScrollOffset() { 84 return scrollOffset; 85 } 86 87 public void setScrollOffset(Point scrollOffset) { 88 this.scrollOffset = scrollOffset; 89 } 90 91 public int getHandleOfWindowAbove() { 92 return handleOfWindowAbove; 93 } 94 95 public void setHandleOfWindowAbove(int handleOfWindowAbove) { 96 this.handleOfWindowAbove = handleOfWindowAbove; 97 } 98 99 public int getWindowFlags() { 100 return windowFlags; 101 } 102 103 public void setWindowFlags(int windowFlags) { 104 this.windowFlags = windowFlags; 105 } 106 107 public int getWindowExtraFlags() { 108 return windowExtraFlags; 109 } 110 111 public void setWindowExtraFlags(int windowExtraFlags) { 112 this.windowExtraFlags = windowExtraFlags; 113 } 114 115 public int getTitleForegroundColour() { 116 return titleForegroundColour; 117 } 118 119 public void setTitleForegroundColour(int titleForegroundColour) { 120 this.titleForegroundColour = titleForegroundColour; 121 } 122 123 public int getTitleBackgroundColour() { 124 return titleBackgroundColour; 125 } 126 127 public void setTitleBackgroundColour(int titleBackgroundColour) { 128 this.titleBackgroundColour = titleBackgroundColour; 129 } 130 131 public int getWorkAreaForegroundColour() { 132 return workAreaForegroundColour; 133 } 134 135 public void setWorkAreaForegroundColour(int workAreaForegroundColour) { 136 this.workAreaForegroundColour = workAreaForegroundColour; 137 } 138 139 public int getWorkAreaBackgroundColour() { 140 return workAreaBackgroundColour; 141 } 142 143 public void setWorkAreaBackgroundColour(int workAreaBackgroundColour) { 144 this.workAreaBackgroundColour = workAreaBackgroundColour; 145 } 146 147 public int getScrollBarOuterColour() { 148 return scrollBarOuterColour; 149 } 150 151 public void setScrollBarOuterColour(int scrollBarOuterColour) { 152 this.scrollBarOuterColour = scrollBarOuterColour; 153 } 154 155 public int getScrollBarInnerColour() { 156 return scrollBarInnerColour; 157 } 158 159 public void setScrollBarInnerColour(int scrollBarInnerColour) { 160 this.scrollBarInnerColour = scrollBarInnerColour; 161 } 162 163 public int getActiveTitleBackgroundColour() { 164 return activeTitleBackgroundColour; 165 } 166 167 public void setActiveTitleBackgroundColour(int activeTitleBackgroundColour) { 168 this.activeTitleBackgroundColour = activeTitleBackgroundColour; 169 } 170 171 public int getTitleBarIconFlags() { 172 return titleBarIconFlags; 173 } 174 175 public void setTitleBarIconFlags(int titleBarIconFlags) { 176 this.titleBarIconFlags = titleBarIconFlags; 177 } 178 179 public int getWorkAreaButtonFlags() { 180 return workAreaButtonFlags; 181 } 182 183 public void setWorkAreaButtonFlags(int workAreaButtonFlags) { 184 this.workAreaButtonFlags = workAreaButtonFlags; 185 } 186 187 public SpriteArea getSpriteArea() { 188 return spriteArea; 189 } 190 191 public void setSpriteArea(SpriteArea spriteArea) { 192 this.spriteArea = spriteArea; 193 } 194 195 public Dimension getMinimumSize() { 196 return minimumSize; 197 } 198 199 public void setMinimumSize(Dimension minimumSize) { 200 this.minimumSize = minimumSize; 201 } 202 203 public void addIcon(Icon icon) { 204 this.icons.add(icon); 205 } 206 207 public void removeIcon(int index) { 208 icons.remove(index); 209 } 210 211 public Icon getIcon(int index) { 212 return (Icon) icons.get(index); 213 } 214 215 public int getNumberOfIcons() { 216 return icons.size(); 217 } 218 219 public Iterator icons() { 220 return icons.iterator(); 221 } 222 }