Reputation: 120634
I would like to know the correct and generally accepted way of adding a top and bottom margin to a GtkTextView
that is inside of a GtkScrolledWindow
. There are functions to set the left and right margin, which I am using:
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(editor_text_view), 2);
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(editor_text_view), 2);
But I can't seem to find any documentation on top and bottom. I've tried changing the border width of the GtkTextView
with gtk_container_set_border_width
but the border is not painted with the background color of the GtkTextView
.
Basically - what I have is on the left and what I want is on the right.
Upvotes: 8
Views: 3470
Reputation: 364249
I just had to solve similar issue and I nested the text view in GtkAlignment - that gave me an option to set padding for all sides.
Upvotes: 1
Reputation: 1175
I'm using Ubuntu Natty with gtk+-3.2.3. and those CSS properties don't have any affect for some reason.
But you can use: gtk_text_view_set_border_window_size( )
Along with: GTK_TEXT_WINDOW_TOP and GTK_TEXT_WINDOW_BOTTOM
And the border color will match the background of the GtkTextView.
http://developer.gnome.org/gtk3/3.4/GtkTextView.html#gtk-text-view-set-border-window-size
Upvotes: 2
Reputation: 302
You should use CSS for this things in GTK+ 3:
http://developer.gnome.org/gtk3/3.3/GtkCssProvider.html
Maybe you can use the view class:
.view {
padding: 3px;
}
Or only apply the style to the GtkTextView:
GtkTextView {
padding: 3px;
}
Upvotes: 4