cText Struct Reference

Inheritance diagram for cText

Inheritance graph

Collaboration diagram for cText:

Collaboration graph


Public Methods

struct cText* cText_ctor (struct cText *ptr_text, char *text, struct Font *ptr_font, color_t color)
void cText_dtor (struct cText *ptr_text, int memory_flag)
void cText_SetText (struct cText *ptr_text, char *text)
bool cText_proc (struct cText *ptr_text, struct Message *ptr_message)
void cText_Disconnect (struct cText *ptr_text)
bool cText_Select (struct cText *ptr_text)
void cText_update (struct cText *ptr_text)
struct cClipcText_GetParent (struct cText *ptr_text)
void cText_Hide (struct cText *ptr_text)
void cText_Show (struct cText *ptr_text)
void cText_Disable (struct cText *ptr_text)
void cText_Enable (struct cText *ptr_text)


Detailed Description

A static, transparent text line. Use this structure to place text on the Cybiko computer's screen.

To place a cText object created by the cText_ctor function onto the Cybiko screen, use the cWinApp_AddObj function. If you want to replace the onscreen text, you should first clear it with the cWinApp_clear_screen function. Then use the cText_SetText function to place new text.

You must call the cText_ctor function before use and the cText_dtor function after use.

See also:
Controls , cWinApp_AddObj , cWinApp_clear_screen


Member Function Documentation

void cText_Disable ( struct cText * ptr_text )
 

Disables a cText object so that it cannot be selected.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
None
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     // Now the user can't use this object
     cText_Disable (&text);
     ...
     // Now the user can use this object again
     cText_Enable (&text);
     ...
     cText_dtor( &text, LEAVE_MEMORY );
See also:
cText_Enable.

void cText_Disconnect ( struct cText * ptr_text )
 

Disconnects a cText object from its parent object.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
None
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     // Removes the object from the Cybiko screen.
     cText_Disconnect( &text);
     ...
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     // Afterwards this function disconnects the cText object automatically
     cText_dtor( &text, LEAVE_MEMORY );

void cText_Enable ( struct cText * ptr_text )
 

Enables a cText object so that it may be selected.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
None
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     // Now the user can't use this object
     cText_Disable (&text);
     ...
     // Now the user can use this object again
     cText_Enable (&text);
     ...
     cText_dtor( &text, LEAVE_MEMORY );
See also:
cText_Disable.

struct cClip * cText_GetParent ( struct cText * ptr_text )
 

Returns a pointer to the parent object.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
A pointer to the parent object
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     struct cClip *parent;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     parent = cText_GetParent( &text );
     if ( parent == main_module.m_process )
     {
     }
     ...
     cText_dtor( &text, LEAVE_MEMORY );

void cText_Hide ( struct cText * ptr_text )
 

Hides a cText object.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
None
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     cText_Hide (&text);
      ...
     cText_Show (&text);
     ...
     cText_dtor( &text, LEAVE_MEMORY );
See also:
cText_Show.

bool cText_Select ( struct cText * ptr_text )
 

Selects a cText object.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
TRUE if the object was selected
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     cText_Select(&text)
     ...
     cText_dtor( &text, LEAVE_MEMORY );

void cText_SetText ( struct cText * ptr_text,
char * text )
 

Sets a new text line.

Parameters:
ptr_text   A pointer to the initialized cText object
text   A new text string
Returns:
None
   #include <cywin.h>
     ...
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     ...
     cWinApp_clear_screen();
     cText_SetText( &text, "Another text" );
     ...
     cText_dtor( &text, LEAVE_MEMORY );

void cText_Show ( struct cText * ptr_text )
 

Shows a cText object.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
None
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     cText_Hide (&text);
     ...
     cText_Show (&text);
     ...
     cText_dtor( &text, LEAVE_MEMORY );
See also:
cText_Hide.

struct cText * cText_ctor ( struct cText * ptr_text,
char * text,
struct Font * ptr_font,
color_t color )
 

Initializes a cText object.

Parameters:
ptr_text   A pointer to a cText object
text   A text string
ptr_font   A pointer to the structure of the font to use
color   The text's color
Returns:
A pointer to the initialized cText object
   #include <cywin.h>
     ...
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     ...
     cText_dtor( &text, LEAVE_MEMORY );

void cText_dtor ( struct cText * ptr_text,
int memory_flag )
 

Deletes a cText object.

Parameters:
ptr_text   is a pointer to a cText object.
memory_flag   Can be FREE_MEMORY or LEAVE_MEMORY. If the memory was allocated for the object by malloc(), use FREE_MEMORY to free it. Use LEAVE_MEMORY If the object was static or allocated in a stack
Returns:
None
   #include <cywin.h>
     ...
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     ...
     cText_dtor( &text, LEAVE_MEMORY );
See also:
FREE_MEMORY, LEAVE_MEMORY.

bool cText_proc ( struct cText * ptr_text,
struct Message * ptr_message )
 

The message-processing function.

Parameters:
ptr_text   A pointer to the initialized cText object
ptr_message   A pointer to the processed message
Returns:
TRUE if the message was processed.

void cText_update ( struct cText * ptr_text )
 

Updates a cText object.

Parameters:
ptr_text   A pointer to the initialized cText object
Returns:
None
   #include <cywin.h>
     struct cText text;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     cText_ctor( &text, "Any string", cool_normal_font , CLR_DKGRAY );
     cWinApp_clear_screen();
     // Puts the 'text' object on the Cybiko screen.
     cWinApp_AddObj( main_module.m_process, &text, 10, 40 );
     cWinApp_clear_screen();
     // Redraws the text
     cText_update(&text);
     ...
     cText_dtor( &text, LEAVE_MEMORY );