Media Queries in H-SMILE core.
Implementation of Media Queries resembles CSS3 Media Queries but uses CSSS! expression syntax.
Therefore this CSS3 MQ
@media handheld and (min-width: 20em),
screen and (min-width: 20em) { ... }
in H-SMILE core will look like as:
@media handheld && (min-width >= 20em),
screen && (min-width >= 20em) { ... }
Media queries get executed in runtime when engine receives from the OS notification about environment changes. So if for example orientation of the device changes you can adjust some styles like:
@media handheld && orientation-portrait
{
body { flow:vertical; }
}
@media handheld && orientation-landscape
{
body { flow:horizontal; }
}
By default H-SMILE core sets following variables. These variables can be reset by application for the whole view or particular <frame>
.
- "width", "height" - pixels, width and height of the view;
- "min-width", "min-height" - pixels, minimal width and height of the view;
- "max-width", "max-height" - pixels, maximum width and height of the view if its window is opened in full screen;
- "aspect-ratio" - float, width/height ratio of the view;
- "monitors" - integer, number of monitors in the system;
- "device-width", "device-height" - pixels, width and height of primary monitor;
- "device-aspect-ratio" - float, width/height ratio of primary monitor;
- "orientation-portrait" - bool, true if width is smaller than height;
- "orientation-landscape" - bool, true if width is larger than height;
- "color" - integer, bits per pixel of the display;
- "color-index" - integer, total number of colors supported;
- "resolution" - integer, DPI, number of dots per inch;
- "min-resolution" - integer, DPI, number of dots per inch;
- "max-resolution" - integer, DPI, number of dots per inch;
- "resolution-dpcm" - integer, DPCM, number of dots per centimeter;
- "min-resolution-dpcm" - integer, DPCM, number of dots per centimeter;
- "max-resolution-dpcm" - integer, DPCM, number of dots per centimeter;
- "high-contrast" - bool, is true when system is using high-contrast accessibility modes;
- "has-pen" - bool, is on if system is pen based;
- "has-mouse" - bool, is on if system has mouse;
- "has-mouse-wheel" - bool, is on if mouse has wheel;
- "screen-reader" - bool, accessibility, is on if screen reader is in effect;
- "slow-machine" - bool, is true if OS detects low end processor;
- "engine" - string, name of the engine, "sciter" or "htmlayout" at the moment. Use this MQ variable if you have the same markup/styles targeted to e.g. Sciter and conventional browsers;
- "engine-version-minor" - int, minor version number;
- "engine-version-major" - int, major version number, E.g. for the Sicter it will be 1 and minor number will be 0.
Media Queries also supported by <style media="">, <link media=""> elements and @import statements.