Author image Kevin Ryde
and 1 contributors


Gtk2::Ex::Dashes -- widget displaying row of dashes


 use Gtk2::Ex::Dashes;
 my $dashes = Gtk2::Ex::Dashes->new;


Gtk2::Ex::Dashes is a subclass of Gtk2::Misc.



A Gtk2::Ex::Dashes widget displays a line of dashes, either horizontally or vertically.

    |                                |
    |  ====  ====  ====  ====  ====  |
    |                                |

It's similar to Gtk2::Separator, but a dashed line, and the Gtk2::Ex::Dashes::MenuItem subclass looks like Gtk2::TearoffMenuItem but is a plain item, not driving the menu.

Line segments are drawn per the widget style (see Gtk2::Style) and positioned in the widget area per the Gtk2::Misc properties described below. There's nothing to control the length and spacing of the line segments, currently they just scale with the line thickness to keep the display sensible.

See examples/ or examples/ in the sources for the simplest usage, or examples/ to interactively see the effect of settings.


$dashes = Gtk2::Ex::Dashes->new (key=>value,...)

Create and return a new Dashes widget. Optional key/value pairs can be given to set initial properties, as per Glib::Object->new.

    my $dashes = Gtk2::Ex::Dashes->new
                   (xalign => 0, direction => 'vertical');


orientation (Gtk2::Orientation enum, default "horizontal")

Whether to draw a horizontal line or a vertical line.

xalign (float, default 0.5)
yalign (float, default 0.5)

These Gtk2::Misc properties control positioning of the line within its allocated area. The default 0.5 means centre it.

xalign for a horizontal line can be thought of as positioning one dash segment somewhere between the left and right ends, and then the further segments drawn each way from there to fill the window. Similarly yalign when vertical.

If the widget text direction (see set_direction in Gtk2::Widget) is rtl then the sense of xalign is reversed, so 0 means the right edge instead of the left.


Gtk2::Ex::Dashes::MenuItem, Gtk2::Misc, Gtk2::Separator, Gtk2::TearoffMenuItem



Gtk2-Ex-Dashes is Copyright 2010, 2011, 2019 Kevin Ryde

Gtk2-Ex-Dashes is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Gtk2-Ex-Dashes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Gtk2-Ex-Dashes. If not, see