| 1 package org.lobobrowser.html.renderer; 2 3 import java.awt.Color ; 4 import java.awt.Component ; 5 import java.awt.Dimension ; 6 import java.awt.Graphics ; 7 import org.lobobrowser.html.*; 8 import org.lobobrowser.html.style.HtmlValues; 9 import org.w3c.dom.html2.*; 10 11 class BrowserFrameUIControl implements UIControl { 12 private final Component component; 14 private final HTMLElement element; 15 16 public BrowserFrameUIControl(HTMLElement element, BrowserFrame browserFrame) { 17 this.component = browserFrame.getComponent(); 18 this.element = element; 19 } 20 21 public int getVAlign() { 22 return RElement.VALIGN_BASELINE; 23 } 24 25 public float getAlignmentY() { 26 return 0; 27 } 28 29 public Color getBackgroundColor() { 30 return this.component.getBackground(); 31 } 32 33 public Component getComponent() { 34 return this.component; 35 } 36 37 private int availWidth; 38 private int availHeight; 39 40 public void reset(int availWidth, int availHeight) { 41 this.availWidth = availWidth; 42 this.availHeight = availHeight; 43 } 44 45 public Dimension getPreferredSize() { 46 int width = HtmlValues.getOldSyntaxPixelSize(element.getAttribute("width"), this.availWidth, 100); 47 int height = HtmlValues.getOldSyntaxPixelSize(element.getAttribute("height"), this.availHeight, 100); 48 return new Dimension (width, height); 49 } 50 51 public void invalidate() { 52 this.component.invalidate(); 53 } 54 55 public void paint(Graphics g) { 56 this.component.paint(g); 58 } 59 60 public boolean paintSelection(Graphics g, boolean inSelection, 61 RenderableSpot startPoint, RenderableSpot endPoint) { 62 return false; 64 } 65 66 public void setBounds(int x, int y, int width, int height) { 67 this.component.setBounds(x, y, width, height); 68 } 69 70 public void setRUIControl(RUIControl ruicontrol) { 71 } 73 } 74 | Popular Tags |