123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- $PBExportHeader$uo_tlbar.sru
- $PBExportComments$ToolBar 用户对象
- forward
- global type uo_tlbar from UserObject
- end type
- type uo_topline from uo_tlbar_menuseperator within uo_tlbar
- end type
- type uo_bottomline from uo_tlbar_menuseperator within uo_tlbar
- end type
- type ln_2 from line within uo_tlbar
- end type
- type ln_4 from line within uo_tlbar
- end type
- type ln_3 from line within uo_tlbar
- end type
- type ln_1 from line within uo_tlbar
- end type
- end forward
- global type uo_tlbar from UserObject
- int Width=2386
- int Height=200
- boolean Border=true
- long BackColor=67108864
- long PictureMaskColor=536870912
- long TabTextColor=33554432
- long TabBackColor=67108864
- event ue_paint pbm_paint
- uo_topline uo_topline
- uo_bottomline uo_bottomline
- ln_2 ln_2
- ln_4 ln_4
- ln_3 ln_3
- ln_1 ln_1
- end type
- global uo_tlbar uo_tlbar
- type variables
- Public:
- string TextAlign ='Right' //Right,None
- integer Picture_Size = 16
- protectedwrite uo_tlbar_button iuo_buttons[]
- Protected:
- uo_tlbar_space iuo_spaces[]
- window iw_parent
- long ButtonHeight
- long Minwidth
- long il_space = 3
- end variables
- forward prototypes
- public subroutine of_readmenu (readonly menu am_menu)
- public subroutine of_getparentwin ()
- public subroutine of_setalign (string as_align)
- public subroutine of_setsize ()
- public subroutine of_setposition ()
- public subroutine of_draw ()
- public subroutine of_showbottom ()
- public subroutine of_minwidth ()
- public subroutine of_hidebottom ()
- public subroutine of_redraw ()
- public subroutine of_setbuttonsize (integer ai_size)
- public subroutine of_setpicturesize (integer ai_size)
- public subroutine of_resize ()
- public subroutine of_bott ()
- public subroutine of_read (string s_align)
- end prototypes
- event ue_paint;integer li_loop
- FOR li_loop = 1 TO upperbound(iuo_buttons)
- IF NOT iuo_buttons[li_loop].enabled THEN
- iuo_buttons[li_loop].of_drawdisabled()
- END IF
- NEXT
- end event
- public subroutine of_readmenu (readonly menu am_menu);long ll_beginx,ll_btnheight
- integer li_btnpos,li_spacepos
- menu lm_submenu,lm_menu
- IF isvalid (am_menu) = false THEN
- //Not a valid menu , hide toolbar.
- this.hide()
- RETURN
- ELSE
- setredraw(false)
- integer li_menucnt,li_loop,li_loop2
- li_menucnt = UpperBound(am_menu.item)
- ll_beginx =this.x+ 40
- FOR li_loop = 1 TO li_menucnt
- lm_submenu = am_menu.item[li_loop] //sub menu
- FOR li_loop2 =1 TO UpperBound(lm_submenu.item)
- lm_menu = lm_submenu.item[li_loop2] //menu
- IF lm_menu.text = '-' THEN CONTINUE
-
- if trim(String(lm_menu.ToolbarItemName))='' or lm_menu.toolbaritemvisible=false then
- continue
- end if
-
- IF lm_menu.ToolbarItemSpace > 0 then
- li_spacepos = upperbound(iuo_spaces) + 1
- iw_parent.openuserobject(iuo_spaces[li_spacepos],ll_beginx, this.y + 10)
- iw_parent.control[Upperbound(iw_parent.control)+1] = iuo_spaces[li_spacepos]
- ll_beginx = ll_beginx + iuo_spaces[li_spacepos].width + il_space
- END IF
- li_btnpos = Upperbound(iuo_buttons)+1
- iw_parent.openuserobject(iuo_buttons[li_btnpos],ll_beginx,this.y + 10)
- iuo_buttons[li_btnpos].ButtonText = trim(lm_menu.ToolbarItemText)
- iuo_buttons[li_btnpos].TextAlign = TextAlign
- iuo_buttons[li_btnpos].ToolTip = trim(lm_menu.MicroHelp)
- iuo_buttons[li_btnpos].enabled = lm_menu.Enabled
- iuo_buttons[li_btnpos].Picture_Name = String(lm_menu.ToolbarItemName)
- iuo_buttons[li_btnpos].Picture_size = Picture_size
- iuo_buttons[li_btnpos].Bringtotop = true
- iuo_buttons[li_btnpos].visible = this.visible
- iuo_buttons[li_btnpos].of_setparent(this)
- iuo_buttons[li_btnpos].of_setmenu(lm_menu)
- iuo_buttons[li_btnpos].triggerevent('Constructor')
-
- ll_beginx = ll_beginx + iuo_buttons[li_btnpos].width + il_space
-
- IF iuo_buttons[li_btnpos].height>ll_btnheight THEN ll_btnheight = iuo_buttons[li_btnpos].height
- IF lower(lm_menu.tag) = 'checked' THEN
- // IF lm_menu.checked = true THEN
- iuo_buttons[li_btnpos].ButtonType = 'Checked'
- IF lm_menu.checked THEN iuo_buttons[li_btnpos].of_checked()
- ELSEIF left(lower(lm_menu.tag),10) = 'radiogroup' THEN
- iuo_buttons[li_btnpos].ButtonType = 'RadioButton'
- iuo_buttons[li_btnpos].of_setgroup(integer(mid(lm_menu.tag,11)))
- IF lm_menu.checked THEN iuo_buttons[li_btnpos].of_checked()
- END IF
- IF lm_menu.ToolbarItemSpace > 0 THEN
- iuo_spaces[li_spacepos].height = iuo_buttons[li_btnpos].height - 10
- iuo_spaces[li_spacepos].bringtotop = true
- END IF
-
- iw_parent.control[Upperbound(iw_parent.control)+1] = iuo_buttons[li_btnpos]
-
- NEXT
- NEXT
- setredraw(true)
- END IF
- ButtonHeight = ll_btnheight
- MinWidth = ll_beginx - this.x
- of_setsize()
- of_setposition()
- end subroutine
- public subroutine of_getparentwin ();powerobject lpo_tmp
- userobject luo_tmp
- lpo_tmp = this.getparent()
- DO While lpo_tmp.typeof() <> Window!
- luo_tmp = lpo_tmp
- lpo_tmp= luo_tmp.getparent()
- LOOP
- iw_parent = lpo_tmp
- end subroutine
- public subroutine of_setalign (string as_align);IF TextAlign = as_align THEN RETURN
- IF pos('Right;None;',as_align)>0 THEN
- TextAlign = as_align
- IF TextAlign='None' THEN uo_bottomline.visible = false
- ELSE
- TextAlign = 'Bottom'
- END IF
- integer li_loop,li_loop2
- long ll_beginx
- ll_beginx = this.x + 40
- IF upperbound(iuo_buttons)>0 THEN
- ButtonHeight = 0
- Minwidth = 0
- FOR li_loop = 1 TO upperbound(iuo_buttons)
- iuo_buttons[li_loop].of_setalign(TextAlign)
- iuo_buttons[li_loop].y = this.y + 10
- IF iuo_buttons[li_loop].of_getmenu().ToolbarItemSpace>0 THEN
- li_loop2 ++
- iuo_spaces[li_loop2].x = ll_beginx
- iuo_spaces[li_loop2].y = this.y + 10
- iuo_spaces[li_loop2].height = iuo_buttons[li_loop].height - 10
- ll_beginx = ll_beginx + iuo_spaces[li_loop2].width + il_space
- END IF
- iuo_buttons[li_loop].x = ll_beginx
- ll_beginx = ll_beginx + iuo_buttons[li_loop].width + il_space
- IF iuo_buttons[li_loop].height>ButtonHeight THEN ButtonHeight = iuo_buttons[li_loop].height
- NEXT
- Minwidth = ll_beginx - this.x
- END IF
- of_SetSize()
- of_SetPosition()
- end subroutine
- public subroutine of_setsize ();IF upperbound(iuo_buttons)=0 THEN RETURN
- IF this.width < minwidth THEN this.width = minwidth
- CHOOSE CASE TextAlign
- CASE 'Bottom'
- this.height = ButtonHeight + 25
- uo_Bottomline.visible = true
- CASE 'Right'
- this.height = ButtonHeight + 25
- uo_Bottomline.visible = true
- CASE 'None'
- this.height = ButtonHeight + 25
- END CHOOSE
- ln_1.endy = height - 20
- ln_2.endy = height - 20
- ln_3.endy = height - 20
- ln_4.endy = height - 20
- //uo_topline.width = width+900//+900 zkl加上
- //uo_bottomline.width = width+900
- end subroutine
- public subroutine of_setposition ();IF upperbound(iuo_buttons)=0 THEN RETURN
- uo_bottomline.y = this.height - 10
- end subroutine
- public subroutine of_draw ();of_setalign(TextAlign)
- of_setsize()
- of_setposition()
- end subroutine
- public subroutine of_showbottom ();of_setsize()
- of_setposition()
- uo_bottomline.visible = true
- end subroutine
- public subroutine of_minwidth ();this.width = minwidth
- end subroutine
- public subroutine of_hidebottom ();uo_bottomline.visible = false
- end subroutine
- public subroutine of_redraw ();
- end subroutine
- public subroutine of_setbuttonsize (integer ai_size);IF ai_size = 24 THEN
- Picture_Size = 24
- ELSE
- picture_size = 16
- END IF
- end subroutine
- public subroutine of_setpicturesize (integer ai_size);IF ai_size = 24 THEN
- Picture_Size = 24
- ELSE
- picture_size = 16
- END IF
- end subroutine
- public subroutine of_resize ();IF iw_parent.windowstate <> Minimized! THEN
- this.width = iw_parent.width -20
- of_setsize()
- END IF
- end subroutine
- public subroutine of_bott ();of_read('Bottom')
- end subroutine
- public subroutine of_read (string s_align);of_setalign(s_align)
- of_readmenu(iw_parent.menuid)
- end subroutine
- on uo_tlbar.create
- this.uo_topline=create uo_topline
- this.uo_bottomline=create uo_bottomline
- this.ln_2=create ln_2
- this.ln_4=create ln_4
- this.ln_3=create ln_3
- this.ln_1=create ln_1
- this.Control[]={this.uo_topline,&
- this.uo_bottomline,&
- this.ln_2,&
- this.ln_4,&
- this.ln_3,&
- this.ln_1}
- end on
- on uo_tlbar.destroy
- destroy(this.uo_topline)
- destroy(this.uo_bottomline)
- destroy(this.ln_2)
- destroy(this.ln_4)
- destroy(this.ln_3)
- destroy(this.ln_1)
- end on
- event constructor;of_getparentwin()
- backcolor=iw_parent.backcolor
- width=6000
- end event
- type uo_topline from uo_tlbar_menuseperator within uo_tlbar
- int X=0
- int Y=0
- int Width=5207
- int TabOrder=10
- long BackColor=80269524
- end type
- on uo_topline.destroy
- call uo_tlbar_menuseperator::destroy
- end on
- type uo_bottomline from uo_tlbar_menuseperator within uo_tlbar
- int X=0
- int Y=176
- int Width=5202
- int TabOrder=20
- boolean Visible=false
- end type
- on uo_bottomline.destroy
- call uo_tlbar_menuseperator::destroy
- end on
- type ln_2 from line within uo_tlbar
- boolean Enabled=false
- int BeginX=14
- int BeginY=20
- int EndX=14
- int EndY=168
- int LineThickness=4
- long LineColor=8421504
- end type
- type ln_4 from line within uo_tlbar
- boolean Enabled=false
- int BeginX=27
- int BeginY=20
- int EndX=27
- int EndY=168
- int LineThickness=4
- long LineColor=8421504
- end type
- type ln_3 from line within uo_tlbar
- boolean Enabled=false
- int BeginX=23
- int BeginY=20
- int EndX=23
- int EndY=168
- int LineThickness=4
- long LineColor=16777215
- end type
- type ln_1 from line within uo_tlbar
- boolean Enabled=false
- int BeginX=9
- int BeginY=20
- int EndX=9
- int EndY=168
- int LineThickness=8
- long LineColor=31910120
- end type
|