uo_toolbar_button.sru 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. $PBExportHeader$uo_toolbar_button.sru
  2. $PBExportComments$工具栏按钮对象
  3. forward
  4. global type uo_toolbar_button from userobject
  5. end type
  6. type uo_triangle from uo_angle within uo_toolbar_button
  7. end type
  8. type plb_1 from picturelistbox within uo_toolbar_button
  9. end type
  10. type ln_bottom from line within uo_toolbar_button
  11. end type
  12. type ln_top from line within uo_toolbar_button
  13. end type
  14. type ln_left from line within uo_toolbar_button
  15. end type
  16. type ln_right from line within uo_toolbar_button
  17. end type
  18. type st_caption from statictext within uo_toolbar_button
  19. end type
  20. type rect from structure within uo_toolbar_button
  21. end type
  22. end forward
  23. type rect from structure
  24. long left
  25. long top
  26. long right
  27. long bottom
  28. end type
  29. shared variables
  30. nvo_tooltips inv_tooltips
  31. end variables
  32. global type uo_toolbar_button from userobject
  33. integer width = 311
  34. integer height = 204
  35. long backcolor = 12632256
  36. long tabtextcolor = 33554432
  37. long picturemaskcolor = 536870912
  38. event ue_lbuttonup pbm_lbuttonup
  39. event ue_lbuttondown pbm_lbuttondown
  40. event ue_mousemove pbm_mousemove
  41. event clicked ( )
  42. event ue_paint pbm_paint
  43. uo_triangle uo_triangle
  44. plb_1 plb_1
  45. ln_bottom ln_bottom
  46. ln_top ln_top
  47. ln_left ln_left
  48. ln_right ln_right
  49. st_caption st_caption
  50. end type
  51. global uo_toolbar_button uo_toolbar_button
  52. type prototypes
  53. FUNCTION ulong SetCapture(ulong hwnd) library "user32.dll"
  54. FUNCTION boolean ReleaseCapture() library "user32.dll"
  55. FUNCTION ulong SleepEx(ulong dwMilliseconds,ulong bAlertable) LIBRARY "kernel32.dll"
  56. FUNCTION ulong DrawFocusRect(ulong hdc,ref RECT lpRect) LIBRARY "user32.dll" alias for "DrawFocusRect;Ansi"
  57. FUNCTION ulong SetRect(ref RECT lpRect,ulong X1,ulong Y1,ulong X2,ulong Y2) LIBRARY "user32.dll" alias for "SetRect;Ansi"
  58. FUNCTION ulong GetDC(ulong hwnd) LIBRARY "user32.dll"
  59. FUNCTION ulong DrawText(ulong hdc,ref string lpStr,ulong nCount,ref RECT lpRect,ulong wFormat) LIBRARY "user32.dll" ALIAS FOR "DrawTextA;Ansi"
  60. FUNCTION ulong SelectObject(ulong hdc,ulong hObject) LIBRARY "gdi32.dll"
  61. FUNCTION ulong SetTextColor(ulong hdc,ulong crColor) LIBRARY "gdi32.dll"
  62. FUNCTION ulong GetSysColor(ulong nIndex) LIBRARY "user32.dll"
  63. FUNCTION ulong SetBkColor(ulong hdc,ulong crColor) LIBRARY "gdi32.dll"
  64. FUNCTION ulong SetBkMode(ulong hdc,ulong nBkMode) LIBRARY "gdi32.dll"
  65. FUNCTION ulong DeleteObject(ulong hObject) LIBRARY "gdi32.dll"
  66. //获取整个窗口(包括边框、滚动条、标题栏、菜单等)的设备场景
  67. FUNCTION ulong GetWindowDC(ulong hwnd) LIBRARY "user32.dll"
  68. //创建一幅与设备有关位图,它与指定的设备场景兼容
  69. FUNCTION ulong CreateCompatibleBitmap(ulong hdc,ulong nWidth,ulong nHeight) LIBRARY "gdi32.dll"
  70. //创建一个与特定设备场景一致的内存设备场景
  71. FUNCTION ulong CreateCompatibleDC(ulong hdc) LIBRARY "gdi32.dll"
  72. //这个函数可为一幅图象或绘图操作应用各式各样的效果(绘图片的浮雕状态)
  73. FUNCTION boolean DrawState(ulong hDC,ulong hBrush,ulong lpDrawStateProc,ulong lParam,ulong wParam,ulong n1,ulong n2,ulong n3,ulong n4,ulong un) LIBRARY "user32.dll" ALIAS FOR "DrawStateA"
  74. //删除专用设备场景或信息场景,释放所有相关窗口资源
  75. FUNCTION ulong DeleteDC(ulong hdc) LIBRARY "gdi32.dll"
  76. //释放由调用GetDC或GetWindowDC函数获取的指定设备场景
  77. FUNCTION ulong ReleaseDC(ulong hwnd,ulong hdc) LIBRARY "user32.dll"
  78. end prototypes
  79. type variables
  80. Public:
  81. protectedwrite string class_name = 'uo_toolbar_button'
  82. string ButtonText =''
  83. string ButtonType='Normal' //Normal,Checked,RadioButton
  84. string ToolTip = ''
  85. string Picture_Name =''
  86. integer Picture_Size = 16 //16,24
  87. string TextAlign ='Right' //Right,Bottom,None
  88. integer RadioGroup = 0
  89. boolean Checked = False
  90. Protected:
  91. window iw_parent
  92. uo_toolbar iuo_parent
  93. boolean ib_Captured
  94. boolean ib_clicked
  95. boolean ChildMenu
  96. boolean ib_mousein
  97. menu im_menuid
  98. Private:
  99. integer ii_charwidth = 28
  100. integer ii_minwidth = 240
  101. integer ii_minheight = 110
  102. integer ii_poffsetx,ii_poffsety,ii_coffsetx,ii_coffsety
  103. integer ii_toffsetx,ii_toffsety
  104. integer ii_px,ii_py,ii_cx,ii_cy,ii_tx,ii_ty
  105. //Constant Variables
  106. CONSTANT LONG TRANSPARENT = 1
  107. CONSTANT LONG COLOR_BTNHIGHLIGHT = 20
  108. CONSTANT LONG COLOR_BTNSHADOW = 16
  109. CONSTANT ULONG DT_CENTER = 1
  110. constant long WM_PAINT = 15
  111. Constant ulong DST_BITMAP = 4 //&H4 位图
  112. Constant ulong DSS_DISABLED = 32 //&H20 图象具有浮雕效果
  113. end variables
  114. forward prototypes
  115. public subroutine of_buttontext (string as_text)
  116. public subroutine of_setstyle (string as_style)
  117. public subroutine of_settooltip (string as_tooltip)
  118. public subroutine of_setpicture (string as_picture)
  119. public subroutine of_setpicturesize (integer ai_size)
  120. public subroutine of_setalign (string as_align)
  121. public subroutine of_checked ()
  122. public subroutine of_drawbutton (string as_type)
  123. public subroutine of_getparentwindow ()
  124. public subroutine of_setposition ()
  125. public subroutine of_enabled (boolean ab_enabled)
  126. public subroutine of_drawdisabled ()
  127. public subroutine of_setgroup (integer ai_groupid)
  128. public subroutine of_setmenu (menu am_menu)
  129. public subroutine of_setparent (readonly uo_toolbar auo_parent)
  130. public function menu of_getmenu ()
  131. public subroutine of_childmenu (boolean ab_enabled)
  132. public subroutine of_enabledmenu (boolean ab_enabled)
  133. public subroutine of_setbkcolor (long al_color)
  134. public subroutine of_setsize ()
  135. end prototypes
  136. event ue_lbuttonup;IF NOT ib_clicked THEN RETURN
  137. ib_clicked = false
  138. ib_captured = false
  139. IF ((XPos<0 or YPos<0) or (XPos>=this.Width or YPos>this.Height)) THEN
  140. ReleaseCapture()
  141. of_drawbutton('Flat')
  142. ELSE
  143. IF ButtonType = 'Checked' THEN of_checked()
  144. IF ButtonType = 'RadioButton' AND (NOT Checked) THEN of_checked()
  145. IF NOT ChildMenu THEN of_drawbutton('Flat')
  146. this.triggerevent("clicked")
  147. END IF
  148. end event
  149. event ue_lbuttondown;IF ib_clicked THEN RETURN
  150. ib_clicked = true
  151. ib_captured = false
  152. of_drawbutton('Down')
  153. end event
  154. event ue_mousemove;IF NOT ib_Captured THEN
  155. SetCapture(handle(this))
  156. ib_Captured=true
  157. ib_mousein = true
  158. IF NOT ib_clicked THEN
  159. of_drawbutton('Up')
  160. END IF
  161. inv_tooltips.relaymsg(this)
  162. ELSE
  163. IF ((XPos<0 or YPos<0) or (XPos>=this.Width or YPos>this.Height)) THEN
  164. IF NOT ib_clicked THEN
  165. ib_Captured = false
  166. ReleaseCapture()
  167. END IF
  168. IF ib_mousein THEN
  169. of_drawbutton('Flat')
  170. ib_mousein = false
  171. END IF
  172. ELSE
  173. IF NOT ib_mousein THEN
  174. ib_mousein =true
  175. IF ib_clicked THEN
  176. of_drawbutton('Down')
  177. ELSE
  178. of_drawbutton('Flat')
  179. END IF
  180. END IF
  181. inv_tooltips.relaymsg(this)
  182. END IF
  183. END IF
  184. end event
  185. event clicked;IF isvalid(im_menuid) THEN
  186. IF ButtonType = 'Checked' THEN
  187. im_menuid.checked = Checked
  188. END IF
  189. IF ChildMenu THEN
  190. im_menuid.popmenu( this.x , this.y + this.height )
  191. of_drawbutton('Flat')
  192. ELSE
  193. im_menuid.event clicked()
  194. END IF
  195. END IF
  196. end event
  197. event ue_paint;IF NOT this.enabled THEN
  198. of_drawdisabled()
  199. END IF
  200. end event
  201. public subroutine of_buttontext (string as_text);st_caption.text = as_text
  202. ButtonText = as_text
  203. end subroutine
  204. public subroutine of_setstyle (string as_style);IF pos('Checked;RadioButton;',as_style)>0 THEN
  205. ButtonType = as_style
  206. ELSE
  207. ButtonType = 'Normal'
  208. END IF
  209. end subroutine
  210. public subroutine of_settooltip (string as_tooltip);ToolTip = as_tooltip
  211. inv_tooltips.AddTool(this,as_tooltip,0)
  212. end subroutine
  213. public subroutine of_setpicture (string as_picture);IF as_picture = '' THEN RETURN
  214. Picture_Name = as_Picture
  215. plb_1.reset()
  216. plb_1.deletepicture(1)
  217. plb_1.addpicture(as_picture)
  218. plb_1.additem(' ',1)
  219. end subroutine
  220. public subroutine of_setpicturesize (integer ai_size);IF ai_size =24 THEN
  221. Picture_Size = 24
  222. ELSE
  223. Picture_Size = 16
  224. END IF
  225. end subroutine
  226. public subroutine of_setalign (string as_align);IF as_align = TextAlign THEN RETURN
  227. IF pos('None;Right;',as_align)>0 THEN
  228. TextAlign = as_align
  229. ELSE
  230. TextAlign = 'Bottom'
  231. END IF
  232. of_setsize()
  233. of_setposition()
  234. IF checked THEN
  235. of_drawbutton('Down')
  236. END IF
  237. end subroutine
  238. public subroutine of_checked ();classdefinition lcd_classinfo
  239. variabledefinition lvd_classinfo
  240. userobject us_tmp
  241. uo_toolbar_button us_tmp_r
  242. IF ButtonType = 'Checked' THEN
  243. Checked = not Checked
  244. IF Checked THEN
  245. of_drawbutton('Down')
  246. ELSE
  247. of_drawbutton('Flat')
  248. END IF
  249. ELSE
  250. IF ButtonType = 'RadioButton' THEN
  251. IF Checked THEN
  252. Checked = false
  253. of_drawbutton('Flat')
  254. ELSE
  255. Checked = True
  256. integer in_loop
  257. FOR in_loop = 1 TO upperbound(iuo_parent.iuo_buttons)
  258. us_tmp_r = iuo_parent.iuo_buttons[in_loop]
  259. IF us_tmp_r.RadioGroup = this.RadioGroup AND us_tmp_r.Checked &
  260. AND handle(us_tmp_r) <> handle(this)THEN
  261. us_tmp_r.of_Checked()
  262. EXIT
  263. END IF
  264. NEXT
  265. END IF
  266. END IF
  267. END IF
  268. end subroutine
  269. public subroutine of_drawbutton (string as_type);CHOOSE CASE as_type
  270. CASE 'Down'
  271. ln_top.linecolor = rgb(128,128,128)
  272. ln_left.linecolor = rgb(128,128,128)
  273. ln_bottom.linecolor =rgb(255,255,255)
  274. ln_right.linecolor =rgb(255,255,255)
  275. plb_1.x = ii_poffsetx
  276. plb_1.y = ii_poffsety
  277. st_caption.x = ii_coffsetx
  278. st_caption.y = ii_coffsety
  279. uo_triangle.x = ii_toffsetx
  280. uo_triangle.y = ii_toffsety
  281. CASE 'Flat'
  282. IF checked AND NOT ChildMenu THEN RETURN
  283. ln_top.linecolor = this.backcolor
  284. ln_left.linecolor = this.backcolor
  285. ln_bottom.linecolor = this.backcolor
  286. ln_right.linecolor = this.backcolor
  287. plb_1.x = ii_px
  288. plb_1.y = ii_py
  289. st_caption.x = ii_cx
  290. st_caption.y = ii_cy
  291. uo_triangle.x = ii_tx
  292. uo_triangle.y = ii_ty
  293. CASE 'Up'
  294. IF checked AND NOT ChildMenu THEN RETURN
  295. ln_top.linecolor = rgb(255,255,255)
  296. ln_left.linecolor = rgb(255,255,255)
  297. ln_bottom.linecolor =rgb(128,128,128)
  298. ln_right.linecolor =rgb(128,128,128)
  299. plb_1.x = ii_px
  300. plb_1.y = ii_py
  301. st_caption.x = ii_cx
  302. st_caption.y = ii_cy
  303. uo_triangle.x = ii_tx
  304. uo_triangle.y = ii_ty
  305. END CHOOSE
  306. end subroutine
  307. public subroutine of_getparentwindow ();powerobject lpo_tmp
  308. userobject luo_tmp
  309. lpo_tmp = this.getparent()
  310. DO While lpo_tmp.typeof() <> Window!
  311. luo_tmp = lpo_tmp
  312. lpo_tmp= luo_tmp.getparent()
  313. LOOP
  314. iw_parent = lpo_tmp
  315. end subroutine
  316. public subroutine of_setposition ();CHOOSE CASE TextAlign
  317. CASE 'None'
  318. st_caption.visible = false
  319. plb_1.y = (this.height - plb_1.height)/2 + 5
  320. IF this.uo_triangle.visible = true THEN
  321. plb_1.x = (this.width - plb_1.width - uo_triangle.width)/2
  322. uo_triangle.x = plb_1.x + plb_1.width + 15
  323. uo_triangle.y = plb_1.y + plb_1.height/2 - 10
  324. ELSE
  325. plb_1.x = (this.width - plb_1.width)/2 + 5
  326. END IF
  327. CASE 'Bottom'
  328. st_caption.visible = true
  329. plb_1.x = (this.width - plb_1.width)/2
  330. plb_1.y = (this.height - plb_1.height - st_caption.height)/2
  331. IF this.uo_triangle.visible = true THEN
  332. uo_triangle.x = plb_1.x + plb_1.width + 15
  333. uo_triangle.y = plb_1.y + plb_1.height - 20
  334. END IF
  335. st_caption.x = (this.width - st_caption.width)/2
  336. st_caption.y = plb_1.y + plb_1.height + 10
  337. CASE 'Right'
  338. st_caption.visible = true
  339. IF this.uo_triangle.visible = true THEN
  340. plb_1.x = (this.width - plb_1.width)/2 - (st_caption.width/2) - 30
  341. ELSE
  342. plb_1.x = (this.width - plb_1.width)/2 - (st_caption.width/2) - 20
  343. END IF
  344. plb_1.y = (this.height - plb_1.height)/2 + 5
  345. st_caption.x = plb_1.x + plb_1.width + 10
  346. st_caption.y = (this.height - st_caption.height ) / 2
  347. IF this.uo_triangle.visible = true THEN
  348. uo_triangle.x = st_caption.x + st_caption.width + 5
  349. uo_triangle.y = plb_1.y + plb_1.height/3
  350. END IF
  351. END CHOOSE
  352. ii_px = plb_1.x
  353. ii_py = plb_1.y
  354. ii_cx = st_caption.x
  355. ii_cy = st_caption.y
  356. ii_tx = uo_triangle.x
  357. ii_ty = uo_triangle.y
  358. ii_poffsetx = ii_px + 5
  359. ii_poffsety = ii_py + 5
  360. ii_coffsetx = ii_cx + 5
  361. ii_coffsety = ii_cy + 5
  362. ii_toffsetx = ii_tx + 5
  363. ii_toffsety = ii_ty + 5
  364. ln_top.beginy = 2
  365. ln_top.endy = 2
  366. ln_top.beginx = 3
  367. ln_top.endx = this.width - 3
  368. ln_bottom.beginx = ln_top.beginx
  369. ln_bottom.endx = this.width - 3
  370. ln_bottom.beginy = this.height - 4
  371. ln_bottom.endy = this.height - 4
  372. ln_left.beginx = ln_top.beginx
  373. ln_left.endx = ln_top.beginx
  374. ln_left.beginy = ln_top.beginy
  375. ln_left.endy = this.height - 4
  376. ln_right.beginy = ln_left.beginy
  377. ln_right.endy = this.height
  378. ln_right.beginx = this.width - 4
  379. ln_right.endx = this.width - 4
  380. end subroutine
  381. public subroutine of_enabled (boolean ab_enabled);//**************************************************************************
  382. // Function: of_enabled *
  383. // Description: set button enabled *
  384. //-------------------------------------------------------------------------*
  385. // Arguments: <type> <name> <desc> *
  386. // boolean ab_enabled true/false *
  387. // *
  388. // Return: (none) *
  389. //-------------------------------------------------------------------------*
  390. // Example: of_enabled(true) *
  391. //-------------------------------------------------------------------------*
  392. // Author(s): Date remark *
  393. // rain Develop *
  394. // DuSDong 200.04.04 修改enabled前先判断是否修改修改 *
  395. //**************************************************************************
  396. if this.enabled = ab_enabled then return //DuSDong 加入
  397. this.enabled = ab_enabled
  398. IF this.enabled THEN
  399. st_caption.textcolor = 0
  400. this.uo_triangle.of_setenabled(true)
  401. setredraw(true)
  402. ELSE
  403. st_caption.textcolor = rgb(128,128,128)
  404. this.uo_triangle.of_setenabled(false)
  405. of_drawdisabled()
  406. END IF
  407. end subroutine
  408. public subroutine of_drawdisabled ();//====================================================================
  409. // Function - of_drawtext for uo_toolbutton
  410. //--------------------------------------------------------------------
  411. // Description: draw normal(enabled) or gray(disabled) text
  412. // on the st_caption control by judging the
  413. // toolbutton is enabled or disabled.
  414. //--------------------------------------------------------------------
  415. // Arguments:
  416. //
  417. // string as_text menu text
  418. //
  419. // boolean ab_enabled button status
  420. //
  421. //--------------------------------------------------------------------
  422. // Returns: (None)
  423. //--------------------------------------------------------------------
  424. // Author: Brave_QQ Date: December, 23, 2002
  425. //====================================================================
  426. ulong ll_hdc
  427. long ll_newfont
  428. long ll_oldfont
  429. rect lstr_text
  430. ll_hdc = GetDC( handle( st_caption ) )
  431. lstr_text.left = 0
  432. lstr_text.top = 0
  433. lstr_text.right = UnitsToPixels( st_caption.width, XUnitsToPixels! )
  434. lstr_text.bottom = UnitsToPixels( st_caption.height, YUnitsToPixels! )
  435. ll_NewFont = Send(Handle(st_caption),49,0,0)
  436. ll_OldFont = SelectObject(ll_hdc , ll_NewFont)
  437. rect lstr_text1
  438. lstr_text1.left = lstr_text.left + 1
  439. lstr_text1.top = lstr_text.top + 1
  440. lstr_text1.right = lstr_text.right + 1
  441. lstr_text1.bottom = lstr_text.bottom + 1
  442. SetBKMode( ll_hdc , TRANSPARENT )
  443. setBKcolor( ll_hdc , st_caption.backcolor )
  444. SetTextColor( ll_hdc , GetSysColor( COLOR_BTNHIGHLIGHT ))
  445. DrawText( ll_hdc , ButtonText , len(ButtonText) , lstr_text1 , DT_CENTER )
  446. SetTextColor( ll_hdc,GetSysColor( COLOR_BTNSHADOW ) )
  447. DrawText( ll_hdc , ButtonText , len(ButtonText) , lstr_text , DT_CENTER )
  448. DeleteObject( ll_oldfont )
  449. ulong Pdc,il_mask,ll_inst,il_bmp
  450. Pdc = GetWindowDC(Handle(plb_1))
  451. SetNull( ll_inst )
  452. plb_1.BackColor = rgb(255,255,255)
  453. ulong hdc, ll_rs = 0, hwnd, ll_memdc, ll_old,lw,lh,ll_bmp
  454. lw = 0
  455. lh = 0
  456. hwnd = handle( plb_1 )
  457. lw = plb_1.picturewidth
  458. lh = plb_1.pictureheight
  459. hdc = GetDC( hwnd )
  460. ll_rs = CreateCompatibleBitmap( hdc, lw, lh )
  461. ll_memdc = CreateCompatibleDC( hdc )
  462. ReleaseDC( hwnd, hdc )
  463. ll_old = SelectObject( ll_memdc, ll_rs )
  464. Send( hwnd, WM_PAINT, ll_memdc, 0 )
  465. ll_bmp = SelectObject( ll_memdc, ll_old )
  466. DeleteObject(ll_old)
  467. Deletedc(ll_memdc)
  468. ReleaseDc(hwnd,hdc)
  469. il_mask = ll_bmp
  470. if il_mask = 0 then return
  471. il_bmp = SelectObject(Pdc,il_mask)
  472. plb_1.BackColor = this.backcolor
  473. DrawState( Pdc, 0, 0, il_mask, 0, 0, 0, 0, 0, DST_BITMAP + DSS_DISABLED)
  474. ReleaseDC(Handle(plb_1),Pdc)
  475. DeleteObject(il_bmp)
  476. DeleteObject(il_mask)
  477. end subroutine
  478. public subroutine of_setgroup (integer ai_groupid);RadioGroup= ai_groupid
  479. end subroutine
  480. public subroutine of_setmenu (menu am_menu);im_menuid = am_menu
  481. end subroutine
  482. public subroutine of_setparent (readonly uo_toolbar auo_parent);iuo_parent = auo_parent
  483. end subroutine
  484. public function menu of_getmenu ();return im_menuid
  485. end function
  486. public subroutine of_childmenu (boolean ab_enabled);ChildMenu = ab_enabled
  487. IF ab_enabled THEN
  488. this.uo_triangle.visible = true
  489. END IF
  490. end subroutine
  491. public subroutine of_enabledmenu (boolean ab_enabled);IF ab_enabled THEN
  492. im_menuid.enabled = true
  493. ELSE
  494. im_menuid.enabled = false
  495. END IF
  496. end subroutine
  497. public subroutine of_setbkcolor (long al_color);this.backcolor = al_color
  498. plb_1.backcolor = al_color
  499. st_caption.backcolor = al_color
  500. uo_triangle.backcolor = al_color
  501. end subroutine
  502. public subroutine of_setsize ();st_caption.height = 52
  503. st_caption.width = len(ButtonText) * ii_charwidth
  504. plb_1.width = PixelsToUnits(Picture_Size,XPixelstoUnits!)
  505. plb_1.height = PixelsToUnits(Picture_Size,YPixelstoUnits!)
  506. plb_1.pictureheight = Picture_Size
  507. plb_1.picturewidth = Picture_Size
  508. CHOOSE CASE TextAlign
  509. CASE 'Bottom'
  510. this.height = st_caption.height + plb_1.height + 50
  511. IF st_caption.width >= plb_1.width THEN
  512. this.width = st_caption.width + 30
  513. ELSE
  514. this.width = plb_1.width + 30
  515. END IF
  516. CASE 'Right'
  517. IF this.uo_triangle.visible = true THEN
  518. this.width = st_caption.width + plb_1.width + uo_triangle.width + 10
  519. ELSE
  520. this.width = st_caption.width + plb_1.width + 10
  521. END IF
  522. IF st_caption.height >= plb_1.height THEN
  523. this.height = st_caption.height + 30
  524. ELSE
  525. this.height = plb_1.height + 30
  526. END IF
  527. CASE 'None'
  528. IF this.uo_triangle.visible = true THEN
  529. this.width = plb_1.width + uo_triangle.width + 70
  530. ELSE
  531. this.width = plb_1.width + 40
  532. END IF
  533. this.height = plb_1.height + 40
  534. RETURN
  535. END CHOOSE
  536. IF this.width < ii_minwidth THEN this.width = ii_minwidth
  537. IF this.height < ii_minheight THEN this.height = ii_minheight
  538. end subroutine
  539. on uo_toolbar_button.create
  540. this.uo_triangle=create uo_triangle
  541. this.plb_1=create plb_1
  542. this.ln_bottom=create ln_bottom
  543. this.ln_top=create ln_top
  544. this.ln_left=create ln_left
  545. this.ln_right=create ln_right
  546. this.st_caption=create st_caption
  547. this.Control[]={this.uo_triangle,&
  548. this.plb_1,&
  549. this.ln_bottom,&
  550. this.ln_top,&
  551. this.ln_left,&
  552. this.ln_right,&
  553. this.st_caption}
  554. end on
  555. on uo_toolbar_button.destroy
  556. destroy(this.uo_triangle)
  557. destroy(this.plb_1)
  558. destroy(this.ln_bottom)
  559. destroy(this.ln_top)
  560. destroy(this.ln_left)
  561. destroy(this.ln_right)
  562. destroy(this.st_caption)
  563. end on
  564. event constructor;IF ButtonText = '' THEN
  565. of_Buttontext(this.tag)
  566. ELSE
  567. of_Buttontext(ButtonText)
  568. END IF
  569. IF NOT ChildMenu THEN
  570. uo_triangle.visible = false
  571. END IF
  572. of_setsize()
  573. of_SetPosition()
  574. of_settooltip(Tooltip)
  575. of_setpicture(Picture_name)
  576. of_drawbutton('Flat')
  577. of_getparentwindow()
  578. of_enabled(this.enabled)
  579. end event
  580. type uo_triangle from uo_angle within uo_toolbar_button
  581. integer x = 215
  582. integer y = 72
  583. integer taborder = 20
  584. end type
  585. on uo_triangle.destroy
  586. call uo_angle::destroy
  587. end on
  588. type plb_1 from picturelistbox within uo_toolbar_button
  589. integer x = 119
  590. integer y = 32
  591. integer width = 73
  592. integer height = 64
  593. integer taborder = 10
  594. integer textsize = -9
  595. integer weight = 400
  596. fontcharset fontcharset = ansi!
  597. fontpitch fontpitch = variable!
  598. fontfamily fontfamily = swiss!
  599. string facename = "Tahoma"
  600. long textcolor = 33554432
  601. long backcolor = 12632256
  602. boolean enabled = false
  603. boolean border = false
  604. boolean vscrollbar = true
  605. string picturename[] = {"Structure5!"}
  606. long picturemaskcolor = 12632256
  607. end type
  608. type ln_bottom from line within uo_toolbar_button
  609. long linecolor = 8421504
  610. integer linethickness = 4
  611. integer beginx = 9
  612. integer beginy = 200
  613. integer endx = 315
  614. integer endy = 200
  615. end type
  616. type ln_top from line within uo_toolbar_button
  617. long linecolor = 16777215
  618. integer linethickness = 4
  619. integer beginx = 5
  620. integer endx = 306
  621. end type
  622. type ln_left from line within uo_toolbar_button
  623. long linecolor = 16777215
  624. integer linethickness = 4
  625. integer endy = 200
  626. end type
  627. type ln_right from line within uo_toolbar_button
  628. long linecolor = 8421504
  629. integer linethickness = 4
  630. integer beginx = 306
  631. integer beginy = 4
  632. integer endx = 306
  633. integer endy = 200
  634. end type
  635. type st_caption from statictext within uo_toolbar_button
  636. event ue_paint pbm_paint
  637. integer x = 14
  638. integer y = 112
  639. integer width = 279
  640. integer height = 52
  641. integer textsize = -9
  642. integer weight = 400
  643. fontcharset fontcharset = gb2312charset!
  644. fontpitch fontpitch = variable!
  645. string facename = "宋体"
  646. long backcolor = 12632256
  647. boolean enabled = false
  648. boolean focusrectangle = false
  649. end type