vdk 2.4.0
Public Member Functions | Public Attributes | Friends | List of all members
VDKTextBuffer Class Reference

Provides a gtk+ gtktextbuffer wrapper. More...

#include <vdktextview.h>

Inheritance diagram for VDKTextBuffer:
VDKNotCopyAble

Public Member Functions

 VDKTextBuffer ()
 
 VDKTextBuffer (char *filename)
 
virtual ~VDKTextBuffer ()
 
bool LoadFromFile (const char *filename)
 
bool SaveToFile (const char *filename)
 
GtkTextBuffer * Buffer ()
 
void Clear ()
 
void TextInsert (const char *txt, int nchar=-1)
 
gchar * GetChars (int start, int end=-1)
 
void ForwardDelete (int nchars)
 
void BackwardDelete (int nchars)
 
void Undo ()
 
int GetLineAtOffset (int offset)
 

Public Attributes

VDKReadWriteValueProp
< VDKTextBuffer, int > 
Pointer
 
VDKReadWriteValueProp
< VDKTextBuffer, int > 
Column
 
VDKReadWriteValueProp
< VDKTextBuffer, int > 
Line
 
VDKReadWriteValueProp
< VDKTextBuffer, bool > 
Changed
 

Friends

class VDKTextView
 

Detailed Description

Provides a gtk+ gtktextbuffer wrapper.

Programming notes:
VDKTextBuffer can be shared by several VDKTextView. These objects aren't handled by garbage collection (aren't VDKObjects), however are reference conted so do not need to be explicitely deleted if assigned to a VDKTextView using either the appropriate VDKTextView contructor or VDKText::Buffer() assignement method. If constructed and never assigned to a VDKTextView they need to be explicitely deleted or they will leak.

Constructor & Destructor Documentation

VDKTextBuffer::VDKTextBuffer ( )

Default constructor

VDKTextBuffer::VDKTextBuffer ( char *  filename)

Default constructor

Parameters
filenamebuilds a text buffer loading file <filename>
VDKTextBuffer::~VDKTextBuffer ( )
virtual

Destructor

Member Function Documentation

void VDKTextBuffer::BackwardDelete ( int  nchars)

Backward delete chars from insertion point

GtkTextBuffer* VDKTextBuffer::Buffer ( void  )
inline

Returns underlying GtkTextBuffer

void VDKTextBuffer::Clear ( )

Clears text buffer deleting all text.

void VDKTextBuffer::ForwardDelete ( int  nchars)

Forward delete chars from insertion point

gchar * VDKTextBuffer::GetChars ( int  start,
int  end = -1 
)

Returns a text segment

Parameters
startstarting position
endending position, if -1 all text buffer from start to end will be returned.
Tip
Invisible chars won't be included. Returned address should be g_free()'d by user.
int VDKTextBuffer::GetLineAtOffset ( int  offset)

Gets line number at a buffer position

Parameters
offsetbuffer offset position (counting from 0) on error returns -1
bool VDKTextBuffer::LoadFromFile ( const char *  filename)

Load text buffer with a file

Parameters
filenameto load
bool VDKTextBuffer::SaveToFile ( const char *  filename)

Save buffer to file

void VDKTextBuffer::TextInsert ( const char *  txt,
int  nchar = -1 
)

Inserts text at cursor position.

Parameters
txtnull terminating string to be inserted
ncharshow many chars have to be inserted (-1 means all)
void VDKTextBuffer::Undo ( void  )
inline

Undoes last operation

Member Data Documentation

VDKReadWriteValueProp<VDKTextBuffer,bool> VDKTextBuffer::Changed

Sets/gets modified flag

VDKReadWriteValueProp<VDKTextBuffer,int> VDKTextBuffer::Column

Sets/gets text insertion position expressed in column offset

VDKReadWriteValueProp<VDKTextBuffer,int> VDKTextBuffer::Line

Sets/gets text insertion position expressed in lines

VDKReadWriteValueProp<VDKTextBuffer,int> VDKTextBuffer::Pointer

Sets/gets text insertion position expressed in chars from text beginning. (counting from 0, gets -1 on failure)


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