classDiagram
class View {
+Frame: Rectangle
+Margin: Adornment - outermost
+Border: Adornment - border lines and Title
+Padding: Adornment - innermost - Scrollbars
+Viewport: Rectangle describing portal into ContentArea
+ContentArea: Rectangle with Location always 0,0
+GetContentSize(): Size
+SetContentSize(Size)
}
class Adornment {
+Thickness: Thickness
}
class Thickness {
+Top: int
+Right: int
+Bottom: int
+Left: int
}
class Rectangle {
+Location: Point
+Size: Size
}
View --> Adornment : has
Adornment --> Thickness : has
View --> Rectangle : has
note for View "Frame defines location and size relative to SuperView"
note for Adornment "Separates Frame from Viewport"
note for Rectangle "Defines location and size"
The diagram above shows the structure of a View's composition:
Each layer is defined by a Thickness that specifies the width of each side (top, right, bottom, left). The Content Area is shown as a separate container that the Viewport "looks into" - this illustrates how scrolling works. In this example, the Viewport is positioned at (5,5) relative to the Content Area, showing how scrolling works.