2016-05-02 22:01:55 +02:00
|
|
|
/** @file
|
2013-10-20 18:14:22 +02:00
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
|
|
|
* @license GPL v3 (see license file)
|
|
|
|
*/
|
2016-05-02 22:01:55 +02:00
|
|
|
#pragma once
|
2016-10-03 22:01:55 +02:00
|
|
|
#include <etk/types.hpp>
|
|
|
|
#include <ewol/object/Object.hpp>
|
|
|
|
#include <appl/Gui/TextViewer.hpp>
|
|
|
|
#include <ewol/compositing/Text.hpp>
|
|
|
|
#include <appl/TextPlugin.hpp>
|
2013-10-20 18:14:22 +02:00
|
|
|
|
|
|
|
namespace appl {
|
2015-08-11 23:21:41 +02:00
|
|
|
class textPluginManager : public gale::Resource {
|
2014-09-18 22:27:54 +02:00
|
|
|
private:
|
2016-07-19 22:03:39 +02:00
|
|
|
ememory::WeakPtr<appl::TextViewer> m_currentViewer;
|
2017-10-09 10:25:41 +02:00
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_list;
|
2017-08-28 00:09:10 +02:00
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventEntry;
|
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventInput;
|
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnWrite;
|
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReplace;
|
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnRemove;
|
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReceiveShortCutViewer;
|
|
|
|
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnCursorMove;
|
2014-09-18 22:27:54 +02:00
|
|
|
protected:
|
|
|
|
textPluginManager();
|
2017-08-28 00:09:10 +02:00
|
|
|
void init(const etk::String& _name);
|
2014-09-18 22:27:54 +02:00
|
|
|
public:
|
|
|
|
DECLARE_RESOURCE_SINGLE_FACTORY(textPluginManager, "plugin-Manager");
|
|
|
|
virtual ~textPluginManager() {};
|
|
|
|
/**
|
|
|
|
* @brief Add default plugin list
|
|
|
|
*/
|
|
|
|
void addDefaultPlugin();
|
|
|
|
/**
|
|
|
|
* @brief Add a plugin.
|
|
|
|
* @param[in] _plugin Plugin pointer to add.
|
|
|
|
*/
|
2016-07-19 22:03:39 +02:00
|
|
|
void addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin);
|
2014-09-18 22:27:54 +02:00
|
|
|
/**
|
|
|
|
* @brief connect a new widget to the plugin.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
*/
|
|
|
|
void connect(appl::TextViewer& _widget);
|
|
|
|
/**
|
|
|
|
* @brief dis-connect a new widget to the plugin.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
*/
|
|
|
|
void disconnect(appl::TextViewer& _widget);
|
|
|
|
/**
|
|
|
|
* @brief On entry event call.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _event Generic event.
|
|
|
|
* @return true if the event might not propagate anymore.
|
|
|
|
*/
|
|
|
|
bool onEventEntry(appl::TextViewer& _widget,
|
|
|
|
const ewol::event::Entry& _event);
|
|
|
|
/**
|
|
|
|
* @brief On Input event call.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _event Generic event.
|
|
|
|
* @return true if the event might not propagate anymore
|
|
|
|
*/
|
|
|
|
bool onEventInput(appl::TextViewer& _textDrawer,
|
|
|
|
const ewol::event::Input& _event);
|
|
|
|
/**
|
|
|
|
* @brief Called when data is written in the buffer.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _pos Position in the buffer where data might be witten.
|
|
|
|
* @param[in] _data Input stream written.
|
|
|
|
* @return true if the event might not propagate anymore
|
|
|
|
*/
|
|
|
|
bool onWrite(appl::TextViewer& _textDrawer,
|
|
|
|
const appl::Buffer::Iterator& _pos,
|
2017-08-28 00:09:10 +02:00
|
|
|
const etk::String& _data);
|
2014-09-18 22:27:54 +02:00
|
|
|
/**
|
|
|
|
* @brief Called when data is written in the buffer, and some are removed.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _pos Position in the buffer where data might be witten.
|
|
|
|
* @param[in] _data Input stream written.
|
|
|
|
* @param[in] _posEnd end replace position.
|
|
|
|
* @return true if the event might not propagate anymore
|
|
|
|
*/
|
|
|
|
bool onReplace(appl::TextViewer& _textDrawer,
|
|
|
|
const appl::Buffer::Iterator& _pos,
|
2017-08-28 00:09:10 +02:00
|
|
|
const etk::String& _data,
|
2014-09-18 22:27:54 +02:00
|
|
|
const appl::Buffer::Iterator& _posEnd);
|
|
|
|
/**
|
|
|
|
* @brief Called when data is removed.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _pos Position in the buffer where data might be witten.
|
|
|
|
* @param[in] _posEnd end replace position.
|
|
|
|
* @return true if the event might not propagate anymore
|
|
|
|
*/
|
|
|
|
bool onRemove(appl::TextViewer& _textDrawer,
|
|
|
|
const appl::Buffer::Iterator& _pos,
|
|
|
|
const appl::Buffer::Iterator& _posEnd);
|
|
|
|
/**
|
|
|
|
* @brief Called when a message arrive.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _shortCutName shortcut properties.
|
|
|
|
* @return true if the event might not propagate anymore
|
|
|
|
*/
|
|
|
|
bool onReceiveShortCut(appl::TextViewer& _textDrawer,
|
2017-08-28 00:09:10 +02:00
|
|
|
const etk::String& _shortCutName);
|
2014-09-18 22:27:54 +02:00
|
|
|
/**
|
|
|
|
* @brief Called when Cursor move of position.
|
|
|
|
* @param[in] _widget Reference on the widget caller.
|
|
|
|
* @param[in] _pos New cursor position.
|
|
|
|
* @return true if the event might not propagate anymore
|
|
|
|
*/
|
|
|
|
bool onCursorMove(appl::TextViewer& _textDrawer,
|
|
|
|
const appl::Buffer::Iterator& _pos);
|
2013-10-20 18:14:22 +02:00
|
|
|
};
|
2016-05-02 22:01:55 +02:00
|
|
|
}
|
2013-10-20 18:14:22 +02:00
|
|
|
|