www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GtkD help

reply Ivan Trombley <itrombley dot-borg.org> writes:
I have this small application for viewing select log data from a 
certain game that I originally wrote in C++/Qt. For various 
reasons, I decided to rewrite this app in D using gtk-d. First, I 
have to say that the documentation for gtk-d is atrocious! 
However, I managed to cobble together enough information to get 
80% of it done.

I would like to be able to controll how the cells in a TreeView 
are rendered (ie the text color used) but I'm not able to find 
any information about how to do this. Does any one have 
experience here? If so, can you please give me a clue?
Nov 18
next sibling parent reply Ivan Trombley <itrombley dot-borg.org> writes:
Any information about using gio.Settings would be really 
appreciated too.
Nov 18
parent reply Antonio Corbi <acorbi ggmail.xml> writes:
On Saturday, 18 November 2017 at 22:31:15 UTC, Ivan Trombley 
wrote:
 Any information about using gio.Settings would be really 
 appreciated too.
Hi Ivan, I would recommend you to search for information about Gtk under valadoc pages [1]. You'll get Vala syntax but doing the mental-mapping to D+GtkD is automatic, i.e TreeView [2] and Glib Settings [3]. A. Corbi [1] https://valadoc.org/index.htm [2] https://valadoc.org/gtk+-3.0/Gtk.TreeView.html [3] https://valadoc.org/gio-2.0/GLib.Settings.html
Nov 19
parent Ivan Trombley <itrombley dot-borg.org> writes:
On Sunday, 19 November 2017 at 09:54:06 UTC, Antonio Corbi wrote:
 On Saturday, 18 November 2017 at 22:31:15 UTC, Ivan Trombley 
 wrote:
 Any information about using gio.Settings would be really 
 appreciated too.
Hi Ivan, I would recommend you to search for information about Gtk under valadoc pages [1]. You'll get Vala syntax but doing the mental-mapping to D+GtkD is automatic, i.e TreeView [2] and Glib Settings [3]. A. Corbi [1] https://valadoc.org/index.htm [2] https://valadoc.org/gtk+-3.0/Gtk.TreeView.html [3] https://valadoc.org/gio-2.0/GLib.Settings.html
Thanks. I'll give it a look.
Nov 19
prev sibling next sibling parent reply Mike Wey <mike-wey example.com> writes:
On 18-11-17 22:57, Ivan Trombley wrote:
 I have this small application for viewing select log data from a certain 
 game that I originally wrote in C++/Qt. For various reasons, I decided 
 to rewrite this app in D using gtk-d. First, I have to say that the 
 documentation for gtk-d is atrocious! However, I managed to cobble 
 together enough information to get 80% of it done.
 
 I would like to be able to controll how the cells in a TreeView are 
 rendered (ie the text color used) but I'm not able to find any 
 information about how to do this. Does any one have experience here? If 
 so, can you please give me a clue?
To change how a cell is rendered you will need to add a CellRenderer to the column, a CellRendererText would be used for rendering text and it has a foreground property to change the text color. A small example on using CellRenderers can be found here: https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/DemoMultiCellRenderer/DemoMultiCellRenderer.d If the color needs to differ between the different rows you can use TreeViewColumn.addAttribute to map a property of an renderer to a value on the TreeModel. If the color depends on the value of the cell TreeViewColumn.setCellDataFunc() is also an option. -- Mike Wey
Nov 19
parent Ivan Trombley <itrombley dot-borg.org> writes:
On Sunday, 19 November 2017 at 13:59:10 UTC, Mike Wey wrote:
 On 18-11-17 22:57, Ivan Trombley wrote:
 [...]
To change how a cell is rendered you will need to add a CellRenderer to the column, a CellRendererText would be used for rendering text and it has a foreground property to change the text color. A small example on using CellRenderers can be found here: https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/DemoMultiCellRenderer/DemoMultiCellRenderer.d If the color needs to differ between the different rows you can use TreeViewColumn.addAttribute to map a property of an renderer to a value on the TreeModel. If the color depends on the value of the cell TreeViewColumn.setCellDataFunc() is also an option.
Thanks. It looks like setCellDataFunc is what I need.
Nov 19
prev sibling parent reply Ivan Trombley <itrombley dot-borg.org> writes:
Since I wanted people to just be able to run the executable and 
not have to go through some install process, glib.Settings turned 
out to be a no-go since it requires a schema file to be installed 
in a specific place. Instead, I just create a json sidecar file 
next to the app in order to store settings.

I solved the TreeView text cooler l color issue by using markup.

The application code is in this repository of anyone is 
interested: https://github.com/Barugon/CotA
Nov 20
parent Ivan Trombley <itrombley dot-borg.org> writes:
On Monday, 20 November 2017 at 08:01:28 UTC, Ivan Trombley wrote:
 I solved the TreeView text cooler l color issue by using markup.
Phoned.
Nov 20