View File Preprocessor¶
Documentation for preprocessor directives in Movian view files.
Overview¶
The view file preprocessor provides:
- File inclusion (#import)
- Macro definitions (#define)
- Conditional compilation
- Text substitution
Import Directive¶
Basic Import¶
Import Paths¶
skin://- Skin-relative path- Relative paths - Relative to current file
- Absolute paths - From skin root
Macro Definitions¶
Simple Macros¶
#define MY_COLOR "#4192ff"
#define SPACING 0.5em
widget(quad, {
color: MY_COLOR;
padding: [SPACING, SPACING];
});
Parameterized Macros¶
#define ListItemHighlight() { \
alpha: 0.1 * isHovered() + 0.2 * isNavFocused(); \
}
#define PageHeader(TITLE) { \
widget(label, { \
caption: TITLE; \
size: 2em; \
}); \
}
#define BackButton(ENABLED=true, EVENT=event("back")) { \
widget(container_x, { \
focusable: ENABLED; \
onEvent(activate, EVENT); \
}); \
}
Macro Usage¶
widget(container_z, {
ListItemHighlight();
});
PageHeader("My Page");
BackButton(true, navOpen("home:"));