FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I set the color of a HSeparator or VSeparator object?

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
gc1



Joined: 18 Feb 2010
Posts: 7

PostPosted: Sun Feb 28, 2010 11:03 am    Post subject: How do I set the color of a HSeparator or VSeparator object? Reply with quote

I have tried setting the color of a gtk.HSeparator or gtk.VSeparator object using modifyFg(), modifyBg(), modifyText() and modifyBase(). None of these affect the separator's color, it remains grey.

Does anyone know how this can be done ? Do I need to use a Colormap and does anyone have an example ?
Back to top
View user's profile Send private message
gc1



Joined: 18 Feb 2010
Posts: 7

PostPosted: Tue Mar 02, 2010 1:57 pm    Post subject: Reply with quote

I'll answer my own question. I couldn't find a way of changing the color of a HSeparator or VSeparator object - but I found the following worked fine for objects to be attached to a gtk.Table object (to make horizontal or vertical row or column separator grid lines):

Code:

class TableSeparatorLine : gtk.DrawingArea.DrawingArea {
   this(gdk.Color.Color color) {
      super(1, 1);
      modifyBg(GtkStateType.NORMAL, color);
   }
}


This seems to work as the gtk.Table object resizes it's constituent elements when necessary.

E.g. a 2 x 2 table with green horizontal and vertical grid separator lines:

Code:

t = new Table(5, 5, false);
t.setColSpacing(0, 1);
t.setColSpacing(1, 100);
t.setColSpacing(2, 1);
t.setColSpacing(3, 100);
t.setColSpacing(4, 1);
t.setRowSpacing(0, 1);
t.setRowSpacing(1, 100);
t.setRowSpacing(2, 1);
t.setRowSpacing(3, 100);
t.setRowSpacing(4, 1);
t.attach(new Label("0,0", false), 1, 2, 1, 2, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 1, 1);
t.attach(new Label("0,1", false), 3, 4, 1, 2, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 1, 1);
t.attach(new Label("1,0", false), 1, 2, 3, 4, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 1, 1);
t.attach(new Label("1,1", false), 3, 4, 3, 4, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 1, 1);
grid_color = new Color(cast(ubyte)0, cast(ubyte)255, cast(ubyte)0);
t.attach(new TableSeparatorLine(grid_color), 0, 1, 0, 5, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 0, 0);
t.attach(new TableSeparatorLine(grid_color), 2, 3, 0, 5, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 0, 0);
t.attach(new TableSeparatorLine(grid_color), 4, 5, 0, 5, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 0, 0);
t.attach(new TableSeparatorLine(grid_color), 0, 5, 0, 1, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 0, 0);
t.attach(new TableSeparatorLine(grid_color), 0, 5, 2, 3, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 0, 0);
t.attach(new TableSeparatorLine(grid_color), 0, 5, 4, 5, GtkAttachOptions.FILL, GtkAttachOptions.FILL, 0, 0);


If a row or column size changes the grid lines grow or shrink to match.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group