Daniel P Daniel P - 3 months ago 34
C++ Question

GTK and CSS : Rounded buttons

I am trying to create a rounded button by calling a external CSS file in my C++ application.

I manage to get a round button but some rectangular border remains and I cannot find how to get rid of that border.

Content of CSS file :

GtkButton {
-GtkWidget-focus-line-width: 1px;
border-width: 1px;
border-radius: 30px;
background-image: -gtk-gradient (linear,
left top,
left bottom,
from (@win_bg),
color-stop (0.5, @win_dark),
to (@win_bg));
}


PS : I left out the color definitions to keep it shorter.

Answer

I am running Debian Wheezy (currently testing), after installing the gtk unico engine (apt-get install gtk3-engines-unico) and modifying my css it worked (rectangular borders are gone)

GtkButton  {
    engine: unico;
    -GtkWidget-focus-line-width: 1px; 
    border-width: 1px;
    border-radius: 30px;
    background-image: -gtk-gradient (linear,
        left top,
        left bottom,
        from (@win_bg),
        color-stop (0.5, @win_dark),
        to (@win_bg));
}
Comments