123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203 |
- $PBExportHeader$u_lbs_stsplitbar.sru
- $PBExportComments$resize拖动条
- forward
- global type u_lbs_stsplitbar from uo_text_m
- end type
- end forward
- global type u_lbs_stsplitbar from uo_text_m
- integer width = 535
- integer height = 20
- integer textsize = -9
- long backcolor = 271938463
- event mousemove pbm_mousemove
- event lbuttonup pbm_lbuttonup
- end type
- global u_lbs_stsplitbar u_lbs_stsplitbar
- type variables
- Public:
- //-- Define the "style" of split bar. --
- constant integer VERTICAL = 1
- constant integer HORIZONTAL = 2
- //-- Define the "Register" type. --
- constant integer LEFT=1
- constant integer RIGHT=2
- constant integer ABOVE=3
- constant integer BELOW=4
- Protected:
- //-- Define the "Extreme points" constants. --
- constant integer LEFTMOST=1
- constant integer RIGHTMOST=2
- constant integer TOPMOST=3
- constant integer BOTTOMMOST=4
- constant integer UNITIALIZED = -32000
- //-- Define default icons. --
- string is_verticalpointer ='SizeWE!'
- string is_horizontalpointer ='SizeNS!'
- // -- Registered information. --
- integer ii_lefttopbound
- dragobject idrg_lefttop[]
- real ir_lefttopx[]
- real ir_lefttopy[]
- real ir_lefttopwidth[]
- real ir_lefttopheight[]
- integer ii_rightbottombound
- dragobject idrg_rightbottom[]
- real ir_rightbottomx[]
- real ir_rightbottomy[]
- real ir_rightbottomwidth[]
- real ir_rightbottomheight[]
- // --Other. --
- integer ii_style = -1 // Default to negative value.
- Integer ii_barwidth = -1 // Default to negative value.
- long il_barcolor=78682240
- long il_barmovecolor=8421504
- integer ii_minobjectsize = 20
- integer ii_minobjectsize2 = 0
- boolean ib_performredraw=True
- //-- Internal attributes. --
- boolean ib_supported = True
- integer ii_prevpositionx = UNITIALIZED
- integer ii_prevpositiony = UNITIALIZED
- window iw_parent
- userobject iuo_parent
- tab itab_parent
- Integer ii_rounding=5
- //增加,定位拖动条
- integer il_leftspace
- integer il_topspace
- //定位对象
- dragobject idrg_posh //水平定位对象
- dragobject idrg_posv//垂直定位对象
- end variables
- forward prototypes
- public function integer of_setbarcolor (long al_color)
- public function integer of_setbarmovecolor (long al_color)
- protected function integer of_lbuttonup (unsignedlong aul_flags, integer ai_xpos, integer ai_ypos)
- protected function integer of_mousemove (unsignedlong aul_flags, integer ai_xpos, integer ai_ypos)
- public function integer of_register (dragobject adrg_object, integer ai_position)
- protected function integer of_updateobjectdata ()
- protected function integer of_redraw (integer ai_prevx, integer ai_prevwidth, integer ai_prevy, integer ai_prevheight)
- public function integer of_getextremepoint (integer ai_extremetype)
- public function integer of_setminobjectsize (integer ai_minsize)
- public function integer of_getminobjectsize ()
- public function integer of_getbarcolor ()
- public function string of_gethorizontalpointer ()
- public function string of_getverticalpointer ()
- public function integer of_sethorizontalpointer (string as_icon)
- public function integer of_setverticalpointer (string as_icon)
- public function integer of_getbarmovecolor ()
- protected function boolean of_issupported ()
- public function integer of_reset ()
- public function integer uf_possplitbar (dragobject adrg_object)
- public function integer of_setminobjectsize2 (integer ai_minsize)
- end prototypes
- event mousemove;//////////////////////////////////////////////////////////////////////////////
- //
- // Event: mousemove
- //
- // Arguments:
- // flags
- // xpos
- // ypos
- //
- // Returns: None.
- //
- // Description: Perform the Mouse Move processing.
- //
- //////////////////////////////////////////////////////////////////////////////
- //
- // Revision History
- //
- // Version
- // 6.0 Initial version
- //
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright ?1996 Sybase, Inc. and its subsidiaries. All rights reserved.
- // Any distribution of the PowerBuilder Foundation Classes (PFC)
- // source code by other than Sybase, Inc. and its subsidiaries is prohibited.
- //
- //////////////////////////////////////////////////////////////////////////////
- If Not KeyDown(keyLeftButton!) Then
- Return
- End If
- of_MouseMove(flags, xpos, ypos)
- end event
- event lbuttonup;call super::lbuttonup;//////////////////////////////////////////////////////////////////////////////
- //
- // Event: lbuttonup
- //
- // Arguments:
- // flags
- // xpos
- // ypos
- //
- // Returns: None.
- //
- // Description: Perform the Left Button Up processing.
- //
- //////////////////////////////////////////////////////////////////////////////
- //
- // Revision History
- //
- // Version
- // 6.0 Initial version
- //
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright ?1996 Sybase, Inc. and its subsidiaries. All rights reserved.
- // Any distribution of the PowerBuilder Foundation Classes (PFC)
- // source code by other than Sybase, Inc. and its subsidiaries is prohibited.
- //
- //////////////////////////////////////////////////////////////////////////////
- of_lbuttonup(flags, xpos, ypos)
- end event
- public function integer of_setbarcolor (long al_color);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_SetBarColor
- //
- // Access: Public
- //
- // Arguments:
- // al_color The desired color.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Set the Non-Moving Split Bar Color.
- //
- //////////////////////////////////////////////////////////////////////////////
- // Validate the argument.
- If IsNull(al_color) Or al_color<0 Then
- Return -1
- End If
- // Set the color.
- il_barcolor = al_color
- // Start using the requested color.
- this.BackColor = il_barcolor
- Return 1
- end function
- public function integer of_setbarmovecolor (long al_color);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_SetBarMoveColor
- //
- // Access: Public
- //
- // Arguments:
- // al_color The desired color.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Set the Moving Split Bar Color.
- //
- //////////////////////////////////////////////////////////////////////////////
- // Validate the argument.
- If IsNull(al_color) Or al_color<0 Then
- Return -1
- End If
- il_barmovecolor = al_color
- Return 1
- end function
- protected function integer of_lbuttonup (unsignedlong aul_flags, integer ai_xpos, integer ai_ypos);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_LButtonUp
- //
- // Access: Protected
- //
- // Arguments:
- // aul_flags
- // ai_xpos
- // ai_ypos
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Resize the objects according to the bar that was just moved
- // and other service attributes.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_cnt
- Integer li_deltax, li_deltay
- Integer li_pointerx, li_pointery
- Integer li_minx, li_maxx, li_miny, li_maxy
- Integer li_x, li_y, li_width, li_height
- // Validate required values.
- If ii_style <0 or ii_barwidth <0 Then
- Return -1
- End If
- // Validate that objects were registered.
- If UpperBound(idrg_lefttop) =0 Or UpperBound(idrg_rightbottom) =0 Then
- Return -1
- End If
- this.SetPosition(ToTop!)
- // Change to the base color.
- this.BackColor = il_barcolor
- // Validate that the bar has been moved.
- If ii_prevpositionx = UNITIALIZED Or ii_prevpositiony = UNITIALIZED Then
- Return 0
- End If
- // Get the new position.
- If IsValid(iuo_parent) Then
- li_pointerx = iuo_parent.PointerX()
- li_pointery = iuo_parent.PointerY()
- ElseIf IsValid(itab_parent) Then
- li_pointerx = itab_parent.PointerX()
- li_pointery = itab_parent.PointerY()
- ElseIf IsValid(iw_parent) Then
- li_pointerx = iw_parent.PointerX()
- li_pointery = iw_parent.PointerY()
- Else
- // Reset the Previous position variables to UNITIALIZED.
- ii_prevpositionx = UNITIALIZED
- ii_prevpositiony = UNITIALIZED
- Return -1
- End If
- // Calculate the Extreme points the split bars can be moved.
- If ii_style = HORIZONTAL Then
- li_miny = of_GetExtremePoint(TOPMOST)
- li_maxy = of_GetExtremePoint(BOTTOMMOST)
- If li_pointery < li_miny Then
- li_pointery = li_miny
- ElseIf li_pointery > li_maxy Then
- li_pointery = li_maxy
- End If
- ElseIf ii_style = VERTICAL Then
- li_minx = of_GetExtremePoint(LEFTMOST)
- li_maxx = of_GetExtremePoint(RIGHTMOST)
- If li_pointerx < li_minx Then
- li_pointerx = li_minx
- ElseIf li_pointerx > li_maxx Then
- li_pointerx = li_maxx
- End If
- End If
- // Calculate delta values.
- li_deltax = li_pointerx - ii_prevpositionx
- li_deltay = li_pointery - ii_prevpositiony
- // Minimize size rounding problems.
- of_UpdateObjectData()
- If ii_style = HORIZONTAL Then
- // Position bar on its new location.
- this.Y = li_pointery
- // Refresh the Width of the bar.
- this.Height = ii_barwidth
- // Resize the objects above the horizontal split bar.
- For li_cnt = 1 to UpperBound(idrg_lefttop)
- If IsValid(idrg_lefttop[li_cnt]) Then
- ir_lefttopheight[li_cnt] =ir_lefttopheight[li_cnt] + li_deltay
- idrg_lefttop[li_cnt].Resize(ir_lefttopwidth[li_cnt], ir_lefttopheight[li_cnt])
- End If
- Next
-
- // Resize the objects below the horizontal split bar.
- For li_cnt = 1 to UpperBound(idrg_rightbottom)
- If IsValid(idrg_rightbottom[li_cnt]) Then
- ir_rightbottomy[li_cnt] = ir_rightbottomy[li_cnt] + li_deltay
- ir_rightbottomheight[li_cnt] = ir_rightbottomheight[li_cnt] - li_deltay
- idrg_rightbottom[li_cnt].Move (ir_rightbottomx[li_cnt], ir_rightbottomy[li_cnt])
- idrg_rightbottom[li_cnt].Resize (ir_rightbottomwidth[li_cnt], ir_rightbottomheight[li_cnt])
- End If
- Next
- //重新定位
- if IsValid(idrg_posh) then
- this.y=idrg_posh.y + idrg_posh.height + il_topspace
- end if
- ElseIf ii_style = VERTICAL Then
- // Position bar on its new location.
- this.X = li_pointerx
- // Refresh the Width of the bar.
- this.Width = ii_barwidth
-
- // Resize the objects left of the verticalbar.
- For li_cnt = 1 to UpperBound(idrg_lefttop)
- If IsValid(idrg_lefttop[li_cnt]) Then
- ir_lefttopwidth[li_cnt] =ir_lefttopwidth[li_cnt] + li_deltax
- idrg_lefttop[li_cnt].Resize(ir_lefttopwidth[li_cnt], ir_lefttopheight[li_cnt])
- End If
- Next
-
- // Resize the objects right of the verticalbar.
- For li_cnt = 1 to UpperBound(idrg_rightbottom)
- If IsValid(idrg_rightbottom[li_cnt]) Then
- ir_rightbottomx[li_cnt] =ir_rightbottomx[li_cnt] + li_deltax
- ir_rightbottomWidth[li_cnt] =ir_rightbottomWidth[li_cnt] - li_deltax
- idrg_rightbottom[li_cnt].Move (ir_rightbottomx[li_cnt], ir_rightbottomy[li_cnt])
- idrg_rightbottom[li_cnt].Resize(ir_rightbottomWidth[li_cnt], ir_rightbottomHeight[li_cnt])
- End If
- Next
- //重新定位
- if IsValid(idrg_posv) then
- this.x=idrg_posv.x + idrg_posv.width + il_leftspace
- end if
- End If
- // Reset the Previous position variables to UNITIALIZED.
- ii_prevpositionx = UNITIALIZED
- ii_prevpositiony = UNITIALIZED
- Return 1
- end function
- protected function integer of_mousemove (unsignedlong aul_flags, integer ai_xpos, integer ai_ypos);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_MouseMove
- //
- // Access: Public
- //
- // Arguments:
- // aul_flags
- // ai_xpos
- // ai_ypos
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: One of the split bars is being moved. Refresh the location
- // of the appropriate splitbar(s) and perform redraws if requested.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_cnt
- Integer li_pointerx, li_pointery
- Integer li_minx, li_maxx, li_miny, li_maxy
- Integer li_prevx
- Integer li_prevwidth
- Integer li_prevheight
- Integer li_prevy
- Integer li_upperbound
- Integer li_parentx, li_parenty
- string ls_redraw
- Integer li_x, li_y, li_width, li_height
- // Validate required values.
- If ii_style < 0 Then
- Return -1
- End If
- // Validate that objects were registered.
- If UpperBound(idrg_lefttop) =0 Or UpperBound(idrg_rightbottom) =0 Then
- Return -1
- End If
- // Always keep the Split Bar on top of other objects.
- this.SetPosition(ToTop!)
- // Store the Begin Movement information.
- If ii_prevpositionx = UNITIALIZED or ii_prevpositiony = UNITIALIZED Then
- ii_prevpositionx = This.X
- ii_prevpositiony = This.Y
- End If
- // Store the previous placement information.
- li_prevx = this.X
- li_prevwidth = this.Width
- li_prevy = this.Y
- li_prevheight = this.Height
- // Get the new position.
- If IsValid(iuo_parent) Then
- li_pointerx = iuo_parent.PointerX()
- li_pointery = iuo_parent.PointerY()
- ElseIf IsValid(itab_parent) Then
- li_pointerx = itab_parent.PointerX()
- li_pointery = itab_parent.PointerY()
- ElseIf IsValid(iw_parent) Then
- li_pointerx = iw_parent.PointerX()
- li_pointery = iw_parent.PointerY()
- Else
- Return -1
- End If
- // Calculate the Extreme points the split bars can be moved.
- If ii_style = HORIZONTAL Then
- li_miny = of_GetExtremePoint(TOPMOST)
- li_maxy = of_GetExtremePoint(BOTTOMMOST)
- If li_pointery < li_miny Then
- li_pointery = li_miny
- ElseIf li_pointery > li_maxy Then
- li_pointery = li_maxy
- End If
- ElseIf ii_style = VERTICAL Then
- li_minx = of_GetExtremePoint(LEFTMOST)
- li_maxx = of_GetExtremePoint(RIGHTMOST)
- If li_pointerx < li_minx Then
- li_pointerx = li_minx
- ElseIf li_pointerx > li_maxx Then
- li_pointerx = li_maxx
- End If
- End If
- // Change to the "Moving" color.
- this.BackColor = il_barmovecolor
- If ii_style = HORIZONTAL Then
-
- // Position bar on its new location.
- this.Y = li_pointery
- // Refresh the Width of the bar.
- this.Height = ii_barwidth
-
- // Perform redraws when appropriate.
- If ib_performredraw Then
- If (li_prevy <> this.Y) Then
- of_Redraw(li_prevx, li_prevwidth, li_prevy, li_prevheight)
- End If
- End If
- ElseIf ii_style = VERTICAL Then
-
- // Position bar on its new location.
- this.X = li_pointerx
- // Refresh the Width of the bar.
- this.Width = ii_barwidth
- // Perform redraws when appropriate.
- If ib_performredraw Then
- If (li_prevx <> this.X) Then
- of_Redraw(li_prevx, li_prevwidth, li_prevy, li_prevheight)
- End If
- End If
-
- End If
- Return 1
- end function
- public function integer of_register (dragobject adrg_object, integer ai_position);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_Register
- //
- // Access: public
- //
- // Arguments:
- // adrg_object The object to register with the service.
- // ai_position The position of the object in relation to the splitbar.
- //
- // Returns: integer
- // 1 if it succeeds
- // -1 if an error registering the objects occurs.
- //
- // Description: Register controls which need to either be moved and/or resized
- // when the split bar object is moved.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_rc
- Integer li_upperbound
- Integer li_obj
- // Validate required values.
- If ii_style <0 or ii_barwidth <0 Then
- Return -1
- End If
- // Validate the dragobject.
- If IsNull(adrg_object) Or Not IsValid(adrg_object) Then
- Return -1
- End If
- // Validate the position parameter.
- If IsNull(ai_position) Or ai_position < 0 Or ai_position > 4 Then
- Return -1
- Else
- If (ii_style = HORIZONTAL) And &
- (ai_position = LEFT Or ai_position = RIGHT) Then
- Return -1
- ElseIf (ii_style = VERTICAL) And &
- (ai_position = ABOVE Or ai_position = BELOW) Then
- Return -1
- End If
- End If
- // Make sure this object is not already registered on the left/top array.
- li_upperbound = UpperBound (idrg_lefttop)
- For li_obj = 1 to li_upperbound
- If IsValid(idrg_lefttop[li_obj]) Then
- If adrg_object = idrg_lefttop[li_obj] Then
- Return -1
- End If
- End If
- Next
- // Make sure this object is not already registered on the right/bottom array.
- li_upperbound = UpperBound (idrg_rightbottom)
- For li_obj = 1 to li_upperbound
- If IsValid(idrg_rightbottom[li_obj]) Then
- If adrg_object = idrg_rightbottom[li_obj] Then
- Return -1
- End If
- End If
- Next
- // Register the new object.
- If ai_position = LEFT Or ai_position = ABOVE Then
- ii_lefttopbound = UpperBound (idrg_lefttop) + 1
- idrg_lefttop[ii_lefttopbound] = adrg_object
- ir_lefttopx[ii_lefttopbound] = adrg_object.X
- ir_lefttopy[ii_lefttopbound] = adrg_object.Y
- ir_lefttopwidth[ii_lefttopbound] = adrg_object.Width
- ir_lefttopheight[ii_lefttopbound] = adrg_object.Height
- // il_leftspace=this.x - adrg_object.x - adrg_object.width
- // il_topspace=this.y - adrg_object.y - adrg_object.height
- Else
- ii_rightbottombound = UpperBound (idrg_rightbottom) + 1
- idrg_rightbottom[ii_rightbottombound] = adrg_object
- ir_rightbottomx[ii_rightbottombound] = adrg_object.X
- ir_rightbottomy[ii_rightbottombound] = adrg_object.Y
- ir_rightbottomwidth[ii_rightbottombound] = adrg_object.Width
- ir_rightbottomheight[ii_rightbottombound] = adrg_object.Height
- // il_leftspace=this.x - adrg_object.x - adrg_object.width
- // il_topspace=this.y - adrg_object.y - adrg_object.height
- End If
- Return 1
- end function
- protected function integer of_updateobjectdata ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_UpdateObjectData
- //
- // Access: Protected
- //
- // Arguments: None.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Update the registered object data in order to minimize
- // rounding problems.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_cnt
- Integer li_upperbound
- li_upperbound = Upperbound (idrg_lefttop)
- For li_cnt = 1 to li_upperbound
- If IsValid(idrg_lefttop[li_cnt]) Then
- If abs(ir_lefttopx[li_cnt] - idrg_lefttop[li_cnt].X) > ii_rounding Then
- ir_lefttopx[li_cnt] = idrg_lefttop[li_cnt].X
- End If
- If abs(ir_lefttopy[li_cnt] - idrg_lefttop[li_cnt].Y) > ii_rounding Then
- ir_lefttopy[li_cnt] = idrg_lefttop[li_cnt].Y
- End If
- If abs(ir_lefttopwidth[li_cnt] - idrg_lefttop[li_cnt].Width) > ii_rounding Then
- ir_lefttopwidth[li_cnt] = idrg_lefttop[li_cnt].Width
- End If
- If abs(ir_lefttopheight[li_cnt] - idrg_lefttop[li_cnt].Height) > ii_rounding Then
- ir_lefttopheight[li_cnt] = idrg_lefttop[li_cnt].Height
- End If
- End If
- Next
-
- li_upperbound = Upperbound (idrg_rightbottom)
- For li_cnt = 1 to li_upperbound
- If IsValid(idrg_rightbottom[li_cnt]) Then
- If abs(ir_rightbottomx[li_cnt] - idrg_rightbottom[li_cnt].X) > ii_rounding Then
- ir_rightbottomx[li_cnt] = idrg_rightbottom[li_cnt].X
- End If
- If abs(ir_rightbottomy[li_cnt] - idrg_rightbottom[li_cnt].Y) > ii_rounding Then
- ir_rightbottomy[li_cnt] = idrg_rightbottom[li_cnt].Y
- End If
- If abs(ir_rightbottomwidth[li_cnt] - idrg_rightbottom[li_cnt].Width) > ii_rounding Then
- ir_rightbottomwidth[li_cnt] = idrg_rightbottom[li_cnt].Width
- End If
- If abs(ir_rightbottomheight[li_cnt] - idrg_rightbottom[li_cnt].Height) > ii_rounding Then
- ir_rightbottomheight[li_cnt] = idrg_rightbottom[li_cnt].Height
- End If
- End If
- Next
- Return 1
- end function
- protected function integer of_redraw (integer ai_prevx, integer ai_prevwidth, integer ai_prevy, integer ai_prevheight);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_Redraw
- //
- // Access: protected
- //
- // Arguments:
- // ai_prevx The bar previous X location.
- // ai_prevwidth The bar previous Width.
- // ai_prevy The bar previous Y location.
- // ai_prevheight The bar previous Height.
- //
- // Returns: Integer
- // 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Perform a Redraw on those object which may be still showing
- // the bar on its previous position.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_cnt
- // Validate required values.
- If ii_style <0 or ii_barwidth <0 Then
- Return -1
- End If
- If ii_style = HORIZONTAL Then
- // Redraw the objects above the Horizontal Split Bar.
- For li_cnt = 1 to ii_lefttopbound
- If IsValid(idrg_lefttop[li_cnt]) Then
- If (ai_prevy >= idrg_lefttop[li_cnt].Y Or &
- ai_prevy + ai_prevheight >= idrg_lefttop[li_cnt].Y) And &
- ai_prevy < idrg_lefttop[li_cnt].Y + idrg_lefttop[li_cnt].Height Then
- idrg_lefttop[li_cnt].SetRedraw(True)
- End If
- End If
- Next
- // Redraw the objects below the Horizontal Split Bar.
- For li_cnt = 1 to ii_rightbottombound
- If IsValid(idrg_rightbottom[li_cnt]) Then
- If (ai_prevy >= idrg_rightbottom[li_cnt].Y Or &
- ai_prevy + ai_prevheight >= idrg_rightbottom[li_cnt].Y ) And &
- ai_prevy < idrg_rightbottom[li_cnt].Y + idrg_rightbottom[li_cnt].Height Then
- idrg_rightbottom[li_cnt].SetRedraw(True)
- End If
- End If
- Next
- ElseIf ii_style = VERTICAL Then
-
- // Redraw the objects left of the Vertical Split Bar.
- For li_cnt = 1 to ii_lefttopbound
- If IsValid(idrg_lefttop[li_cnt]) Then
- If (ai_prevx >= idrg_lefttop[li_cnt].X Or &
- ai_prevx + ai_prevwidth >= idrg_lefttop[li_cnt].X) And &
- ai_prevx < idrg_lefttop[li_cnt].X + idrg_lefttop[li_cnt].Width Then
- idrg_lefttop[li_cnt].SetRedraw(True)
- End If
- End If
- Next
- // Redraw the objects right of the Vertical Split Bar.
- For li_cnt = 1 to ii_rightbottombound
- If IsValid(idrg_rightbottom[li_cnt]) Then
- If (ai_prevx >= idrg_rightbottom[li_cnt].X Or &
- ai_prevx + ai_prevwidth >= idrg_rightbottom[li_cnt].X) And &
- ai_prevx < idrg_rightbottom[li_cnt].X + idrg_rightbottom[li_cnt].Width Then
- idrg_rightbottom[li_cnt].SetRedraw(True)
- End If
- End If
- Next
- End If
- Return 1
- end function
- public function integer of_getextremepoint (integer ai_extremetype);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_GetExtremePoint
- //
- // Access: Public
- //
- // Arguments:
- // ai_extremetype The extreme point desired. Valid values are:
- // LEFTMOST=1
- // RIGHTMOST=2
- // TOPMOST=3
- // BOTTOMMOST=4
- //
- // Returns: Integer
- // Returns the desired extreme point.
- //
- // Description: Get the desired extreme point coordinate. The coordinate is
- // the maximum or minimum point where the split bar can be
- // moved to.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_point
- Integer li_extremepoint
- Integer li_rc
- Integer li_cnt
- constant Integer LOW_VALUE = -999999
- constant Integer HIGH_VALUE = 999999
- CHOOSE CASE ai_extremetype
- CASE LEFTMOST
- // Initialize the extreme point.
- li_point = LOW_VALUE
- // Find the left most point.
- For li_cnt = 1 to UpperBound(idrg_lefttop)
- If IsValid(idrg_lefttop[li_cnt]) Then
- If idrg_lefttop[li_cnt].X > li_point Then
- li_point = idrg_lefttop[li_cnt].X
- End If
- End If
- Next
- // Take into account the the minimum object size.
- li_extremepoint = li_point + ii_minobjectsize
-
- CASE RIGHTMOST
- // Initialize the extreme point.
- li_point = HIGH_VALUE
- // Find the right most point.
- For li_cnt = 1 to UpperBound(idrg_rightbottom)
- If IsValid(idrg_rightbottom[li_cnt]) Then
- If idrg_rightbottom[li_cnt].X + idrg_rightbottom[li_cnt].Width < li_point Then
- li_point = idrg_rightbottom[li_cnt].X + idrg_rightbottom[li_cnt].Width
- End If
- End If
- Next
-
- // Take into account the split bar itself and the minimum object size.
- // if ii_minobjectsize2 = 0 then
- // li_extremepoint = li_point - (ii_barwidth + ii_minobjectsize )
- // else
- li_extremepoint = li_point - (ii_barwidth + ii_minobjectsize2 )
- // end if
-
- CASE TOPMOST
-
- // Initialize the extreme point.
- li_point = LOW_VALUE
-
- // Find the top most point.
- For li_cnt = 1 to UpperBound(idrg_lefttop)
- If IsValid(idrg_lefttop[li_cnt]) Then
- If idrg_lefttop[li_cnt].Y > li_point Then
- li_point = idrg_lefttop[li_cnt].Y
- End If
- End If
- Next
- // Take into account the the minimum object size.
- li_extremepoint = li_point + ii_minobjectsize
-
- CASE BOTTOMMOST
-
- // Initialize the extreme point.
- li_point = HIGH_VALUE
-
- // Find the bottom most point.
- For li_cnt = 1 to UpperBound(idrg_rightbottom)
- If IsValid(idrg_rightbottom[li_cnt]) Then
- If idrg_rightbottom[li_cnt].Y + idrg_rightbottom[li_cnt].Height < li_point Then
- li_point = idrg_rightbottom[li_cnt].Y + idrg_rightbottom[li_cnt].Height
- End If
- End If
- Next
- // Take into account the split bar itself and the minimum object size.
- li_extremepoint = li_point - (ii_barwidth + ii_minobjectsize)
-
- CASE Else
- Return -1
- END CHOOSE
- // Make sure the initial value was replaced.
- If li_point = LOW_VALUE or li_point = HIGH_VALUE Then
- Return -1
- End If
- Return li_extremepoint
- end function
- public function integer of_setminobjectsize (integer ai_minsize);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_SetMinObjectSize
- //
- // Access: Public
- //
- // Arguments:
- // ai_minsize The desired minimum object size for all registered objects.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description:
- // Set the desired minimum object size for all registered objects.
- //
- //////////////////////////////////////////////////////////////////////////////
- // Validate the argument.
- If IsNull(ai_minsize) or ai_minsize < 0 Then
- Return -1
- End If
- ii_minobjectsize = ai_minsize
- ii_minobjectsize2 = ai_minsize
- Return 1
- end function
- public function integer of_getminobjectsize ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_GetMinObjectSize
- //
- // Access: Public
- //
- // Arguments: None
- //
- // Returns: Integer
- // The desired minimum object size for all registered objects.
- //
- // Description:
- // Gets the desired minimum object size for all registered objects.
- //
- //////////////////////////////////////////////////////////////////////////////
- Return ii_minobjectsize
- end function
- public function integer of_getbarcolor ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_GetBarColor
- //
- // Access: Public
- //
- // Arguments: None
- //
- // Returns: Integer
- // The non-moving Split Bar color.
- //
- // Description:
- // 得到分割条的值.
- //
- //////////////////////////////////////////////////////////////////////////////
- Return il_barcolor
- end function
- public function string of_gethorizontalpointer ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_GetHorizontalPointer
- //
- // Access: Public
- //
- // Arguments: None
- //
- // Returns: String
- // Returns the Horizontal Icon.
- //
- // Description:
- // Reports the Horizontal Icon.
- //
- //////////////////////////////////////////////////////////////////////////////
- Return is_horizontalpointer
- end function
- public function string of_getverticalpointer ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_GetVerticalPointer
- //
- // Access: Public
- //
- // Arguments: None
- //
- // Returns: String
- // Returns the Vertical Icon.
- //
- // Description:
- // Reports the Vertical Icon.
- //
- //////////////////////////////////////////////////////////////////////////////
- Return is_verticalpointer
- end function
- public function integer of_sethorizontalpointer (string as_icon);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_SetHorizontalPointer
- //
- // Access: Public
- //
- // Arguments:
- // as_icon The desired icon.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Set the Horizontal Icon.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_rc
- // Validate the argument.
- If IsNull(as_icon) Or Len(Trim(as_icon)) = 0 Then
- Return -1
- End If
- // Set the icon.
- is_horizontalpointer = as_icon
- If ii_style = HORIZONTAL Then
- this.Pointer = as_icon
- End If
- Return 1
- end function
- public function integer of_setverticalpointer (string as_icon);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_SetVerticalPointer
- //
- // Access: Public
- //
- // Arguments:
- // as_icon The desired icon.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description: Set the Vertical Icon.
- //
- //////////////////////////////////////////////////////////////////////////////
- Integer li_rc
- // Validate the argument.
- If IsNull(as_icon) Or Len(Trim(as_icon)) = 0 Then
- Return -1
- End If
- // Set the icon.
- is_verticalpointer = as_icon
- If ii_style = VERTICAL Then
- this.Pointer = as_icon
- End If
- Return 1
- end function
- public function integer of_getbarmovecolor ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_GetBarMoveColor
- //
- // Access: Public
- //
- // Arguments: None
- //
- // Returns: Integer
- // The moving Split Bar color.
- //
- // Description:
- // 得到移动条的背景颜色.
- //
- //////////////////////////////////////////////////////////////////////////////
- Return il_barmovecolor
- end function
- protected function boolean of_issupported ();//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_IsSupported
- //
- // Access: Public
- //
- // Arguments: None
- //
- // Returns: Boolean
- // True if running in a supported environment.
- //
- // Description:
- // Dtermines if object is running in a supported environment.
- //
- //////////////////////////////////////////////////////////////////////////////
- Environment lenv_object
- GetEnvironment (lenv_object)
- If lenv_object.ostype = Macintosh! Then
- Return False
- End If
- Return True
- end function
- public function integer of_reset ();Real lr_Empty[]
- DragObject ldo_Empty[]
- ii_lefttopbound = 0
- idrg_lefttop = ldo_Empty
- ir_lefttopx = lr_Empty
- ir_lefttopy = lr_Empty
- ir_lefttopwidth = lr_Empty
- ir_lefttopheight = lr_Empty
- ii_rightbottombound = 0
- idrg_rightbottom = ldo_Empty
- ir_rightbottomx = lr_Empty
- ir_rightbottomy = lr_Empty
- ir_rightbottomwidth = lr_Empty
- ir_rightbottomheight = lr_Empty
- Return 1
- end function
- public function integer uf_possplitbar (dragobject adrg_object);////////////////////////////////////////////////////
- //拖动条的与要定位的对象的空格
- //
- //--------------------------------------------------
- //
- //2000-3-17
- ////////////////////////////////////////////////////
- if ii_style = HORIZONTAL then
- if IsValid(adrg_object) then
- idrg_posh=adrg_object
- il_topspace=this.y - adrg_object.y - adrg_object.height
- end if
- elseif ii_style = VERTICAL then
- if IsValid(adrg_object) then
- idrg_posv=adrg_object
- il_leftspace=this.x - adrg_object.x - adrg_object.width
- end if
- end if
- return 1
- end function
- public function integer of_setminobjectsize2 (integer ai_minsize);//////////////////////////////////////////////////////////////////////////////
- //
- // Function: of_SetMinObjectSize
- //
- // Access: Public
- //
- // Arguments:
- // ai_minsize The desired minimum object size for all registered objects.
- //
- // Returns: Integer
- // Returns 1 if it succeeds and?1 if an error occurs.
- //
- // Description:
- // Set the desired minimum object size for all registered objects.
- //
- //////////////////////////////////////////////////////////////////////////////
- // Validate the argument.
- If IsNull(ai_minsize) or ai_minsize < 0 Then
- Return -1
- End If
- ii_minobjectsize2 = ai_minsize
- Return 1
- end function
- event constructor;//////////////////////////////////////////////////////////////////////////////
- //
- // Event: constructor
- //
- // Arguments: None.
- //
- // Returns: None.
- //
- // Description: SplitBar Object.
- // Initialize required information by the object.
- //
- // *Note: The Style and the Width (this.Width for a VerticalBar and this.Height
- // for a HorizontalBar) are not changeable past this point. For example,
- // an outside entity should not change this.Height for a HorizontalBar.
- //
- //////////////////////////////////////////////////////////////////////////////
- //
- // Revision History
- //
- // Version
- // 6.0 Initial version - Claudio J. Quant
- //
- //////////////////////////////////////////////////////////////////////////////
- //
- // Copyright ?1996 Sybase, Inc. and its subsidiaries. All rights reserved.
- // Any distribution of the PowerBuilder Foundation Classes (PFC)
- // source code by other than Sybase, Inc. and its subsidiaries is prohibited.
- //
- //////////////////////////////////////////////////////////////////////////////
- powerobject lpo_parent
- // Determine if this object is supported.
- ib_supported = of_IsSupported()
- // Defined the object to be on Top of other objects.
- this.SetPosition(ToTop!)
- // Set the object to the Non-Moving Split bar color.
- this.BackColor = il_barcolor
- // Get and store the parent object.
- lpo_parent = this.GetParent()
- CHOOSE CASE lpo_parent.TypeOf()
- CASE Window!
- iw_parent = lpo_parent
- CASE UserObject!
- iuo_parent = lpo_parent
- CASE Tab!
- itab_parent = lpo_parent
- END CHOOSE
- If ib_supported Then
- // Determine object attributes by looking at the object size.
- If this.Height >= this.Width Then
- ii_style = VERTICAL
- this.Pointer = is_verticalpointer
- ii_barwidth = this.Width
-
- Else
- ii_style = HORIZONTAL
- this.Pointer = is_horizontalpointer
- ii_barwidth = this.Height
- End If
- Else
- // Since it is not supported - hide the object.
- this.Enabled = False
- this.Visible = False
- this.Resize(0,0)
- End If
- end event
- on u_lbs_stsplitbar.create
- call super::create
- end on
- on u_lbs_stsplitbar.destroy
- call super::destroy
- end on
|