/* Ofront+ 1.0 -sw7 -48 */

#ifndef OV__oh
#define OV__oh

#include "SYSTEM.oh"
#include "TermBox.oh"
#include "StrList.oh"

typedef
  struct OV_AppDesc *OV_App;

typedef
  struct OV_WindowDesc *OV_Window;

typedef
  struct OV_MenuDesc *OV_Menu;

typedef
  struct OV_ControlDesc *OV_Control;

typedef
  struct OV_AppDesc {
    OV_Window windows;
    OV_Menu menu, statusbar;
    LONGCHAR statusText[256];
    OV_Control cur, dragged;
    INTEGER dragX, dragY;
    char _prvt0[4];
    INTEGER lastMouseDownTime;
    BOOLEAN quit, needRedraw, sync;
    INTEGER mouseBtn;
  } OV_AppDesc;

typedef
  struct OV_ButtonDesc *OV_Button;

typedef
  void (*OV_ClickHandler)(OV_Control);

typedef
  struct OV_ControlMethodDesc *OV_ControlMethod;

typedef
  struct OV_ControlDesc {
    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_ControlDesc;

typedef
  struct OV_ButtonDesc { /* OV_ControlDesc */
    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_ButtonDesc;

typedef
  struct OV_ColumnListDesc *OV_ColumnList;

typedef
  struct OV_ColumnListDesc { /* OV_ControlDesc */
    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_;
    INTEGER cols;
    StrList_List items;
    INTEGER begin, cur, lastMouseDownItem;
    char _prvt0[4];
  } OV_ColumnListDesc;

typedef
  struct OV_ControlMethodDesc {
    void (*added)(OV_Control, OV_Control);
    void (*draw)(OV_Control, INTEGER, INTEGER);
    void (*resize)(OV_Control, INTEGER, INTEGER, INTEGER, INTEGER);
    void (*refresh)(OV_Control);
    void (*click)(OV_Control);
    void (*dblClick)(OV_Control);
    void (*keyDown)(OV_Control, TermBox_Event*, SYSTEM_ADRINT *);
    void (*textInput)(OV_Control, LONGCHAR);
    void (*getFocus)(OV_Control);
    void (*lostFocus)(OV_Control);
    void (*mouseMove)(OV_Control, INTEGER, INTEGER, INTEGER);
    void (*mouseDown)(OV_Control, INTEGER, INTEGER, INTEGER);
    void (*mouseUp)(OV_Control, INTEGER, INTEGER, INTEGER);
    void (*close)(OV_Control, BOOLEAN*);
  } OV_ControlMethodDesc;

typedef
  struct OV_EditDesc *OV_Edit;

typedef
  struct OV_EditDesc { /* OV_ControlDesc */
    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_;
    INTEGER len, pos;
  } OV_EditDesc;

typedef
  struct OV_LabelDesc *OV_Label;

typedef
  struct OV_LabelDesc { /* OV_ControlDesc */
    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_;
    INTEGER len, align;
  } OV_LabelDesc;

typedef
  struct OV_MenuDesc { /* OV_ControlDesc */
    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_;
    INTEGER innerW, innerH;
    LONGCHAR hint[40];
    INTEGER hintW, hotkey;
    OV_Control lastSelected;
  } OV_MenuDesc;

typedef
  struct OV_QuickBtnDesc *OV_QuickBtn;

typedef
  struct OV_QuickBtnDesc { /* OV_MenuDesc */
    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_;
    INTEGER innerW, innerH;
    LONGCHAR hint[40];
    INTEGER hintW, hotkey;
    OV_Control lastSelected;
  } OV_QuickBtnDesc;

typedef
  struct OV_ScrollbarDesc *OV_Scrollbar;

typedef
  struct OV_ScrollbarDesc { /* OV_ControlDesc */
    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_;
    INTEGER max, cur, runnerOffset, runnerW;
    void (*onScrollbar)(OV_Control);
  } OV_ScrollbarDesc;

typedef
  struct OV_WinBtnDesc *OV_WinBtn;

typedef
  struct OV_WinBtnDesc { /* OV_ButtonDesc */
    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_WinBtnDesc;

typedef
  struct OV_WindowDesc { /* OV_ControlDesc */
    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;
  } OV_WindowDesc;


import OV_ControlMethod OV_controlMethod, OV_labelMethod, OV_quickBtnMethod, OV_buttonMethod, OV_winBtnMethod, OV_scrollbarMethod, OV_editMethod, OV_columnListMethod, OV_windowMethod, OV_menuMethod;

import SYSTEM_ADRINT *OV_ControlDesc__typ;
import SYSTEM_ADRINT *OV_ControlMethodDesc__typ;
import SYSTEM_ADRINT *OV_MenuDesc__typ;
import SYSTEM_ADRINT *OV_LabelDesc__typ;
import SYSTEM_ADRINT *OV_QuickBtnDesc__typ;
import SYSTEM_ADRINT *OV_ButtonDesc__typ;
import SYSTEM_ADRINT *OV_WinBtnDesc__typ;
import SYSTEM_ADRINT *OV_ScrollbarDesc__typ;
import SYSTEM_ADRINT *OV_EditDesc__typ;
import SYSTEM_ADRINT *OV_ColumnListDesc__typ;
import SYSTEM_ADRINT *OV_WindowDesc__typ;
import SYSTEM_ADRINT *OV_AppDesc__typ;

import void OV_Add (OV_Control c, OV_Control child);
import void OV_AddMenu (OV_App app, OV_Menu m);
import void OV_AddStatusbar (OV_App app, OV_Control c);
import void OV_AddWindow (OV_App app, OV_Window w);
import void OV_BringToFront (OV_Control c);
import void OV_ButtonClick (OV_Control c);
import void OV_ButtonDraw (OV_Control c, INTEGER x, INTEGER y);
import void OV_ButtonMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ButtonMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ButtonMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_CenterWindow (OV_Window c);
import void OV_CloseAllWindows (OV_Control c);
import void OV_CloseCurWindow (OV_Control c);
import void OV_CloseCurWindowEx (OV_Control c, BOOLEAN *cancel);
import void OV_ColumnListDraw (OV_Control c, INTEGER x, INTEGER y);
import void OV_ColumnListGetFocus (OV_Control c);
import void OV_ColumnListKeyDown (OV_Control c, TermBox_Event *E, SYSTEM_ADRINT *E__typ);
import void OV_ColumnListMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ColumnListMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ColumnListMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ColumnListRefresh (OV_Control c);
import void OV_ColumnListResize (OV_Control c, INTEGER x, INTEGER y, INTEGER w, INTEGER h);
import void OV_ColumnListSetCur (OV_ColumnList C, INTEGER cur);
import void OV_ColumnListTextInput (OV_Control c, LONGCHAR ch);
import void OV_ColumnListUpdateCur (OV_ColumnList C, INTEGER x, INTEGER y);
import void OV_ControlClick (OV_Control c);
import void OV_ControlDblClick (OV_Control c);
import void OV_ControlGetFocus (OV_Control c);
import void OV_ControlLostFocus (OV_Control c);
import void OV_ControlMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ControlMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ControlMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ControlResize (OV_Control c, INTEGER x, INTEGER y, INTEGER w, INTEGER h);
import void OV_DrawApp (OV_App app);
import void OV_DrawAppWindows (OV_App app);
import void OV_DrawChildren (OV_Control c, INTEGER x, INTEGER y);
import void OV_DrawWindowBorder (INTEGER x, INTEGER y, INTEGER w, INTEGER h, INTEGER fg, INTEGER bg, LONGCHAR *title, INTEGER title__len, BOOLEAN resizable, BOOLEAN moving, BOOLEAN inactive);
import void OV_EditDraw (OV_Control c, INTEGER x, INTEGER y);
import void OV_EditGetFocus (OV_Control c);
import void OV_EditKeyDown (OV_Control c, TermBox_Event *E, SYSTEM_ADRINT *E__typ);
import void OV_EditMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER edit);
import void OV_EditSetCaption (OV_Edit c, LONGCHAR *s, INTEGER s__len);
import void OV_EditTextInput (OV_Control c, LONGCHAR ch);
import OV_Control OV_FindChildAt (OV_Control c, INTEGER x, INTEGER y);
import OV_Control OV_GetControlAt (OV_App app, INTEGER x, INTEGER y);
import BOOLEAN OV_HasModalWindow (OV_App app);
import void OV_InitApp (OV_App app);
import void OV_InitButton (OV_Button c, LONGCHAR *caption, INTEGER caption__len);
import void OV_InitButtonMethod (OV_ControlMethod m);
import void OV_InitColumnList (OV_ColumnList c);
import void OV_InitColumnListMethod (OV_ControlMethod m);
import void OV_InitControl (OV_Control c);
import void OV_InitControlMethod (OV_ControlMethod m);
import void OV_InitEdit (OV_Edit c);
import void OV_InitEditMethod (OV_ControlMethod m);
import void OV_InitLabel (OV_Label c, LONGCHAR *caption, INTEGER caption__len);
import void OV_InitLabelMethod (OV_ControlMethod m);
import void OV_InitMenu (OV_Menu m, LONGCHAR *caption, INTEGER caption__len, LONGCHAR *hint, INTEGER hint__len, INTEGER hotkey, OV_ClickHandler onClick);
import void OV_InitMenuMethod (OV_ControlMethod m);
import void OV_InitQuickBtn (OV_QuickBtn c, LONGCHAR *caption, INTEGER caption__len, LONGCHAR *hint, INTEGER hint__len, INTEGER hotkey, OV_ClickHandler onClick);
import void OV_InitQuickBtnMethod (OV_ControlMethod m);
import void OV_InitScrollbar (OV_Scrollbar c);
import void OV_InitScrollbarMethod (OV_ControlMethod m);
import void OV_InitWinBtn (OV_WinBtn c, LONGCHAR ch);
import void OV_InitWinBtnMethod (OV_ControlMethod m);
import void OV_InitWindow (OV_Window w);
import void OV_InitWindowMethod (OV_ControlMethod m);
import void OV_MenuAdded (OV_Control c, OV_Control child);
import void OV_MenuClick (OV_Control c);
import void OV_MenuGetFocus (OV_Control c);
import BOOLEAN OV_MenuHotkey (OV_Control c, LONGCHAR ch);
import void OV_MenuKeyDown (OV_Control c, TermBox_Event *E, SYSTEM_ADRINT *E__typ);
import void OV_MenuLostFocus (OV_Control c);
import void OV_MenuMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_MenuMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_MenuMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_NeedRedraw (OV_App app);
import OV_App OV_NewApp (void);
import OV_Button OV_NewButton (LONGCHAR *caption, INTEGER caption__len);
import OV_ColumnList OV_NewColumnList (void);
import OV_Control OV_NewControl (void);
import OV_Edit OV_NewEdit (void);
import OV_Label OV_NewLabel (LONGCHAR *caption, INTEGER caption__len);
import OV_Menu OV_NewMenu (LONGCHAR *caption, INTEGER caption__len, LONGCHAR *hint, INTEGER hint__len, INTEGER hotkey, OV_ClickHandler onClick);
import OV_QuickBtn OV_NewQuickBtn (LONGCHAR *caption, INTEGER caption__len, LONGCHAR *hint, INTEGER hint__len, INTEGER hotkey, OV_ClickHandler onClick);
import OV_Scrollbar OV_NewScrollbar (void);
import OV_WinBtn OV_NewWinBtn (LONGCHAR ch);
import OV_Window OV_NewWindow (void);
import void OV_NextWindow (OV_Control c);
import BOOLEAN OV_PassMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import BOOLEAN OV_PassMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_PrevWindow (OV_Control c);
import void OV_PutMarkedString (INTEGER x, INTEGER y, LONGCHAR *s, INTEGER s__len, INTEGER fg, INTEGER fg2, INTEGER bg, INTEGER limit);
import void OV_QuitApp (OV_Control c);
import void OV_Refresh (OV_Control c);
import void OV_RefreshAppMenu (OV_Menu menu);
import void OV_RefreshDisplay (OV_Control c);
import void OV_RefreshMenu (OV_Control c);
import void OV_Remove (OV_Control c);
import void OV_RunApp (OV_App app);
import void OV_ScrollbarDraw (OV_Control c, INTEGER x, INTEGER y);
import void OV_ScrollbarMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ScrollbarMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ScrollbarMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_ScrollbarUpdateCur (OV_Scrollbar S, INTEGER x, INTEGER y, BOOLEAN end);
import void OV_SetAppFocus (OV_App app, OV_Control c);
import void OV_SetDragged (OV_App app, OV_Control c);
import void OV_SetEnabled (OV_Control c, BOOLEAN enabled);
import void OV_SetFocus (OV_Control c);
import void OV_SetOnResize (OV_App a, void (*p)(INTEGER, INTEGER));
import void OV_SetScrollbarCur (OV_Scrollbar S, INTEGER cur);
import void OV_SetStatusText (OV_App app, LONGCHAR *text, INTEGER text__len);
import void OV_UnsetFocus (OV_App app);
import void OV_WinBtnMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_WinBtnMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_WindowAdded (OV_Control c, OV_Control child);
import void OV_WindowDraw (OV_Control c, INTEGER x, INTEGER y);
import void OV_WindowGetFocus (OV_Control c);
import void OV_WindowKeyDown (OV_Control c, TermBox_Event *E, SYSTEM_ADRINT *E__typ);
import void OV_WindowMouseDown (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_WindowMouseMove (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_WindowMouseUp (OV_Control c, INTEGER x, INTEGER y, INTEGER button);
import void OV_WindowRefresh (OV_Control c);
import void OV_WindowResize (OV_Control c, INTEGER x, INTEGER y, INTEGER w, INTEGER h);
import void OV_ZoomCurWindow (OV_Control c);
import void *OV__init (void);


#endif
