diff options
author | Robin Gareus <robin@gareus.org> | 2019-08-07 17:32:05 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-08-07 17:40:23 +0200 |
commit | 2970ce2f5994fb40ecafe6a0bcdc356bc0fa20f7 (patch) | |
tree | 872d36a5022362565f856484ec0b113f9492910e /gtk2_ardour/luainstance.cc | |
parent | 7020c40fc463727d9a7436da7921613aebf2b5c6 (diff) |
Add Lua bindings for Pango Alignment
Diffstat (limited to 'gtk2_ardour/luainstance.cc')
-rw-r--r-- | gtk2_ardour/luainstance.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc index 268fa8bf39..1d390e65fe 100644 --- a/gtk2_ardour/luainstance.cc +++ b/gtk2_ardour/luainstance.cc @@ -266,6 +266,22 @@ class PangoLayout { return _layout->is_ellipsized (); } + /** Sets the alignment for the layout: how partial lines are + * positioned within the horizontal space available. + * @param alignment The alignment. + */ + void set_alignment(Pango::Alignment alignment) { + _layout->set_alignment (alignment); + } + + /** Gets the alignment for the layout: how partial lines are + * positioned within the horizontal space available. + * @return The alignment. + */ + Pango::Alignment get_alignment() const { + return _layout->get_alignment (); + } + /** Sets the wrap mode; the wrap mode only has effect if a width * is set on the layout with set_width(). * To turn off wrapping, set the width to -1. @@ -312,7 +328,6 @@ class PangoLayout { return 2; } - /** Draws a Layout in the specified Cairo @a context. The top-left * corner of the Layout will be drawn at the current point of the * cairo context. @@ -650,6 +665,8 @@ LuaInstance::bind_cairo (lua_State* L) .addFunction ("set_ellipsize", &LuaCairo::PangoLayout::set_ellipsize) .addFunction ("get_ellipsize", &LuaCairo::PangoLayout::get_ellipsize) .addFunction ("is_ellipsized", &LuaCairo::PangoLayout::is_ellipsized) + .addFunction ("set_alignment", &LuaCairo::PangoLayout::set_alignment) + .addFunction ("get_alignment", &LuaCairo::PangoLayout::get_alignment) .addFunction ("set_wrap", &LuaCairo::PangoLayout::set_wrap) .addFunction ("get_wrap", &LuaCairo::PangoLayout::get_wrap) .addFunction ("is_wrapped", &LuaCairo::PangoLayout::is_wrapped) @@ -663,6 +680,12 @@ LuaInstance::bind_cairo (lua_State* L) .addConst ("End", Pango::ELLIPSIZE_END) .endNamespace () + .beginNamespace ("Alignment") + .addConst ("Left", Pango::ALIGN_LEFT) + .addConst ("Center", Pango::ALIGN_CENTER) + .addConst ("Right", Pango::ALIGN_RIGHT) + .endNamespace () + .beginNamespace ("WrapMode") .addConst ("Word", Pango::WRAP_WORD) .addConst ("Char", Pango::WRAP_CHAR) |