wintext.h File Reference

Fuctions to display a text widget in the window system. More...

Go to the source code of this file.

Functions

win_widget_twin_text_new_label (char *text)
 Creates a new text widget as a label.
win_widget_twin_text_new_entry (int len)
 Creates a new text widget as an entry field.
void win_text_set_text (win_widget_t *widget, char *text)
 Sets the contents of a text widget.
char * win_text_get_text (win_widget_t *widget)
 Retrieves the contents of a text widget.


Detailed Description

Fuctions to display a text widget in the window system.

Text widgets are used for two purposes: to display text, and to allow the user to edit text. The two tasks are selected by settings of the focusable flag of the component.

Definition in file wintext.h.


Function Documentation

char* win_text_get_text ( win_widget_t widget  ) 

Retrieves the contents of a text widget.

The result of this method is a pointer to an internal text buffer. It may safely be used only until the next call to a windowing system method. If it will be stored for later use, then the contents should be copied to an alternate location.

Modifications made to the returned text array are live, and require only a call to win_repaint to display on the screen. However, the amount of memory reserved for text is indeterminate. If the text will extended for longer than the current string length, the application should call win_text_set_text with a different text buffer instead. This behavior may change in a future release of the library, depending on user feedback.

Parameters:
text The new text, as a null-terminated C string.

win_widget_t* win_text_new_entry ( int  len  ) 

Creates a new text widget as an entry field.

Allocates and returns a new text widget, with no initial text, and a given amount of memory set for the user to type. The widget is focusable, and is intended to be used as a field for input.

The text is initially set to black text on a white background, opaque, with the minifont.

Returns:
A pointer to the newly allocated text widget.

win_widget_t* win_text_new_label ( char *  text  ) 

Creates a new text widget as a label.

Allocates and returns a new text widget, with its initial text set to the given value. The widget is not focusable, and has no extra memory reserved for future changes to the text.

The text is initially set to black text on a white background, opaque, with the minifont.

Returns:
A pointer to the newly allocated text widget.

void win_text_set_text ( win_widget_t widget,
char *  text 
)

Sets the contents of a text widget.

After this call, the widget will contain the new text. The text size is not changed to match the new text. You may need to modify the width or height of the label by calling win_widget_pack or win_widget_set_size to avoid cutting off the text.

Parameters:
text The new text, as a null-terminated C string.


Generated on Fri Feb 16 16:43:17 2007 for HPGCCWindows by  doxygen 1.5.0