Skip to content

Add wxListCtrl support to document and DC classes - #136

Merged
utelle merged 17 commits into
utelle:mainfrom
Blake-Madden:PrintList
Jun 12, 2026
Merged

Add wxListCtrl support to document and DC classes#136
utelle merged 17 commits into
utelle:mainfrom
Blake-Madden:PrintList

Conversation

@Blake-Madden

Copy link
Copy Markdown
Contributor

These classes can now accept a wxListCtrl (with various options) and they will print it within the document (spanning across multiple pages if necessary).

I tried to emulate some of LaTeX table features so that we have lots of customization available.

Sample project is included, but only the CMake project builds it currently; you will need to run the premake script to add it to the other build scripts.

Some examples from the sample project:

image image image image

@utelle

utelle commented Jun 11, 2026

Copy link
Copy Markdown
Owner

These classes can now accept a wxListCtrl (with various options) and they will print it within the document (spanning across multiple pages if necessary).

This is a nice feature making it a lot easier to output tables to PDF.

Currently, your implementation uses wxFont objects to specify fonts. IMHO it would be nice to have the option to specify fonts also via wxPdfFont objects. I haven't inspected the code in full detail yet, so I don't know whether this is simple to accomplish or not. If it is difficult, it can be postponed. Please let me know what you think. Depending on that, I'll decide when to merge the PR.

Sample project is included, but only the CMake project builds it currently; you will need to run the premake script to add it to the other build scripts.

That is the reason why the Appveyor CI run currently fails. I will adjust the build scripts after I have merged the PR.

@Blake-Madden

Copy link
Copy Markdown
Contributor Author

OK, wxPdfFont support is in there now.

@utelle
utelle merged commit 2a20b90 into utelle:main Jun 12, 2026
2 of 3 checks passed
@utelle

utelle commented Jun 12, 2026

Copy link
Copy Markdown
Owner

I regenerated the build files to include the new class and the listctrl sample.

However, I detected a glitch in the implementation. For cells with a background color the list icons were not visible in PDF (although they are actually in the PDF file). The reason is the order in which icons and cell content were drawn. The icon was written to PDF before the cell content. Therefore the cell content was drawn over the icon, making the icon invisible, if the cell had a background fill color. I committed a fix for this.

There are still other issues with the implementation. For example, the cell alignment is not respected. All cells are written left aligned to PDF.

Additionally, there will be problems if an application will draw more than one listctrl with different image lists attached. The names of the icons use the index within the image list, and therefore the second listctrl will actually use the icons from the first list, because the names will be identical. It will be necessary to use either a global index, so that each icon gets a unique name (could be inefficient, if the icon list really are identical). Or some logic would be needed to detect which icons are really different.

@Blake-Madden
Blake-Madden deleted the PrintList branch June 12, 2026 16:41
@Blake-Madden

Copy link
Copy Markdown
Contributor Author

OK, I just submitted a PR to fix these.

@utelle

utelle commented Jun 12, 2026

Copy link
Copy Markdown
Owner

OK, I just submitted a PR to fix these.

Thanks. I merged your PR.

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

Successfully merging this pull request may close these issues.

2 participants