//
// Copyright (C) 1999-2004 WideStudio Development Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// WIDESTUDIO DEVELOPMENT TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// Except as contained in this notice, the name of WideStudio Development Team
// shall not be used in advertising or otherwise to promote the sale, use or
// other dealings in this Software without prior written authorization from
// WideStudio Development Team.

#ifndef WSCPROPEDIT_H
#define WSCPROPEDIT_H

#include <WScom.h>
#include <WSCscrForm.h>

class WSCscrForm;
class WSCvbtn;
class WSCvlabel;
class WSCvlabel;
class WSCoption;
class WSCvifield;
class WSCmessageDialog;
class WSCcolorSelect;
class WSCvfbtn;
class WSCdialog;
class WSCtextField;
class WSCvkslabel;

class WSCpropertyEditor  :public WSCscrForm{

  protected:
     void* _voidp_client;
     WSMFpropertyDef( WSNclient,  void*,          _voidp_client ); 

//     WSCscrForm*  _scr_area;
     WSCmessageDialog* _msg;
     WSClistData  _if_list;
     WSClistData  _cif_list;
     WSClistData  _option_list;
     WSClistData  _label_list;
     WSCbase*     _client;

     WSCdialog* newdial_000;
     WSCvlabel* newvlab_001;
     WSCvkslabel* newvifi_002;
     WSCvlabel* newvlab_004;
     WSCvkslabel* newvifi_005;
     WSCvlabel* newvlab_006;
     WSCtextField* newtext_007;
     WSCoption* newopti_008;
     WSCbool _update_sequence;

     void setWorkWSNwidth(WSCushort);
     void setWorkWSNheight(WSCushort);

     void _check_name(char* );

    virtual void onVisibleChange(WSCbool);
    virtual void onParentVisibleChange(WSCbool);
    virtual void onActivate();
    virtual void onValueChange();

     void updateGeometryProperties();
static void _set_cbtn_work(WSCbase*);

static void _set_btn_work(WSCbase*);
static void _color_set_work(WSCbase*,void*);
static void _cset_btn_work(WSCbase*);
static void _if_focus_on(WSCbase*);
static void _exec_change_name_handler(WSCbase* this_instance);
static void (*_ch_name_handler)(WSCbase* this_instance);
static void _popup_prop_work(WSCbase*);
static void _set_prop_work(WSCbase*);
   void _sort_property(WSClistData* dest,WSClistData* src);
static void _delay_update_work(WSCuchar clk,void*);
 
  public:
static void setChangeNameHandler(void (*)(WSCbase*));

    WSCpropertyEditor(WSCbase*,char*);
    virtual ~WSCpropertyEditor();

    virtual  long initialize();
    virtual void onGuiPolicyChange(long);

//    virtual long execEventProc(long,void*);
    void updateProperties();

    void setPropertyDataToClient();

virtual  void update();  //if GEOMETRY-UPDATE of user data is 1 then
                         //execute updateGeometryProperties()
    WSMFguiClassDef(WSCpropertyEditor,WSCform);

};
extern WSDLEX WSCbase* WSGIappPropertyEditor();
#endif //WSCPROPEDIT_H
