123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- $PBExportHeader$u_function_button.sru
- $PBExportComments$By PBKiller v2.5.18(http://kivens.nease.net)
- forward
- global type u_function_button from userobject
- end type
- type st_text from statictext within u_function_button
- end type
- type ln_top from line within u_function_button
- end type
- type ln_bottom from line within u_function_button
- end type
- type ln_left from line within u_function_button
- end type
- type ln_right from line within u_function_button
- end type
- type ln_top1 from line within u_function_button
- end type
- type ln_left1 from line within u_function_button
- end type
- end forward
- global type u_function_button from userobject
- integer width = 869
- integer height = 76
- long backcolor = 79741120
- string pointer = "HyperLink!"
- event mousedown pbm_lbuttondown
- event mousemove pbm_mousemove
- event mouseup pbm_lbuttonup
- event ue_click ( )
- st_text st_text
- ln_top ln_top
- ln_bottom ln_bottom
- ln_left ln_left
- ln_right ln_right
- ln_top1 ln_top1
- ln_left1 ln_left1
- end type
- global u_function_button u_function_button
- type prototypes
- public function ulong setcapture (ulong hwnd) library "USER32.DLL" alias for "SetCapture"
- public function boolean releasecapture () library "USER32.DLL" alias for "ReleaseCapture"
- end prototypes
- type variables
- public long il_txtx
- public long il_txty
- public long il_grey = 8421504
- public long il_white = 16777215
- public long il_mousex
- public long il_mousey
- public integer ii_type = -1
- public integer ii_index
- public string is_data
- public boolean ib_mousecaptured = false
- public u_function_panel iuo_parent
- end variables
- forward prototypes
- private function integer of_capturemouse ()
- public function string of_getdata ()
- public subroutine of_highlight (integer ai_type)
- public function integer of_releasemouse ()
- public subroutine of_resize (integer ai_width,integer ai_height)
- public subroutine of_settext (string txt)
- end prototypes
- event mousedown;of_highlight(2)
- return
- end event
- event mousemove;boolean lb_inbounds = false
- of_capturemouse()
- if ((((xpos < 0) or (ypos < 0)) or (xpos > width)) or (ypos > height)) then
- lb_inbounds = false
- else
- lb_inbounds = true
- end if
- if not lb_inbounds then
- st_text.textcolor = 0
- else
- st_text.textcolor = 16711680
- end if
- if lb_inbounds and keydown(keyleftbutton!) then
- of_highlight(2)
- else
- if not lb_inbounds then
- of_highlight(1)
- of_releasemouse()
- else
- of_highlight(1)
- end if
- end if
- return
- end event
- event mouseup;boolean lb_inbounds = false
- if ((((xpos < 0) or (ypos < 0)) or (xpos > width)) or (ypos > height)) then
- lb_inbounds = false
- else
- lb_inbounds = true
- end if
- st_text.textcolor = 0
- of_highlight(1)
- of_releasemouse()
- if lb_inbounds then
- triggerevent("ue_click")
- end if
- return
- end event
- event ue_click();
- if iuo_parent.ii_curgroup <> ii_index then
- iuo_parent.ii_curgroup = ii_index
- iuo_parent.is_selectedid = is_data
- iuo_parent.triggerevent("ue_clickbutton")
- end if
- end event
- private function integer of_capturemouse ();if ib_mousecaptured then
- return -1
- end if
- setcapture(handle(this))
- ib_mousecaptured = true
- return 1
- end function
- public function string of_getdata ();return is_data
- end function
- public subroutine of_highlight (integer ai_type);if ai_type = ii_type then
- return
- else
- ii_type = ai_type
- end if
- if ai_type = 0 then
- st_text.move(il_txtx,il_txty)
- ln_top.hide()
- ln_bottom.hide()
- ln_left.hide()
- ln_right.hide()
- ln_top1.hide()
- ln_left1.hide()
- setposition(totop!)
- return
- end if
- if ai_type = 1 then
- ln_top.linecolor = il_white
- ln_left.linecolor = il_white
- ln_bottom.linecolor = il_grey
- ln_right.linecolor = il_grey
- st_text.move(il_txtx,il_txty)
- ln_top.show()
- ln_bottom.show()
- ln_left.show()
- ln_right.show()
- ln_top1.hide()
- ln_left1.hide()
- setposition(totop!)
- return
- end if
- if ai_type = 2 then
- ln_top.linecolor = il_grey
- ln_left.linecolor = il_grey
- ln_bottom.linecolor = il_white
- ln_right.linecolor = il_white
- ln_top1.linecolor = il_grey
- ln_left1.linecolor = il_grey
- st_text.move(il_txtx + 4,il_txty + 4)
- ln_top.show()
- ln_bottom.show()
- ln_left.show()
- ln_right.show()
- ln_top1.show()
- ln_left1.show()
- setposition(totop!)
- return
- end if
- end subroutine
- public function integer of_releasemouse ();if not ib_mousecaptured then
- return -1
- end if
- releasecapture()
- ib_mousecaptured = false
- return 1
- end function
- public subroutine of_resize (integer ai_width,integer ai_height);integer li_x
- integer li_y
- integer li_width
- integer li_height
- resize(ai_width,ai_height)
- li_x = 0
- li_y = 0
- li_width = unitstopixels(ai_width,xunitstopixels!) - 1
- li_height = unitstopixels(ai_height,yunitstopixels!) - 1
- ln_top.beginx = pixelstounits(li_x,xpixelstounits!)
- ln_top.beginy = pixelstounits(li_y,ypixelstounits!)
- ln_top.endx = pixelstounits(li_width,xpixelstounits!)
- ln_top.endy = ln_top.beginy
- ln_left.beginx = pixelstounits(li_x,xpixelstounits!)
- ln_left.beginy = pixelstounits(li_y,ypixelstounits!)
- ln_left.endx = ln_left.beginx
- ln_left.endy = pixelstounits(li_height,ypixelstounits!)
- ln_right.beginx = pixelstounits(li_width,xpixelstounits!)
- ln_right.beginy = pixelstounits(li_y,ypixelstounits!)
- ln_right.endx = ln_right.beginx
- ln_right.endy = pixelstounits(li_height,ypixelstounits!)
- ln_bottom.beginx = pixelstounits(li_x,xpixelstounits!)
- ln_bottom.beginy = pixelstounits(li_height,ypixelstounits!)
- ln_bottom.endx = pixelstounits(li_width + 1,xpixelstounits!)
- ln_bottom.endy = ln_bottom.beginy
- ln_top1.beginx = pixelstounits(1,xpixelstounits!)
- ln_top1.beginy = pixelstounits(1,ypixelstounits!)
- ln_top1.endx = pixelstounits(li_width,xpixelstounits!)
- ln_top1.endy = ln_top1.beginy
- ln_left1.beginx = pixelstounits(1,xpixelstounits!)
- ln_left1.beginy = pixelstounits(1,ypixelstounits!)
- ln_left1.endx = ln_left1.beginx
- ln_left1.endy = pixelstounits(li_height,ypixelstounits!)
- st_text.move(20,(ai_height - st_text.height) / 2)
- st_text.resize(ai_width - st_text.x - 20,st_text.height)
- il_txtx = st_text.x
- il_txty = st_text.y
- return
- end subroutine
- public subroutine of_settext (string txt);st_text.text = txt
- end subroutine
- event constructor;call super::constructor;
- hide()
- of_resize(width,height)
- of_highlight(1)
- return
- end event
- on u_function_button.create
- this.st_text=create st_text
- this.ln_top=create ln_top
- this.ln_bottom=create ln_bottom
- this.ln_left=create ln_left
- this.ln_right=create ln_right
- this.ln_top1=create ln_top1
- this.ln_left1=create ln_left1
- this.Control[]={this.st_text,&
- this.ln_top,&
- this.ln_bottom,&
- this.ln_left,&
- this.ln_right,&
- this.ln_top1,&
- this.ln_left1}
- end on
- on u_function_button.destroy
- destroy(this.st_text)
- destroy(this.ln_top)
- destroy(this.ln_bottom)
- destroy(this.ln_left)
- destroy(this.ln_right)
- destroy(this.ln_top1)
- destroy(this.ln_left1)
- end on
- type st_text from statictext within u_function_button
- integer x = 32
- integer y = 12
- integer width = 809
- integer height = 52
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 67108864
- boolean enabled = false
- alignment alignment = center!
- boolean focusrectangle = false
- end type
- type ln_top from line within u_function_button
- long linecolor = 16777215
- integer beginx = 5
- integer endx = 850
- end type
- type ln_bottom from line within u_function_button
- long linecolor = 8421504
- integer beginx = 9
- integer beginy = 68
- integer endx = 855
- integer endy = 68
- end type
- type ln_left from line within u_function_button
- long linecolor = 16777215
- integer beginx = 5
- integer beginy = 4
- integer endx = 5
- integer endy = 68
- end type
- type ln_right from line within u_function_button
- long linecolor = 8421504
- integer beginx = 850
- integer beginy = 4
- integer endx = 850
- integer endy = 68
- end type
- type ln_top1 from line within u_function_button
- long linecolor = 8421504
- integer beginx = 9
- integer beginy = 4
- integer endx = 855
- integer endy = 4
- end type
- type ln_left1 from line within u_function_button
- long linecolor = 8421504
- integer beginx = 9
- integer beginy = 20
- integer endx = 9
- integer endy = 68
- end type
|