gtk4-rs
gtk4-rs copied to clipboard
book: Add chapter about subclassing GtkWidget and drawing
- How to use measure(), and how it will get called twice. It wasn't initially apparent that you weren't supposed to give the size of both axis at once, and instead were only supposed to give one based on the orientation argument. Also that you can pass -1 for things like baseline measurements.
- Using measue() vs css properties like max-width
- In general, provide some quick guidelines on how to use measure/vexpand/hexpand for common usecases like: fixed width and height, variable width with a minimum and fixed height, fully fluid and adapting to the widget size, height-for-width, etc.
- Layout managers and when to use them - for instance, you can use BoxLayout instead of having a child box
- Some basic snapshot() examples showing rectangles, text, gradients, etc.
- Go over the coordinate system, and how there's nothing preventing you from drawing further than the widget's bounds - you should get the widget's size, and not draw past that. You can also set overflow to hidden.
- Setting a css name for the widget, and using that for things like borders or padding