cFrameForm Struct Reference

Inheritance diagram for cFrameForm

Inheritance graph

Collaboration diagram for cFrameForm:

Collaboration graph


Public Methods

struct cFrameForm* cFrameForm_ctor (struct cFrameForm *ptr_frame_form, char *text, struct cWinApp *ptr_win_app)
void cFrameForm_dtor (struct cFrameForm *ptr_frame_form)
int cFrameForm_ShowModal (struct cFrameForm *ptr_frame_form)
bool cFrameForm_proc (struct cFrameForm *ptr_frame_form, struct Message *ptr_message)
void cFrameForm_Disconnect (struct cFrameForm *ptr_frame_form)
bool cFrameForm_Select (struct cFrameForm *ptr_frame_form)
void cFrameForm_update (struct cFrameForm *ptr_frame_form)
struct cClipcFrameForm_GetParent (struct cFrameForm *ptr_frame_form)
void cFrameForm_Hide (struct cFrameForm *ptr_frame_form)
void cFrameForm_Show (struct cFrameForm *ptr_frame_form)
void cFrameForm_Disable (struct cFrameForm *ptr_frame_form)
void cFrameForm_Enable (struct cFrameForm *ptr_frame_form)
void cFrameForm_AddObj (struct cFrameForm *ptr_frame_form, struct cObject *ptr_object, int x, int y)
void cFrameForm_InsObj (struct cFrameForm *ptr_frame_form, struct cObject *ptr_object, int x, int y, int index)
void cFrameForm_RemObj (struct cClip *ptr_frame_form, struct cObject *ptr_object)
bool cFrameForm_SelectFirst (struct cFrameForm *ptr_frame_form)
bool cFrameForm_SelectPrev (struct cFrameForm *ptr_frame_form, bool round)
bool cFrameForm_SelectNext (struct cFrameForm *ptr_frame_form, bool round)
void cFrameForm_Scroll (struct cFrameForm *ptr_frame_form, struct rect_t *rectangle)
void cFrameForm_Scroll_Ex (struct cFrameForm *ptr_frame_form, int x, int y)
void cFrameForm_SendScroll (struct cFrameForm *ptr_frame_form)
int cFrameForm_GetShifty (struct cFrameForm *ptr_frame_form)
int cFrameForm_GetShiftx (struct cFrameForm *ptr_frame_form)
int cFrameForm_GetCount (struct cFrameForm *ptr_frame_form)
struct cObjectcFrameForm_get_by_index (struct cFrameForm *ptr_frame_form, int index)
int cFrameForm_FindObj (struct cFrameForm *ptr_frame_form, struct cObject *ptr_object)
struct cObjectcFrameForm_GetSelectedObject (struct cFrameForm *ptr_frame_form)


Detailed Description

This is the structure for creating a full-screen window with a frame.

After creating the form, you can show it (see cFrameForm_ShowModal) and then when a message comes in, you can process it by calling the cDialog_proc function.

You must call the cFrameForm_ctor function before use and cFrameForm_dtor function after use.

See also:
Forms & Containers , cDialog_proc


Member Function Documentation

void cFrameForm_AddObj ( struct cFrameForm * ptr_frame_form,
struct cObject * ptr_object,
int x,
int y )
 

Adds an object to the cFrameForm in position (x, y).

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object.
ptr_object   A pointer to the initialized cObject structure
x   x-coordinate of the new object
y   y-coordinate of the new object
Returns:
None

void cFrameForm_Disable ( struct cFrameForm * ptr_frame_form )
 

Disables a cFrameForm object so that it cannot be selected.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None
See also:
cFrameForm_Enable.

void cFrameForm_Disconnect ( struct cFrameForm * ptr_frame_form )
 

Disconnects a cFrameForm from its parent object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None

void cFrameForm_Enable ( struct cFrameForm * ptr_frame_form )
 

Enables a cFrameForm object so that it may be selected.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None
See also:
cFrameForm_Disable.

int cFrameForm_FindObj ( struct cFrameForm * ptr_frame_form,
struct cObject * ptr_object )
 

Returns the child object's index in the cFrameForm (or -1 ).

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
ptr_object   A pointer to the initialized cObject object
Returns:
The child object's index in the cFrameForm (or -1 )

int cFrameForm_GetCount ( struct cFrameForm * ptr_frame_form )
 

Returns the count of child objects.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
Child objects count

struct cClip * cFrameForm_GetParent ( struct cFrameForm * ptr_frame_form )
 

Returns a pointer to the parent object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
A pointer to the parent object

struct cObject * cFrameForm_GetSelectedObject ( struct cFrameForm * ptr_frame_form )
 

Returns the currently selected object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
The currently selected object

int cFrameForm_GetShiftx ( struct cFrameForm * ptr_frame_form )
 

Returns the 'x' coordinate shift (as a result of scrolling).

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
'x' coordinate shift (as a result of scrolling)

int cFrameForm_GetShifty ( struct cFrameForm * ptr_frame_form )
 

Returns the 'y' coordinate shift (as a result of scrolling).

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
'y' coordinate shift (as a result of scrolling)

void cFrameForm_Hide ( struct cFrameForm * ptr_frame_form )
 

Hides a cFrameForm object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None
   #include <cywin.h>
    ...
    // Application's main form
    struct cFrameForm* ptr_main_form;
    ...
    // Selects the effect
    cMainForm_ShowModal( ptr_main_form );
    ...
    cFrameForm_Hide( ptr_main_form );
    ...
See also:
cFrameForm_Show.

void cFrameForm_InsObj ( struct cFrameForm * ptr_frame_form,
struct cObject * ptr_object,
int x,
int y,
int index )
 

Adds an object to the cFrameForm in a position ( x, y ) with a z-position index (maximal index is on the top).

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
ptr_object   A pointer to initialized cObject structure
x   The x-coordinate of the new object
y   The y-coordinate of the new object
index   z-position of the new object
Returns:
None

void cFrameForm_RemObj ( struct cClip * ptr_frame_form,
struct cObject * ptr_object )
 

Removes an object from a cFrameForm.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object.
ptr_object   A pointer to the initialized cObject structure
Returns:
None

void cFrameForm_Scroll ( struct cFrameForm * ptr_frame_form,
struct rect_t * rectangle )
 

Scrolls a cFrameForm to make a rectangle visible.
Provides minimal scrolling.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
rectangle   A pointer to the initialized rect_t structure
Returns:
None
See also:
cFrameForm_Scroll_Ex.

void cFrameForm_Scroll_Ex ( struct cFrameForm * ptr_frame_form,
int x,
int y )
 

Scrolls a cFrameForm by (x, y), but cannot exceed the child's boundaries.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
x   "x" coordinate shift
y   "y" coordinate shift
Returns:
None
See also:
cFrameForm_Scroll.

bool cFrameForm_Select ( struct cFrameForm * ptr_frame_form )
 

Selects a cFrameForm object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
TRUE if the object was selected.

bool cFrameForm_SelectFirst ( struct cFrameForm * ptr_frame_form )
 

Selects the first object in the cFrameForm.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
FALSE if the function failed

bool cFrameForm_SelectNext ( struct cFrameForm * ptr_frame_form,
bool round )
 

Selects the next object in the cFrameForm.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
round   is TRUE if you need to select the last object after selecting the first
Returns:
FALSE if the function failed

bool cFrameForm_SelectPrev ( struct cFrameForm * ptr_frame_form,
bool round )
 

Selects the previous object in the cFrameForm.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
round   TRUE if you need to select the last object after selecting the first
Returns:
FALSE if the function failed

void cFrameForm_SendScroll ( struct cFrameForm * ptr_frame_form )
 

Forces this object to redraw its scrolling arrows.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None

void cFrameForm_Show ( struct cFrameForm * ptr_frame_form )
 

Shows a cFrameForm object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None
   #include <cywin.h>
   ...
   int cMainForm_ShowModal( struct cFrameForm* ptr_form )
   {
     cFrameForm_Show( ptr_form );
     ...
     ptr_form->ModalResult = mrNone;
     ...
     while( ptr_form->ModalResult == mrNone  &&
       ptr_menu_form->ModalResult != mrQuit )
     {
      struct Message *ptr_message =
        cWinApp_get_message( ptr_form->CurrApplication,
          0, 1, MSG_USER );
      ...
      cMainForm_proc( ptr_form, ptr_message );
      ...
      Message_delete( ptr_message );
     }
     return ptr_form->ModalResult;
   }
   ...
See also:
cFrameForm_Hide.

int cFrameForm_ShowModal ( struct cFrameForm * ptr_frame_form )
 

Shows a cFrameForm in modal mode.
This function shows the cFrameForm and enters it into the message loop. The loop continues until any one ModalResult variable is set to a non-zero value, or until a MSG_QUIT or MSG_SHUTUP messages is received. If these messages are received, the function reposts them to the application and leaves the message loop. This is how all forms will close when the application ends.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
tMResults value. mrNone(Zero) if MSG_QUIT or MSG_SHUTUP messages initiates leaving the loop. There are some predefined results
   #include <cywin.h>
     ...
     struct cFrameForm frame_form;
     struct module_t main_module;
     struct Message* ptr_message;
     ...
     init_module( &main_module );
     ...
     cFrameForm_ctor( &frame_form, "Caption", main_module.m_process );
     ...
     // Adding some objects to the custom form.
     ...
     cFrameForm_ShowModal( &frame_form );
     ...
     cFrameForm_dtor( &frame_form, LEAVE_MEMORY );
See also:
tMResults , MSG_QUIT , MSG_SHUTUP

struct cFrameForm * cFrameForm_ctor ( struct cFrameForm * ptr_frame_form,
char * text,
struct cWinApp * ptr_win_app )
 

Constructor.
Creates the full-screen window form.

Parameters:
ptr_frame_form   A pointer to a cFrameForm object
text   The form's caption
ptr_win_app   A pointer to the structure of the current cywin application
Returns:
A pointer to the initialized cFrameForm object
   #include <cywin.h>
     ...
     struct cFrameForm frame_form;
     struct module_t main_module;
     struct Message* ptr_message;
     ...
     init_module( &main_module );
     ...
     cFrameForm_ctor( &frame_form, "Caption", main_module.m_process );
     ...
     // Adding some objects to the custom form.
     ...
     cFrameForm_ShowModal( &frame_form );
     ...
     cFrameForm_dtor( &frame_form, LEAVE_MEMORY );

void cFrameForm_dtor ( struct cFrameForm * ptr_frame_form )
 

Deletes the cFrameForm object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None
   #include <cywin.h>
     ...
     struct cFrameForm frame_form;
     struct module_t main_module;
     struct Message* ptr_message;
     ...
     init_module( &main_module );
     ...
     cFrameForm_ctor( &frame_form, "Caption", main_module.m_process );
     ...
     // Adding some objects to the custom form.
     ...
     cFrameForm_ShowModal( &frame_form );
     ...
     cFrameForm_dtor( &frame_form, LEAVE_MEMORY );

struct cObject * cFrameForm_get_by_index ( struct cFrameForm * ptr_frame_form,
int index )
 

Returns an object's index (or NULL).

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
index   Object's index
Returns:
Object's index (or NULL)

bool cFrameForm_proc ( struct cFrameForm * ptr_frame_form,
struct Message * ptr_message )
 

The Message-processing function.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
ptr_message   A pointer to the processed message
Returns:
TRUE if the message was processed
   #include <cywin.h>
    ...
    bool cMainForm_proc( struct cFrameForm* ptr_form, struct Message* ptr_message )
    {
      switch( ptr_message->msgid )
      {
        case MSG_SHUTUP: // Processes the system exit signal
        case MSG_QUIT:
        ...
        ptr_form->ModalResult = mrQuit;
        ...
        break;
        ...
        case MSG_KEYDOWN: // Processes the keyboard
        ...
        switch( Message_get_key_param( ptr_message )->scancode )
        {
          case KEY_ESC:
          ...
          ptr_form->ModalResult = mrQuit;
          ...
          return TRUE;
          ...
          case KEY_ENTER:
          ...
          // ModalResult containing the selected menu item
          ptr_form->ModalResult = mrOk;
          ...
          return TRUE;
        }
      }
      return cFrameForm_proc( ptr_form, ptr_message );
    }
    ...

void cFrameForm_update ( struct cFrameForm * ptr_frame_form )
 

Updates a cFrameForm object.

Parameters:
ptr_frame_form   A pointer to the initialized cFrameForm object
Returns:
None
   #include <cywin.h>
    ...
    int cMainForm_ShowModal( struct cFrameForm* ptr_form )
    {
      ptr_form->HelpContext = 0;
      ...
      cFrameForm_Show( ptr_form );
      ...
      ptr_form->ModalResult = mrNone;
      ...
      while( ptr_form->ModalResult == mrNone )
      {
        struct Message* ptr_message =
          cWinApp_get_message( ptr_form->CurrApplication, 0, 1, MSG_USER );
        ...
        cMainForm_proc( ptr_form, ptr_message );
        ...
        cFrameForm_update( ptr_form );
        ...
        Message_delete( ptr_message );
      }
      return ptr_form->ModalResult;
    }
    ...