#include once "fltk-c.bi"

'test of:
' DrawSetRGBColor
' DrawSetColor
' DrawYXLine
' DrawXYLine
' DrawSetLineStyle
' DrawRect

sub DrawCB cdecl (self as any ptr)
  dim as integer x =  Fl_WidgetGetX(self)
  dim as integer y =  Fl_WidgetGetY(self)
  dim as integer w =x+Fl_WidgetGetW(self)
  dim as integer h =y+Fl_WidgetGetH(self)

  DrawSetRGBColor 128,0,0
  for xx as integer = x to w step 20
    DrawYXLine xx,y,h
  next
  DrawSetColor FL_BLUE
  for yy as integer = y to h step 20
    DrawXYLine x,yy,w
  next
  DrawSetColor FL_BLACK
  DrawSetLineStyle FL_SOLID or FL_CAP_ROUND,3
  DrawRect(x,y,w-x,h-y)
end sub

'
' main
'
dim as Fl_Window ptr win = Fl_WindowNew(640,480,"drawing01 resize me ...")
dim as Fl_BoxEx ptr box = Fl_BoxExNew(5,5,630,470)
Fl_BoxExSetDrawCB box,@DrawCB
Fl_GroupSetResizable win,box
Fl_WindowShow win
Fl_Run
