! Deschide fereastra principala centrata
Program Center

use dflib
use dfwin

!type(qwinfo) winfo
logical result, CenterWindow
integer bkcolor, textcolor

character(100) text

TYPE (rccoord) curpos
integer(2) row, col


TYPE (xycoord) xy
integer(2) x2,y2


type(wxycoord) wc
real(8) wx1, wy1

TYPE (windowconfig) wconfig

integer(handle) hWnd


! Set Application Window Text:
!hWnd = GETHWNDQQ (QWIN$FRAMEWINDOW) 

!lret =SetWindowText(hWnd, 'My QuickWin Program'C)


! Set Title for the Frame Window:
status = GETWINDOWCONFIG(wconfig)

wconfig%title ='Frame Window'C
status = SETWINDOWCONFIG(wconfig)


! Fill winfo & Set window:
result = CenterWindow()

write (*, *), "Test in fereastra principala"


! 1st window: bkcolor =black
open(9, file ='user', title ='Window 1')
write(9, *), "Test in fereastra nr. 1"


! 2nd window: bkcolor =bright white
open(10, file ='user', title ='Window 2')

bkcolor =#FFFFFF
result = SETBKCOLORRGB (bkcolor)

call CLEARSCREEN($GWINDOW)

textcolor =#0 
result = SETTEXTCOLORRGB (textcolor)
write (10, *), "Test in fereastra nr. 2"


! Coordonate "text" (linie; coloana):
text =' test Arial-1'
grstat=SETtextCOLORRGB(#FF0000)		! blue

row =int2(3)	! linia 3
col =int2(2)	! coloana 2
CALL SETTEXTPOSITION (row, col, curpos)

call outtext(trim(text))


! Functii grafice:
result = INITIALIZEFONTS()

! Font = Arial
result = SETFONT('t''Arial''h18pvb')


! Coordonate "viweport" (implicit = 640x480 pixeli):
text =' test Arial-2'
grstat=SETCOLORRGB(#00FF00)		! green

x2 =int2(100)
y2 =int2(50)
call moveto(x2, y2, xy)
call outgtext(trim(text))


result = SETFONT('t''tms rmn''h20be')

! Coordonate de fereastra:
status = SETWINDOW(.false., 0D0, 800D0, 0D0, 450D0) 

text =' test Times Roman bold'
grstat=SETCOLORRGB(#0000FF)		! red

wx1 =50.D0
wy1 =100.D0
CALL MOVETO_w(wx1, wy1, wc)

call outgtext(trim(text))

text =' test Times Roman'
result = SETFONT('t''tms rmn''h20pv')

call GETCURRENTPOSITION_w(wc)
CALL MOVETO_w(wc.wx, wc%wy +20, wc)

call outgtext(trim(text))

end program Center


