Skip to content

Some ideas for GUI development #73

@TheSimpleZ

Description

@TheSimpleZ

Here are a few things that would be amazing to have for GUI development:

Support for newlines inside genpage_add() and genpage_change():
I would like to be able to format the text I feed to this function using newlines. Currently, it breaks things.
Doing something like this:

int line = genpage_add("");
genpage_change("Hello\nWorld", line);
genpage_change("foo", line);

should result in "foo" being displayed, but right now it displays "foo\nWorld".

Add support for formatting the layout of a page:
For example, I'd like to be able to add padding/margins to text to control it's horizontal/vertical position.
Would be amazing if I could define a page to be vertically centered. It's useful for single page apps that shows a small piece of text.

Support removing lines:
A function similar to genpage_change, let's call it genpage_delete, which takes a line number as single argument.
Would be super useful for showing a temporary piece of text based on some condition.

Add support for showing images using general_page:
Why?! Because syntax is much nicer than the adafruit stuff.


One suggestion is to make the UI based on some primitives such as text boxes, image boxes, etc. That way, I can do something like:

auto tb = genpage_textbox("Some text \n with line breaks"); // Auto because i haven't thought of what dataype to use 
genpage_add(tb);
textbox_set(tb, "Some other piece of text");
set_padding(tb, 10, 10, 10, 10); // add 10 px padding on all sides
genpage_delete(tb);

These are just some unstructured thoughts that popped up while developing the gadgetbridge stuff. Let me know if you'd like me to elaborate something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions