Source

Kephra / lib / Kephra / API.pm

Full commit
use strict;
use warnings;

package Kephra::API;

use Carp;
use Kephra::App::Window;
use Kephra::CommandList;
use Kephra::DocumentStash;
use Kephra::Keymap;
use Kephra::Log;

Kephra::CommandList::register_switch_var({
	'$app'    => 'app',
	'$doc'    => 'document',
	'$docbar' => 'docbar',
	'$editor' => 'editor',
});

sub app             { $Kephra::App::_ref }
sub main_window     { $Kephra::App::Window::_ref }
sub editor          { Kephra::DocumentStash::active_editor() }
sub docbar          { Kephra::App::Panel::Editor::active_docbar() }
sub document        { Kephra::DocumentStash::active_doc() }
sub all_documents   { Kephra::DocumentStash::all_doc() }
sub do_with_all_documents { }

sub focus             {$Kephra::App::Window::_ref->set_focus(@_)}
sub focus_back        {$Kephra::App::Window::_ref->set_focus_back()}

# IO-unit
sub input             { $Kephra::App::Panel::IOUnit::_ref->get_line() }
sub output            { $Kephra::App::Panel::IOUnit::_ref->output(@_) }
sub log               { $Kephra::App::Panel::IOUnit::_ref->output('log', @_) }
sub raise_output_slot { $Kephra::App::Panel::IOUnit::_ref->raise_slot(@_) }

sub configs  { }

# event table
sub add_event_callback {}
sub del_event_callback {}
sub trigger_event {}
sub freeze_event {}
sub thaw_event {}


# command list
sub add_command {}
sub del_command {}
sub run_command {}
sub command_status {}

# cmd line lang
sub run_sandrum_commands {}

# plugin API
sub register_plugin {}
sub get_plugin_status {}
sub get_plugin_data {}
sub available_plugins {}
sub unregister_plugin {}

1;

__END__

=head1 NAMESPACES

If you want to leave the recommended ways as proposed by this module
and call functions or data directly ...
here is an overview to the Kephra name space organisation.

to the namespace Kephra::Doc::* belongs also the module Kephra::Doc

=over 2

* Kephra

internals

* Kephra::API

interface all plugins and internal functions should use

* Kephra::App

all the Wx-GUI-related stuff, all visible parts

* Kephra::Config

data structures

* Kephra::Document

document properties, syntax modes

* Kephra::Edit

text processing

* Kephra::Plugin

plugin namespace
Kephra::API::Plugin is the base class for all plugins

=back