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

[devel] Owner draw table columns support #4226

Open
pfalcon opened this issue Sep 14, 2024 · 2 comments
Open

[devel] Owner draw table columns support #4226

pfalcon opened this issue Sep 14, 2024 · 2 comments

Comments

@pfalcon
Copy link
Contributor

pfalcon commented Sep 14, 2024

SWT's support for showing arbitrary content in table cells is anemic. One might think that drawing arbitrary stuff on image and then returning it in LabelProvider.getImage() would work, but it doesn't, because SWT tries to make images in different column of the same size, i.e. whenever there're multiple images in a table (which is always the case in PP), it will scale everything down to 16x16.

Then owner-draw support is rather low-level. Whenever you register a paint listener, it gets called for each column in a table. We of course would like to wrap it a familiar interface, where there's e.g. OwnerDrawLabelProvider.paint() which gets called just for our column.

I first implemented that as a kind of mixin - interface with hidden inner class to track state. But I initially implemented it using PP's Column class, which of course doesn't work, TableColumn is what should be tracked. But TableColumn is not known at the time label provider is specified (normally Column subclass constructor), it gets assigned later.

In #4224 I describe ColumnWithOptionLabelProvider, which is already set up to capture TableColumn associated with a label provider. And it seems, it's also just what we need to support owner draw either! Then I'm going to drop that dichotomy of ColumnWithOptionLabelProvider vs OwnerDraw interface, and just merge everything into one class. Which then should be named different than ColumnWithOptionLabelProvider.

Don't have a sticky name just yet, but ParameterizableColumnLabelProvider might work.

@pfalcon
Copy link
Contributor Author

pfalcon commented Sep 14, 2024

@buchen : Please let me know if you have suggestions.

@pfalcon
Copy link
Contributor Author

pfalcon commented Sep 14, 2024

and just merge everything into one class

Yeah, it's much clearer and concise this way. ParameterizableColumnLabelProvider be it. Updated #4225 with it (new name; functionality of course to be added step by step).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant