Simon Hausmann
b857eb4671
Add an accepted signal to TextInput and LineEdit
2020-09-21 13:18:53 +02:00
Simon Hausmann
34eae40814
Allow moving the text cursor to the end of the input
2020-09-21 13:15:53 +02:00
Simon Hausmann
083cdd6653
Added a crude backspace and delete handler in TextInput
2020-09-18 18:18:44 +02:00
Simon Hausmann
ade78875ea
Fix TextInput::move_cursor to respect character boundaries
2020-09-18 18:13:31 +02:00
Simon Hausmann
0d751e6627
Render a text cursor for TextInput items
...
It doesn't look quite perfect yet, but it's a start.
2020-09-18 17:58:14 +02:00
Simon Hausmann
d819541ea3
Fix build
2020-09-18 16:41:37 +02:00
Simon Hausmann
2da84fee46
Add a boilerplate TextInput item
2020-09-18 16:34:24 +02:00
Simon Hausmann
39fabdee9e
Pass a window reference to Item::key_event
...
Similar to the input_event.
2020-09-18 16:22:00 +02:00
Simon Hausmann
7053aee0c8
Pass the ComponentWindow to ItemVTable::input_event
2020-09-18 16:18:48 +02:00
Simon Hausmann
ad77896312
Change the way Text's default color is implemented
...
Instead of via an item constructor, implement support for default
bindings in the compiler.
2020-09-16 13:41:18 +02:00
Simon Hausmann
1d6af1da09
Prospective CI build fix
...
Try to ensure that the C functions in items.rs are included in the binary.
2020-09-16 08:38:30 +02:00
Simon Hausmann
625cb6c6b8
Add a constructor to Text and let the color default to black
...
We really shouldn't require specifying a color for every Text {} element just in order
to see *some* text.
For Rectangle OTOH transparent is a good default (and thus for Color), hence
this change just to Text.
Right now the constructor bit is also a bit repetitive, this could
perhaps be folded into BuiltinItem to generate the ffi, default impl and
forward to an init function if it exists.
2020-09-16 08:20:13 +02:00
Simon Hausmann
dd8e487acc
Fix discrepancy between Text layout info and rendering
...
The layout_info() would calculate the text metrics based on a different effective pixel
size compared to the rendering.
2020-09-15 16:15:26 +02:00
Simon Hausmann
79ba5d9de8
Provide a window reference in various ItemVTable functions
...
Access to the window, in particular the scale factor, will be needed in a few places.
2020-09-15 15:55:47 +02:00
Simon Hausmann
37e550e540
Fix inconsistency in Font API
...
Have just one height() function in the fontkit and canvas version.
2020-09-15 12:28:30 +02:00
Simon Hausmann
546818ee55
Add key event data structures and event function boiler plate
2020-09-15 11:16:55 +02:00
Olivier Goffart
8761ca80a3
Add SharedArray::push and adjust a bit the API
2020-09-09 18:47:15 +02:00
Olivier Goffart
e997dff094
Use a reference as a signal argument.
...
It will be easier to make that work with C++
2020-09-08 12:12:01 +02:00
Simon Hausmann
570e51eaa9
Improve API of color handling of text
...
Make the text color a rendering variable, so that it can be passed
through as uniform to the glyph shader and applied to the gray
map of the glyphs. This avoids re-creating the glyph runs when
merely the color changes.
This already "worked" for the glyph cache based text rendering,
but it wasn't used because of the wasm canvas code path. This
patch changes that to render the text into a text using simply black
and then render that texture using our existing glyph shader,
which merely uses the alpha channel anyway.
This reduces also #cfg's.
2020-09-02 11:48:41 +02:00
Olivier Goffart
58cdaeb8dd
Update license header to mention that commertial option are available
2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692
Apply license headers to all non-binary/non-json sources
2020-08-17 17:55:20 +02:00
Simon Hausmann
62a8b15f09
Move ItemVTable and frieds to corelib::items
...
To avoid ambiguities regarding the use of FieldOffset, the BuiltinItem
proc-macro uses fully-qualified type names now.
2020-08-12 10:10:51 +02:00
Simon Hausmann
aafb96cb93
Get rid of abi::datastructures::WindowProperties
...
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Olivier Goffart
b5c9bf5d10
Settings page for the printer demo
...
Fix the text maximum size so it can be put in a layout
2020-08-11 12:08:44 +02:00
Olivier Goffart
35cb14b2e6
Slider
2020-08-10 14:58:13 +02:00
Olivier Goffart
0a56912d0f
Mouse grab in rust
2020-08-07 16:06:49 +02:00
Olivier Goffart
55ec533c40
WIP input events
...
Compile and passes tests. But the mouse event are currently not working
2020-08-07 16:06:49 +02:00
Simon Hausmann
fcc819e395
Add support for enums to the compiler
...
This replaces the duplicated text alignment enums
2020-08-07 13:15:43 +02:00
Simon Hausmann
aecf6a8878
Center text in buttons in the demo and gallery
...
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.
This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
2020-08-07 10:02:52 +02:00
Olivier Goffart
9bb6a1f2a1
Remove useless debug output
2020-08-05 10:54:59 +02:00
Simon Hausmann
d3c596669c
Add larger icons to the printer demo
...
The icons on the main screen are now nicely large and they scale down on
activation.
2020-08-05 10:04:11 +02:00
Simon Hausmann
48df8d0911
Rework the API between the items and the renderer
...
Move fields out of the HighLevelRenderingPrimitive that are suitable to
represent as uniform variables. That reduces fields like Image or
Rectangle to their image or dimension, and only if *they* change, then
we re-do the work of building geometry and uploading it to the GPU.
Instead, the typically animated properties such as the position or the
color are passed separately with each draw call. This avoids re-decoding
PNG files and uploading them again when moving an image element around
on the screen.
2020-08-05 09:44:12 +02:00
Simon Hausmann
685a3fb8ab
Rename Text::font_pixel_size to just font_size
...
Since length are resolution independent, it doesn't make sense anymore
to have the pixel infix.
2020-08-04 16:56:42 +02:00
Olivier Goffart
1bfd708784
Change the field_offsets() function to a FIELD_OFFSETS associated const
2020-08-03 16:04:55 +02:00
Simon Hausmann
8338bd4360
Move CachedRenderingData from datastructures into item_rendering
2020-08-03 14:17:38 +02:00
Simon Hausmann
37fa04098f
Move MouseEvent and MouseEventType from datastructures into input
2020-08-03 13:55:33 +02:00
Simon Hausmann
97a2fb2c7b
Move datastructures::EasingCurve into animations
2020-08-03 13:49:20 +02:00
Simon Hausmann
30d7a0b36d
Move PathData and friends from datastructure to
...
graphics
2020-08-03 13:43:44 +02:00
Simon Hausmann
b05a11945e
Move datastructures::LayoutInfo into layout
2020-08-03 13:31:43 +02:00
Simon Hausmann
1b270f42d0
Move datastructures::Color into graphics
2020-08-03 13:27:35 +02:00
Simon Hausmann
fa87363dc5
Move Point, Rect and Size into graphics
...
And move the expanded structures for cbindgen into an ffi sub-module.
2020-08-03 13:24:39 +02:00
Simon Hausmann
ce7f66320b
Move datastructures::Resource into graphics
...
It's only used for graphics at the moment and used
for image resources.
2020-08-03 12:47:05 +02:00
Simon Hausmann
05f3ff10a6
Rename graphics::RenderingPrimitive to HighLevelRenderingPrimitive
...
That plays better with the existing LowlLevelRenderingPrimitive.
2020-08-03 12:39:57 +02:00
Simon Hausmann
550d0122a5
Move datastructures::RenderingPrimitive to graphics
2020-08-03 12:39:52 +02:00
Simon Hausmann
69beab5957
Rename corelib::abi::primitives to corelib::items
2020-08-03 10:32:03 +02:00