initialize `background-image` with a resource file
Master via gtkmm-list <[email protected]> Tue, 23 Aug 2022 22:14:07 +0430
| Newsgroups | gmane.comp.gnome.gtkmm |
|---|---|
| Message-ID | <CALot762XMCtwK8NxoS=txrMYgRugh5BqBYa1ia5-DUzDdTbyow@mail.gmail.com> |
--===============2103906559571835970==
Content-Type: multipart/alternative; boundary="00000000000029d47a05e6ec1d75"
--00000000000029d47a05e6ec1d75
Content-Type: text/plain; charset="UTF-8"
in my gtkmm app i have a label that has a background image thanks to css
provider. like this:
```
MainWindow::MainWindow():
Mylabel(Hello)
{
provider = Gtk::CssProvider::create();
provider->load_from_data(
"#LogoLabel{"
//"color:#800000;"
//"color:#5485ae;"
"color:#0075ff;"
"}"
"#PleaseHitKeyLbl{"
"background-color:#3333337a;"
"font-size:20px;"
"}"
"#BackgroundImage{"
"background-image:url(\"file:///home/ali/Desktop/sonbg.jpg\");"
"background-size:100% 100%;"
"opacity:0.3;"
"}"
);
MyLabel.set_name("BackgroundImage");
MyLabel.get_style_context()->add_provider(provider, 1);
}
```
The problem is that I dont know how to tell the `background-image` inside
the style provider to "get the image from resource" instead of "file"
please help me.
Regards.
--00000000000029d47a05e6ec1d75
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl">in my gtkmm app i have a label that has a background image=
thanks to css provider. like this:<br>```<br>MainWindow::MainWindow():<br>=
Mylabel(Hello)<br>{<br>provider =3D Gtk::CssProvider::create();<br>provider=
->load_from_data(<br>"#LogoLabel{"<br>//"color:#800000;&q=
uot;<br>//"color:#5485ae;"<br>"color:#0075ff;"<br>"=
;}"<br>"#PleaseHitKeyLbl{"<br>"background-color:#333333=
7a;"<br>"font-size:20px;"<br>"}"<br>"#Backgro=
undImage{"<br>"background-image:url(\"file:///home/ali/Deskt=
op/sonbg.jpg\");"<br>"background-size:100% 100%;"<br>&q=
uot;opacity:0.3;"<br>"}"<br>);<br>MyLabel.set_name("Bac=
kgroundImage");<br>MyLabel.get_style_context()->add_provider(provid=
er, 1);<br>}<br>```<div dir=3D"ltr">The problem is that I dont know how to =
tell the `background-image` inside the style provider to "get the imag=
e from resource" instead of "file" please help me.=C2=A0</di=
v><div dir=3D"ltr">Regards.</div></div>
--00000000000029d47a05e6ec1d75--
--===============2103906559571835970==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
--===============2103906559571835970==--