Re: Fetching gtkmm custom css style properties

2020-02-19 Thread Daniel Boles via gtkmm-list
you can just type any property name though. the argument is just a string.
the symbols in the header are just macros and not exhaustive.

glad to help. have fun!


On Wed, 19 Feb 2020, 11:23 Mohith Manoj via gtkmm-list, <
gtkmm-list@gnome.org> wrote:

> viola... that gets the wheel rolling.
>
> *gtk_style_context_get* works. However, there are only 10 style
> properties defined in gtkstylecontext.h that we can retrieve this way and
> not all the style properties listed in Gtk-Inspector. For example there is
> a single definition for border radius as,
> #define GTK_STYLE_PROPERTY_BORDER_RADIUS "border-radius"
> While Gtk-Inspector lists one radii for each of the four corners. Which
> makes sense because in cases where you have linked buttons inside a button
> box (with 'linked' style class added), individual corners needs to be
> manipulated depending on the position of the button in the group and
> whether they are vertically stacked or horizontally.
>
> Anyway this is a good starting point. Many thanks to Daniel Boles.
> This post in Stackoverflow confirms the findings.
>
> https://stackoverflow.com/questions/47371967/getting-objects-out-of-a-gvalue
>
>
>
>
>
> *Please consider the Environment before printing this e-mail.*
>
> The information contained in this message (including any attachments) is
> confidential and may be privileged or otherwise protected from disclosure.
> If you are not the intended recipient, you must not copy this message or
> attachment or disclose the contents to any other person.  If you have
> received this transmission in error, please notify the sender immediately
> by return e-mail and permanently delete this message and any attachments
> from your system.  Any dissemination, use, review, distribution, printing
> or copying of this message in whole or in part is strictly prohibited.
> Please note that e-mails are susceptible to change.
>
> *SKANRAY* *(including its group of companies)
> shall not be liable for any omission or error in the message, improper or
> incomplete transmission of the information contained in this communication
> or for any delay in its receipt or damage to your system. * *SKANRAY*
> *(or its group of companies) does not guarantee
> that the integrity of this communication has been maintained or that this
> communication is free of viruses, interceptions or interference.*
> ___
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Fetching gtkmm custom css style properties

2020-02-19 Thread Mohith Manoj via gtkmm-list
viola... that gets the wheel rolling.

*gtk_style_context_get* works. However, there are only 10 style properties
defined in gtkstylecontext.h that we can retrieve this way and not all the
style properties listed in Gtk-Inspector. For example there is a single
definition for border radius as,
#define GTK_STYLE_PROPERTY_BORDER_RADIUS "border-radius"
While Gtk-Inspector lists one radii for each of the four corners. Which
makes sense because in cases where you have linked buttons inside a button
box (with 'linked' style class added), individual corners needs to be
manipulated depending on the position of the button in the group and
whether they are vertically stacked or horizontally.

Anyway this is a good starting point. Many thanks to Daniel Boles.
This post in Stackoverflow confirms the findings.
https://stackoverflow.com/questions/47371967/getting-objects-out-of-a-gvalue

-- 


-- 
*Please consider the Environment before printing this e-mail.*








The information contained in this message 
(including any attachments) is 
confidential and may be privileged or 
otherwise protected from disclosure. 
 If you are not the intended 
recipient, you must not copy this message or 
attachment or disclose the 
contents to any other person.  If you have 
received this transmission in
 error, please notify the sender immediately 
by return e-mail and 
permanently delete this message and any attachments 
from your system.  
Any dissemination, use, review, distribution, printing 
or copying of 
this message in whole or in part is strictly prohibited.  
Please note 
that e-mails are susceptible to change. 
 
*SKANRAY* 
*(including
 its group of companies) shall not be 
liable for any omission or error 
in the message, improper or incomplete 
transmission of the information 
contained in this communication or for any 
delay in its receipt or 
damage to your system. * *SKANRAY* 
*(or
 its group of companies) does not guarantee 
that the integrity of this 
communication has been maintained or that this 
communication is free of 
viruses, interceptions or interference.*
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Fetching gtkmm custom css style properties

2020-02-19 Thread Daniel Boles via gtkmm-list
-- Forwarded message -
From: Daniel Boles 
Date: Wed, 19 Feb 2020, 10:31
Subject: Re: Fetching gtkmm custom css style properties
To: Mohith Manoj 


Oh, sorry.

What you want is not Object.get_property but rather StyleContext.get, but
the latter is not wrapped in gtkmm yet.

So you would have to use C code, something like

auto opacity = double{};
gtk_style_context_get(styleContext->gobj(), styleContext->get_state(),
"opacity", , NULL);

you may need to cast the state too, but you get the idea i hope :-) this
can be hidden in a helper function, made into a template, etc.





On Wed, 19 Feb 2020, 10:24 Mohith Manoj via gtkmm-list, <
gtkmm-list@gnome.org> wrote:

> Sorry I felt a bit dumb at this point, so I though I'll try all
> combinations. Following code is executed on a button press from a custom
> widget derived from Gtk::ToggleButton.
>   int nValue;
>   Glib::RefPtr refStyleContext =
> get_style_context();
>
>   refStyleContext->get_property("color", nValue);
>   refStyleContext->get_property("css-color", nValue);
>
>   refStyleContext->get_style_property("color", nValue);
>   refStyleContext->get_style_property("css-color", nValue);
>
>   get_property("color", nValue);
>   get_property("css-color", nValue);
>
> All six lines threw warnings as below.
>
>
>
>
>
>
>
>
>
>
>
> *(TV_UI:21972): GLib-GObject-WARNING **: 15:49:20.480:
> g_object_get_is_valid_property: object class 'GtkStyleContext' has no
> property named 'color'(TV_UI:21972): GLib-GObject-WARNING **: 15:49:20.480:
> g_object_get_is_valid_property: object class 'GtkStyleContext' has no
> property named 'css-color'(TV_UI:21972): Gtk-WARNING **: 15:49:20.480:
> ../../../../gtk/gtkstylecontext.c:1796: widget class
> 'gtkmm__GtkToggleButton' has no style property named 'color'(TV_UI:21972):
> Gtk-WARNING **: 15:49:20.480: ../../../../gtk/gtkstylecontext.c:1796:
> widget class 'gtkmm__GtkToggleButton' has no style property named
> 'css-color'(TV_UI:21972): GLib-GObject-WARNING **: 15:49:20.480:
> g_object_get_is_valid_property: object class 'gtkmm__GtkToggleButton' has
> no property named 'color'(TV_UI:21972): GLib-GObject-WARNING **:
> 15:49:20.480: g_object_get_is_valid_property: object class
> 'gtkmm__GtkToggleButton' has no property named 'css-color'*
>
>
>
>
>
> *Please consider the Environment before printing this e-mail.*
>
> The information contained in this message (including any attachments) is
> confidential and may be privileged or otherwise protected from disclosure.
> If you are not the intended recipient, you must not copy this message or
> attachment or disclose the contents to any other person.  If you have
> received this transmission in error, please notify the sender immediately
> by return e-mail and permanently delete this message and any attachments
> from your system.  Any dissemination, use, review, distribution, printing
> or copying of this message in whole or in part is strictly prohibited.
> Please note that e-mails are susceptible to change.
>
> *SKANRAY* <http://www.skanray.com>*(including its group of companies)
> shall not be liable for any omission or error in the message, improper or
> incomplete transmission of the information contained in this communication
> or for any delay in its receipt or damage to your system. * *SKANRAY*
> <http://www.skanray.com>*(or its group of companies) does not guarantee
> that the integrity of this communication has been maintained or that this
> communication is free of viruses, interceptions or interference.*
> ___
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Fetching gtkmm custom css style properties

2020-02-19 Thread Mohith Manoj via gtkmm-list
Sorry I felt a bit dumb at this point, so I though I'll try all
combinations. Following code is executed on a button press from a custom
widget derived from Gtk::ToggleButton.
  int nValue;
  Glib::RefPtr refStyleContext = get_style_context();

  refStyleContext->get_property("color", nValue);
  refStyleContext->get_property("css-color", nValue);

  refStyleContext->get_style_property("color", nValue);
  refStyleContext->get_style_property("css-color", nValue);

  get_property("color", nValue);
  get_property("css-color", nValue);

All six lines threw warnings as below.











*(TV_UI:21972): GLib-GObject-WARNING **: 15:49:20.480:
g_object_get_is_valid_property: object class 'GtkStyleContext' has no
property named 'color'(TV_UI:21972): GLib-GObject-WARNING **: 15:49:20.480:
g_object_get_is_valid_property: object class 'GtkStyleContext' has no
property named 'css-color'(TV_UI:21972): Gtk-WARNING **: 15:49:20.480:
../../../../gtk/gtkstylecontext.c:1796: widget class
'gtkmm__GtkToggleButton' has no style property named 'color'(TV_UI:21972):
Gtk-WARNING **: 15:49:20.480: ../../../../gtk/gtkstylecontext.c:1796:
widget class 'gtkmm__GtkToggleButton' has no style property named
'css-color'(TV_UI:21972): GLib-GObject-WARNING **: 15:49:20.480:
g_object_get_is_valid_property: object class 'gtkmm__GtkToggleButton' has
no property named 'color'(TV_UI:21972): GLib-GObject-WARNING **:
15:49:20.480: g_object_get_is_valid_property: object class
'gtkmm__GtkToggleButton' has no property named 'css-color'*

-- 


-- 
*Please consider the Environment before printing this e-mail.*








The information contained in this message 
(including any attachments) is 
confidential and may be privileged or 
otherwise protected from disclosure. 
 If you are not the intended 
recipient, you must not copy this message or 
attachment or disclose the 
contents to any other person.  If you have 
received this transmission in
 error, please notify the sender immediately 
by return e-mail and 
permanently delete this message and any attachments 
from your system.  
Any dissemination, use, review, distribution, printing 
or copying of 
this message in whole or in part is strictly prohibited.  
Please note 
that e-mails are susceptible to change. 
 
*SKANRAY* 
*(including
 its group of companies) shall not be 
liable for any omission or error 
in the message, improper or incomplete 
transmission of the information 
contained in this communication or for any 
delay in its receipt or 
damage to your system. * *SKANRAY* 
*(or
 its group of companies) does not guarantee 
that the integrity of this 
communication has been maintained or that this 
communication is free of 
viruses, interceptions or interference.*
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Fetching gtkmm custom css style properties

2020-02-19 Thread Daniel Boles via gtkmm-list
it doesnt work because those are CSS properties, which are not widget style
properties.

use get_property("css-prop-name", dst_value)


On Wed, 19 Feb 2020, 09:51 Mohith Manoj via gtkmm-list, <
gtkmm-list@gnome.org> wrote:

> Of course... get_color() works as we have seen in the example code. But to
> get a property like 'border-top-left-radius' or 'border-right-color' there
> is no direct API and we are dependent on something like
> Gtk::StyleContext::get_style_property, but since this doesn't work we have
> our hunting hat on.
>
> On Wed, Feb 19, 2020 at 12:27 PM Daniel Boles via gtkmm-list <
> gtkmm-list@gnome.org> wrote:
>
>> color is a normal css property, not a widget style property. use the
>> right api for that. there is get_property() and iirc maybe even get_color().
>>
>> don't use widget style properties in new code because they are removed in
>> gtk 4.
>> ___
>> gtkmm-list mailing list
>> gtkmm-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>>
>
>
>
> *Please consider the Environment before printing this e-mail.*
>
> The information contained in this message (including any attachments) is
> confidential and may be privileged or otherwise protected from disclosure.
> If you are not the intended recipient, you must not copy this message or
> attachment or disclose the contents to any other person.  If you have
> received this transmission in error, please notify the sender immediately
> by return e-mail and permanently delete this message and any attachments
> from your system.  Any dissemination, use, review, distribution, printing
> or copying of this message in whole or in part is strictly prohibited.
> Please note that e-mails are susceptible to change.
>
> *SKANRAY* *(including its group of companies)
> shall not be liable for any omission or error in the message, improper or
> incomplete transmission of the information contained in this communication
> or for any delay in its receipt or damage to your system. * *SKANRAY*
> *(or its group of companies) does not guarantee
> that the integrity of this communication has been maintained or that this
> communication is free of viruses, interceptions or interference.*
> ___
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Fetching gtkmm custom css style properties

2020-02-19 Thread Mohith Manoj via gtkmm-list
Of course... get_color() works as we have seen in the example code. But to
get a property like 'border-top-left-radius' or 'border-right-color' there
is no direct API and we are dependent on something like
Gtk::StyleContext::get_style_property, but since this doesn't work we have
our hunting hat on.

On Wed, Feb 19, 2020 at 12:27 PM Daniel Boles via gtkmm-list <
gtkmm-list@gnome.org> wrote:

> color is a normal css property, not a widget style property. use the right
> api for that. there is get_property() and iirc maybe even get_color().
>
> don't use widget style properties in new code because they are removed in
> gtk 4.
> ___
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>

-- 


-- 
*Please consider the Environment before printing this e-mail.*








The information contained in this message 
(including any attachments) is 
confidential and may be privileged or 
otherwise protected from disclosure. 
 If you are not the intended 
recipient, you must not copy this message or 
attachment or disclose the 
contents to any other person.  If you have 
received this transmission in
 error, please notify the sender immediately 
by return e-mail and 
permanently delete this message and any attachments 
from your system.  
Any dissemination, use, review, distribution, printing 
or copying of 
this message in whole or in part is strictly prohibited.  
Please note 
that e-mails are susceptible to change. 
 
*SKANRAY* 
*(including
 its group of companies) shall not be 
liable for any omission or error 
in the message, improper or incomplete 
transmission of the information 
contained in this communication or for any 
delay in its receipt or 
damage to your system. * *SKANRAY* 
*(or
 its group of companies) does not guarantee 
that the integrity of this 
communication has been maintained or that this 
communication is free of 
viruses, interceptions or interference.*
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Fetching gtkmm custom css style properties

2020-02-18 Thread Daniel Boles via gtkmm-list
color is a normal css property, not a widget style property. use the right
api for that. there is get_property() and iirc maybe even get_color().

don't use widget style properties in new code because they are removed in
gtk 4.
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list