Module: reefvision.widgets.settingschrome
Source: ./reefvision/widgets/settingschrome.reef
Overview
reefvision.widgets.settingschrome — Apply/Cancel row + confirm-discard
Pure helpers (not a View) for settings-style dialogs/windows. Project Settings and other app settings screens share ApplyCancelBar geometry, SettingsDirty tracking, and confirm-discard wired to existing MessageBox Yes/No (do not rebuild Yes/No chrome).
On Cancel/close with dirty:
ans = app.message_box(discard_title(), discard_text(), discard_kind())
if may_close(true, ans): close else: stay
When clean, may_close(false, _) is true without prompting.
Objects
ApplyCancelBar
Fields:
| Name | Type |
|---|---|
content |
cell.Rect |
btn_w |
int |
gap |
int |
pad_x |
int |
pad_y |
int |
gap_above |
int |
proc init(content: cell.Rect, btn_w: int, gap: int, pad_x: int, pad_y: int, gap_above: int)
exclusive proc set_content(content: cell.Rect)
exclusive proc set_btn_w(w: int)
exclusive proc set_gap(gap: int)
exclusive proc set_pad(pad_x: int, pad_y: int)
exclusive proc set_gap_above(g: int)
exclusive fn inner_x(): int
exclusive fn inner_y(): int
exclusive fn inner_w(): int
exclusive fn inner_h(): int
exclusive fn button_h(): int
exclusive fn chrome_h(): int
exclusive fn button_y(): int
exclusive fn cancel_rect(): cell.Rect
Right-aligned Cancel button.
exclusive fn apply_rect(): cell.Rect
Apply immediately left of Cancel (gap between).
exclusive fn form_rect(): cell.Rect
Content above the button strip — pass to FormGrid.
SettingsDirty
Fields:
| Name | Type |
|---|---|
dirty |
bool |
proc init()
exclusive proc mark()
exclusive proc clear()
exclusive fn is_dirty(): bool
Functions
fn apply_cancel_bar(content: cell.Rect): ApplyCancelBar
Defaults: btn_w=10, gap=1, pad=0, gap_above=1.
fn apply_cancel_bar_full(content: cell.Rect, btn_w: int, gap: int, pad_x: int, pad_y: int, gap_above: int): ApplyCancelBar
fn settings_dirty(): SettingsDirty
fn discard_title(): string
fn discard_text(): string
fn discard_kind(): MessageBoxKind
Yes/No — reuse MessageBox; no new modal stack.
fn discard_accepted(cmd: int): bool
True when cmd is CMD_YES.
fn may_close(dirty: bool, message_box_cmd: int): bool
Clean → true; dirty → discard_accepted(cmd).
Generated by reefc doc