Documentation
¶
Overview ¶
Package window implements the framed Window view that hosts content on the desktop. v0.2 phase 1 delivers the minimum: a Frame border (title, optional close and zoom glyphs) and a Window that owns the frame plus a client rectangle. Drag, resize, zoom, modal dispatch, and the close button arrive in phase 2.
Index ¶
- Constants
- type Flags
- type Frame
- type Window
- func (w *Window) ChangeBounds(r vio.Rect)
- func (w *Window) ClientRect() vio.Rect
- func (w *Window) Close()
- func (w *Window) Draw(s *vio.Surface)
- func (w *Window) Flags() Flags
- func (w *Window) Frame() *Frame
- func (w *Window) HandleEvent(e *event.Event)
- func (w *Window) SetState(bits view.State, on bool)
- func (w *Window) SetTitle(title string)
- func (w *Window) Zoom()
- func (w *Window) Zoomed() bool
Constants ¶
const FlagsAll = FlagMove | FlagGrow | FlagClose | FlagZoom
FlagsAll enables every decoration. Stock IDE windows use this set.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flags ¶
type Flags uint8
Flags controls which decorations the frame draws and which actions a Window will accept once phase 2 lands. Mirrors the flags Turbo Vision passes to Window.Init: wfMove, wfGrow, wfClose, wfZoom.
type Frame ¶
type Frame struct {
*view.View
Title string
PassiveSlot byte
ActiveSlot byte
// contains filtered or unexported fields
}
Frame is the boxed border drawn around a Window. The frame paints a title centered along the top edge, plus optional close and zoom glyphs at the corners. Active windows use a different palette slot for the line glyphs so the focused window stands out.
A Frame's bounds are the same rectangle as its owning Window; the frame paints only the perimeter and leaves the interior untouched for the window's content children.
PassiveSlot and ActiveSlot let a Dialog point the frame at a different palette pair (e.g. 15/16 for the gray-on-gray dialog frame) without touching the regular window theme.
func NewFrame ¶
NewFrame returns a frame sized to bounds, with the given decoration flags. Frames are not selectable on their own; the parent Window owns focus.
func (*Frame) HandleEvent ¶
HandleEvent ignores everything; frames are decoration only in v0.2.1.
type Window ¶
type Window struct {
*view.Group
Title string
Number int
// contains filtered or unexported fields
}
Window is a framed Group hosted on the desktop. It owns a Frame child that paints the border and title; the rest of the children are content views laid out inside the client rectangle. v0.2 adds drag, resize, F5 zoom, Ctrl-F4 close, and a drop shadow.
func New ¶
New returns a Window with the supplied bounds, title, and flags. The frame matches the bounds; the client rectangle is the bounds inset by 1 cell on every side. Insert the returned window into a Desktop (or any Group) to make it visible.
func (*Window) ChangeBounds ¶
ChangeBounds resizes the window and keeps the frame aligned with the outer rectangle.
func (*Window) ClientRect ¶
ClientRect returns the rectangle inside the frame that content views should occupy. It is the window bounds inset by 1 cell on each side.
func (*Window) Close ¶
func (w *Window) Close()
Close removes the window from its owning group. Phase 3 will route this through a CmdClose command so dialogs can intercept (for example to prompt about unsaved changes); for v0.2 we close directly.
func (*Window) Draw ¶
Draw paints the drop shadow (when StateShadow is set), fills the client rectangle with the body color, and composes the frame and any content children on top. It also re-syncs the frame's active state from the window's focus, since Group.SetCurrent updates focus through the embedded *View and bypasses Window.SetState.
func (*Window) HandleEvent ¶
HandleEvent runs window-level shortcuts (F5 zoom, Ctrl-F4 close) and mouse drag/resize before delegating to the embedded Group dispatch.
func (*Window) SetState ¶
SetState propagates focus state into the frame so it switches between active and inactive palette slots.