questions regarding gtkcheckbutton

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

questions regarding gtkcheckbutton

songqing shan
Hello,


I have a few questions regarding using gtkcheckbutton as follows.

  1.  how can I change or reduce the size of gtkcheckbutton (small square) in gtkcheckbutton? It is too big and makes a big space between lines. I want to make it smaller so that the space between lines are similar to the space between text lines. I have tried many methods (e.g., methods in gtkwidget and gtkbuttons) in gtk3 and css methods, but all of them failed. It is appreciated if someone can help.

2. can I dynamically change the background color of the small square box in the gtkcheckbutton? If yes, how can do it?

3. can I dynamically change or set the check color of the check in the square box in the gtkcheckbutton? if yes, how can do it?

 For questions 2 and 3, in other words, change the colors of background and check respectively.


Any help, comments and suggestions are appreciated.


Regards,


Song




_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: questions regarding gtkcheckbutton

Chris Moller-3
In theory, this should probably be done with CSS, but I've been unable
to make that work.  Instead, I'm using the sequence

     GtkWidget *image = gtk_image_new ();
     gtk_widget_set_size_request (image, 16, 16);
     g_signal_connect (G_OBJECT (image), "draw",
                       G_CALLBACK (colour_button_draw),
                       GINT_TO_POINTER (i));
     gtk_button_set_image (GTK_BUTTON (button), image);

and drawing the button manually using cairo.

I agree:  the GTK default geometries are too big.


On 05/19/17 19:42, songqing shan wrote:

> Hello,
>
>
> I have a few questions regarding using gtkcheckbutton as follows.
>
>    1.  how can I change or reduce the size of gtkcheckbutton (small square) in gtkcheckbutton? It is too big and makes a big space between lines. I want to make it smaller so that the space between lines are similar to the space between text lines. I have tried many methods (e.g., methods in gtkwidget and gtkbuttons) in gtk3 and css methods, but all of them failed. It is appreciated if someone can help.
>
> 2. can I dynamically change the background color of the small square box in the gtkcheckbutton? If yes, how can do it?
>
> 3. can I dynamically change or set the check color of the check in the square box in the gtkcheckbutton? if yes, how can do it?
>
>   For questions 2 and 3, in other words, change the colors of background and check respectively.
>
>
> Any help, comments and suggestions are appreciated.
>
>
> Regards,
>
>
> Song
>
>
>
>
> _______________________________________________
> gtk-app-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>

_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list