vdk 2.4.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VDKEditor Class Reference

Provides a nice source editor wrapping Mike Hammerson GtkSourceView. Editor provides: More...

#include <vdkeditor.h>

Inheritance diagram for VDKEditor:
Inheritance graph
[legend]
Collaboration diagram for VDKEditor:
Collaboration graph
[legend]

Public Member Functions

 VDKEditor (VDKForm *owner, GtkSourceBuffer *buff=NULL)
 
virtual ~VDKEditor ()
 
TokenListSetTokens (TokenList *tkl=NULL)
 
virtual void SetForeground (VDKRgb rgb, GtkStateType state=GTK_STATE_NORMAL)
 
virtual void SetBackground (VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
 
virtual void SetFont (VDKFont *font)
 
GtkSourceBuffer * Buffer (void)
 
void Scroll (int pointer=-1, int margin=0)
 
void Scroll (int line, int col, int margin=0)
 
char * GetWord (int pos=-1)
 
bool LoadFromFile (const char *filename)
 
void Clear ()
 
gchar * GetChars (int start=0, int end=-1)
 
bool SaveToFile (const char *filename)
 
void Eol ()
 
void TextInsert (const char *txt, int nchar=-1)
 
void ForwardDelete (int nchars)
 
void BackwardDelete (int nchars)
 
bool IsLineVisible (int line)
 
int GetLineAtOffset (int offset)
 
void InstallSyntaxTable (VDKColor *key_color, VDKFont *key_font, VDKColor *gtk_color, VDKFont *gtk_font, VDKColor *macro_color, VDKFont *macro_font, VDKColor *pp_color, VDKFont *pp_font, VDKColor *const_color, VDKFont *const_font, VDKColor *comment_color, VDKFont *comment_font)
 
void ClearSyntaxTable ()
 
void ScrollToPos (int pointer=-1, int margin=0)
 
void ScrollToLine (int line, int col, int margin=0)
 
void SelectText (int start, int end)
 
void UnselectText ()
 
bool AddMarkIcon (VDKPixbuf *image, const char *icon_key, bool overwrite=true)
 
void AddLineMark (int line, const char *icon_key)
 
void RemoveLineMark (int line, const char *icon_key)
 
void RemoveLineMarks (int line)
 
void RemoveAllLineMarks ()
 
- Public Member Functions inherited from VDKObject
VDKRgb GetBackground (GtkStateType state=GTK_STATE_NORMAL)
 
VDKRgb GetForeground (GtkStateType state=GTK_STATE_NORMAL)
 
 VDKObject (VDKForm *owner=NULL)
 
 VDKObject (VDKForm *owner, GtkWidget *widget)
 
virtual ~VDKObject ()
 
bool Destroy ()
 
virtual int isA ()
 
VDKFormOwner ()
 
virtual GtkWidget * Widget ()
 
GtkWidget * ConnectingWidget ()
 
GtkWidget * WrappedWidget ()
 
VDKFontGetFont ()
 
void SetVisible (bool visible)
 
bool GetVisible ()
 
void SetCursor (VDKCursorType)
 
VDKCursorType GetCursor ()
 
void SetSize (int w, int h)
 
void SetUsize (VDKPoint s)
 
virtual void SetTip (char *)
 
virtual void Add (VDKObject *obj, int justify=l_justify, int expand=TRUE, int fill=TRUE, int padding=0)
 
ItemListItems ()
 
void Draw (GdkRectangle *area=NULL)
 
virtual void Setup ()
 
void SignalEmit (int signal)
 
void SignalEmit (char *sig)
 
void SignalEmitParent (int signal)
 
void SignalEmitParent (char *sig)
 
void GrabFocus ()
 
VDKObjectParent (VDKObject *p=NULL)
 
int SignalConnect (VDKObject *obj, char *signal, bool(VDKObject::*method)(VDKObject *), bool gtk=true, bool after=false)
 
int SignalConnect (char *signal, bool(VDKObject::*method)(VDKObject *), bool gtk=true, bool after=false)
 
bool SignalDisconnect (int connection)
 
int EventConnect (VDKObject *obj, char *event, bool(VDKObject::*method)(VDKObject *, GdkEvent *), bool after=false)
 
int EventConnect (char *, bool(VDKObject::*)(VDKObject *, GdkEvent *), bool after=false)
 
bool EventDisconnect (int connection)
 

Static Public Member Functions

static TokenListLoadTokens (const char *filename)
 

Public Attributes

VDKReadWriteValueProp< VDKEditor, int > Pointer
 
VDKReadWriteValueProp< VDKEditor, int > Column
 
VDKReadWriteValueProp< VDKEditor, int > Line
 
VDKReadOnlyValueProp< VDKEditor, int > FirstVisibleLine
 
VDKReadOnlyValueProp< VDKEditor, int > LastVisibleLine
 
VDKReadWriteValueProp< VDKEditor, bool > Changed
 
- Public Attributes inherited from VDKObject
VDKReadWriteValueProp< VDKObject, VDKRgbNormalBackground
 
VDKReadWriteValueProp< VDKObject, VDKFont * > Font
 
SizeObjectProp Usize
 
VDKReadWriteValueProp< VDKObject, bool > Enabled
 
VDKReadWriteValueProp< VDKObject, VDKCursorType > Cursor
 
VDKReadWriteValueProp< VDKObject, bool > Visible
 

Additional Inherited Members

- Protected Attributes inherited from VDKObject
VDKObjectSignal s_clicked
 
GtkWidget * widget
 
GtkWidget * sigwid
 
VDKObjectparent
 

Detailed Description

Provides a nice source editor wrapping Mike Hammerson GtkSourceView. Editor provides:

Constructor & Destructor Documentation

◆ VDKEditor()

VDKEditor::VDKEditor ( VDKForm owner,
GtkSourceBuffer *  buff = NULL 
)

Constructor

Parameters
owner
bufferNULL widget will make his own buffer, otherwise will share <buffer>
left_borderif greater than 0 a left window will be made with <left_border> size
tip
left_border should be greater than zero if user wants activate ShowLineNumbers property.

◆ ~VDKEditor()

VDKEditor::~VDKEditor ( )
virtual

Destructor

Member Function Documentation

◆ AddLineMark()

void VDKEditor::AddLineMark ( int  line,
const char *  icon_key 
)

Add a mark on line numbers

Parameters
linewhere mark will be displayed
icon_keyan unique string as image id

◆ AddMarkIcon()

bool VDKEditor::AddMarkIcon ( VDKPixbuf image,
const char *  icon_key,
bool  overwrite = true 
)

Add an icoon for line markers

Parameters
imagea VDKPixbuf to be displayed
icon_keyan unique string as image id
overwiteif true non unique keys will have icons overwritten

◆ BackwardDelete()

void VDKEditor::BackwardDelete ( int  nchars)

Backward delete chars from insertion point

◆ Buffer()

GtkSourceBuffer* VDKEditor::Buffer ( void  )
inline

Gets text buffer.

◆ Clear()

void VDKEditor::Clear ( )

Clears text buffer deleting all text.

◆ ClearSyntaxTable()

void VDKEditor::ClearSyntaxTable ( )

Clear syntax table

◆ Eol()

void VDKEditor::Eol ( )
inline

Inserts a new line at insertion point

◆ ForwardDelete()

void VDKEditor::ForwardDelete ( int  nchars)

Forward delete chars from insertion point

◆ GetChars()

gchar * VDKEditor::GetChars ( int  start = 0,
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.

◆ GetLineAtOffset()

int VDKEditor::GetLineAtOffset ( int  offset)

Gets line number at a buffer position

Parameters
offsetbuffer offset position (counting from 0) on error returns -1

◆ GetWord()

char * VDKEditor::GetWord ( int  pos = -1)

Gets a word

Parameters
pos,positioninto text buffer, if pos == -1 gets the word at insertion point.

◆ InstallSyntaxTable()

void VDKEditor::InstallSyntaxTable ( VDKColor key_color,
VDKFont key_font,
VDKColor gtk_color,
VDKFont gtk_font,
VDKColor macro_color,
VDKFont macro_font,
VDKColor pp_color,
VDKFont pp_font,
VDKColor const_color,
VDKFont const_font,
VDKColor comment_color,
VDKFont comment_font 
)

Install syntax table. If a color arg is left to NULL no higligth will be done on that word set, if a font arg is left to NULL makes default font to be used.

Parameters
key_colorcolor for language keywords
key_fontrelated font
gtk_colorcolor for gtk_xxx_xxx and VDK functions/members
gtk_fontrelated font
macro_colorcolor for macros
macro_fontrelated font
pp_colorcolor for prepocessor directives
pp_fontrelated font
const_colorcolor for constants (numbers,chars,strings)
const_fontrelated font
comment_colorfor remarks
comment_fontrelated font

◆ IsLineVisible()

bool VDKEditor::IsLineVisible ( int  line)
inline

Answer if a line is visible or not line are counted from 0

Parameters
line

◆ LoadFromFile()

bool VDKEditor::LoadFromFile ( const char *  filename)

Load text buffer with a file

Parameters
filename

◆ LoadTokens()

TokenList * VDKEditor::LoadTokens ( const char *  filename)
static

Loads tokens list for word completions from file, returns a newly constructed list to be assigned to editor with SetTokens(). User is responsible to delete token list when no longer in use. File format : simply a token per line.

Parameters
filename

◆ RemoveAllLineMarks()

void VDKEditor::RemoveAllLineMarks ( )

Remove all markers

◆ RemoveLineMark()

void VDKEditor::RemoveLineMark ( int  line,
const char *  icon_key 
)

Remove a mark on line numbers

Parameters
linewhere mark will be removed from
icon_key

◆ RemoveLineMarks()

void VDKEditor::RemoveLineMarks ( int  line)

Remove all marks on line numbers

Parameters
linewhere marks will be removed from

◆ SaveToFile()

bool VDKEditor::SaveToFile ( const char *  filename)

Save buffer to file

◆ Scroll() [1/2]

void VDKEditor::Scroll ( int  pointer = -1,
int  margin = 0 
)

Scrolls to a pointer pos or (default) to current pointer position, leaving <margin> pixels free

◆ Scroll() [2/2]

void VDKEditor::Scroll ( int  line,
int  col,
int  margin = 0 
)

Scrolls to a line,column leaving <margin> pixels free

◆ ScrollToLine()

void VDKEditor::ScrollToLine ( int  line,
int  col,
int  margin = 0 
)

Scrolls to a line,column leaving <margin> pixels free

◆ ScrollToPos()

void VDKEditor::ScrollToPos ( int  pointer = -1,
int  margin = 0 
)

Scrolls to a pointer pos or (default) to current pointer position, leaving <margin> pixels free

◆ SelectText()

void VDKEditor::SelectText ( int  start,
int  end 
)

Select text from start to end position

◆ SetBackground()

void VDKEditor::SetBackground ( VDKRgb  color,
GtkStateType  state = GTK_STATE_NORMAL 
)
virtual

Sets object background

Parameters
colora VDKRgb object
statecan be one of the gtk+ widget states

Reimplemented from VDKObject.

◆ SetFont()

void VDKEditor::SetFont ( VDKFont f)
virtual

Sets object font

Reimplemented from VDKObject.

◆ SetForeground()

void VDKEditor::SetForeground ( VDKRgb  color,
GtkStateType  state = GTK_STATE_NORMAL 
)
virtual

Sets object foreground

Parameters
colora VDKRgb object
statecan be one of the gtk+ widget states

Reimplemented from VDKObject.

◆ SetTokens()

TokenList* VDKEditor::SetTokens ( TokenList tkl = NULL)
inline

Sets/gets a tokens list to editor

Parameters
tkla valid token list address, if tkl == NULL return editor token list address

◆ TextInsert()

void VDKEditor::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)

◆ UnselectText()

void VDKEditor::UnselectText ( )

Unselect any previous selected text

Member Data Documentation

◆ Changed

VDKReadWriteValueProp<VDKEditor,bool> VDKEditor::Changed

Sets/gets modified flag

◆ Column

VDKReadWriteValueProp<VDKEditor,int> VDKEditor::Column

Sets/gets text insertion position expressed in column offset

◆ FirstVisibleLine

VDKReadOnlyValueProp<VDKEditor,int> VDKEditor::FirstVisibleLine

Gets first visible line (lines are counted from 0)

◆ LastVisibleLine

VDKReadOnlyValueProp<VDKEditor,int> VDKEditor::LastVisibleLine

Gets last visible line (lines are counted from 0)

◆ Line

VDKReadWriteValueProp<VDKEditor,int> VDKEditor::Line

Sets/gets text insertion position expressed in lines

◆ Pointer

VDKReadWriteValueProp<VDKEditor,int> VDKEditor::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: