gc1
Joined: 18 Feb 2010 Posts: 7
|
Posted: Tue Mar 02, 2010 1:57 pm Post subject: |
|
|
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. |
|