Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktoxin #1

Open
viluon opened this issue Aug 28, 2016 · 0 comments
Open

Desktoxin #1

viluon opened this issue Aug 28, 2016 · 0 comments

Comments

@viluon
Copy link
Owner

viluon commented Aug 28, 2016

Desktoxin is a markup/style sheet language for Desktox GUI layouts.

Syntax

-- Lua-like comments

-- Desktoxins can be injected into each other 
inject "orange_button.dtxin"

-- Styles are essentially style sheet classes
style blueish {
  background_colour = light_blue;
}

-- 'for' says what is the basis of this style, i.e. what element
-- you actually get from the constructor
style blue_button for button {
  background_colour = blue;
  foreground_colour = white;
}

-- Anything that isn't a style is a part of the document itself

-- Names are used for reference in Lua code
blue_button "button1" {
  x = 5;
  y = 4;
  width = 12%;
  height = 3;
  text = "Foo";
}

-- blueish did not specify the parent element, therefore
-- it has to be used explicitly
button blueish "button2" {
  x = 0;
  y = 0;
  width = 1;
  height = 1;
}

list_view "my_list" {
  x = 50%;
  y = 0;
  width = 50%;
  height = 100%;
  -- Arrays are defined in [square brackets]
  children = [
    -- Any number of styles can be applied to
    -- an element. They will be used in the
    -- order they are listed in, the next one
    -- always overriding the previous one.
    -- Values that do not cause a clash
    -- will be kept
    blue_button blueish "button3" {
      x = 0;
      y = 0;
      width = 100%;
      height = 3;
    };
  ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant