VDKEditor Class Reference
Provides a nice source editor wrapping Mike Hammerson GtkSourceView. Editor provides:
- syntax higlighting
- undo capability
- parenthesis matching
- word completion.
More...
#include <vdkeditor.h>
List of all members.
Public Member Functions
- VDKEditor (VDKForm *owner, GtkSourceBuffer *buff=NULL)
- virtual ~VDKEditor ()
- TokenList * SetTokens (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 ()
Static Public Member Functions
Public Attributes
Detailed Description
Provides a nice source editor wrapping Mike Hammerson GtkSourceView. Editor provides:
- syntax higlighting
- undo capability
- parenthesis matching
- word completion.
Constructor & Destructor Documentation
VDKEditor::VDKEditor |
( |
VDKForm * |
owner, |
|
|
GtkSourceBuffer * |
buff = NULL | |
|
) |
| | |
Constructor
- Parameters:
-
| owner | |
| buffer | NULL widget will make his own buffer, otherwise will share <buffer> |
| left_border | if 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 |
( |
|
) |
[virtual] |
Member Function Documentation
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:
-
Sets/gets a tokens list to editor
- Parameters:
-
| tkl | a valid token list address, if tkl == NULL return editor token list address |
void VDKEditor::SetForeground |
( |
VDKRgb |
color, |
|
|
GtkStateType |
state = GTK_STATE_NORMAL | |
|
) |
| | [virtual] |
Sets object foreground
- Parameters:
-
| color | a VDKRgb object |
| state | can be one of the gtk+ widget states |
Reimplemented from VDKObject.
void VDKEditor::SetBackground |
( |
VDKRgb |
color, |
|
|
GtkStateType |
state = GTK_STATE_NORMAL | |
|
) |
| | [virtual] |
Sets object background
- Parameters:
-
| color | a VDKRgb object |
| state | can be one of the gtk+ widget states |
Reimplemented from VDKObject.
void VDKEditor::SetFont |
( |
VDKFont * |
f |
) |
[virtual] |
Sets object font
Reimplemented from VDKObject.
GtkSourceBuffer* VDKEditor::Buffer |
( |
void |
|
) |
[inline] |
void VDKEditor::Scroll |
( |
int |
pointer = -1 , |
|
|
int |
margin = 0 | |
|
) |
| | |
Scrolls to a pointer pos or (default) to current pointer position, leaving <margin> pixels free
void VDKEditor::Scroll |
( |
int |
line, |
|
|
int |
col, |
|
|
int |
margin = 0 | |
|
) |
| | |
Scrolls to a line,column leaving <margin> pixels free
char * VDKEditor::GetWord |
( |
int |
pos = -1 |
) |
|
Gets a word
- Parameters:
-
| pos,position | into text buffer, if pos == -1 gets the word at insertion point. |
bool VDKEditor::LoadFromFile |
( |
const char * |
filename |
) |
|
Load text buffer with a file
- Parameters:
-
void VDKEditor::Clear |
( |
|
) |
|
Clears text buffer deleting all text.
gchar * VDKEditor::GetChars |
( |
int |
start = 0 , |
|
|
int |
end = -1 | |
|
) |
| | |
Returns a text segment
- Parameters:
-
| start | starting position |
| end | ending 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.
bool VDKEditor::SaveToFile |
( |
const char * |
filename |
) |
|
void VDKEditor::Eol |
( |
|
) |
[inline] |
Inserts a new line at insertion point
void VDKEditor::TextInsert |
( |
const char * |
txt, |
|
|
int |
nchar = -1 | |
|
) |
| | |
Inserts text at cursor position.
- Parameters:
-
| txt | null terminating string to be inserted |
| nchars | how many chars have to be inserted (-1 means all) |
void VDKEditor::ForwardDelete |
( |
int |
nchars |
) |
|
Forward delete chars from insertion point
void VDKEditor::BackwardDelete |
( |
int |
nchars |
) |
|
Backward delete chars from insertion point
bool VDKEditor::IsLineVisible |
( |
int |
line |
) |
[inline] |
Answer if a line is visible or not line are counted from 0
- Parameters:
-
int VDKEditor::GetLineAtOffset |
( |
int |
offset |
) |
|
Gets line number at a buffer position
- Parameters:
-
| offset | buffer offset position (counting from 0) on error returns -1 |
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_color | color for language keywords |
| key_font | related font |
| gtk_color | color for gtk_xxx_xxx and VDK functions/members |
| gtk_font | related font |
| macro_color | color for macros |
| macro_font | related font |
| pp_color | color for prepocessor directives |
| pp_font | related font |
| const_color | color for constants (numbers,chars,strings) |
| const_font | related font |
| comment_color | for remarks |
| comment_font | related font |
void VDKEditor::ClearSyntaxTable |
( |
|
) |
|
void VDKEditor::ScrollToPos |
( |
int |
pointer = -1 , |
|
|
int |
margin = 0 | |
|
) |
| | |
Scrolls to a pointer pos or (default) to current pointer position, leaving <margin> pixels free
void VDKEditor::ScrollToLine |
( |
int |
line, |
|
|
int |
col, |
|
|
int |
margin = 0 | |
|
) |
| | |
Scrolls to a line,column leaving <margin> pixels free
void VDKEditor::SelectText |
( |
int |
start, |
|
|
int |
end | |
|
) |
| | |
Select text from start to end position
void VDKEditor::UnselectText |
( |
|
) |
|
Unselect any previous selected text
bool VDKEditor::AddMarkIcon |
( |
VDKPixbuf * |
image, |
|
|
const char * |
icon_key, |
|
|
bool |
overwrite = true | |
|
) |
| | |
Add an icoon for line markers
- Parameters:
-
| image | a VDKPixbuf to be displayed |
| icon_key | an unique string as image id |
| overwite | if true non unique keys will have icons overwritten |
void VDKEditor::AddLineMark |
( |
int |
line, |
|
|
const char * |
icon_key | |
|
) |
| | |
Add a mark on line numbers
- Parameters:
-
| line | where mark will be displayed |
| icon_key | an unique string as image id |
void VDKEditor::RemoveLineMark |
( |
int |
line, |
|
|
const char * |
icon_key | |
|
) |
| | |
Remove a mark on line numbers
- Parameters:
-
| line | where mark will be removed from |
| icon_key | |
void VDKEditor::RemoveLineMarks |
( |
int |
line |
) |
|
Remove all marks on line numbers
- Parameters:
-
| line | where marks will be removed from |
void VDKEditor::RemoveAllLineMarks |
( |
|
) |
|
Member Data Documentation
Sets/gets text insertion position expressed in chars from text beginning. (counting from 0, gets -1 on failure)
Sets/gets text insertion position expressed in column offset
Sets/gets text insertion position expressed in lines
Gets first visible line (lines are counted from 0)
Gets last visible line (lines are counted from 0)
The documentation for this class was generated from the following files: