Gtk2::Viewport(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

✨ NAME ✨

Gtk2::Viewport β€” bestie, it's literally just a wrapper for GtkViewport πŸ’…

Like. That's the whole thing. It's the Perl-side glow-up of the C widget. Let's get into it 🫢


🌸 HIERARCHY 🌸

Okay so the family tree? Iconic lineage, no cap:

Glib::Object
+----Glib::InitiallyUnowned
     +----Gtk2::Object
          +----Gtk2::Widget
               +----Gtk2::Container
                    +----Gtk2::Bin
                         +----Gtk2::Viewport

Six generations of ancestors. Main character energy all the way down πŸ‘‘


πŸ¦‹ INTERFACES πŸ¦‹

This thing also implements:

  • Glib::Object::_Unregistered::AtkImplementorIface
  • Gtk2::Buildable

Yes bestie, accessibility AND buildable support. She does it all ✨


πŸ’– METHODS πŸ’–

widget = Gtk2::Viewport->new ($hadjustment=undef, $vadjustment=undef)

Make a brand new viewport, fr fr. She takes two args, both optional (they default to undef):

  • $hadjustment β€” a Gtk2::Adjustment or undef
  • $vadjustment β€” a Gtk2::Adjustment or undef

window or undef = $viewport->get_bin_window

Grabs the bin window, or undef if there isn't one. Heads up: Since: gtk+ 2.20 ⭐


adjustment = $viewport->get_hadjustment

$viewport->set_hadjustment ($adjustment)

Getter/setter duo for the horizontal adjustment πŸŽ€

  • $adjustment β€” a Gtk2::Adjustment

shadowtype = $viewport->get_shadow_type

$viewport->set_shadow_type ($type)

Read it, write it. The shadow type of the box around the viewport 🌈

  • $type β€” a Gtk2::ShadowType

adjustment = $viewport->get_vadjustment

$viewport->set_vadjustment ($adjustment)

Same vibe as the horizontal one but, you know, vertical πŸ’œ

  • $adjustment β€” a Gtk2::Adjustment

window or undef = $viewport->get_view_window

The view window, or undef. Since: gtk+ 2.22 πŸ”₯


πŸŽ€ PROPERTIES πŸŽ€

'hadjustment' (Gtk2::Adjustment : default undef : readable / writable / construct / private / static-nick / static-blurb)

The GtkAdjustment that determines the values of the horizontal position for this viewport.

'shadow-type' (Gtk2::ShadowType : default "in" : readable / writable / private / static-nick / static-blurb)

Determines how the shadowed box around the viewport is drawn.

'vadjustment' (Gtk2::Adjustment : default undef : readable / writable / construct / private / static-nick / static-blurb)

The GtkAdjustment that determines the values of the vertical position for this viewport.

Note the default on 'shadow-type' is literally "in", bestie. That's the vibe out of the box πŸ’…

πŸ”₯ SIGNALS πŸ”₯

set-scroll-adjustments (Gtk2::Viewport, Gtk2::Adjustment, Gtk2::Adjustment)

That's the signal, and those are the three things it hands you: the viewport itself, then two Gtk2::Adjustments. Slay 🫢


🌈 ENUMS AND FLAGS 🌈

enum Gtk2::ShadowType

The full menu, no skips:

  • 'none' / GTK_SHADOW_NONE
  • 'in' / GTK_SHADOW_IN
  • 'out' / GTK_SHADOW_OUT
  • 'etched-in' / GTK_SHADOW_ETCHED_IN
  • 'etched-out' / GTK_SHADOW_ETCHED_OUT

Perl-side name on the left, C constant on the right. iykyk πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

Go read these too, bestie, they're the whole friend group:

  • Gtk2
  • Glib::Object
  • Glib::InitiallyUnowned
  • Gtk2::Object
  • Gtk2::Widget
  • Gtk2::Container
  • Gtk2::Bin

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


And that's the page, babe β€” this doc came to you via perl v5.42.0, dated 2025-07-25. Go build something cute with it 🧚✨

πŸ“¦ where this page comes from