56 lines
1.7 KiB
Ziran
56 lines
1.7 KiB
Ziran
#import "session"
|
|
test_session: Session;
|
|
TestSession :: () -> Session {
|
|
if !SessionValid(test_session) { test_session = SessionOpen() }
|
|
return test_session
|
|
}
|
|
|
|
#import "control_props"
|
|
#import "fieldset_props"
|
|
#import "fieldset_widget"
|
|
#import "geometry"
|
|
#import "style"
|
|
#import "style_sheet"
|
|
#import "tree"
|
|
#import "tree_draw"
|
|
#import "widget_kind"
|
|
|
|
using WidgetKind;
|
|
using StyleField;
|
|
using FrameStatus;
|
|
|
|
#program_export
|
|
Frame :: () -> s32 {
|
|
rules: StyleRules
|
|
rules.count = 1
|
|
rule: StyleRule
|
|
rule.selector = StyleDefaultSelector()
|
|
rule.selector.kind = StyleKindFieldset()
|
|
rule.selector.class_name = 9
|
|
rule.style.fields = cast(u32)StyleBackground | cast(u32)StyleForeground |
|
|
cast(u32)StyleOpacity
|
|
rule.style.background = cast(u32)0x123456ff
|
|
rule.style.foreground = cast(u32)0xaabbccff
|
|
rule.style.opacity = 0.5
|
|
rules.items[0] = rule
|
|
InstallStyleRules(rules)
|
|
first: FieldsetProps
|
|
first.key = cast(u64)7
|
|
first.id = 7
|
|
first.class_name = 9
|
|
first.bounds = Rectangle.{10.0, 30.0, 100.0, 50.0}
|
|
first.title = "Group"
|
|
second: FieldsetProps
|
|
second.key = cast(u64)8
|
|
second.bounds = Rectangle.{120.0, 30.0, 80.0, 50.0}
|
|
BeginFrame(TestSession(), cast(u64)1, Rectangle.{0.0, 0.0, 220.0, 100.0})
|
|
Fieldset(TestSession(), first)
|
|
Fieldset(TestSession(), second)
|
|
if EndFrame(TestSession()) != cast(FrameStatus)FrameOk || TreeCount(TestSession()) != 3 ||
|
|
TreeNodeAt(TestSession(), 1).kind != WidgetKindFieldset ||
|
|
TreeNodeAt(TestSession(), 2).kind != WidgetKindFieldset ||
|
|
TreeNodeAt(TestSession(), 1).semantic_label != "Group" ||
|
|
TreeNodeAt(TestSession(), 2).semantic_label != "" { return -1 }
|
|
return 7
|
|
}
|