//
// 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 WSCPROCEDUREEDITOR_H
#define WSCPROCEDUREEDITOR_H

#include <WScom.h>
#include <WSCform.h>

class WSCscrForm;
class WSCvbtn;
class WSCvlabel;
class WSCform;
class WSCvlabel;
class WSCoption;
class WSCvifield;
class WSCcolorSelect;
class WSCmessageDialog;
//class WSCdialogBase;
class WSCbaseDialog;
class WSCfileSelect;
class WSCvtoggle;
class WSClist;
class WSCpopupMenu;

class WSCprocedureEditor  :public WSCform {

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

     WSCbase*     _client;
     WSClist*     _list;
     WSCmessageDialog* _msg;
     WSCbaseDialog*    _dialog1;
     WSCvlabel*      _if1;
     WSCvifield*    _if2;
     WSCvifield*    _if3;
     WSCoption*     _opt1;
     WSCfileSelect* _fs;
     WSCvtoggle*    _use_file;
     WSCstring      _file_data;
     WSCstring      _file_name;
     WSCvbtn*       _fsbtn;
     WSCvbtn*       _cbtn;
     void*           _editor_hd;
     void*           _dir_hd;
     WSCform* _darea1;
//     WSCform* _darea2;
     WSCpopupMenu* _pmenu;
static WSCeventProc evprocs[];
static void _set_cbtn_work(WSCbase*);
static void _end_btn_work(WSCbase*);
//static void _lbs2_work(WSCbase*);
static void _ibtn1_work(WSCbase*);
static void _ibtn2_work(WSCbase*);
static void _ibtn3_work(WSCbase*);
static void _ibtn4_work(WSCbase*);
static void _ibtn4_work2(WSCbase*);
static void _delay_work(unsigned char,void*);
static void _fsbtn_work(WSCbase*);
static void _file_work(WSCbase*);
static void _dialog_set_work(WSCbase*);
static void _dialog_src_work(WSCbase*);

static void _op_dummy(WSCbase*);
virtual void onValueChange();
    void _adjust();
    virtual void setWorkWSNwidth(WSCushort);
    virtual void setWorkWSNheight(WSCushort);
    virtual void setWorkWSNshadowThickness(WSCuchar);
static void _lb_press(WSCbase*);

static void _dialog_resize_work(WSCbase*);

  public:
    WSCprocedureEditor(WSCbase*,char*);
    virtual ~WSCprocedureEditor();

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

    void setEditClient(WSCbase*);
    WSCbase* getEditClient();

    long getSelectedProc();
    WSCprocedure* getSelectedProcedure();
    WSCprocedure* getProcedure(long);
    virtual long draw();
    virtual void onGuiPolicyChange(long);
    virtual void onVisibleChange(WSCbool fl);
    void  updateProcedures();
    char* getSrcPath();
    void  setEditorExecuteHandler(void*);
    void  setGetDirHandler(void*);
    void  createNewProc();
    void  editProc();
    void  execEditor();
    void  deleteProc();
    WSMFguiClassDef(WSCprocedureEditor,WSCform);
};
extern WSDLEX WSCbase* WSGIappProcedureEditor();
#endif //WSCPROCEDUREEDITOR_H
