Stefan Küng:
> will there also be a command to set those options? Can't see any SCI_SETACOPTIONS or something like that in your patch?
That patch was part of platform interface changes for Scintilla 5. Adding a method to ListBox is a breaking change and I was trying to find a mechanism where further list box settings could be added without breaking downstream platform layers.
There was an issue containing some early platform interface changing code here:
https://sourceforge.net/p/scintilla/feature-requests/1364/
Not all platforms can (easily) support changing list box colours so there should also be a mechanism for communicating that to the application. Its possible that the SCI_SUPPORTSFEATURE API proposed for 5 could be used here.
The most consistent way to expose this in the API would be as 4 separate optional properties with the colours following the system until the application sets a colour.
set void SetListText(Colour fore)
get Colour GetListText()
set void SetListBackground(Colour fore)
get …
set void SetListSelectedText(Colour fore)
get …
set void SetListSelectedBackground(Colour fore)
get …
The application should also be able to reset the colour so it agains follows the system. Previously, adding separate properties for each colour has been a little onerous so a more streamlined API could be examined with a colour option enumeration. Something like:
enum ColourOption { WhitespaceText=0, Border=1, …,
ListText=392, ListBackground=393, ListSelectedText=394, ListSelectedBackground=395 };
ColourOptionSet(ColourOption, Colour);
ColourOptionReset(ColourOption);
Colour ColourOptionGet(ColourOption);
bool ColourOptionIsSet(ColourOption);
bool ColourOptionCanSet(ColourOption);
This could also make some existing optional colour features more regular like setting the selection foreground which is currently SCI_SETSELFORE(bool useSetting, colour fore) where a false useSetting turns off the application preference.
> However I would still need the notification which passes the window handle - that's very important since I need that handle to set the darkmode flag and call SetWindowTheme() on it.
Placing the window handle in lParam isn’t great as the purpose of lParam is macro recording. Exposing internal window details is messy - ac.lb->GetID() is the top-level but the actual list is generally a child of that with (potentially) more sub windows between them. I’ll think some more on APIs for returning platform handles or pointers.
Neil