/* Ofront+ 1.0 -swC -48 */

#ifndef Editor__oh
#define Editor__oh

#include "SYSTEM.oh"
#include "OV.oh"
#include "TermBox.oh"
#include "EditorText.oh"

typedef
  struct Editor_EditorDesc *Editor_Editor;

typedef
  struct Editor_EditorDesc { /* OV_WindowDesc */
    OV_App app;
    OV_Control parent, children, prev, next;
    INTEGER x, y, w, h, tabIndex;
    BOOLEAN enabled, default_, focused, mouseActive;
    INTEGER status;
    LONGCHAR caption[256];
    OV_ClickHandler onClick, onDblClick, onChange;
    OV_ControlMethod do_;
    OV_Control cur;
    BOOLEAN modal, resizable, closeable, closeOnEsc;
    OV_WinBtn closeBtn, zoomBtn;
    INTEGER bg, minW, minH, mx, my, mw, mh;
    EditorText_Text text;
    LONGCHAR fname[1000];
    LONGCHAR search[256];
    INTEGER msgShown;
    LONGCHAR msg[256];
  } Editor_EditorDesc;

typedef
  struct Editor_FileDialogDesc *Editor_FileDialog;

typedef
  struct Editor_FileDialogDesc { /* OV_WindowDesc */
    OV_App app;
    OV_Control parent, children, prev, next;
    INTEGER x, y, w, h, tabIndex;
    BOOLEAN enabled, default_, focused, mouseActive;
    INTEGER status;
    LONGCHAR caption[256];
    OV_ClickHandler onClick, onDblClick, onChange;
    OV_ControlMethod do_;
    OV_Control cur;
    BOOLEAN modal, resizable, closeable, closeOnEsc;
    OV_WinBtn closeBtn, zoomBtn;
    INTEGER bg, minW, minH, mx, my, mw, mh;
    INTEGER type;
    OV_Edit edtFilename;
    OV_Button btnOk, btnCancel;
    LONGCHAR path[1024];
    LONGCHAR home[1024];
    OV_ColumnList colFiles;
    void (*onFileOk)(OV_Control, LONGCHAR*, INTEGER );
  } Editor_FileDialogDesc;

typedef
  struct Editor_SearchDialogDesc *Editor_SearchDialog;

typedef
  struct Editor_SearchDialogDesc { /* OV_WindowDesc */
    OV_App app;
    OV_Control parent, children, prev, next;
    INTEGER x, y, w, h, tabIndex;
    BOOLEAN enabled, default_, focused, mouseActive;
    INTEGER status;
    LONGCHAR caption[256];
    OV_ClickHandler onClick, onDblClick, onChange;
    OV_ControlMethod do_;
    OV_Control cur;
    BOOLEAN modal, resizable, closeable, closeOnEsc;
    OV_WinBtn closeBtn, zoomBtn;
    INTEGER bg, minW, minH, mx, my, mw, mh;
    Editor_Editor editor;
    OV_Edit edtText;
    OV_Button btnOk, btnCancel, btnHelp;
  } Editor_SearchDialogDesc;


import OV_ControlMethod Editor_editorMethod, Editor_fileDialogMethod, Editor_searchDialogMethod;

import SYSTEM_ADRINT *Editor_FileDialogDesc__typ;
import SYSTEM_ADRINT *Editor_EditorDesc__typ;
import SYSTEM_ADRINT *Editor_SearchDialogDesc__typ;

import void Editor_EditClear (OV_Control c);
import void Editor_EditCopy (OV_Control c);
import void Editor_EditCut (OV_Control c);
import void Editor_EditPaste (OV_Control c);
import void Editor_EditSelectAll (OV_Control c);
import void Editor_EditUnselect (OV_Control c);
import void Editor_EditorClose (OV_Control c, BOOLEAN *cancel);
import void Editor_EditorDraw (OV_Control c, INTEGER x, INTEGER y);
import void Editor_EditorGetFocus (OV_Control c);
import void Editor_EditorKeyDown (OV_Control c, TermBox_Event *E, SYSTEM_ADRINT *E__typ);
import void Editor_EditorMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void Editor_EditorMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void Editor_EditorMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void Editor_FileDialogApplyDir (Editor_FileDialog c, LONGCHAR *s, INTEGER s__len);
import void Editor_FileDialogDraw (OV_Control c, INTEGER x, INTEGER y);
import void Editor_FileDialogListChange (OV_Control c);
import void Editor_FileDialogOkClick (OV_Control c);
import void Editor_FileDialogSetFname (Editor_FileDialog F, LONGCHAR *fname, INTEGER fname__len);
import void Editor_FileDialogUpdateFileList (Editor_FileDialog c);
import void Editor_HideMsg (OV_Control c);
import void Editor_InitEditor (Editor_Editor c);
import void Editor_InitEditorMethod (OV_ControlMethod m);
import void Editor_InitFileDialog (Editor_FileDialog c, INTEGER type);
import void Editor_InitFileDialogMethod (OV_ControlMethod m);
import void Editor_InitSearchDialog (Editor_SearchDialog c, Editor_Editor editor);
import void Editor_InitSearchDialogMethod (OV_ControlMethod m);
import void Editor_IntToStr (INTEGER n, LONGCHAR *s, INTEGER s__len);
import BOOLEAN Editor_IsEmpty (Editor_Editor e);
import Editor_Editor Editor_NewEditor (void);
import Editor_FileDialog Editor_NewFileDialog (INTEGER type);
import Editor_SearchDialog Editor_NewSearchDialog (Editor_Editor editor);
import void Editor_PrintText (Editor_Editor c);
import void Editor_PutSelStringH (INTEGER x, INTEGER y, LONGCHAR *s, INTEGER s__len, INTEGER bg, INTEGER limit, INTEGER *comLevel, INTEGER fgSel, INTEGER bgSel, INTEGER x0, INTEGER x1);
import void Editor_PutStringH (INTEGER x, INTEGER y, LONGCHAR *s, INTEGER s__len, INTEGER bg, INTEGER limit, INTEGER *comLevel);
import void Editor_SearchDialogDraw (OV_Control c, INTEGER x, INTEGER y);
import void Editor_SearchDialogOkClick (OV_Control c);
import void Editor_SearchNext (Editor_Editor e);
import void Editor_SetMsg (OV_Control c, LONGCHAR *s, INTEGER s__len);
import void Editor_StringsFindPrev (LONGCHAR *pattern, INTEGER pattern__len, LONGCHAR *stringToSearch, INTEGER stringToSearch__len, INTEGER startPos, BOOLEAN *patternFound, INTEGER *posOfPattern);
import BOOLEAN Editor_TextChanged (Editor_Editor c);
import void *Editor__init (void);


#endif
