cBitmap Struct Reference

Inheritance diagram for cBitmap

Inheritance graph

Collaboration diagram for cBitmap:

Collaboration graph


Public Methods

struct cBitmap* cBitmap_ctor (struct cBitmap *, struct Bitmap *)
struct cBitmap* cBitmap_ctor_Ex (struct cBitmap *, struct Bitmap *, color_t)
void cBitmap_dtor (struct cBitmap *, int)
void cBitmap_SetFlips (struct cBitmap *, short)
bool cBitmap_proc (struct cBitmap *ptr_cbitmap, struct Message *ptr_message)
void cBitmap_Disconnect (struct cBitmap *ptr_cbitmap)
bool cBitmap_Select (struct cBitmap *ptr_cbitmap)
void cBitmap_update (struct cBitmap *ptr_cbitmap)
struct cClipcBitmap_GetParent (struct cBitmap *ptr_cbitmap)
void cBitmap_Hide (struct cBitmap *ptr_cbitmap)
void cBitmap_Show (struct cBitmap *ptr_cbitmap)
void cBitmap_Disable (struct cBitmap *ptr_cbitmap)
void cBitmap_Enable (struct cBitmap *ptr_cbitmap)


Detailed Description

Use this structure to put a simple picture on the screen.

See also:
Controls


Member Function Documentation

void cBitmap_Disable ( struct cBitmap * ptr_cbitmap )
 

Disables a cBitmap object so that it cannot be selected.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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:
cBitmap_Enable.

void cBitmap_Disconnect ( struct cBitmap * ptr_cbitmap )
 

Disconnects a cBitmap from its parent object.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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 cBitmap_Enable ( struct cBitmap * ptr_cbitmap )
 

Enables a cBitmap object so that it may be selected.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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:
cBitmap_Disable.

struct cClip * cBitmap_GetParent ( struct cBitmap * ptr_cbitmap )
 

Returns a pointer to the parent object's cClip.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
Returns:
A pointer to the parent object's cClip
    #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 cBitmap_Hide ( struct cBitmap * ptr_cbitmap )
 

Hides a cBitmap object.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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:
cBitmap_Show.

bool cBitmap_Select ( struct cBitmap * ptr_cbitmap )
 

Selects a cBitmap object.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
Returns:
TRUE if the object was 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 cBitmap_SetFlips ( struct cBitmap * ptr_cbitmap,
short flip )
 

Changes the 'flip' state.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
flip   A flip state flag. It may be any combination of the following: BM_NORMAL, BM_INVERSE, BM_FLIP_X, BM_FLIP_Y
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" );
       // The color value may be: CLR_LTGRAY, CLR_BKGRAY, CLR_WHITE, CLR_BLACK.
       cBitmap_ctor_Ex( &cbmp, &bmp, CLR_LTGRAY );
       // Puts the cBitmap object on the Cybiko screen.
       cWinApp_AddObj( main_module.m_process, &cbmp, 10, 40 );
       ...
       cBitmap_SetFlips( &cbmp, BM_FLIP_X );
       ...
       cBitmap_dtor( &cbmp, LEAVE_MEMORY );
       Bitmap_dtor( &bmp, LEAVE_MEMORY );
See also:
BM_NORMAL , BM_INVERSE , BM_FLIP_X , BM_FLIP_Y

void cBitmap_Show ( struct cBitmap * ptr_cbitmap )
 

Shows a cBitmap object.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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:
cBitmap_Hide.

struct cBitmap * cBitmap_ctor ( struct cBitmap * ptr_cbitmap,
struct Bitmap * ptr_pic )
 

Constructor for a non-transparent picture.

Parameters:
ptr_cbitmap   A pointer to the cBitmap object
ptr_pic   A pointer to a template cBitmap object
Returns:
A pointer to the initialized cBitmap object
       #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 );
       ...
       cBitmap_dtor( &cbmp, LEAVE_MEMORY );
       Bitmap_dtor( &bmp, LEAVE_MEMORY );
See also:
cBitmap_ctor_Ex.

struct cBitmap * cBitmap_ctor_Ex ( struct cBitmap * ptr_cbitmap,
struct Bitmap * ptr_pic,
color_t color )
 

Extended version of the cBitmap_ctor function.
Constructs a transparent picture.

Parameters:
ptr_cbitmap   A pointer to the cBitmap struct
ptr_pic   A pointer to the template cBitmap object
color   A transparent color
Returns:
A pointer to the initialized cBitmap object
       #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" );
       // The color value may be following: CLR_LTGRAY, CLR_BKGRAY, CLR_WHITE, CLR_BLACK.
       cBitmap_ctor_Ex( &cbmp, &bmp, CLR_LTGRAY );
       // Puts the cBitmap object on the Cybiko screen.
       cWinApp_AddObj( main_module.m_process, &cbmp, 10, 40 );
       ...
       cBitmap_dtor( &cbmp, LEAVE_MEMORY );
       Bitmap_dtor( &bmp, LEAVE_MEMORY );
See also:
cBitmap_ctor.

void cBitmap_dtor ( struct cBitmap * ptr_cbitmap,
int memory_flag )
 

Destructor.
Deletes an object.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
memory_flag   Can be FREE_MEMORY or LEAVE_MEMORY. If 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 stack
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" );
       // The color value should have as follows: CLR_LTGRAY, CLR_BKGRAY, CLR_WHITE, CLR_BLACK.
       cBitmap_ctor_Ex( &cbmp, &bmp, CLR_LTGRAY );
       // Puts the cBitmap object on the Cybiko screen.
       cWinApp_AddObj( main_module.m_process, &cbmp, 10, 40 );
       ...
       cBitmap_dtor( &cbmp, LEAVE_MEMORY );
       Bitmap_dtor( &bmp, LEAVE_MEMORY );
See also:
FREE_MEMORY, LEAVE_MEMORY.

bool cBitmap_proc ( struct cBitmap * ptr_cbitmap,
struct Message * ptr_message )
 

The Message-processing function.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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 mesages that manages the cBitmap control.
    cBitmap_proc( &cbmp, ptr_message );
    ...
    // Afterwards this function disconnects the cBitmap object automatically.
    cBitmap_dtor( &cbmp, LEAVE_MEMORY );
    Bitmap_dtor( &bmp, LEAVE_MEMORY ); 

void cBitmap_update ( struct cBitmap * ptr_cbitmap )
 

Updates a cBitmap object.

Parameters:
ptr_cbitmap   A pointer to the initialized cBitmap object
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 );