On Thu, 5 Sep 2019 20:17:13 +0200, Mike Wey wrote:

How the tabs are rendered depends on the gtk theme that is used, at
least with the default adwita theme you don't get the traditional tabs
but only the texts and a blue selected indicator.

Thanks, Mike.

My first move from here would normally have been to use this bit of code to use CSS for colouring the tab (once I tracked down the CSS name for tabs):

class CSS
{
	import gdk.Display;
	import gdk.Screen;
	import gtk.StyleContext;
	import gtk.CssProvider;
	
	string cssPath = "./css/button_label.css";

	this()
	{
		CssProvider provider = new CssProvider();
		provider.loadFromPath(cssPath);
		
		Display display = Display.getDefault();
		Screen screen = display.getDefaultScreen();
		StyleContext.addProviderForScreen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

	} // this()

} // CSS

However, I'm also working towards making all examples GTK4 compliant which means not using the GdkScreen since its use is about to be deprecated. I know there's an alternative method using addProvider(), pretty much the same thing as above, but on a widget-by-widget basis instead of application wide. I've been looking for an example of how to use addProvider(), but I'm not finding anything.

I've got this so far, but there's no association between the provider and the widget:

class CSSButton : Button
{
	CSS css;
	
	this(string textLabel, string cssName)
	{
		super(textLabel);
		setName(cssName);
		css = new CSS(); // enable CSS
		// ??????

	} // this()
	
} // class CSSButton


class CSS
{
	import gtk.StyleContext;
	import gtk.CssProvider;
	
	string cssPath = "./css/button_label.css";

	this()
	{
		CssProvider provider = new CssProvider();
		StyleContext styleContext = new StyleContext();
		provider.loadFromPath(cssPath);
		
		styleContext.addProvider(provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

	} // this()

} // CSS

Questions:

  1. Do you know how to set up this association?
  2. Do you know the CSS name for the tab? Is it as simple as 'tab'?