Padre::Wx::Role::Main - Convenience methods for children of the main window


Padre documentation Contained in the Padre distribution.

Index


Code Index:

NAME

Top

Padre::Wx::Role::Main - Convenience methods for children of the main window

DESCRIPTION

Top

This role implements the fairly common method pattern for Wx elements that are children of Padre::Wx::Main.

It provides accessors for easy access to the most commonly needed elements, and shortcut integration with the Padre::Current context system.

METHODS

Top

ide

    my $ide = $object->ide;

Get the Padre IDE instance that this object is a child of.

config

    my $config = $object->config;

Get the Padre::Config for the current user. Provided mainly as a convenience because it is needed so often.

Please note that this method does NOT integrate with the Padre::Current context system. Any project-specific configuration of overrides of default behaviour will not be present in this configuration object.

For a project-aware configuration, use the following instead.

  $self->current->config;

main

    my $main = $object->main;

Get the Padre::Wx::Main main window that this object is a child of.

aui

    my $aui = $object->aui;

Convenient access to the Wx Advanced User Interface (AUI) Manager object.

current

    my $current = $object->current;

Get a new Padre::Current context object, for access to other parts of the current context.

COPYRIGHT & LICENSE

Top


Padre documentation Contained in the Padre distribution.
package Padre::Wx::Role::Main;

use 5.008;
use strict;
use warnings;
use Params::Util   ();
use Padre::Current ();

our $VERSION = '0.86';

sub ide {
	shift->main->ide;
}

sub config {
	shift->main->config;
}

sub main {
	my $main = shift->GetParent;
	while ( not Params::Util::_INSTANCE( $main, 'Padre::Wx::Main' ) ) {
		$main = $main->GetParent or return Padre::Current->main;
	}
	return $main;
}

sub aui {
	shift->main->aui;
}

sub current {
	Padre::Current->new( main => shift->main );
}

1;