cXByte Struct Reference

Inheritance diagram for cXByte

Inheritance graph

Collaboration diagram for cXByte:

Collaboration graph


Public Methods

struct cXByte* cXByte_ctor (struct cXByte *ptr_cxbyte, int w, char *title, char *num, int sln, int swd, char min_val, char max_val, struct Bitmap **ll, char *lsel)
void cXByte_dtor (struct cXByte *ptr_cxbyte, int memory_flag)
void cXByte_OK (struct cXByte *ptr_cxbyte)
void cXByte_Esc (struct cXByte *ptr_cxbyte)
void cXByte_Disconnect (struct cXByte *ptr_cxbyte)
bool cXByte_Select (struct cXByte *ptr_cxbyte)
void cXByte_update (struct cXByte *ptr_cxbyte)
struct cClipcXByte_GetParent (struct cXByte *ptr_cxbyte)
void cXByte_Hide (struct cXByte *ptr_cxbyte)
void cXByte_Show (struct cXByte *ptr_cxbyte)
void cXByte_Disable (struct cXByte *ptr_cxbyte)
void cXByte_Enable (struct cXByte *ptr_cxbyte)
char* cXByte_GetTitle (struct cXByte *ptr_cxbyte)
bool cXByte_proc (struct cXByte *ptr_cxbyte, struct Message *ptr_message)
void cXByte_SelLeft (struct cXByte *ptr_cxbyte)
void cXByte_SelRight (struct cXByte *ptr_cxbyte)
void cXByte_SetLeft (struct cXByte *ptr_cxbyte, int index)
void cXByte_SetRight (struct cXByte *ptr_cxbyte, int index)
void cXByte_ScrollLR (struct cXByte *ptr_cxbyte)
void cXByte_SetStart (struct cXByte *ptr_cxbyte)
void cXByte_SaveStr (struct cXByte *ptr_cxbyte)


Detailed Description

A cXByte object is a a framed string with an icon on the left. It is used in main application screens. For more information, see the cXStr structure definition. You must call the cXByte_ctor function before use and the cXByte_dtor function after use.

See also:
Controls


Member Function Documentation

void cXByte_Disable ( struct cXByte * ptr_cxbyte )
 

Disables the cXByte object so that it cannot be selected.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None
See also:
cXByte_Enable.

void cXByte_Disconnect ( struct cXByte * ptr_cxbyte )
 

Disconnects a cXByte from its parent object.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None

void cXByte_Enable ( struct cXByte * ptr_cxbyte )
 

Enables a cXByte object so that it may be selected.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None
See also:
cXByte_Disable.

void cXByte_Esc ( struct cXByte * ptr_cxbyte )
 

Restores information.

Parameters:
ptr_cxbyte   A pointer to the initialized cXByte object
Returns:
None
   #include <cywin.h>
     ...
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   picture_index = 2;
     struct cXByte* ptr_menu_item;
     char   value;
     ...
     init_module(&main_module);
     // Bitmap sequence contains three icons: picture of '<apples>', picture of 'potatoes', picture of '<oranges>', etc.
     BitmapSequence_ctor_Ex( &sq, "food_pictures.pic" );
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = BitmapSequence_get_bitmap(&sq, 3);
     bmps[4] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cXByte* )malloc ( sizeof ( struct cXByte ) );
     strcpy( buffer, "Initial value" );
     ...
     value = 20;
     // Item will be shown as follows: '<apples>' | "has discounted (in percent)" | ""
     cXByte_ctor( ptr_menu_item,
                  160,
                  "Percent is",
                  &value,
                  3,
                  80,
                  0,
                  100,
                  bmps,
                  &picture_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     ...
     // We have made changes then restored the previous state.
     cXByte_Esc(  ptr_menu_item  );
     ...
     cXByte_dtor( ptr_menu_item, FREE_MEMORY );
See also:
cXByte_OK.

struct cClip * cXByte_GetParent ( struct cXByte * ptr_cxbyte )
 

Returns a pointer to the parent object.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
A pointer to the parent object

char * cXByte_GetTitle ( struct cXByte * ptr_cxbyte )
 

Returns the item's title.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
The item's title

void cXByte_Hide ( struct cXByte * ptr_cxbyte )
 

Hides a cXByte object.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None
See also:
cXByte_Show.

void cXByte_OK ( struct cXByte * ptr_cxbyte )
 

Saves input information.
Also converts the string on the right side to an integer, if it has been changed.

Parameters:
ptr_cxbyte   A pointer to the initialized cXByte object
Returns:
None
   #include <cywin.h>
     ...
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   picture_index = 2;
     struct cXByte* ptr_menu_item;
     char   value;
     ...
     init_module(&main_module);
     // Bitmap sequence contains three icons: picture of '<apples>', picture of 'potatoes', picture of '<oranges>', etc.
     BitmapSequence_ctor_Ex( &sq, "food_pictures.pic" );
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = BitmapSequence_get_bitmap(&sq, 3);
     bmps[4] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cXByte* )malloc ( sizeof ( struct cXByte ) );
     strcpy( buffer, "Initial value" );
     ...
     value = 20;
     // Item will be shown as follows: '<apples>' | "has discounted (in percent)" | ""
     cXByte_ctor( ptr_menu_item,
                  160,
                  "Percent is",
                  &value,
                  3,
                  80,
                  0,
                  100,
                  bmps,
                  &picture_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     ...
     // Saves the current state
     cXByte_OK(  ptr_menu_item  );
     ...
     cXByte_dtor( ptr_menu_item, FREE_MEMORY );
See also:
cXByte_Esc.

void cXByte_SaveStr ( struct cXByte * ptr_cxbyte )
 

Saves a Str to an external string.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None

void cXByte_ScrollLR ( struct cXByte * ptr_cxbyte )
 

Recalculates a StrBox.
Should be called if you moved the cursor or made changes to the string on the right side while it was selected.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None

void cXByte_SelLeft ( struct cXByte * ptr_cxbyte )
 

Selects the section on the item's left side (only if the item has the focus).

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None
See also:
cXByte_SelRight.

void cXByte_SelRight ( struct cXByte * ptr_cxbyte )
 

Selects the section on the item's right side (only if the item has the focus).

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None
See also:
cXByte_SelLeft.

bool cXByte_Select ( struct cXByte * ptr_cxbyte )
 

Selects a cXByte object.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
TRUE if the object was selected

void cXByte_SetLeft ( struct cXByte * ptr_cxbyte,
int index )
 

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

Parameters:
ptr_cxbyte   A pointer to a cXByte object
index   A new left side's value
Returns:
None
See also:
cXByte_SetRight.

void cXByte_SetRight ( struct cXByte * ptr_cxbyte,
int index )
 

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

Parameters:
ptr_cxbyte   A pointer to a cXByte object
index   A new right side's value
Returns:
None
See also:
cXByte_SetLeft.

void cXByte_SetStart ( struct cXByte * ptr_cxbyte )
 

Highlights the entire string on the item's right side and positions the cursor at its end (only when the section on the item's right side is selected).

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None

void cXByte_Show ( struct cXByte * ptr_cxbyte )
 

Shows a cXByte object.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None
See also:
cXByte_Hide.

struct cXByte * cXByte_ctor ( struct cXByte * ptr_cxbyte,
int w,
char * title,
char * num,
int sln,
int swd,
char min_val,
char max_val,
struct Bitmap ** ll,
char * lsel )
 

Constructor.
Creates an empty cXByte object.

Parameters:
ptr_cxbyte   A pointer to a cSItem struct
w   Item width in pixels (including left and right sections)
title   Title string
num   An integer value that will be converted into a string for the initial string in the item's right section
sln   Maximum character length of the right string on the item's right side (not including finishing '\0' )
swd   Maximum width, in pixels, of the visible part of the string on the item's right side (not including 2 pixels for the surrounding frame)
min_val   The lowest acceptable integer
max_val   The highest acceptable integer
ll   The bitmap list for the section on the item's left side - an array of pointers to bitmaps, with last pointer equaling 0
lsel   A reference to a variable that can be used to access the current left-side index
Returns:
A pointer to the initialized cXByte object
   #include <cywin.h>
     ...
   {
     struct BitmapSequence sq;
     struct Bitmap* bmps[4];
     char   picture_index = 2;
     struct cXByte* ptr_menu_item;
     char   value;
     ...
     init_module(&main_module);
     // Bitmap sequence contains three icons: picture of '<apples>', picture of 'potatoes', picture of '<oranges>', etc.
     BitmapSequence_ctor_Ex( &sq, "food_pictures.pic" );
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = BitmapSequence_get_bitmap(&sq, 3);
     bmps[4] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cXByte* )malloc ( sizeof ( struct cXByte ) );
     strcpy( buffer, "Initial value" );
     ...
     value = 20;
     // Item will be shown as follows: '<apples>' | "has discounted (in percent)" | ""
     cXByte_ctor( ptr_menu_item,
                  160,
                  "Percent is",
                  &value,
                  3,
                  80,
                  0,
                  100,
                  bmps,
                  &picture_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     ...
     cXByte_dtor( ptr_menu_item, FREE_MEMORY );
   }

void cXByte_dtor ( struct cXByte * ptr_cxbyte,
int memory_flag )
 

Destructor.
Deletes the cXByte object.

Parameters:
ptr_cxbyte   A pointer to the initialized cXByte 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   picture_index = 2;
     struct cXByte* ptr_menu_item;
     char   value;
     ...
     init_module(&main_module);
     // Bitmap sequence contains three icons: picture of '<apples>', picture of 'potatoes', picture of '<oranges>', etc.
     BitmapSequence_ctor_Ex( &sq, "food_pictures.pic" );
     bmps[0] = BitmapSequence_get_bitmap(&sq, 0);
     bmps[1] = BitmapSequence_get_bitmap(&sq, 1);
     bmps[2] = BitmapSequence_get_bitmap(&sq, 2);
     bmps[3] = BitmapSequence_get_bitmap(&sq, 3);
     bmps[4] = NULL;
     cWinApp_clear_screen();
     ptr_menu_item = (struct cXByte* )malloc ( sizeof ( struct cXByte ) );
     strcpy( buffer, "Initial value" );
     ...
     value = 20;
     // Item will be shown as follows: '<apples>' | "has discounted (in percent)" | ""
     cXByte_ctor( ptr_menu_item,
                  160,
                  "Percent is",
                  &value,
                  3,
                  80,
                  0,
                  100,
                  bmps,
                  &picture_index );
     cWinApp_AddObj( main_module.m_process, ptr_menu_item, 0, 40 );
     ...
     cXByte_dtor( ptr_menu_item, FREE_MEMORY );
   }
See also:
FREE_MEMORY, LEAVE_MEMORY.

bool cXByte_proc ( struct cXByte * ptr_cxbyte,
struct Message * ptr_message )
 

The Message-processing function.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
ptr_message   A pointer to the Message
Returns:
TRUE if the message was processed

void cXByte_update ( struct cXByte * ptr_cxbyte )
 

Updates a cXByte object.

Parameters:
ptr_cxbyte   A pointer to a cXByte object
Returns:
None