Re: gtkmm-list Digest, Vol 189, Issue 4



Figured I should have added more details.

The reason I'm interested in getting the style property is because only with this information I can perform some drawing operations on my custom widgets. For example, if I need to draw a line with arbitrary thickness I need to get the 'foreground-color' property and use Cairo::move_to/line_to/stroke functions myself because Gtk::StyleContext::render_line always draws a 1 pixel line!

Following code snippet attempts to read the foreground color property of a Gtk::Button.
  Glib::RefPtr <Gtk::StyleContext> refStyleContext = m_oBtn2.get_style_context();
  int nColor;
  Gdk::RGBA oColor = refStyleContext->get_color(Gtk::STATE_FLAG_NORMAL);

  refStyleContext->get_style_property("color", nColor);

  std::cout << "From direct API:" << oColor.to_string() << std::endl;
  std::cout << "From get_style_property:" << nColor << std::endl;

And the results are,
From direct API:rgb(76,76,76)

(Icontheme:8824): Gtk-WARNING **: /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkstylecontext.c:1781: widget class 'gtkmm__GtkButton' has no style property named 'color'
From get_style_property:0
 
As you can see, the foreground color property is correctly returned by the call to Gtk::StyleContext::get_color() function however the call to Gtk::StyleContext::get_style_property only results in a warning.

Is 'color' really not a valid style property? On using GtkInspector I could see that there is a property by name 'color'.

I did some digging and found the function _gtk_style_context_peek_property which is apparently used by all other internal functions to fetch style property values. How to access this function, because it looks like a private function that is not wrapped by GTKMM? Is there any other API that could be used to do the same job.

My search for property names ended in GQuarks and hashtable with no results! Any pointers in the right direction would be much appreciated.


On Tue, Feb 18, 2020 at 6:20 PM Gowthami S D <gowthami sd skanray com> wrote:
please help me..How to fetch the custom style properties through gtkmm..If you people send me the sample code it will be more helpful.

On Tue, Feb 18, 2020 at 5:30 PM <gtkmm-list-request gnome org> wrote:
Send gtkmm-list mailing list submissions to
        gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
        gtkmm-list-request gnome org

You can reach the person managing the list at
        gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

   1. Fetching gtkmm custom css style properties (Gowthami S D)


----------------------------------------------------------------------

Message: 1
Date: Mon, 17 Feb 2020 17:42:52 +0530
From: Gowthami S D <gowthami sd skanray com>
To: gtkmm-list gnome org
Subject: Fetching gtkmm custom css style properties
Message-ID:
        <CAJ3regXZSNXAT9Lm5sTQmZnM9FfP7udKcdmydbEHMx=cDvSP-w mail gmail com>
Content-Type: text/plain; charset="utf-8"

Hello Sir,
Can you send me the sample examples for the get_style_properties_value API
in gtkmm3.0.I had done R and D about this API but I got only the class
references and one line explanation.









Thanks and Regards
Gowthami

--


--
*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.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20200217/0d582ad4/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


------------------------------

End of gtkmm-list Digest, Vol 189, Issue 4
******************************************



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.


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