Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WRAP_WIDTH, WRAP_MODE tags to cell_properties_text, supported since gtk 2.8 #146

Merged
merged 1 commit into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ let main () =
let window = GWindow.window () in
window#connect#destroy ~callback:GMain.quit;
let view = GTree.view ~model ~packing:window#add () in
(* Allow wrapping for title field *)
let col = GTree.view_column ~title:"Title" ()
~renderer:(GTree.cell_renderer_text[], ["text",title]) in
~renderer:(GTree.cell_renderer_text[`WRAP_WIDTH 150;
`WRAP_MODE `WORD_CHAR],
["text",title]) in
col#set_resizable true;
view#append_column col;
let col = GTree.view_column ~title:"Author" ()
~renderer:(GTree.cell_renderer_text[], ["text",author]) in
Expand Down
4 changes: 3 additions & 1 deletion src/gTree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,9 @@ type cell_properties_text_only =
| `STYLE of Pango.Tags.style
| `TEXT of string
| `UNDERLINE of Pango.Tags.underline
| `VARIANT of Pango.Tags.variant ]
| `VARIANT of Pango.Tags.variant
| `WRAP_MODE of Pango.Tags.wrap_mode
| `WRAP_WIDTH of int ]
type cell_properties_text =
[ cell_properties
| cell_properties_text_only
Expand Down
4 changes: 3 additions & 1 deletion src/gTree.mli
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,9 @@ type cell_properties_text =
| `TEXT of string
| `UNDERLINE of Pango.Tags.underline
| `VARIANT of Pango.Tags.variant
| `WEIGHT of Pango.Tags.weight ]
| `WEIGHT of Pango.Tags.weight
| `WRAP_MODE of Pango.Tags.wrap_mode
| `WRAP_WIDTH of int ]
type cell_properties_toggle =
[ cell_properties
| `ACTIVATABLE of bool
Expand Down
2 changes: 2 additions & 0 deletions src/gtkTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class CellRendererText vset : CellRenderer {
"variant-set" gboolean : Read / Write / NoVSet
"weight" gint : Read / Write
"weight-set" gboolean : Read / Write / NoVSet
"wrap-mode" PangoWrapMode : Read / Write
"wrap-width" gint : Read / Write
method set_fixed_height_from_font : "int -> unit"
signal edited : GtkTreePathString string
}
Expand Down
2 changes: 1 addition & 1 deletion tools/propcc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ let enums =
["ExtensionMode"; "WindowTypeHint"; "EventMask"; "Gravity";
(* for canvas *) "CapStyle"; "JoinStyle"; "LineStyle"];
"Pango", "PangoEnums",
["Stretch"; "Style"; "Underline"; "Variant"; "EllipsizeMode"];
["Stretch"; "Style"; "Underline"; "Variant"; "EllipsizeMode"; "WrapMode"];
(* GtkSourceView *)
"Gtk", "SourceView2Enums",
["SourceSmartHomeEndType"; "SourceDrawSpacesFlags"];
Expand Down
2 changes: 1 addition & 1 deletion tools/propcc.ml4
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let enums = [
[ "ExtensionMode"; "WindowTypeHint"; "EventMask"; "Gravity";
(* for canvas *) "CapStyle"; "JoinStyle"; "LineStyle" ];
"Pango", "PangoEnums",
[ "Stretch"; "Style"; "Underline"; "Variant"; "EllipsizeMode" ];
[ "Stretch"; "Style"; "Underline"; "Variant"; "EllipsizeMode"; "WrapMode" ];
(* GtkSourceView *)
"Gtk", "SourceView2Enums",
[ "SourceSmartHomeEndType"; "SourceDrawSpacesFlags" ];
Expand Down