1Padre::Current(3) User Contributed Perl Documentation Padre::Current(3)
2
3
4
6 Padre::Current - convenient access to current objects within Padre
7
9 my $main = Padre::Current->main;
10 ...
11
13 Padre uses lots of objects from different classes. And one needs to
14 have access to the current object of this sort or this other to do
15 whatever is need at the time.
16
17 Instead of poking directly with the various classes to find the object
18 you need, "Padre::Current" provides a bunch of handy methods to
19 retrieve whatever current object you need.
20
22 new
23 # Vanilla constructor
24 Padre::Current->new;
25
26 # Seed the object with some context
27 Padre::Current->new( document => $document );
28
29 The "new" constructor creates a new context object, it optionally takes
30 one or more named parameters which should be any context the caller is
31 aware of before he calls the constructor.
32
33 Providing this seed context allows the context object to derive parts
34 of the current context from other parts, without the need to fall back
35 to the last-resort "Padre->ide" singleton-fetching method.
36
37 Many objects in Padre that are considered to be part of them context
38 will have a "current" method which automatically creates the context
39 object with it as a seed.
40
41 Returns a new Padre::Current object.
42
43 "ide"
44 Return the Padre singleton for the IDE instance.
45
46 "config"
47 Returns the current Padre::Config configuration object for the IDE.
48
49 "main"
50 Returns the Padre::Wx::Main object for the main window.
51
52 "notebook"
53 Returns the Padre::Wx::Notebook object for the main window.
54
55 "document"
56 Returns the active Padre::Document document object.
57
58 "editor"
59 Returns the Padre::Editor editor object for the active document.
60
61 "filename"
62 Returns the file name of the active document, if it has one.
63
64 "title"
65 Return the title of current editor window.
66
67 "project"
68 Return the "Padre::Project" project object for the active document.
69
70 "text"
71 Returns the selected text, or a null string if nothing is selected.
72
74 Copyright 2008-2010 The Padre development team as listed in Padre.pm.
75
76 This program is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79 The full text of the license can be found in the LICENSE file included
80 with this module.
81
82
83
84perl v5.12.1 2010-06-11 Padre::Current(3)