; _______________________________________________________________________________________
;|                                                                                       |
;| ..::FreshLib::..  Free, open source. Licensed under "Fresh artistic license."         |
;|_______________________________________________________________________________________|
;
;  Description: Defines constants and structures for system events of FreshLib
;
;  Target OS: Any
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________

seMouseMove        = $0001
seMouseEnter       = $0002
seMouseLeave       = $0003
seMouseBtnPress    = $0004
seMouseBtnRelease  = $0005
seMouseBtnClick    = $0006
seMouseBtnDblClick = $0007
seTimer            = $0008
seKbdKeyPress      = $0009
seKbdKeyRelease    = $000a
seKbdStatusChanged = $000b
seKbdChar          = $000c

seScroll           = $000d


sePaint            = $0100
seCloseRequest     = $0101

seFocusIn          = $0102
seFocusOut         = $0103

seMoveResize       = $0104


struct TSysEvent
  .event  dd  ?
ends


struct TMouseMoveEvent
  . TSysEvent
  .x         dd ?
  .y         dd ?
ends

mbLeft   = 0
mbMiddle = 1
mbRight  = 2

maskBtnLeft   = $0100
maskBtnMiddle = $0200
maskBtnRight  = $0400
maskShift     = $1
maskCapsLock  = $2
maskCtrl      = $4
maskAlt       = $8


struct TMouseButtonEvent
  . TSysEvent
  .Button    dd ?
  .kbdStatus dd ?
  .x         dd ?   ; coordinates of the mouse pointer in client.s
  .y         dd ?
ends


struct TMouseEnterEvent
  . TSysEvent
ends


; These are scan codes for the non character keys.
include '%TargetOS%/keycodes.inc'




struct TKeyboardEvent
  . TSysEvent
  .key       dd  ?      ; 1..4 bytes UTF-8 character typed by the keyboard, or 0 if non character key is pressed/released.
  .scancode  dd  ?      ; scan code of the pressed key.
  .kbdStatus dd  ?      ; same as mouse button event - contains mouse buttons and Ctrl, Shift and Alt keys status.
ends


skTrack = 1
skUp    = 2
skDown  = 3
skWheelUp = 4
skWheelDn = 5

scrollX = 0
scrollY = 1


struct TScrollEvent
  . TSysEvent
  .ScrollBar  dd ?      ; 0
  .ScrollCmd  dd ?      ;
  .Value      dd ?      ; Distance for skUp and skDown and position for skTrack
ends


struct TTimerEvent
  . TSysEvent
  .timer dd ?
ends


struct TPaintEvent
  . TSysEvent

  .context dd ?  ; pointer to TContext structure, properly initialized.
  .rect   RECT
ends


struct TCloseEvent
  . TSysEvent
  .reason dd ?          ; how the close was requested?
ends

cerFromUser = 0         ; user pressed X button on the window header, pressed alt+F4 from the keyboard, or choose "Close" from the title menu.
cerFromProgram = 1      ; Method Close was executed from the program.


struct TFocusInEvent
  . TSysEvent
ends

struct TFocusOutEvent
  . TSysEvent
ends


struct TMoveResizeEvent
  . TSysEvent
  .newX  dd ?
  .newY  dd ?
  .newWidth  dd ?
  .newHeight dd ?
ends
