Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Public Attributes | Private Member Functions | List of all members
cadabra::CodeInput Class Reference

Description

A text cell editor widget with support for editing Python and LaTeX.

CodeInput is essentially a TextView with some additional i/o logic.

#include <CodeInput.hh>

Inheritance diagram for cadabra::CodeInput:

Classes

class  exp_input_tv
 The actual text widget used by CodeInput. More...
 

Public Member Functions

 CodeInput (DTree::iterator, Glib::RefPtr< Gtk::TextBuffer >, double scale, int font_step)
 Initialise with existing TextBuffer and a pointer to the Datacell corresponding to this CodeInput widget. More...
 
 CodeInput (DTree::iterator, const std::string &, double scale, int font_step)
 Initialise with a new TextBuffer (to be created by CodeInput), filling it with the content of the given string. More...
 
void set_font_size (int num)
 Set the font size, 0 being default, negative smaller, positive larger. More...
 
bool handle_button_press (GdkEventButton *)
 Handle mouse buttons. More...
 
void handle_insert (const Gtk::TextIter &pos, const Glib::ustring &text, int bytes)
 Handle an insert event, which can consist of one or more inserted characters. More...
 
void handle_erase (const Gtk::TextIter &start, const Gtk::TextIter &end)
 Handle an erase event. More...
 
void update_buffer ()
 Ensure that the visual representation matches the DTree cell. More...
 
void slice_cell (std::string &before, std::string &after)
 Return two strings corresponding to the text before and after the current cursor position. More...
 

Public Attributes

Glib::RefPtr< Gtk::TextBuffer > buffer
 We cannot edit the content of the DataCell directly, because Gtk needs a Gtk::TextBuffer. More...
 
exp_input_tv edit
 

Private Member Functions

void init (int font_step)
 

Constructor & Destructor Documentation

CodeInput::CodeInput ( DTree::iterator  it,
Glib::RefPtr< Gtk::TextBuffer >  tb,
double  scale,
int  font_step 
)

Initialise with existing TextBuffer and a pointer to the Datacell corresponding to this CodeInput widget.

CodeInput is not allowed to modify this DataCell directly, but can read properties from it (e.g. in order to know when to display a 'busy' indicator). The scale parameter refers to hdpi scaling.

CodeInput::CodeInput ( DTree::iterator  it,
const std::string &  txt,
double  scale,
int  font_step 
)

Initialise with a new TextBuffer (to be created by CodeInput), filling it with the content of the given string.

Member Function Documentation

bool CodeInput::handle_button_press ( GdkEventButton *  button)

Handle mouse buttons.

void CodeInput::handle_erase ( const Gtk::TextIter &  start,
const Gtk::TextIter &  end 
)

Handle an erase event.

This function will just massage that data and then feed it through to the notebook window class by emitting a signal on content_erase (done like this to separate DTree modification from the widget).

void CodeInput::handle_insert ( const Gtk::TextIter &  pos,
const Glib::ustring &  text,
int  bytes 
)

Handle an insert event, which can consist of one or more inserted characters.

This function will just massage that data and then feed it through to the notebook window class by emitting a signal on content_insert (done like this to separate DTree modification from the widget).

void CodeInput::init ( int  font_step)
private
void CodeInput::set_font_size ( int  num)

Set the font size, 0 being default, negative smaller, positive larger.

void CodeInput::slice_cell ( std::string &  before,
std::string &  after 
)

Return two strings corresponding to the text before and after the current cursor position.

void CodeInput::update_buffer ( )

Ensure that the visual representation matches the DTree cell.

Member Data Documentation

Glib::RefPtr<Gtk::TextBuffer> cadabra::CodeInput::buffer

We cannot edit the content of the DataCell directly, because Gtk needs a Gtk::TextBuffer.

However, the CodeInput widgets corresponding to a single DataCell all share their TextBuffer.

exp_input_tv cadabra::CodeInput::edit

The documentation for this class was generated from the following files: