[Gambas-user] glitch with gtk ListView.ShowCheck checkbox's rendering

Bruce Steers bsteers4 at gmail.com
Tue Dec 19 20:15:55 CET 2023


On Tue, 19 Dec 2023 at 13:38, Benoît Minisini <
benoit.minisini at gambas-basic.org> wrote:

> Le 19/12/2023 à 14:19, Bruce Steers a écrit :
> > I had this somewhere else (cannot remember where) but i noticed ListView
> > suffers the same glitch when rendering check box's.  the right seems to
> > be chopped.
> >
> > i tried modifying the gtk theme but it's still the same..
> >
> > (see pic)
> >
> > Respects
> > BruceS
> >
>
> To render a checkbox with GTK+, you give a rectangle that normally
> should define the size of the checkbox.
>
> Alas, most of GTK+ themes use fixed size images to draw checkboxes (and
> radiobuttons), so the result is either a cropped checkbox, either a too
> small one.
>
> Regards,
>
> --
> Benoît Minisini.
>

Yeah gtk does it terribly.
Style.PaintCheck() with gtk pays no attention to the size arguments when
rendering.

I did a little test with qt and gtk that starts at 5px and increments the
size by 5px and paints some checkbox's  (see 1st pic)

like you say gtk seems to render a fixed size.
That's nasty. :(

So i guess the solution is going to be to force the controls with boxes to
have a size that can fit the gtk box?

could Style.class not do a sneaky resize for the gtk image?

hmm,, I guess I could do a sneaky resize myself if i paint the box to a
temp image and stretch it.........
<<<  has a little play...

Right, so i figured a simple workaround,  i saved the following as
Style.class in my test project...
' Gambas class file

Export
Create Static

Static Public Sub PaintCheck(X As Integer, Y As Integer, W As Integer, H As
Integer, Value As Integer, Optional Flags As Integer)

  If Component.IsLoaded("gb.gtk3") Then
    Dim p As Picture = New Picture(20, 20, True)
    Dim d As Object = Paint.Device
    Paint.End
    Paint.Begin(p)
    Super.PaintCheck(0, 0, 20, 20, Value, Flags)
    Paint.End
    Paint.Begin(d)
    Paint.DrawPicture(p.Stretch(W, H), X, Y, W, H)
  Else
    Super.PaintCheck(X, Y, W, H, Value, Flags)
  Endif

End

The result in the second pic.

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231219/cd63f5e4/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled.jpg
Type: image/jpeg
Size: 21840 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231219/cd63f5e4/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled.jpg
Type: image/jpeg
Size: 97659 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231219/cd63f5e4/attachment-0003.jpg>


More information about the User mailing list