cProgressBar Struct Reference

Inheritance diagram for cProgressBar

Inheritance graph

Collaboration diagram for cProgressBar:

Collaboration graph


Public Methods

struct cProgressBar* cProgressBar_ctor (struct cProgressBar *, int, int, int, struct Font *, color_t, color_t, int)
void cProgressBar_dtor (struct cProgressBar *, int)
void cProgressBar_SetCurrentPos (struct cProgressBar *, int)
bool cProgressBar_proc (struct cProgressBar *ptr_cprogress_bar, struct Message *ptr_message)
void cProgressBar_Disconnect (struct cProgressBar *ptr_cprogress_bar)
bool cProgressBar_Select (struct cProgressBar *ptr_cprogress_bar)
void cProgressBar_update (struct cProgressBar *ptr_cprogress_bar)
struct cClipcProgressBar_GetParent (struct cProgressBar *ptr_cprogress_bar)
void cProgressBar_Hide (struct cProgressBar *ptr_cprogress_bar)
void cProgressBar_Show (struct cProgressBar *ptr_cprogress_bar)
void cProgressBar_Disable (struct cProgressBar *ptr_cprogress_bar)
void cProgressBar_Enable (struct cProgressBar *ptr_cprogress_bar)


Detailed Description

Use cProgressBar to add a progress bar to your application. Progress bars provide users with visual feedback about the progress of a procedure within an application. As the procedure progresses, the rectangular progress bar gradually fills from left to right with the system highlight color.

See also:
Controls


Member Function Documentation

void cProgressBar_Disable ( struct cProgressBar * ptr_cprogress_bar )
 

Disables a cProgressBar object so that it cannot be selected.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
Returns:
None
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    struct cClip* parent;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    // It's the same as using the cButton_Disable( &button ) function.
    // Now the user can't use this object.
    cObject_Disable( &button )
    ...
    // It's the same as using the cButton_Enable( &button ) function.
    // Now the user can use this object again.
    cObject_Enable( &button )
    ...
    cButton_dtor( &button, LEAVE_MEMORY ); 
See also:
cProgressBar_Enable.

void cProgressBar_Disconnect ( struct cProgressBar * ptr_cprogress_bar )
 

Disconnects a cProgressBar from it's parent object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure.
Returns:
None
    #include <cywin.h>
    ...
    struct cBitmap cbmp;
    struct Bitmap bmp;
    struct module_t main_module;
    ...
    init_module( &main_module );
    ...
    // Creates a bitmap from the file "root.ico".
    Bitmap_ctor_Ex1( &bmp, "root.ico" );
    cBitmap_ctor( &cbmp, &bmp );
    // Puts the cBitmap object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &cbmp, 10, 40 );
    ...
    // Removes the object from the Cybiko screen. It's the same as using the cObject_Disconnect( &cbmp ) function.
    cBitmap_Disconnect( &cbmp );
    ...
    // Puts the cBitmap object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &cbmp, 10, 40 );
    ...
    // Afterwards this function disconnects the cBitmap object automatically.
    cBitmap_dtor( &cbmp, LEAVE_MEMORY );
    Bitmap_dtor( &bmp, LEAVE_MEMORY ); 

void cProgressBar_Enable ( struct cProgressBar * ptr_cprogress_bar )
 

Enables for selection cProgressBar object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure.
Returns:
None
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    struct cClip* parent;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    // It's the same as using the cButton_Disable( &button ) function.
    // Now the user can't use this object.
    cObject_Disable( &button )
    ...
    // It's the same as using the cButton_Enable( &button ) function.
    // Now the user can use this object again.
    cObject_Enable( &button )
    ...
    cButton_dtor( &button, LEAVE_MEMORY ); 
See also:
cProgressBar_Disable.

struct cClip * cProgressBar_GetParent ( struct cProgressBar * ptr_cprogress_bar )
 

Returns a pointer to the cClip of the parent object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
Returns:
A pointer to the cClip of the parent object
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    struct cClip* parent;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    // It's the same as using the cButton_GetParent( &button ) function.
    // Checks for the right parent relation.
    parent = cObject_GetParent( &button );
    if ( parent == main_module.m_process )
    {
      ...
    }
    ...
    cButton_dtor( &button, LEAVE_MEMORY ); 

void cProgressBar_Hide ( struct cProgressBar * ptr_cprogress_bar )
 

Hides a cProgressBar object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
Returns:
None
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    struct cClip* parent;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    // It's the same as using the cButton_Hide( &button ) function.
    cObject_Hide( &button );
    ...
    // It's the same as using the cButton_Show( &button ) function.
    cObject_Show( &button );
    ...
    cButton_dtor( &button, LEAVE_MEMORY ); 
See also:
cProgressBar_Show.

bool cProgressBar_Select ( struct cProgressBar * ptr_cprogress_bar )
 

Selects a cProgressBar object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
Returns:
TRUE if the progress bar is selected
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    // It's the same as using the cButton_Select( &button ) function.
    // Selects the button.
    cObject_Select( &button );
    ...
    cButton_dtor( &button, LEAVE_MEMORY );

void cProgressBar_SetCurrentPos ( struct cProgressBar * ptr_cpb,
int cur_pos )
 

Sets the current bar position and updates the object.

Parameters:
ptr_cpb   A pointer to the initialized cProgressBar object
cur_pos   Should be between min_pos and max_pos (see cProgressBar_ctor). Progress status depends on a linear shift in position. Min_pos sets progress status to 0%, max_pos - to 100%
Returns:
None
       #include <cywin.h>
       {
       ...
       struct cProgressBar cprogr;
       struct module_t main_module;
       ...
       init_module( &main_module );
       ...
       // The color value may be: CLR_LTGRAY, CLR_BKGRAY, CLR_WHITE, CLR_BLACK.
       cProgressBar_ctor( &cprogr,
                          100,
                          0,
                          100,
                          cool_normal_font,
                          CLR_WHITE,
                          CLR_BLACK,
                          20 );
       // Puts the cBitmap object on the Cybiko screen.
       cWinApp_AddObj( main_module.m_process, &cprogr, 10, 40 );
       ...
       for( int i=0; i<100; i++ )
       {
          ...
          cProgressBar_SetCurrentPos( &cprogr, i );
          ...
       }
       ...
       cProgressBar_dtor( &cedit, LEAVE_MEMORY );\
       }
See also:
cProgressBar_ctor, FREE_MEMORY, LEAVE_MEMORY.

void cProgressBar_Show ( struct cProgressBar * ptr_cprogress_bar )
 

Shows a cProgressBar object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
Returns:
None
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    struct cClip* parent;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    // It's the same as using the cButton_Hide( &button ) function.
    cObject_Hide( &button );
    ...
    // It's the same as using the cButton_Show( &button ) function.
    cObject_Show( &button );
    ...
    cButton_dtor( &button, LEAVE_MEMORY ); 
See also:
cProgressBar_Hide.

struct cProgressBar * cProgressBar_ctor ( struct cProgressBar * ptr_cpb,
int width,
int min_pos,
int max_pos,
struct Font * txtfont,
color_t color,
color_t back_color,
int height )
 

Constructor.

Parameters:
ptr_cpb   A pointer to the cProgressBar struct
width   The total width of the object. Maximal length of the progress bar itself will be width - 4 because of the frame in which it is enclosed
min_pos   The value that should be passed via SetCurrentPos to set the progress status to 0%
max_pos   The value that should be passed via SetCurrentPos to set the progress status to 100%
txtfont   The font for the progress status text output
color   Main object's color
back_color   Background color
height   The total height with frame. Should not be set below default value height = 16
Returns:
A pointer to the initialized cProgressBar object
       #include <cywin.h>
       ...
       struct cProgressBar cprogr;
       struct module_t main_module;
       ...
       init_module( &main_module );
       ...
       // The color value may be: CLR_LTGRAY, CLR_BKGRAY, CLR_WHITE, CLR_BLACK.
       cProgressBar_ctor( &cprogr,
                          100,
                          0,
                          100,
                          cool_normal_font,
                          CLR_WHITE,
                          CLR_BLACK,
                          20 );
       // Puts the cBitmap object on the Cybiko screen.
       cWinApp_AddObj( main_module.m_process, &cprogr, 10, 40 );
       ...
       cProgressBar_dtor( &cedit, LEAVE_MEMORY );
See also:
cProgressBar_dtor.

void cProgressBar_dtor ( struct cProgressBar * ptr_cpb,
int memory_flag )
 

Destructor.
Deletes an object.

Parameters:
ptr_cpb   A pointer to the initialized cProgressBar 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 cProgressBar cprogr;
       struct module_t main_module;
       ...
       init_module( &main_module );
       ...
       // The color value may be: CLR_LTGRAY, CLR_BKGRAY, CLR_WHITE, CLR_BLACK.
       cProgressBar_ctor( &cprogr,
                          100,
                          0,
                          100,
                          cool_normal_font,
                          CLR_WHITE,
                          CLR_BLACK,
                          20 );
       // Puts the cBitmap object on the Cybiko screen.
       cWinApp_AddObj( main_module.m_process, &cprogr, 10, 40 );
       ...
       cProgressBar_dtor( &cedit, LEAVE_MEMORY );
See also:
FREE_MEMORY, LEAVE_MEMORY.

bool cProgressBar_proc ( struct cProgressBar * ptr_cprogress_bar,
struct Message * ptr_message )
 

The Message-processing function.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
ptr_message   A pointer to the processed message
Returns:
TRUE, if the message was processed
    #include <cywin.h>
    ...
    struct cBitmap cbmp;
    struct Bitmap bmp;
    struct module_t main_module;
    struct Message* ptr_message;
    ...
    init_module( &main_module );
    ...
    // Creates a bitmap from the file "root.ico".
    Bitmap_ctor_Ex1( &bmp, "root.ico" );
    cBitmap_ctor( &cbmp, &bmp );
    // Puts the cBitmap object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &cbmp, 10, 40 );
    ...
    ptr_message = cWinApp_get_message( main_module.m_process, 0, 1, MSG_USER );
    // It's the same as using the cObject_proc( &cbmp, ptr_message ) function.
    // Processes the messages that the cBitmap control manages.
    cBitmap_proc( &cbmp, ptr_message );
    ...
    // Afterwards this function disconnects the cBitmap object automatically.
    cBitmap_dtor( &cbmp, LEAVE_MEMORY );
    Bitmap_dtor( &bmp, LEAVE_MEMORY ); 

void cProgressBar_update ( struct cProgressBar * ptr_cprogress_bar )
 

Updates a cProgressBar object.
Sends a signal to the system, that the object must be redrawn. After you change the state of an object, you must call this function to redraw your object.

Parameters:
ptr_cprogress_bar   A pointer to the initialized cProgressBar structure
Returns:
None
    #include <cywin.h>
    ...
    struct cButton button;
    struct module_t main_module;
    ...
    init_module( &main_module );
    ...
    cButton_ctor( &button, "Button text", mrOk );
    // Puts the 'button' object on the Cybiko screen.
    cWinApp_AddObj( main_module.m_process, &button, 20, 50 );
    ...
    cWinApp_clear_screen();
    // It's the same as using the cButton_update( &button ) function.
    // Redraws the button.
    cObject_update( &button )
    ...
    cButton_dtor( &button, LEAVE_MEMORY );