cgv
Loading...
Searching...
No Matches
text_editor.cxx
1#include "text_editor.h"
2#include "gui_driver.h"
3
4namespace cgv {
5 namespace gui {
6
7
9text_editor_ptr create_text_editor(unsigned int w, unsigned int h, const std::string& title, int x, int y)
10{
12 if (d.empty())
13 return text_editor_ptr();
14 return d->create_text_editor(w,h,title,x,y);
15}
16
21
26
31
36
37
39void text_editor_callback_handler::on_text_insertion(int /*text_pos*/, int /*nr_inserted*/)
40{
41}
42
45{
46}
47
49text_editor::text_editor(const std::string& name, text_editor_callback_handler* _handler) :
50 named(name), handler(_handler)
51{
52}
63
68
69 }
70}
reference counted pointer, which can work together with types that are derived from ref_counted,...
Definition ref_ptr.h:160
bool empty() const
check if pointer is not yet set
Definition ref_ptr.h:230
virtual ~text_editor()
virtual destructor
const text_editor_callback_handler * get_callback_handler() const
return current callback handler
text_editor_callback_handler * handler
store a callback handler
Definition text_editor.h:45
text_editor(const std::string &name, text_editor_callback_handler *_handler=0)
construct from callback handler
void set_callback_handler(text_editor_callback_handler *_handler)
set a new callback handler
gui_driver_ptr get_gui_driver()
return the currently registered gui driver or an empty pointer if non has been registered
data::ref_ptr< text_editor > text_editor_ptr
ref counted pointer to abst control
Definition text_editor.h:86
text_editor_ptr create_text_editor(unsigned int w, unsigned int h, const std::string &title, int x, int y)
construct a new text editor in a separate window of given size, title and position
the cgv namespace
Definition print.h:11
implement this interface to interact with the text editor
Definition text_editor.h:14
virtual void after_read()
called when new file has been read
virtual void after_save()
called when text has been saved
virtual void on_update_callback()
called when text has been saved
virtual void on_text_insertion(int text_pos, int nr_inserted)
called when nr_inserted characters have been inserted at text_pos
virtual void on_text_deletion(int text_pos, int nr_deleted, const char *deleted_text)
called when the nr_deleted characters in deleted_text have been deleted at text position text_pos
virtual void on_close_editor()
called when the editor window is closed