File: w_main.srw
Size: 3605
Date: Mon, 31 Dec 2018 21:14:38 +0100
$PBExportHeader$w_main.srw
forward
global type w_main from window
end type
type cb_background from commandbutton within w_main
end type
type cb_pen from commandbutton within w_main
end type
type cb_save from commandbutton within w_main
end type
type cb_cancel from commandbutton within w_main
end type
type uo_linedraw from u_linedraw within w_main
end type
type history from structure within w_main
end type
end forward

global type w_main from window
integer width = 2821
integer height = 1740
boolean titlebar = true
string title = "LineDraw"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
cb_background cb_background
cb_pen cb_pen
cb_save cb_save
cb_cancel cb_cancel
uo_linedraw uo_linedraw
end type
global w_main w_main

on w_main.create
this.cb_background=create cb_background
this.cb_pen=create cb_pen
this.cb_save=create cb_save
this.cb_cancel=create cb_cancel
this.uo_linedraw=create uo_linedraw
this.Control[]={this.cb_background,&
this.cb_pen,&
this.cb_save,&
this.cb_cancel,&
this.uo_linedraw}
end on

on w_main.destroy
destroy(this.cb_background)
destroy(this.cb_pen)
destroy(this.cb_save)
destroy(this.cb_cancel)
destroy(this.uo_linedraw)
end on

type cb_background from commandbutton within w_main
integer x = 658
integer y = 1472
integer width = 517
integer height = 100
integer taborder = 30
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Background Color"
end type

event clicked;uo_linedraw.of_SetBackgroundColor(uo_linedraw.LINEN)

end event

type cb_pen from commandbutton within w_main
integer x = 73
integer y = 1472
integer width = 517
integer height = 100
integer taborder = 20
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Pen Size/Color"
end type

event clicked;uo_linedraw.of_SetPenSizeColor(5, uo_linedraw.RED)

end event

type cb_save from commandbutton within w_main
integer x = 1243
integer y = 1472
integer width = 517
integer height = 100
integer taborder = 40
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Save Bitmap"
end type

event clicked;String ls_pathname, ls_filename
Blob lblb_image
Integer li_rc

li_rc = GetFileSaveName("Save Bitmap", &
            ls_pathname, ls_filename, "bmp", &
            "Bitmap Files (*.bmp),*.bmp")
If li_rc = 1 Then
   lblb_image = uo_linedraw.of_CaptureBitmap()
   uo_linedraw.of_WriteBlob(ls_pathname, lblb_image)
End If

end event

type cb_cancel from commandbutton within w_main
integer x = 2377
integer y = 1472
integer width = 334
integer height = 100
integer taborder = 50
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Cancel"
boolean cancel = true
end type

event clicked;Close(Parent)

end event

type uo_linedraw from u_linedraw within w_main
integer x = 73
integer y = 64
integer width = 2638
integer height = 1348
integer taborder = 10
boolean border = true
end type

on uo_linedraw.destroy
call u_linedraw::destroy
end on