glib.StringCompletion.StringCompletion Class Reference

List of all members.

Detailed Description

Description GCompletion provides support for automatic completion of a string using any group of target strings.

It is typically used for file name completion as is common in many UNIX shells. A GCompletion is created using g_completion_new(). Target items are added and removed with g_completion_add_items(), g_completion_remove_items() and g_completion_clear_items(). A completion attempt is requested with g_completion_complete() or g_completion_complete_utf8(). When no longer needed, the GCompletion is freed with g_completion_free(). Items in the completion can be simple strings (e.g. filenames), or pointers to arbitrary data structures. If data structures are used you must provide a GCompletionFunc in g_completion_new(), which retrieves the item's string from the data structure. You can change the way in which strings are compared by setting a different GCompletionStrncmpFunc in g_completion_set_compare().


Public Member Functions

GCompletiongetStringCompletionStruct ()
 this (GCompletion *gCompletion)
 Sets our main struct and passes it to the parent class.
 this (GCompletionFunc func)
 Creates a new GCompletion.
void addItems (ListG items)
 Adds items to the GCompletion.
void removeItems (ListG items)
 Removes items from a GCompletion.
void clearItems ()
 Removes all items from the GCompletion.
ListG complete (char[] prefix, char **newPrefix)
 Attempts to complete the string prefix using the GCompletion target items.
ListG completeUtf8 (char[] prefix, char **newPrefix)
 Attempts to complete the string prefix using the GCompletion target items.
void setCompare (GCompletionStrncmpFunc strncmpFunc)
 Sets the function to use for string comparisons.
void free ()
 Frees all memory used by the GCompletion.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GCompletiongCompletion
 the main Gtk struct


Constructor & Destructor Documentation

glib.StringCompletion.StringCompletion.this ( GCompletion gCompletion  ) 

Sets our main struct and passes it to the parent class.

glib.StringCompletion.StringCompletion.this ( GCompletionFunc  func  ) 

Creates a new GCompletion.

func: the function to be called to return the string representing an item in the GCompletion, or NULL if strings are going to be used as the GCompletion items. Returns: the new GCompletion.


Member Function Documentation

void glib.StringCompletion.StringCompletion.addItems ( ListG  items  ) 

Adds items to the GCompletion.

cmp: the GCompletion. items: the list of items to add.

void glib.StringCompletion.StringCompletion.clearItems (  ) 

Removes all items from the GCompletion.

cmp: the GCompletion.

ListG glib.StringCompletion.StringCompletion.complete ( char[]  prefix,
char **  newPrefix 
)

Attempts to complete the string prefix using the GCompletion target items.

cmp: the GCompletion. prefix: the prefix string, typically typed by the user, which is compared with each of the items. new_prefix: if non-NULL, returns the longest prefix which is common to all items that matched prefix, or NULL if no items matched prefix. This string should be freed when no longer needed. Returns: the list of items whose strings begin with prefix. This should not be changed.

ListG glib.StringCompletion.StringCompletion.completeUtf8 ( char[]  prefix,
char **  newPrefix 
)

Attempts to complete the string prefix using the GCompletion target items.

In contrast to g_completion_complete(), this function returns the largest common prefix that is a valid UTF-8 string, omitting a possible common partial character. You should use this function instead of g_completion_complete() if your items are UTF-8 strings. cmp: the GCompletion prefix: the prefix string, typically used by the user, which is compared with each of the items new_prefix: if non-NULL, returns the longest prefix which is common to all items that matched prefix, or NULL if no items matched prefix. This string should be freed when no longer needed. Returns: the list of items whose strings begin with prefix. This should not be changed. Since 2.4

void glib.StringCompletion.StringCompletion.free (  ) 

Frees all memory used by the GCompletion.

cmp: the GCompletion.

GCompletion* glib.StringCompletion.StringCompletion.getStringCompletionStruct (  ) 

void* glib.StringCompletion.StringCompletion.getStruct (  )  [protected]

the main Gtk struct as a void*

void glib.StringCompletion.StringCompletion.removeItems ( ListG  items  ) 

Removes items from a GCompletion.

cmp: the GCompletion. items: the items to remove.

void glib.StringCompletion.StringCompletion.setCompare ( GCompletionStrncmpFunc  strncmpFunc  ) 

Sets the function to use for string comparisons.

The default string comparison function is strncmp(). cmp: a GCompletion. strncmp_func: the string comparison function.


Member Data Documentation

GCompletion* glib.StringCompletion.StringCompletion.gCompletion [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo