[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Radio and CheckBox icons for GianLuigi :)


On Sun, 29 Sept 2024 at 13:57, Gianluigi <gradobag@xxxxxxxxxxx> wrote:

> Il 29/09/24 02:47, Bruce Steers ha scritto:
> > Re: RadioButton icons
> >
> > Hey GL
> > Sorry in a previous post i mistakenly said 16 not 22 in an example of
> > how to draw a Radio image using Style.PaintOption.
> > (i had a nagging feeling i might have used the wrong size while i was
> > posting it)
> > But 16x16 looked okay on my system so i stuck with it. silly me eh. I
> > almost ticked all the boxes but made one mistake :^)
> > When you mentioned after about 22 being the visible size on your system
> > i realized yes, dang, i previously knew that but forgot and after
> > looking closer 16x16 is cropped on my system :-\
> >
> > I corrected the code in further examples as you were right about that.
> >
> > But here's a better example for you and ties in with your request on the
> > bugTracker
> > (i didn't want to post this on bugtracker so i'm posting it here)
> >
> > It has 2 customized classes to choose from
> >
> > one fixes Style.PaintOption and Style.PaintCheck with gtk3 with a
> > Style.class patch that stretches the gtk3 option/check pictures
> >
> > The other does like what you have asked Benoit for on the BugTracker and
> > adds widget "icons" with Picture["style:/<type>/<size>/<value>/<flag>"]
> > syntax with a Picture.class patch
> > option and check are supported, pictures are cached
> > Eg
> > Picture["style:/option/16/true"]
> > Picture["style:/check/16/true"]
> > Picture["style:/option/42/false" &/ Style.Hovered]
> >
> > Note: adding an icon for a widget is not so simple a task as there are
> > also many style flags to consider like Hovered, etc
> >
> > Fixing Style.class was an easier route
> >
> > Enjoy :)
> > BruceS
> >
> > Untitled.png
> >
>
> Hi,
>
> I didn't reply before because I couldn't.
> Nice code, congratulations.
>
> Regards
> Gianluigi
>

Well you said you wanted an "icon that, like all the other Gambas icons if
present, captures the theme used by the OS."

That's one way how it could be done capturing the current toolkit theme and
various states of of the objects existence.

Note: the Picture.class and Style.class in the program are completely
separate and do not use each other but they should if in the same project.
meaning the Picture.class is handling the resizing independently and not
using the included Style.class to do it  , but it probably should.

I left it like that so the Picture.class could be imported into any project
without the Style.class and still work.

I think something like this could be very useful for making custom
Radio/CheckBox controls.

So i guess the congratulations are to you not me.  aren't you lucky :)

You're welcome , and so is everyone else :)

BruceS

References:
Radio and CheckBox icons for GianLuigi :)Bruce Steers <bsteers4@xxxxxxxxx>
Re: Radio and CheckBox icons for GianLuigi :)Gianluigi <gradobag@xxxxxxxxxxx>