cXItem Struct Reference

Inheritance diagram for cXItem

Inheritance graph

Collaboration diagram for cXItem:

Collaboration graph


Public Methods

struct cXItem* cXItem_ctor (struct cXItem *ptr_cxitem, int width, char *title, char **rstr, char *rref, bool submenu, bool readonly, struct Bitmap **lbmp, char *lref)
void cXItem_dtor (struct cXItem *ptr_cxitem, int memory_flag)
void cXItem_SelLeft (struct cXItem *ptr_cxitem)
void cXItem_SelRight (struct cXItem *ptr_cxitem)
void cXItem_SetLeft (struct cXItem *ptr_cxitem, int index)
void cXItem_SetRight (struct cXItem *ptr_cxitem, int index)
void cXItem_OK (struct cXItem *ptr_cxitem)
void cXItem_Esc (struct cXItem *ptr_cxitem)
bool cXItem_proc (struct cXItem *ptr_cxitem, struct Message *ptr_message)
void cXItem_Disconnect (struct cXItem *ptr_cxitem)
bool cXItem_Select (struct cXItem *ptr_cxitem)
void cXItem_update (struct cXItem *ptr_cxitem)
struct cClipcXItem_GetParent (struct cXItem *ptr_cxitem)
void cXItem_Hide (struct cXItem *ptr_cxitem)
void cXItem_Show (struct cXItem *ptr_cxitem)
void cXItem_Disable (struct cXItem *ptr_cxitem)
void cXItem_Enable (struct cXItem *ptr_cxitem)
char* cXItem_GetTitle (struct cXItem *ptr_cxitem)


Detailed Description

The same type of string as in the cItem structure. However, it is possible to insert text on the right or an icon on the left, and to select one of the values assigned previously.

You must call the cXItem_ctor function before use and the cXItem_dtor function after use.

See also:
Controls


Member Function Documentation

void cXItem_Disable ( struct cXItem * ptr_cxitem )
 

Disables a cXItem object so that it cannot be selected.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
None
See also:
cXItem_Enable.

void cXItem_Disconnect ( struct cXItem * ptr_cxitem )
 

Disconnects a cXItem from its parent object.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
None

void cXItem_Enable ( struct cXItem * ptr_cxitem )
 

Enables a cXItem object so that it may be selected.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
None
See also:
cXItem_Disable.

void cXItem_Esc ( struct cXItem * ptr_cxitem )
 

Deselects the left or right section of the item (if either was selected), and restores L/Rsel from L/Rprev.

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
Returns:
None
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char  left_index = 1;
       struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     // For example, icon "1" is selected now, you can bypass the icon "2" value and set the icon "3" value.
     cXItem_SetLeft( ptr_menu_item, 2 );
     ...
     // Restores the previous state.
     cXItem_Esc( ptr_menu_item, FREE_MEMORY );
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
cXItem_OK.

struct cClip * cXItem_GetParent ( struct cXItem * ptr_cxitem )
 

Returns a pointer to the cClip of the parent object.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
A pointer to the cClip of the parent object

char * cXItem_GetTitle ( struct cXItem * ptr_cxitem )
 

Returns the item's title.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
The item's title

void cXItem_Hide ( struct cXItem * ptr_cxitem )
 

Hides a cXItem object.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
None
See also:
cXItem_Show.

void cXItem_OK ( struct cXItem * ptr_cxitem )
 

Deselects the left or right section of the item (if either was selected), and saves L/Rsel to L/Rprev.

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
Returns:
None
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
    // For example, icon "1" is selected now, you can bypass the icon "2" value and set the icon "3" value.
     cXItem_SetLeft( ptr_menu_item, 2 );
     ...
     // Save the current state.
     cXItem_OK( ptr_menu_item, FREE_MEMORY );
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
cXItem_Esc.

void cXItem_SelLeft ( struct cXItem * ptr_cxitem )
 

Selects the left-side section of the item (only if the item has focus).

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
Returns:
None
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     // If you on the right item part now you can select the left item part. Note, the focus would be on the left part.
     cXItem_SelLeft( ptr_menu_item );
     ...
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
cXItem_SelRight.

void cXItem_SelRight ( struct cXItem * ptr_cxitem )
 

Selects the right-side section of the item (only if the item has focus).

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
Returns:
None
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     // If you on the left item part now you can select the right item part. Note, the focus would be on the right part.
     cXItem_SelRight( ptr_menu_item );
     ...
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
cXItem_SelLeft.

bool cXItem_Select ( struct cXItem * ptr_cxitem )
 

Selects cXItem object.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
TRUE if the object was selected

void cXItem_SetLeft ( struct cXItem * ptr_cxitem,
int index )
 

Changes the left section's value by 'index'.

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
index   A new left section's value
Returns:
None
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     // For example, "Digit 1" value is selected now, you can bypass "Digit 2" value and set the "Digit 3" value.
     cXItem_SetRight( ptr_menu_item, 2 );
     ...
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
cXItem_SetRight.

void cXItem_SetRight ( struct cXItem * ptr_cxitem,
int index )
 

Changes the right section's value by 'index'.

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
index   A new right section's value
Returns:
None
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     // For example, icon "1" is selected now, you can bypass the icon "2" value and set the icon "3" value.
     cXItem_SetLeft( ptr_menu_item, 2 );
     ...
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
cXItem_SetLeft.

void cXItem_Show ( struct cXItem * ptr_cxitem )
 

Shows a cXItem object.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
None
See also:
cXItem_Hide.

struct cXItem * cXItem_ctor ( struct cXItem * ptr_cxitem,
int width,
char * title,
char ** rstr,
char * rref,
bool submenu,
bool readonly,
struct Bitmap ** lbmp,
char * lref )
 

Constructor.
Creates a cXItem object.

Parameters:
ptr_cxitem   A pointer to cXItem structure
width   Item's width in pixels
title   Item's title.
rstr   The string in the right-side section - an array of pointers to strings, with the last pointer equaling 0
rref   A pointer to a variable that can be used to access the current right-side index
submenu   Determines if there is a submenu
readonly   Forbids entering and changing the section on the item's right side.
lbmp   The bitmap list for the left-side section - an array of pointers to bitmaps, with last pointer equaling 0
lref   A reference to a variable that can be used to access the current left-side index. Initial value is an index of an initially displayed bitmap
Returns:
A pointer to the initialized cXItem object
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }

void cXItem_dtor ( struct cXItem * ptr_cxitem,
int memory_flag )
 

Destructor.
It deletes the cXItem object.

Parameters:
ptr_cxitem   A pointer to the initialized cXItem 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 BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
FREE_MEMORY, LEAVE_MEMORY.

bool cXItem_proc ( struct cXItem * ptr_cxitem,
struct Message * ptr_message )
 

The Message-processing function.

Parameters:
ptr_cxitem   A pointer to the initialized cXItem object
ptr_message   A pointer to a Message
Returns:
TRUE if the message was processed
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   right_index = 1;
     char   left_index = 1;
     struct cItem* ptr_menu_item;
     static const char* sz_menu_text[4] = {
                                             "Digit 1",
                                             "Digit 2",
                                             "Digit 3",
                                             '\0'
                                          };
     init_module(&main_module);
     // Bitmap sequence contains three icons: digit '1', digit '2', digit '3'.
     BitmapSequence_ctor_Ex(&sq, "digits.pic");
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cItem* )malloc ( sizeof ( struct cItem ) );
     // Item will be shown as follows: '2' | "Now digit is" | "Digit 2"
     cXItem_ctor( ptr_menu_item,
                  160,
                  "Now digit is",
                  sz_menu_text,
                  &right_index,
                  FALSE,
                  FALSE,
                  bmps,
                  &left_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     ...
     ptr_message = cWinApp_get_message( main_module.m_process, 0, 1, MSG_USER );
     // cXItem will be redraw automatically now.
     cXItem_proc( ptr_menu_item, ptr_message );
     ...
     // Now you can use the <Select> button to change values on the left part of the item: "Digit 1"->"Digit 2"-> etc.
     // To move to the right part use the arrows buttons.
     // Now you can use the <Select> button to change values on the right part of the item: icon '1'->icon '2'-> etc.
     ...
     // For example, icon "1" is selected now, you can bypass the icon "2" value and set the icon "3" value.
     cXItem_SetLeft( ptr_menu_item, 2 );
     ...
     // Restore the previous state.
     cXItem_Esc( ptr_menu_item, FREE_MEMORY );
     cXItem_dtor( ptr_menu_item, FREE_MEMORY );
   }

void cXItem_update ( struct cXItem * ptr_cxitem )
 

Updates a cXItem object.

Parameters:
ptr_cxitem   A pointer to a cXItem object
Returns:
None