]> git.tdb.fi Git - libs/gltk.git/log
libs/gltk.git
7 months agoRework how widget ownership works in Container master
Mikko Rasa [Tue, 22 Aug 2023 20:07:49 +0000 (23:07 +0300)]
Rework how widget ownership works in Container

The class now supports both owned and non-owned children.  Owned children
are passed in as unique_ptr or can be created by the container with the
add_new() function template.  This is likely to introduce memory leaks in
existing code.

7 months agoAdd an example of dialogs in the widget demo program
Mikko Rasa [Mon, 21 Aug 2023 14:35:13 +0000 (17:35 +0300)]
Add an example of dialogs in the widget demo program

7 months agoRefactor Dialog to separate the autodeletion functionality
Mikko Rasa [Mon, 21 Aug 2023 14:34:08 +0000 (17:34 +0300)]
Refactor Dialog to separate the autodeletion functionality

The base Dialog class now only hides itself, allowing reusable dialogs.
There's a new AutoDialog class which can be used to create autodeleting
dialogs, ensuring that they're allocated in the correct way.

7 months agoUse std::unique_ptr for managing memory
Mikko Rasa [Mon, 21 Aug 2023 10:05:52 +0000 (13:05 +0300)]
Use std::unique_ptr for managing memory

7 months agoRefactor Panel to create Layout internally on request
Mikko Rasa [Mon, 21 Aug 2023 12:42:10 +0000 (15:42 +0300)]
Refactor Panel to create Layout internally on request

The Panel always took ownership of the layout anyway, and there seems to
be little point to replace an existing layout with a new one.

7 months agoRemove unnecessary Container::create_child
Mikko Rasa [Mon, 21 Aug 2023 09:34:21 +0000 (12:34 +0300)]
Remove unnecessary Container::create_child

Overriding the child type has been obsolete since 1b29f19.

7 months agoStyle and comment updates
Mikko Rasa [Mon, 21 Aug 2023 08:32:19 +0000 (11:32 +0300)]
Style and comment updates

7 months agoMinor refactoring
Mikko Rasa [Mon, 21 Aug 2023 08:23:42 +0000 (11:23 +0300)]
Minor refactoring

7 months agoUse size_t to represent counts and indices
Mikko Rasa [Mon, 21 Aug 2023 08:22:43 +0000 (11:22 +0300)]
Use size_t to represent counts and indices

7 months agoConvert all list containers to vectors
Mikko Rasa [Sun, 20 Aug 2023 21:06:05 +0000 (00:06 +0300)]
Convert all list containers to vectors

8 months agoMake sure classes follow the rule of 0/3/5
Mikko Rasa [Sun, 20 Aug 2023 20:51:25 +0000 (23:51 +0300)]
Make sure classes follow the rule of 0/3/5

8 months agoClear saved input focus if the widget is removed from the container
Mikko Rasa [Sun, 20 Aug 2023 20:25:02 +0000 (23:25 +0300)]
Clear saved input focus if the widget is removed from the container

Checking the saved focus widget's parent in focus_in can lead to use
after free if the widget was deleted in the meantime.

8 months agoRename some get functions as find because they can return null
Mikko Rasa [Sun, 20 Aug 2023 20:07:04 +0000 (23:07 +0300)]
Rename some get functions as find because they can return null

8 months agoUse the override specifier when overriding a virtual function
Mikko Rasa [Sun, 20 Aug 2023 10:00:21 +0000 (13:00 +0300)]
Use the override specifier when overriding a virtual function

8 months agoRemove unnecessary destructors from exception classes
Mikko Rasa [Sun, 20 Aug 2023 09:57:30 +0000 (12:57 +0300)]
Remove unnecessary destructors from exception classes

8 months agoUse nullptr instead of 0 for pointers
Mikko Rasa [Sun, 20 Aug 2023 09:55:01 +0000 (12:55 +0300)]
Use nullptr instead of 0 for pointers

8 months agoSimplify constructors with C++11
Mikko Rasa [Sun, 20 Aug 2023 09:10:32 +0000 (12:10 +0300)]
Simplify constructors with C++11

Use default member initializers, defaulted constructors and constructor
delegation.

8 months agoConvert loops and iterators to use C++11 features
Mikko Rasa [Sun, 20 Aug 2023 07:48:39 +0000 (10:48 +0300)]
Convert loops and iterators to use C++11 features

8 months agoFix an uninitialized variable
Mikko Rasa [Fri, 18 Aug 2023 21:23:37 +0000 (00:23 +0300)]
Fix an uninitialized variable

8 months agoAdd API declarations
Mikko Rasa [Fri, 18 Aug 2023 21:22:14 +0000 (00:22 +0300)]
Add API declarations

8 months agoRemove deprecated and unmaintained interfaces
Mikko Rasa [Fri, 18 Aug 2023 20:54:47 +0000 (23:54 +0300)]
Remove deprecated and unmaintained interfaces

8 months agoBump version
Mikko Rasa [Thu, 17 Aug 2023 12:04:35 +0000 (15:04 +0300)]
Bump version

The parameterless render() function got removed from Root, breaking
source compatibility.  More changes to come.

8 months agoAdjust things to conform to changes in other libraries
Mikko Rasa [Thu, 17 Aug 2023 08:40:03 +0000 (11:40 +0300)]
Adjust things to conform to changes in other libraries

4 years agoEmit rebuild_needed from a container when a child is added
Mikko Rasa [Wed, 16 Oct 2019 11:15:34 +0000 (14:15 +0300)]
Emit rebuild_needed from a container when a child is added

Otherwise the flag won't properly propagate if the container itself is
already parented.

4 years agoAdd a signal for selection changes in Entry
Mikko Rasa [Fri, 27 Sep 2019 11:29:46 +0000 (14:29 +0300)]
Add a signal for selection changes in Entry

4 years agoFix a bug in selection handling when deleting text
Mikko Rasa [Fri, 27 Sep 2019 11:29:09 +0000 (14:29 +0300)]
Fix a bug in selection handling when deleting text

4 years agoAdd a progress bar widget
Mikko Rasa [Fri, 27 Sep 2019 11:27:49 +0000 (14:27 +0300)]
Add a progress bar widget

4 years agoRefactor edit position adjustments from Entry::insert and delete
Mikko Rasa [Wed, 25 Sep 2019 19:10:27 +0000 (22:10 +0300)]
Refactor edit position adjustments from Entry::insert and delete

4 years agoImprove Dialog staleness checks
Mikko Rasa [Wed, 25 Sep 2019 18:44:04 +0000 (21:44 +0300)]
Improve Dialog staleness checks

Buttons may be activated by a navigation event.  There's now a protected
function that derived classes can call if they implement custom mechanisms
for producing a response.

4 years agoAdd a page size feature to Slider
Mikko Rasa [Mon, 23 Sep 2019 22:26:30 +0000 (01:26 +0300)]
Add a page size feature to Slider

4 years agoRefactor all slider logic into the Slider class
Mikko Rasa [Mon, 23 Sep 2019 22:10:45 +0000 (01:10 +0300)]
Refactor all slider logic into the Slider class

Having to write the same logic twice is annoying and more prone to
errors.

4 years agoMark Entry for rebuild when cursor starts or stops blinking
Mikko Rasa [Mon, 23 Sep 2019 21:00:06 +0000 (00:00 +0300)]
Mark Entry for rebuild when cursor starts or stops blinking

4 years agoDefer widget rebuild to just before they are rendered
Mikko Rasa [Mon, 23 Sep 2019 20:59:24 +0000 (23:59 +0300)]
Defer widget rebuild to just before they are rendered

This improves performance especially with complex widgets like Entry.

4 years agoMark List::Item as receiving navigation input
Mikko Rasa [Mon, 23 Sep 2019 18:53:35 +0000 (21:53 +0300)]
Mark List::Item as receiving navigation input

To make it consistent with the fact that it can receive focus.

4 years agoRebuild Entry when the slider is moved
Mikko Rasa [Mon, 23 Sep 2019 18:37:10 +0000 (21:37 +0300)]
Rebuild Entry when the slider is moved

4 years agoAdjust protections of list item base classes
Mikko Rasa [Mon, 23 Sep 2019 18:36:18 +0000 (21:36 +0300)]
Adjust protections of list item base classes

4 years agoAdjust a pointer check in Container
Mikko Rasa [Mon, 23 Sep 2019 18:26:00 +0000 (21:26 +0300)]
Adjust a pointer check in Container

This is semantically equivalent but more intuitive and more tolerant to
mistakes.

4 years agoImprove pointer grab handling
Mikko Rasa [Mon, 23 Sep 2019 18:23:08 +0000 (21:23 +0300)]
Improve pointer grab handling

This fixes a bug where hiding a widget with active pointer grab would
leave the grab flag set, preventing pointer events from being sent
anywere.

4 years agoImplement a grid view mode for List
Mikko Rasa [Thu, 19 Sep 2019 21:47:43 +0000 (00:47 +0300)]
Implement a grid view mode for List

4 years agoAdd a level of indirection to decouple list rows from items
Mikko Rasa [Thu, 19 Sep 2019 21:01:53 +0000 (00:01 +0300)]
Add a level of indirection to decouple list rows from items

This is required to support different kinds of views like grid and
possibly tree.

4 years agoCache the items part in List
Mikko Rasa [Thu, 19 Sep 2019 19:04:41 +0000 (22:04 +0300)]
Cache the items part in List

4 years agoRename Widget::on_geometry_change to on_size_change
Mikko Rasa [Thu, 19 Sep 2019 16:33:30 +0000 (19:33 +0300)]
Rename Widget::on_geometry_change to on_size_change

The new name better represents its actual function.

4 years agoAdd a helper class for single-child list items
Mikko Rasa [Thu, 19 Sep 2019 08:25:00 +0000 (11:25 +0300)]
Add a helper class for single-child list items

4 years agoUse the maximum item height for autosizing List
Mikko Rasa [Thu, 19 Sep 2019 06:21:56 +0000 (09:21 +0300)]
Use the maximum item height for autosizing List

4 years agoUse a LoadableTypeRegistry to manage child types for Panel
Mikko Rasa [Tue, 17 Sep 2019 21:03:02 +0000 (00:03 +0300)]
Use a LoadableTypeRegistry to manage child types for Panel

4 years agoEnsure Text always has at least one line
Mikko Rasa [Tue, 17 Sep 2019 19:48:56 +0000 (22:48 +0300)]
Ensure Text always has at least one line

Otherwise coords_to_geometry may access bogus data.

4 years agoAdd page up/down navigation to Entry
Mikko Rasa [Tue, 17 Sep 2019 19:46:16 +0000 (22:46 +0300)]
Add page up/down navigation to Entry

4 years agoImplement next/previous navigation in Panel
Mikko Rasa [Tue, 17 Sep 2019 19:38:04 +0000 (22:38 +0300)]
Implement next/previous navigation in Panel

The order is the one widgets were added in, which I think should produce
a sensible result in common scenarios.

4 years agoProperly handle multibyte UTF-8 in Entry and Text
Mikko Rasa [Tue, 17 Sep 2019 16:06:34 +0000 (19:06 +0300)]
Properly handle multibyte UTF-8 in Entry and Text

4 years agoEmit signal_text_changed from Entry::set_text
Mikko Rasa [Tue, 17 Sep 2019 15:49:04 +0000 (18:49 +0300)]
Emit signal_text_changed from Entry::set_text

4 years agoUse RAII to ensure consistent PartCache state
Mikko Rasa [Tue, 17 Sep 2019 12:42:19 +0000 (15:42 +0300)]
Use RAII to ensure consistent PartCache state

end_rebuild needs to be called even if an exception is thrown during
rebuilding.

4 years agoFix an unsigned overflow error in Text
Mikko Rasa [Tue, 17 Sep 2019 12:36:33 +0000 (15:36 +0300)]
Fix an unsigned overflow error in Text

4 years agoSelect list items upon navigation by default
Mikko Rasa [Tue, 17 Sep 2019 11:55:09 +0000 (14:55 +0300)]
Select list items upon navigation by default

With control pressed, only the focus is moved.

4 years agoMake sure Entry::first_row stays consistent
Mikko Rasa [Mon, 16 Sep 2019 17:25:30 +0000 (20:25 +0300)]
Make sure Entry::first_row stays consistent

Shrinking and then enlarging an Entry caused first_row to first be set to
the edit position, but would never be reset to zero due to the check in
slider_value_changed.  Yet the visual result was correct thanks to Text
clamping first_row independently.

4 years agoAdd a signal for Entry widget text changes
Mikko Rasa [Mon, 16 Sep 2019 16:40:24 +0000 (19:40 +0300)]
Add a signal for Entry widget text changes

4 years agoAdd a set_modal function for Dialog
Mikko Rasa [Mon, 16 Sep 2019 16:33:29 +0000 (19:33 +0300)]
Add a set_modal function for Dialog

4 years agoDo not navigate out of a widget holding the pointer grab
Mikko Rasa [Mon, 16 Sep 2019 16:32:26 +0000 (19:32 +0300)]
Do not navigate out of a widget holding the pointer grab

4 years agoUse separate widget class for Dialog
Mikko Rasa [Mon, 16 Sep 2019 16:31:18 +0000 (19:31 +0300)]
Use separate widget class for Dialog

4 years agoRemember the last input focus of a Container and restore it when focused
Mikko Rasa [Mon, 16 Sep 2019 16:30:45 +0000 (19:30 +0300)]
Remember the last input focus of a Container and restore it when focused

4 years agoSome more interfaces to support integrating Entry with other components
Mikko Rasa [Thu, 12 Sep 2019 13:46:07 +0000 (16:46 +0300)]
Some more interfaces to support integrating Entry with other components

4 years agoAvoid duplicating the logic in Entry::get_selection
Mikko Rasa [Thu, 12 Sep 2019 12:03:10 +0000 (15:03 +0300)]
Avoid duplicating the logic in Entry::get_selection

4 years agoCollapse the two implementations of Entry::set_edit_position
Mikko Rasa [Thu, 12 Sep 2019 11:15:08 +0000 (14:15 +0300)]
Collapse the two implementations of Entry::set_edit_position

4 years agoUse the public functions also in internal edit operations of Entry
Mikko Rasa [Thu, 12 Sep 2019 11:05:33 +0000 (14:05 +0300)]
Use the public functions also in internal edit operations of Entry

4 years agoRefactor visible height calculation in Entry and Text
Mikko Rasa [Thu, 12 Sep 2019 10:55:11 +0000 (13:55 +0300)]
Refactor visible height calculation in Entry and Text

It's now contained in a common function to ensure it's calculated the
same way in both.

4 years agoImprove vertical positioning of text
Mikko Rasa [Thu, 12 Sep 2019 09:11:39 +0000 (12:11 +0300)]
Improve vertical positioning of text

Applying alignment to only the number of lines that fit in the widget
results in a more consistent position.

4 years agoAdd some editing functions to Entry
Mikko Rasa [Wed, 11 Sep 2019 15:53:54 +0000 (18:53 +0300)]
Add some editing functions to Entry

4 years agoInterpret shift+tab as NAV_PREVIOUS
Mikko Rasa [Wed, 11 Sep 2019 15:43:11 +0000 (18:43 +0300)]
Interpret shift+tab as NAV_PREVIOUS

4 years agoAdd modifier state enum
Mikko Rasa [Wed, 11 Sep 2019 15:42:44 +0000 (18:42 +0300)]
Add modifier state enum

This was supposed to be in 6e5db3e

4 years agoImplement a selection feature in Entry widget
Mikko Rasa [Wed, 11 Sep 2019 07:49:15 +0000 (10:49 +0300)]
Implement a selection feature in Entry widget

4 years agoHandle home and end keys in Entry widget
Mikko Rasa [Wed, 11 Sep 2019 06:26:38 +0000 (09:26 +0300)]
Handle home and end keys in Entry widget

4 years agoPass modifier state to key_press and key_release functions
Mikko Rasa [Tue, 10 Sep 2019 08:40:37 +0000 (11:40 +0300)]
Pass modifier state to key_press and key_release functions

4 years agoAdd an event handler to allow containers to reach to focus changes
Mikko Rasa [Sun, 8 Sep 2019 15:32:19 +0000 (18:32 +0300)]
Add an event handler to allow containers to reach to focus changes

4 years agoOnly focus widgets if the container is focused
Mikko Rasa [Sun, 8 Sep 2019 15:28:21 +0000 (18:28 +0300)]
Only focus widgets if the container is focused

This prevents issues where a widget could be focused before it's added
to a rooted hierarchy, presenting inconsistent focus state.

4 years agoMake the entry widget cursor blink
Mikko Rasa [Sun, 8 Sep 2019 14:25:56 +0000 (17:25 +0300)]
Make the entry widget cursor blink

If the cursor part has different graphics for normal and active states,
it will toggle between those every half a second while the widget is
focused.

4 years agoAdd a system for animating widgets
Mikko Rasa [Sun, 8 Sep 2019 14:17:02 +0000 (17:17 +0300)]
Add a system for animating widgets

4 years agoAdd a flag to make widgets in a LinearArrangement the same size
Mikko Rasa [Thu, 5 Sep 2019 21:08:08 +0000 (00:08 +0300)]
Add a flag to make widgets in a LinearArrangement the same size

4 years agoUpdate deprecated things
Mikko Rasa [Thu, 5 Sep 2019 16:56:06 +0000 (19:56 +0300)]
Update deprecated things

7 years agoChange Root::render to use the passed in Renderer
Mikko Rasa [Thu, 29 Dec 2016 17:21:24 +0000 (19:21 +0200)]
Change Root::render to use the passed in Renderer

7 years agoAdd nameless child keywords for Panel
Mikko Rasa [Mon, 28 Nov 2016 00:35:12 +0000 (02:35 +0200)]
Add nameless child keywords for Panel

Additionally, use a template specialization rather than separate function
for a child which is itself a Panel.

7 years agoAllow overriding the spacing between two widgets in LinearArrangement
Mikko Rasa [Sat, 26 Nov 2016 11:39:26 +0000 (13:39 +0200)]
Allow overriding the spacing between two widgets in LinearArrangement

7 years agoChange the Resources reference in Root to non-const
Mikko Rasa [Sat, 26 Nov 2016 11:38:42 +0000 (13:38 +0200)]
Change the Resources reference in Root to non-const

It might be necessary to load textures on the fly.

7 years agoAdd a datafile statement to set an icon for an Image
Mikko Rasa [Sat, 26 Nov 2016 11:38:02 +0000 (13:38 +0200)]
Add a datafile statement to set an icon for an Image

7 years agoUpdate Renderer matrix manipulation calls
Mikko Rasa [Sat, 19 Nov 2016 12:43:31 +0000 (14:43 +0200)]
Update Renderer matrix manipulation calls

7 years agoExplicitly require sigc++-2.0
Mikko Rasa [Fri, 16 Sep 2016 22:39:29 +0000 (01:39 +0300)]
Explicitly require sigc++-2.0

7 years agoInherit Root from GL::Renderable
Mikko Rasa [Thu, 15 Sep 2016 21:46:32 +0000 (00:46 +0300)]
Inherit Root from GL::Renderable

This allows better integration with GL::Pipeline and the new GL::View
class.

7 years agoFocus entry widget on touch press
Mikko Rasa [Thu, 15 Sep 2016 14:54:15 +0000 (17:54 +0300)]
Focus entry widget on touch press

7 years agoAdd lexical conversion for the centering constraints
Mikko Rasa [Thu, 15 Sep 2016 14:53:27 +0000 (17:53 +0300)]
Add lexical conversion for the centering constraints

7 years agoRewrite Panel navigation logic so it makes more sense
Mikko Rasa [Mon, 12 Sep 2016 15:34:12 +0000 (18:34 +0300)]
Rewrite Panel navigation logic so it makes more sense

Rather than calculating distances between widget centers it now considers
the closeness of their edges.  It's not perfect but better than before.

7 years agoAdd centering constraints to Layout
Mikko Rasa [Sun, 11 Sep 2016 13:28:49 +0000 (16:28 +0300)]
Add centering constraints to Layout

7 years agoAdd support for displaying named icons in an Image widget
Mikko Rasa [Sun, 11 Sep 2016 13:27:46 +0000 (16:27 +0300)]
Add support for displaying named icons in an Image widget

7 years agoOnly pass key and navigation events to enabled widgets
Mikko Rasa [Fri, 2 Sep 2016 22:08:37 +0000 (01:08 +0300)]
Only pass key and navigation events to enabled widgets

It would be even better to not allow them to be focused in the first
place, but that raises issues such as where to put the focus if the
focused widget gets disabled.  So this will have to do.

7 years agoPass List::focus_in to base class
Mikko Rasa [Fri, 2 Sep 2016 22:07:33 +0000 (01:07 +0300)]
Pass List::focus_in to base class

It sets the FOCUS flag in state, which is then checked to determine
whether to focus items.

7 years agoImplement touch interactions for List
Mikko Rasa [Thu, 1 Sep 2016 16:46:44 +0000 (19:46 +0300)]
Implement touch interactions for List

It wasn't working on touchscreens at all because the touch events were
passed to the list items by Container and not converted into mouse events
for the list itself to process.

7 years agoFix an incorrectly positioned graphic
Mikko Rasa [Thu, 1 Sep 2016 16:46:11 +0000 (19:46 +0300)]
Fix an incorrectly positioned graphic

7 years agoImprove list focus management
Mikko Rasa [Thu, 1 Sep 2016 16:42:41 +0000 (19:42 +0300)]
Improve list focus management

Now that containers no longer get an implicit navigation event when
focused, list must take care of focusing the correct item itself.

7 years agoMove navigation logic from Container to Panel
Mikko Rasa [Thu, 1 Sep 2016 07:46:57 +0000 (10:46 +0300)]
Move navigation logic from Container to Panel

A number of widgets inherit from Container because they have internal
sub-widgets, but have their own navigation logic.  Panel is the user-
visible generic container.

7 years agoDon't pass events to an invisible root widget
Mikko Rasa [Wed, 31 Aug 2016 09:56:06 +0000 (12:56 +0300)]
Don't pass events to an invisible root widget

7 years agoImplement keyboard navigation for most widgets
Mikko Rasa [Wed, 31 Aug 2016 08:52:45 +0000 (11:52 +0300)]
Implement keyboard navigation for most widgets

7 years agoAdd a border around the focused widget in the basic skin
Mikko Rasa [Wed, 31 Aug 2016 08:34:40 +0000 (11:34 +0300)]
Add a border around the focused widget in the basic skin

7 years agoAllow an empty graphic to be specified in part definitions
Mikko Rasa [Wed, 31 Aug 2016 08:30:26 +0000 (11:30 +0300)]
Allow an empty graphic to be specified in part definitions

It can be used to cancel out a graphic for specific states.