Curses::UI::Window(3)

✨ Curses::UI::Window(3) ✨

Okay bestie, so we're looking at the manual page for Curses::UI::Window(3) from the User Contributed Perl Documentation, and it's literally giving main character energy in the widget world πŸ’…


🌸 NAME 🌸

Curses::UI::Window β€” create and manipulate Window widgets, periodt. This is the icon, the moment, the window wrapper you didn't know you needed πŸͺŸβœ¨


πŸ¦‹ CLASS HIERARCHY πŸ¦‹

Okay so the vibe check here is that Curses::UI::Window is deep in the family tree. It inherits from Curses::UI::Container, which inherits from Curses::UI::Widget. The way that hierarchy is set up is honestly so organized:

Curses::UI::Widget
   |
   +----Curses::UI::Container
           |
           +----Curses::UI::Window

Like, it's giving generational wealth of functionality πŸ§¬πŸ‘‘


🌈 SYNOPSIS 🌈

Here's how you bring this baby into existence. No cap, it's this easy:

use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add(
    'window_id', 'Window',
    %options,
);

You literally just use Curses::UI, make a new instance, and then add a Window with whatever %options your heart desires. Slay πŸ’–


πŸ’œ DESCRIPTION πŸ’œ

So Curses::UI::Window is a window widget β€” that's the whole assignment. You can add it to a Curses::UI instance, and after that you fill it with other widgets to create an actual application window. It's like the blank canvas of your terminal UI dreams 🌟

For the tea on how to fill the window with widgets, you gotta check out Curses::UI::Container. That's where the details live, bestie.


πŸŽ€ STANDARD OPTIONS πŸŽ€

These are the standard options that come with the territory. We're talking:

  • -parent
  • -x
  • -y
  • -width
  • -height
  • -pad
  • -padleft
  • -padright
  • -padtop
  • -padbottom
  • -ipad
  • -ipadleft
  • -ipadright
  • -ipadtop
  • -ipadbottom
  • -title
  • -titlefullwidth
  • -titlereverse
  • -onfocus
  • -onblur

For an explanation of these standard options, see Curses::UI::Widget. That's the parent manual, okay? It's got the lore πŸ‘‘


πŸ“ WIDGET-SPECIFIC OPTIONS πŸ“

So there's this one specific option that makes windows do a cute little trick:

  • -centered < BOOLEAN > β€” bestie, this lets a window automatically be drawn in the center of the screen. To enable it, use a true value; to disable it, use a false value. The default is not to center a window. Here's the example so you can see it in action:
$cui->add('mywindow', 'Window', -centered => 1);

It's giving "I want my window right in the middle, looking cute and centered" πŸ’…πŸŽ―


πŸ’… METHODS πŸ’…

Okay so there are standard methods and then there are the special ones. Let's get into it:

  • new ( OPTIONS ) β€” standard construction situation.
  • layout ( ) β€” standard layout method.
  • draw ( BOOLEAN ) β€” standard draw method.
  • focus ( ) β€” standard focus method.
  • onFocus ( CODEREF ) β€” standard focus callback situation.
  • onBlur ( CODEREF ) β€” standard blur callback situation.
  • intellidraw ( ) β€” standard intellidraw method.

All of the above are standard methods. See Curses::UI::Widget for the full explanation, because that's where the standard method lore lives πŸ“š

Now for the modal focus ones:

  • modalfocus ( ) β€” if you call this method, the window will get modal focus. What does that mean? It means all events will be sent to this window. Like, every single one. It's main character energy to the max. By calling the loose_focus method, the window will loose its focus. (Yes, "loose" β€” that's how it's spelled in the original, we don't fix it, we accept it πŸ’€)
  • loose_focus ( ) β€” this method will have the window loose its focus. And yes, using this method you can also let a modal focused window loose its focus. So if your window is acting all modal and possessive, loose_focus is the way to free it πŸ•ŠοΈ

πŸ”₯ SEE ALSO πŸ”₯

You already know these are the besties:

  • Curses::UI
  • Curses::UI::Container
  • Curses::UI::Widget

Go read those if you want the full picture, iykyk πŸ‘€


πŸ‘‘ AUTHOR πŸ‘‘

Copyright (c) 2001-2002 Maurice Makaay. All rights reserved. That's the original icon right there 🫢

Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de) β€” send him some love if this widget serves you well ✨

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself. So like, use it however, just don't come for anyone if it breaks, okay? πŸ˜­πŸ’–


Final vibe check: this manual page is perl v5.42.2 from 2023-07-03, and it's called Curses::UI::Window(3). We love a classic. Now go build something iconic with your windows, bestie. No cap, you're gonna ate this πŸ†βœ¨πŸ’œ
πŸ“¦ where this page comes from