Wide Studio Object Reference

Wide Studio Home
Up to

## Class Name

WSCbase

## Specification of methods

### initialize method

Form
  long initialize()
Function
  Initializes the instance.
Description
Parameters
  None.
Return value
  Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
Notice
  Requires calling this initialize method once before calling the others.
Samples

      WSCbase* create_proc(WSCbase* parent){
         WSCbase* inst = new  WSCdialog(parent,"newwin000");
         inst->initialize();
         inst->setPropertyV(WSNname,"newwin000");
         inst->setPropertyV(WSNtitleString,"title1");
         inst->setPropertyV(WSNvis,(WSCbool)1);
         return inst;
      }

### getInitialized method

Form
  WSCbool getInitialized()
Function
  Returns the status of initializing.
Description
  Acquires whether the instance is initialized.
Parameters
  None.
Return value
  Returns True if initialized; returns False if not.
Notice
Samples

      void sample_proc(WSCbase* object){
        if (object->getInitialized() != False){
          //object is initialized by initialize()
        }else{
          //object is not initialized.
        }
      }

### getInstanceName method

Form
  char* getInstanceName()
Function
  Returns the instance name.
Description
Parameters
  None.
Return value
  Returns the instance name.
Notice
  Do not delete the return value; and it will become invalid by calling setInstanceName().
Samples

      void sample_proc(WSCbase* object){
        char* iname = object->getInstanceName();
        printf("instance name=%s\n",iname);

        char* iname2 = object->getInstanceName();
        object->setInstanceName("new-name"); //delete the pointer.
        //value: iname2 becomes junc pointer by setInstanceName()...
        printf("instance name=%s\n",iname2); //junc pointer!!

        WSCstring iname3;
        iname3 = object->getInstanceName();
        object->setInstanceName("new-name");
        printf("instance name=%s\n",(char*)iname3); //not junc pointer.
      }

### setInstanceName method

Form
  void setInstanceName(char*)
Function
  Specifies the instance name.
Description
Parameters

  (in)char* pname | instance name

Return value
  None.
Notice
Samples
  Refer to getInstanceName().

  ### getClassName method

  Form
    char* getClassName()
  Function
    Returns the class name of the instance.
  Description
  Parameters
    None.
  Return value
    Returns the class name.
  Notice
    Do not delete the return value.
  Samples

        void sample_proc(WSCbase* object){
          char* cname = object->getClassName();
          printf("class name=%s\n",cname);
        }

  ### cast method

  Form
    void* cast(char* class_name)
  Function
    Supplies the function of down cast. Usually C++ language does not allow casting an abstract pointer to a pointer of a child class. So the instance has all child class pointers, cast() method seek for a specified class pointer from among all the contained pointers of child classes.
  Description
  Parameters

    (in)char* class_name | child class name

  Return value
    Returns the pointer. If the specified class does not relate, returns NULL.
  Notice
    Please use the returned pointer as follows.
  Samples

          extern WSCbase* object;
          // WSCvlabel* label = (WSCvlabel*)object; //C++ does not allow this.
          WSCvlabel* label = (WSCvlabel*)object->cast("WSCvlabel");
          if (label == NULL){
            //if this "object" does not relate to WSCvlabel class,
            //returns NULL.
          }else{
            //it is OK.
            //this "object" is the child class of WSCvlabel.
            //cast void* to WSCvlabel* ...
          }

  ### setProperty method

  Form
    WSCbool setProperty(char* pname,const WSCvariant &)
  Function
    Sets the value into the property.
  Description
    Seeks for the specified property, then sets the value into it.
  Parameters

    (in)char* pname | the property name
    (in)WSCvariant & value | the value

  Return value
    Returns True if it succeeds, False if it fails.
  Notice
    Second parameter requires any type which it can cast to WSCvariant.
  Samples

        void sample_proc(WSCbase* object){
          long  val1 = 1;
          object->setProperty(WSNlabelString,val1); //set long value.
          char* val2 = "char* string..";
          object->setProperty(WSNlabelString,val2); //set string value.
          WSCstring val3 = "WSCstring..";
          object->setProperty(WSNlabelString,val3); //set WSCstring value.
          WSCvariant val4 = 1;
          object->setProperty(WSNlabelString,val4); //set WSCvariant value.
        }

  ### getProperty method

  Form
    WSCvariant getProperty(char* pname)
  Function
    Returns the value of the specified property
  Description
    Seeks for the specified property, then returns the value of it.
  Parameters

    (in)char* pname | the property name

  Return value
    Returns the value by WSCvariant type.
  Notice
  Samples

        void sample_proc(WSCbase* object){
          long  val1 = object->getProperty(WSNlabelString); //get the value by long.
          printf("val1=%d\n",val1);
          //get value by string.
          WSCstring val2 = object->getProperty(WSNlabelString); //get the value by WSCstring.
          printf("val2=%s\n",(char*)val2);
        //Error! val2 becomes junc pointer!!!
        //  char* val2 = object->getProperty(WSNlabelString);
        }

  ### setVisible method

  Form
    void setVisible(WSCbool fl)
  Function
    Specifies the status of visibility.
  Description
  Parameters

    (in)WSCbool fl | visibility True = visible, False = invisible

  Return value
    None.
  Notice
    This state is equal to the WSNvis property.
  Samples

        void sample_proc(WSCbase* object){
          if ( object->getVisible() == False){
            object->setVisible(True);
          }else{
            object->setVisible(False);
          }
        }

  ### getVisible method

  Form
    WSCbool getVisible()
  Function
    Returns the status of visibility.
  Description
    Returns the status of visibility including the parent instance.
  Parameters
    None.
  Return value
    Returns the current visibility.
  Notice
    The return value is not always equal to the WSNvis property because it includes the status of the parent instance. It returns False if the parent instance is invisible and the instance is visible.
  Samples
    Refer to setVisible()

  ### setSensitive method

  Form
    void setSensitive(WSCbool fl)
  Function
    Specifies the state of sensitivity.
  Description
  Parameters

    (in)WSCbool fl | True = sensitive, False = insensitive

  Return value
    None.
  Notice
    if the parent instance is insensitive and the instance is sensitive, it becomes insensitive.
  Samples

        void sample_proc(WSCbase* object){
          if ( object->getSensitive() == False){
            object->setSensitive(True);
          }else{
            object->setSensitive(False);
          }
        }

  ### getVisible method

  Form
    WSCbool getVisible()
  Function
    Returns the sensitivity
  Description
    Returns the sensitivity including the parent instance.
  Parameters
    None.
  Return value
    Returns the current sensitivity.
  Notice
    The return value is not always equal with the WSNdet property because it includes the status of the parent instance. It returns False if the parent instance is insensitive and the instance is sensitive.
  Samples
    Refer to setSensitive().

  ### draw method

  Form
    long draw()
  Function
    Draws the instance.
  Description
  Parameters
    None.
  Return value
    Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
  Notice
    It does not draw if the instance is drawn once, so if you want to draw it forcibly, execute the method: setAbsoluteDraw(True).
  Samples

        void sample_proc(WSCbase* object){
          //draw only if needed.
          object->draw();

          //draw forcely.
          object->setAbsoluteDraw(True);
          object->draw();

          //draw with created expose event.
          object->redraw();

        }

  ### redraw method

  Form
    long redraw()
  Function
    Clears and draws the instance.
  Description
  Parameters
    None.
  Return value
    Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
  Samples
    Refer to draw().
  Notice

  ### update method

  Form
    long update()
  Function
    If needed, clears and draws the instance.
  Description
    A change of properties causes the necessity of updating.
  Parameters
    None.
  Return value
    Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
  Samples

        void sample_proc(WSCbase* object){
          //execute updating the instance only when if it is needed.
          object->update();
        }

  Notice

  ### getChildren method

  Form
    WSClistData & getChildren()
  Function
    Returns a list of child instances. It functions as a method of the classes which has the ability to manage child instances.
  Description
  Parameters
    None.
  Return value
    Returns the list of child instances.
  Notice
    Accessing of child instances is as follows. The "parent" is a management class like the WSCform,WSCwindow class which has child instances.
  Samples

          WSClistData children = parent->getChildren();
          int num = children.getNum();
          for(int i=0; i < num; i++){
            WSCbase* child = (WSCbase*)children[i];
            //do someting to child instance...
          }

  ### execProcedure method

  Form
    void execProcedure(long trigger)
  Function
    Executes the event procedures by a specified trigger.
  Description
  Parameters

    (in)long trigger | the trigger

  Return value
    None.
  Notice
    This method does nothing if there are no event procedures.
  Samples

        void sample_proc(WSCbase* object){
          object->execProcedure(WSEV_ACTIVATE);
        }

  ### execProcedure method

  Form
    void execProcedure(char* pname)
  Function
    Executes the event procedures by a specified procedure name.
  Description
  Parameters

    (in)char* pname | Event procedure name

  Return value
    None.
  Notice
    This method does nothing if there are no event procedures.
  Samples

        void sample_proc(WSCbase* object){
          object->execProcedure("event procedure name");
        }

  ### setFocus method

  Form
    long setFocus(WSCbool fl = True)
  Function
    Changes the state of the keyboard focus.
  Description
  Parameters

    (in)WSCbool fl | True = focused, False = lost focus

  Return value
    Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
  Notice
    By changing the state,it executes the event method: onFocusChange().
  Samples

        void sample_proc(WSCbase* object){
          //set focus.
          object->setFocus();
          //set focus.
          object->setFocus(True);
          //unset focus.
          object->setFocus(False);
        }

  ### getFocus method

  Form
    WSCbool getFocus()
  Function
    Returns the state of the keyboard focus.
  Description
  Parameters
    None.
  Return value
    Returns True if it is focused; returns False if not.
  Notice
  Samples

        void sample_proc(WSCbase* object){
          WSCbool fl = object->getFocus();
          if (fl == False){
            //not focused..
          }else{
            //focused..
          }
        }

  ### setSpecialFocus method

  Form
    long setSpecialFocus(WSCbool fl = True)
  Function
    Changes the state of the keyboard special focus.
  Description
  Parameters

    (in)WSCbool fl | True = focused, False = lost focus

  Return value
    Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
  Notice
    It executes the event method by changing the state: onSpecialFocusChange().
  Samples

        void sample_proc(WSCbase* object){
          //set focus.
          object->setSpecialFocus();
          //set focus.
          object->setSpecialFocus(True);
          //unset focus.
          object->setSpecialFocus(False);
        }

  ### getSpecialFocus method

  Form
    WSCbool getSpecialFocus()
  Function
    Returns the state of the keyboard special focus.
  Description
  Parameters
    None.
  Return value
    Returns True if it is focused; returns False if not.
  Notice
  Samples

        void sample_proc(WSCbase* object){
          WSCbool fl = object->getSpecialFocus();
          if (fl == False){
            //not focused..
          }else{
            //focused..
          }
        }

  ### getAllChildren method

  Form
    long getAllChildren(WSClistData &list)
  Function
    Returns all children.
  Description
    getChildren() returns the children of the instance, but getAllChildren() returns all of the children of the instance and its children, recursively.
  Parameters

    (out)WSClistData & list | the list which contains the return value.

  Return value
    Returns WS_NO_ERR if it succeeds; returns otherwise if it fails.
  Notice
  Samples

        void sample_proc(WSCbase* object){
          WSClistData children;
          object->getAllChildren(children);
          int i;
          long num = children.getNum();
          for(i=0; i< num; i++){
            WSCbase* child = (WSCbase*)children[i];
            //access child instances..
          }
        }

  ### getParentWindow method

  Form
    WSCbase* getParentWindow()
  Function
    Returns the parent application window of the instance.
  Description
    Follows the parents and finds the top parent instance. Then it returns that instance.
  Parameters
    None.
  Return value
    Returns the application window.
  Notice
    Returns the instance if the instance is the application window.
  Samples

        void sample_proc(WSCbase* object){
          WSCbase* parent_window = object->getParentWindow();
        }

  ### getParent method

  Form
    WSCbase* getParent()
  Function
    Returns the parent instance.
  Description
  Parameters
    None.
  Return value
    The parent instance.
  Notice
  Samples

        void sample_proc(WSCbase* object){
          WSCbase* parent = object->getParent();
        }

  ### onMouseIn method

  Form
    virtual void onMouseIn(WSCpoint* pt)
  Function
    It executes this method when the mouse pointer moves into the area of the instance.
  Description
    Instead of the event procedure by the WSEV_MOUSE_IN trigger, the WSEV_MOUSE_IN event can be handled by overloading of this method.
  Parameters

    (out)WSCpoint* pt | the coordinate of the mouse pointer

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onMouseIn(WSCpoint* pt){
          short x = pt->x; //X
          short y = pt->y; //Y
          //This event method is called when the mouse pointer moves into this area.

          //call the method of the parent class.
          old_class::onMouseIn(pt);
        }

  ### onMouseOut method

  Form
    virtual void onMouseOut()
  Function
    It executes this method when the mouse pointer leaves the area of the instance.
  Description
    Instead of the event procedure by the WSEV_MOUSE_OUT trigger, the WSEV_MOUSE_OUT event can be handled by overloading of this method.
  Parameters
    None.
  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onMouseOut(){
          //This event method is called when the mouse pointer moves out of this area.

          //call the method of the parent class.
          old_class::onMouseOut();
        }

  ### onMouseMove method

  Form
    virtual void onMouseMove(WSCpoint* pt)
  Function
    It executes this method when the mouse pointer moves in the area of the instance.
  Description
    Instead of the event procedure by the WSEV_MOUSE_MOVE trigger, the WSEV_MOUSE_MOVE event can be handled by overloading of this method.
  Parameters

    (out)WSCpoint* pt | the coordinate of the mouse pointer

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onMouseMove(WSCpoint* pt){
          short x = pt->x; //X
          short y = pt->y; //Y
          //This event method is called when the mouse pointer moves over this area.

          //call the method of the parent class.
          old_class::onMouseMove(pt);
        }

  ### onMousePress method

  Form
    virtual void onMousePress(WSCpoint* pt)
  Function
    It executes this method when the mouse pointer is pressed in the area of the instance.
  Description
    Instead of the event procedure by the WSEV_MOUSE_PRESS trigger, the WSEV_MOUSE_PRESS event can be handled by overloading of this method.
  Parameters

    (out)WSCpoint* pt | the coordinate of the mouse pointer

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        #include <WSDmouse.h>
        void new_class::onMousePress(WSCpoint* pt){
          short x = pt->x; //X
          short y = pt->y; //Y
          //get pressed button.
          long status  = WSGIappMouse()->getMouseStatus();
          if (status & WS_MOUSE_BTN1){
            //Left button is pressed.
          }
          if (status & WS_MOUSE_BTN2){
            //Middle button is pressed.
          }
          if (status & WS_MOUSE_BTN3){
            //Right button is pressed.
          }
          //call the method of the parent class.
          old_class::onMousePress(pt);
        }

  ### onMouseRelease method

  Form
    virtual void onMouseRelease(WSCpoint* pt)
  Function
    It executes this method when the mouse pointer is released in the area of the instance.
  Description
    Instead of the event procedure by the WSEV_MOUSE_RELEASE trigger, the WSEV_MOUSE_RELEASE event can be handled by overloading of this method.
  Parameters

    (out)WSCpoint* pt | the coordinate of the mouse pointer

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        #include <WSDmouse.h>
        void new_class::onMouseRelease(WSCpoint* pt){
          short x = pt->x; //X
          short y = pt->y; //Y
          //do something for WSEV_MOUSE_RELEASE event.

          //call the method of the parent class.
          old_class::onMouseRelease(pt);
        }

  ### onExpose method

  Form
    virtual void onExpose(WSCrect* rect)
  Function
    It executes this method when the instance is exposed.
  Description
    Instead of the event procedure by the WSEV_EXPOSE trigger, the WSEV_EXPOSE event can be handled by overloading of this method.
  Parameters

    (out)WSCrect* rect | the coordinate of the exposed area

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onExpose(WSCrect* rect){
          //do something for EXPOSE event.

          //call the method of the parent class.
          old_class::onExpose(rect);
        }

  ### onResize method

  Form
    virtual void onResize(WSCrect* rect)
  Function
    It executes this method when the instance is resized.
  Description
    Instead of the event procedure by the WSEV_RESIZE trigger, the WSEV_RESIZE event can be handled by overloading of this method.
  Parameters

    (out)WSCrect* rect | the coordinate, width, and height of the instance

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onResize(){
          //do something for RESIZE event.

          //call the method of the parent class.
          old_class::onResize();
        }

  ### onVisibleChange method

  Form
    virtual void onVisibleChange(WSCbool vis)
  Function
    It executes this method when the state of visibility is changed.
  Description
    Instead of the event procedure by the WSEV_VISIBLE_CH trigger, the WSEV_VISIBLE_CH event can be handled by overloading of this method.
  Parameters

    (out)WSCbool vis | the new state of the visibility

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onVisibleChange(WSCbool vis){
          //do something for VISIBLE_CH event.
          if (vis == False){
            //not visible
          }else{
            //visible
          }

          //call the method of the parent class.
          old_class::onVisibleChange();
        }

  ### onParentVisibleChange method

  Form
    virtual void onParentVisibleChange(WSCbool vis)
  Function
    It executes this method when the state of the parent's visibility is changed.
  Description
    Instead of the event procedure by the WSEV_PARENT_VISIBLE_CH trigger, the WSEV_PARENT_VISIBLE_CH event can be handled by overloading of this method.
  Parameters

    (out)WSCbool vis | the new state of the parent's visibility

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onParentVisibleChange(WSCbool vis){
          //do something for PARENT_VISIBLE_CH event.
          if (vis == False){
            //not visible
          }else{
            //visible
          }
          //call the method of the parent class.
          old_class::onParentVisibleChange(vis);
        }

  ### onSensitiveChange method

  Form
    virtual void onSensitiveChange(WSCbool det)
  Function
    It executes this method when the state of the sensitivity is changed.
  Description
    Instead of the event procedure by the WSEV_SENSITIVE_CH trigger, the WSEV_SENSITIVE_CH event can be handled by overloading of this method.
  Parameters

    (out)WSCbool det | the new state of the sensitivity

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onSensitiveChange(WSCbool vis){
          //do something for SENSITIVE_CH event.
          if (vis == False){
            //not sensitive.
          }else{
            //sensitive.
          }
          //call the method of the parent class.
          old_class::onSensitiveChange(vis);
        }

  ### onParentSensitiveChange method

  Form
    virtual void onParentSensitiveChange(WSCbool det)
  Function
    It executes this method when the state of the parent's sensitivity is changed.
  Description
    Instead of the event procedure by the WSEV_PARENT_SENSITIVE_CH trigger, the WSEV_PARENT_SENSITIVE_CH event can be handled by overloading of this method.
  Parameters

    (out)WSCbool det | the state of the parent's sensitivity

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onParentSensitiveChange(WSCbool vis){
          //do something for PARENT_SENSITIVE_CH event.
          if (vis == False){
            //not sensitive.
          }else{
            //sensitive.
          }
          //call the method of the parent class.
          old_class::onParentSensitiveChange(vis);
        }

  ### onChildAdded method

  Form
    virtual void onChildAdded(WSCbase* child)
  Function
    It executes this method when the child is added to the instance.
  Description
    the added child instance event can be handled by overloading of this method.
  Parameters

    (out)WSCbase* child | the added child instance

  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onChildAdded(WSCbase* child){
          //This event method is called when a child instance is added.

          //call the method of the parent class.
          old_class::onChildAdded(child);
        }

  Document Release 3.70
  For use with Wide Studio Release 3.70, Spring 2004

  Wide Studio Home | Up to

  Copyright(C) WideStudio Development Team, 1999-2004 |  | Last modified: May 25, 2004