sptk2 logo
SPTK Home Page
Public Member Functions | List of all members
sptk::CEditor Class Reference

Text editor widget. More...

#include <CEditor.h>

Inheritance diagram for sptk::CEditor:
sptk::CLayoutClient

Public Member Functions

 CEditor (int layoutSize=100, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
 
 ~CEditor () override
 
Fl_Text_Buffer * textBuffer ()
 
Fl_Text_Buffer * styleBuffer ()
 
bool preferredSize (int &w, int &h) override
 
void cursorRowCol (int &row, int &col)
 
bool wrapMode () const
 
void wrapMode (bool wm)
 
int handle (int event) override
 
- Public Member Functions inherited from sptk::CLayoutClient
 CLayoutClient (Fl_Widget *widget, int layoutSize, CLayoutAlign ca)
 
virtual ~CLayoutClient ()
 
CLayoutAlign layoutAlign () const
 
void layoutAlign (CLayoutAlign al)
 
int layoutSize () const
 
void layoutSize (int ls)
 
virtual void label (const String &l)
 
virtual const Stringlabel () const
 
void name (const char *aname)
 
void name (const String &aname)
 
const Stringname () const
 
virtual bool preferredSize (int &w, int &h)
 
virtual bool computeSize (int &w, int &h)
 
virtual String className () const
 
Fl_Widget * widget () const
 
virtual void load (const xdoc::SNode &node, CLayoutXMLmode xmlMode)
 
virtual void load (const std::shared_ptr< xdoc::Node > &node)
 
virtual void save (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) const
 

Additional Inherited Members

- Protected Member Functions inherited from sptk::CLayoutClient
int lastPreferredH () const
 
int lastPreferredW () const
 
void lastPreferredH (int height)
 
void lastPreferredW (int width)
 
- Protected Attributes inherited from sptk::CLayoutClient
Fl_Widget * m_widget
 
String m_name
 
String m_label
 
CLayoutAlign m_layoutAlign
 

Detailed Description

Text editor widget.

Class CEditor is the Fl_Text_Editor combined with the layout client. It has a modified handle() function to track the current cursor position. It also allocates the text buffer in constructor and destroys it in destructor.

Constructor & Destructor Documentation

◆ CEditor()

sptk::CEditor::CEditor ( int  layoutSize = 100,
CLayoutAlign  layoutAlign = CLayoutAlign::TOP 
)
explicit

Constructor in SPTK style

Parameters
layoutSizeint, widget align in layout
layoutAlignCLayoutAlign, widget align in layout

◆ ~CEditor()

sptk::CEditor::~CEditor ( )
override

Destructor

Member Function Documentation

◆ cursorRowCol()

void sptk::CEditor::cursorRowCol ( int &  row,
int &  col 
)

Returns current cursor position

Parameters
rowint&, row number
colint&, column number

◆ handle()

int sptk::CEditor::handle ( int  event)
override

Special version of handle() function

◆ preferredSize()

bool sptk::CEditor::preferredSize ( int &  w,
int &  h 
)
overridevirtual

Computes the optimal widgets size

Parameters
wint&, input - width offered by the program, output - width required by widget
hint&, input - height offered by the program, output - height required by widget
Returns
true if the size is stable (doesn't depend on input sizes)

Reimplemented from sptk::CLayoutClient.

◆ styleBuffer()

Fl_Text_Buffer * sptk::CEditor::styleBuffer ( )
inline

Retruns internal style buffer

◆ textBuffer()

Fl_Text_Buffer * sptk::CEditor::textBuffer ( )
inline

Retruns internal text buffer

◆ wrapMode() [1/2]

bool sptk::CEditor::wrapMode ( ) const
inline

Returns current wrap mode

◆ wrapMode() [2/2]

void sptk::CEditor::wrapMode ( bool  wm)

Sets current wrap mode


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

Fri Oct 14 2022 09:58:35: SPTK 5.4.1