$PBExportHeader$u_dwtoolbar_group.sru forward global type u_dwtoolbar_group from u_base_container end type type st_divider from u_st within u_dwtoolbar_group end type type st_1 from statictext within u_dwtoolbar_group end type end forward global type u_dwtoolbar_group from u_base_container integer width = 1010 integer height = 196 boolean border = true long backcolor = 16777215 st_divider st_divider st_1 st_1 end type global u_dwtoolbar_group u_dwtoolbar_group type variables protected: boolean #ShowDivider = TRUE u_dwtoolbar idw_toolbars[] long il_parent[] w_float_toolbar iw_float[] end variables forward prototypes public subroutine of_addtoolbars (readonly u_dwtoolbar adw_toolbars[]) public subroutine of_updatetheme () public subroutine of_addtoolbar (readonly u_dwtoolbar adw_toolbar) public subroutine of_updatelayout () public subroutine of_toolbarshow (readonly integer ai_index, readonly boolean ab_show) public subroutine of_settheme (readonly integer ai_theme) public subroutine of_removetoolbar (readonly u_dwtoolbar adw_toolbar) public subroutine of_removelasttoolbar (readonly boolean ab_hide) public subroutine of_float (readonly u_dwtoolbar auo) end prototypes public subroutine of_addtoolbars (readonly u_dwtoolbar adw_toolbars[]);//=========================================================================== // Function: of_Addtoolbars (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // readonly u_dwtoolbar adw_toolbars[] //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== long ll_count, n n_svc_mgr lnv_svc n_svc_window lnv_w lnv_svc.of_LoadSvc(lnv_w, CSvc.WINDOW) idw_toolbars = adw_toolbars ll_count = UPPERBOUND(idw_toolbars) FOR n = 1 to ll_count il_parent[n] = Handle(lnv_w.of_getparentwindow(idw_toolbars[n], TRUE)) SetParent(Handle(idw_toolbars[n]), Handle(this)) NEXT of_UpdateLayout() end subroutine public subroutine of_updatetheme ();//=========================================================================== // Function: of_Updatetheme (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== n_svc_mgr lnv_svc n_svc_theme lnv_t str_theme lstr lnv_svc.of_LoadSvc(lnv_t, CSvc.THEME) lstr = lnv_t.of_gettheme() this.backcolor = lstr.toolbarbackground end subroutine public subroutine of_addtoolbar (readonly u_dwtoolbar adw_toolbar);//=========================================================================== // Function: of_Addtoolbar (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // readonly u_dwtoolbar adw_toolbar //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== long ll_index, n n_svc_mgr lnv_svc n_svc_window lnv_w boolean lb_found lnv_svc.of_LoadSvc(lnv_w, CSvc.WINDOW) ll_index = UPPERBOUND(idw_toolbars) FOR n = 1 to ll_index IF NOT ISVALID(idw_toolbars[n]) THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN n = ll_index + 1 idw_toolbars[n] = adw_toolbar il_parent[n] = Handle(lnv_w.of_getparentwindow(adw_toolbar, TRUE)) SetParent(Handle(adw_toolbar), Handle(this)) st_divider.BringToTop = TRUE end subroutine public subroutine of_updatelayout ();//=========================================================================== // Function: of_Updatelayout (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== long ll_count, n long llx, lly, llpy SetRedraw(FALSE) ll_count = UPPERBOUND(idw_toolbars) FOR n = 1 to ll_count IF NOT ISVALID(idw_toolbars[n]) THEN CONTINUE IF NOT idw_toolbars[n].Visible THEN CONTINUE IF idw_toolbars[n].#NewLine THEN idw_toolbars[n].Move(0, lly) llpy = lly lly += idw_toolbars[n].height llx = idw_toolbars[n].width ELSE idw_toolbars[n].Move(llx, llpy) llx += idw_toolbars[n].width END IF NEXT IF #ShowDivider THEN lly += PixelsToUnits(2, YPixelsToUnits!) st_divider.BringToTop = TRUE ELSE st_divider.Visible = FALSE END IF this.Resize(this.width, lly) //notify parent parent.TriggerEvent("resize") SetRedraw(TRUE) parent.DYNAMIC SetRedraw(TRUE) end subroutine public subroutine of_toolbarshow (readonly integer ai_index, readonly boolean ab_show);//=========================================================================== // Function: of_Toolbarshow (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // readonly Integer ai_index // readonly Boolean ab_show //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== TRY this.SetRedraw(FALSE) idw_toolbars[ai_index].Visible = ab_show of_Updatelayout() CATCH(RuntimeError ex) END TRY end subroutine public subroutine of_settheme (readonly integer ai_theme);//=========================================================================== // Function: of_Settheme (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // readonly Integer ai_theme //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== n_svc_mgr lnv_svc n_svc_theme lnv_t lnv_svc.of_LoadSvc(lnv_t, CSvc.THEME) lnv_t.of_Settheme(ai_theme) long ll_count ,n ll_count = UPPERBOUND(idw_toolbars) FOR n = 1 to ll_count idw_toolbars[n].of_suspenddraw() idw_toolbars[n].of_suspendresize() idw_toolbars[n].of_SetTheme(ai_theme) NEXT FOR n = 1 to ll_count idw_toolbars[n].of_resumeresize() idw_toolbars[n].of_resumedraw() NEXT of_UpdateTheme() end subroutine public subroutine of_removetoolbar (readonly u_dwtoolbar adw_toolbar);//=========================================================================== // Function: of_Removetoolbar (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // readonly u_dwtoolbar adw_toolbar //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== long ll_count, n u_dwtoolbar luo_empty ll_count = UPPERBOUND(idw_toolbars) FOR n = 1 to ll_count IF idw_toolbars[n] = adw_toolbar THEN //return to parent SetParent(Handle(adw_toolbar), il_parent[n]) idw_toolbars[n] = luo_empty SetNull(il_parent[n]) EXIT END IF NEXT end subroutine public subroutine of_removelasttoolbar (readonly boolean ab_hide);//=========================================================================== // Function: of_Removelasttoolbar (public ) // Object: u_dwtoolbar_group //--------------------------------------------------------------------------- // Description: // Note: //--------------------------------------------------------------------------- // Parameters: // readonly Boolean ab_hide //--------------------------------------------------------------------------- // Returns: (none) //--------------------------------------------------------------------------- // Author: (Yeyi) Gabriel B. Abulencia //=========================================================================== long ll_count ll_count = UPPERBOUND(idw_toolbars) IF ll_count > 1 THEN IF ISVALID(idw_toolbars[ll_count]) THEN & idw_toolbars[ll_count].Visible = NOT ab_hide of_removetoolbar(idw_toolbars[ll_count]) END IF end subroutine public subroutine of_float (readonly u_dwtoolbar auo);window lw lw = of_Getparentwindow(TRUE) OPEN(iw_float[1], lw) iw_float[1].Move(lw.X + lw.PointerX(), lw.Y + lw.PointerY()) iw_float[1].of_SetToolbar(this, auo) end subroutine on u_dwtoolbar_group.create int iCurrent call super::create this.st_divider=create st_divider this.st_1=create st_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_divider this.Control[iCurrent+2]=this.st_1 end on on u_dwtoolbar_group.destroy call super::destroy destroy(this.st_divider) destroy(this.st_1) end on event constructor;call super::constructor;this.Border = FALSE st_1.Visible = FALSE end event event ke_preopen;call super::ke_preopen;of_updatetheme() end event type st_divider from u_st within u_dwtoolbar_group integer x = 73 integer y = 160 integer height = 4 long backcolor = 12632256 string text = "" boolean #dock = true long #docktype = 4 end type type st_1 from statictext within u_dwtoolbar_group integer x = 91 integer y = 64 integer width = 805 integer height = 52 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 16777215 string text = "Datawindow Toolbar Group" alignment alignment = center! boolean focusrectangle = false end type
- Sources
- Kodigo
- OpenExplorer
- u_dwtoolbar_group.sru
File: u_dwtoolbar_group.sru
Size: 11496
Date: Mon, 07 Apr 2008 21:31:55 +0200
Size: 11496
Date: Mon, 07 Apr 2008 21:31:55 +0200
- u_base_container u_dwtoolbar_group(sru)
- of_addtoolbar (readonly u_dwtoolbar adw_toolbar)
- of_addtoolbars (readonly u_dwtoolbar adw_toolbars[])
- of_float (readonly u_dwtoolbar auo)
- of_removelasttoolbar (readonly boolean ab_hide)
- of_removetoolbar (readonly u_dwtoolbar adw_toolbar)
- of_settheme (readonly integer ai_theme)
- of_toolbarshow (readonly integer ai_index, readonly boolean ab_show)
- of_updatelayout ()
- of_updatetheme ()
- u_st st_divider
- statictext st_1