// **************************************************************************** // // ** ** // // ** Class : cRebarBand ** // // ** ** // // ** Purpose : Wrapper class for rebar common control ** // // ** ** // // ** Author : Ulbe Stellema ** // // ** Data Access Worldwide ** // // ** ** // // ** Date : March 1, 2000 ** // // ** ** // // **************************************************************************** // Use cRebar.pkg Class cRebarBand Is A Message // Procedure : Construct_Object // Purpose : Object constructor Procedure Construct_Object Forward Send Construct_Object Property Integer Private.pfStyle 0 // style properties Property Integer Private.piBandLength 0 // length of band (in pixels) Property Integer Private.piHeaderLength 0 // length of band header (in pixels) Property Integer Private.piIdealLength 0 // ideal length of band (in pixels) Property Integer Private.piTextColor 0 // foreground (text) color Property Integer Private.piBackColor 0 // background color Property Integer Private.piImage -1 // zero-based index into imagelist Property String Private.psLabel "" Property String Private.psBitmap "" Property Boolean Private.pbAdded False End_Procedure // Construct_Object // Procedure : End_Construct_Object // Purpose : End object constructor Procedure End_Construct_Object Handle hoObject Forward Send End_Construct_Object // Register item in collection (parent should be a cRebar) Move Self To hoObject Delegate Send Private.RegisterBand hoObject //Send Private.InsertBand -1 End_Procedure // End_Construct_Object // Function : Private.IdToIndex // Purpose : Converts a band identifier to a band index in a rebar control. Function Private.IdToIndex Integer iId Returns Integer Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow) Function_Return (SendMessage(hWindow,RB_IDTOINDEX,iId,0)) End_Function // Private.IdToIndex // Procedure : Private.Resize // Purpose : Handles child resize Procedure Private.Resize Integer iResult iSize iObject iTop iBottom iPosition iRows iWidth iHeight iLeft iRight iY iX iGap String sRebarBandInfo sRect sSize Handle hWindow hChild // Calculate rect Move (GetSystemMetrics(SM_CXSIZE)) To iWidth Move (GetSystemMetrics(SM_CYSIZE)) To iHeight // Calculate width and height of buttons Move (iWidth - 2) To iWidth Move (iHeight - 4) To iHeight // DC for toolbar is 9 pixels wider Move (iRight-9) To iRight ZeroType tRECT To sRect Put (iTop + 2) To sRect at tRECT.top Put (iTop + 2 + iHeight) To sRect at tRECT.bottom Put (iRight - (iWidth*3+2)) To sRect at tRECT.left Put (iRight - (iWidth*2+2)) To sRect at tRECT.right Move (iWidth*3+2) To iGap // (12 = 2 for gap between buttons 9 for gripper and border and 1 for fun) // Find a child window // This looks wrong but is correct. RebarBand objects only support one single // child object. The Broadcast get command gets the object-id of the child object. Broadcast Get Object_Id To iObject // Get index of band Get Private.IdToIndex Self To iPosition ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo at REBARBANDINFO.cbSize Put (RBBIM_CHILDSIZE iOr RBBIM_IDEALSIZE iOr RBBIM_SIZE) To sRebarBandInfo at REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iPosition,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo at REBARBANDINFO.cyChild To iY GetBuff From sRebarBandInfo at REBARBANDINFO.cx To iX If iObject Get Window_Handle Of iObject To hChild // Calculate width of the toolbar ZeroType tRECT To sRect Move (GetClientRect(Window_Handle(Self),AddressOf(sRect))) To iResult GetBuff From sRect at tRECT.right To iRight GetBuff From sRect at tRECT.left To iLeft // Calculate height of the toolbar Move (SendMessage(hChild,TB_GETBUTTONSIZE,0,0)) To iHeight // ShowLn "ButtonSize = " (Hi(iHeight)) Move (SendMessage(hChild,TB_GETROWS,0,0)) To iRows // ShowLn "Rows = " iRows Move (iRows+1*Hi(iHeight)) To iHeight // ShowLn "Height = " iHeight //ShowLn "iX = " iX "iY = " iY ", iX = " (iRight-iLeft-iGap) " iY = " iHeight If (iHeight = iY And (iRight-iLeft-iGap) = iX) Procedure_Return //Set GUISize Of iObject To (Hi(GUISize(iObject))) (iRight-iLeft-iGap) Set GUISize Of iObject To iHeight (iRight-iLeft-9) If hChild Get GUISize Of iObject To iSize // Get the window handle of the rebar Delegate Get Window_Handle To hWindow // Set new size Put (Low(iSize)) To sRebarBandInfo At REBARBANDINFO.cxMinChild Put (Hi(iSize)) To sRebarBandInfo At REBARBANDINFO.cyMinChild Put (Hi(iSize)) To sRebarBandInfo At REBARBANDINFO.cyChild Put (Hi(iSize)) To sRebarBandInfo At REBARBANDINFO.cyMaxChild Put 1 To sRebarBandInfo At REBARBANDINFO.cyIntegral // Set new bandlength Put (Low(iSize)) To sRebarBandInfo At REBARBANDINFO.cxIdeal Put (Low(iSize)) To sRebarBandInfo At REBARBANDINFO.cx Move (SendMessage(hWindow,RB_SETBANDINFO,iPosition,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Private.Resize // Procedure : Private.InsertBand // Purpose : This (private) method inserts a band Procedure Private.InsertBand Integer iPosition Integer iResult iMask iSize iObject iTop iBottom String sRebarBandInfo sLabel sBitmap sRect Handle hWindow hChild hBitmap // Avoid bands added multiple times Set Private.pbAdded To True // Find a child window // This looks wrong but is correct. RebarBand objects only support one single // child object. The Broadcast get command gets the object-id of the child object. Broadcast Get Object_Id To iObject Send Page To iObject True If iObject Get Window_Handle Of iObject To hChild If hChild Get GUISize Of iObject To iSize // Determine actual size of child ZeroType tRECT To sRect Move (GetWindowRect(hChild,AddressOf(sRect))) To iResult GetBuff From sRect At tRect.top To iTop GetBuff From sRect At tRect.bottom To iBottom // Get the window handle of the rebar Delegate Get Window_Handle To hWindow // Handle label If (Private.psLabel(Self) <> "") Move (Private.psLabel(Self)) To sLabel // Handle bitmap If (Private.psBitmap(Self) <> "") Begin Move (Private.psBitmap(Self)) To sBitmap Move (LoadImage(0,sBitmap,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)) To hBitmap End // If (Private.psBitmap(Self) <> "") Begin // Set the fMask member // REBARBANDINFO.wID is set to the dataflex object-id of this band. Move (RBBIM_LPARAM Ior RBBIM_ID) To iMask If (Private.pfStyle(Self)) Move (iMask Ior RBBIM_STYLE) To iMask If (Private.piTextColor(Self)) Move (iMask Ior RBBIM_COLORS) To iMask If (Private.piBackColor(Self)) Move (iMask Ior RBBIM_COLORS) To iMask If (hChild) Move (iMask Ior RBBIM_CHILD) To iMask If (hChild) Move (iMask Ior RBBIM_CHILDSIZE) To iMask If (Private.psLabel(Self) <> "") Move (iMask Ior RBBIM_TEXT) To iMask If (Private.psBitmap(Self) <> "") Move (iMask Ior RBBIM_BACKGROUND) To iMask If (Private.piBandLength(Self)) Move (iMask Ior RBBIM_SIZE) To iMask If (Private.piIdealLength(Self)) Move (iMask Ior RBBIM_IDEALSIZE) To iMask If (Private.piImage(Self) <> -1) Move (iMask Ior RBBIM_IMAGE) To iMask If (Private.piHeaderLength(Self)) Move (iMask Ior RBBIM_HEADERSIZE) To iMask ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put iMask To sRebarBandInfo At REBARBANDINFO.fMask Put (Private.pfStyle(Self)) To sRebarBandInfo At REBARBANDINFO.fStyle Put (Private.piTextColor(Self)) To sRebarBandInfo At REBARBANDINFO.clrFore Put (Private.piBackColor(Self)) To sRebarBandInfo At REBARBANDINFO.clrBack Put (AddressOf(sLabel)) To sRebarBandInfo At REBARBANDINFO.lpText Put (Length(sLabel)) To sRebarBandInfo At REBARBANDINFO.cch Put (Private.piImage(Self)) To sRebarBandInfo At REBARBANDINFO.iImage Put hChild To sRebarBandInfo At REBARBANDINFO.hwndChild Put (Low(iSize)) To sRebarBandInfo At REBARBANDINFO.cxMinChild Put (iBottom-iTop) To sRebarBandInfo At REBARBANDINFO.cyMinChild Put (Private.piBandLength(Self)) To sRebarBandInfo At REBARBANDINFO.cx Put hBitmap To sRebarBandInfo At REBARBANDINFO.hbmBack Put (Self) To sRebarBandInfo At REBARBANDINFO.wID Put (Hi(iSize)) To sRebarBandInfo At REBARBANDINFO.cyChild Put (iBottom-iTop) To sRebarBandInfo At REBARBANDINFO.cyMaxChild Put 1 To sRebarBandInfo At REBARBANDINFO.cyIntegral Put (Private.piIdealLength(Self)) To sRebarBandInfo At REBARBANDINFO.cxIdeal Put (Self) To sRebarBandInfo At REBARBANDINFO.lParam Put (Private.piHeaderLength(Self)) To sRebarBandInfo At REBARBANDINFO.cxHeader Move (SendMessage(hWindow,RB_INSERTBAND,iPosition,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Private.InsertBand // Function : pfStyle // Purpose : Returns style for band (this is a private property) Function pfStyle Returns Integer Integer iResult iIndex iStyle String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.pfStyle(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.pfStyle(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_STYLE To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At RebarBandInfo.fStyle To iStyle Function_Return iStyle End_Function // pfStyle // Procedure : Set pfStyle // Purpose : Sets the style of the band (this is a private property) Procedure Set pfStyle Integer iStyle Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.pfStyle To iStyle Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_STYLE To sRebarBandInfo At REBARBANDINFO.fMask Put iStyle To sRebarBandInfo At REBARBANDINFO.fStyle Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set pfStyle // Function : piTextColor // Purpose : Returns foreground (text) color of band Function piTextColor Returns Integer Integer iResult iIndex iColor String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.piTextColor(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.piTextColor(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_COLORS To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At REBARBANDINFO.clrFore To iColor Function_Return iColor End_Function // piTextColor // Procedure : Set piTextColor // Purpose : Sets foreground (text) color of band Procedure Set piTextColor Integer iColor Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.piTextColor To iColor Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_COLORS To sRebarBandInfo At REBARBANDINFO.fMask Put iColor To sRebarBandInfo At REBARBANDINFO.clrFore Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set piTextColor // Function : piBackColor // Purpose : Returns background color of band Function piBackColor Returns Integer Integer iResult iIndex iColor String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.piBackColor(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.piBackColor(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_COLORS To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At REBARBANDINFO.clrBack To iColor Function_Return iColor End_Function // piBackColor // Procedure : Set piBackColor // Purpose : Sets background color of band Procedure Set piBackColor Integer iColor Integer iResult iIndex Pointer pRebarBandInfo String sRebarBandInfo Handle hWindow // Set private property Set Private.piBackColor To iColor Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_COLORS To sRebarBandInfo At REBARBANDINFO.fMask Put iColor To sRebarBandInfo At REBARBANDINFO.clrBack Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set piBackColor // Function : piBandLength // Purpose : Returns length of band Function piBandLength Returns Integer Integer iResult iIndex iLength String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.piBandLength(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.piBandLength(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_SIZE To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At RebarBandInfo.cx To iLength Function_Return iLength End_Function // piBandLength // Procedure : Set piBandLength // Purpose : Sets length of band Procedure Set piBandLength Integer iLength Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.piBandLength To iLength Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_SIZE To sRebarBandInfo At REBARBANDINFO.fMask Put iLength To sRebarBandInfo At REBARBANDINFO.cx Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set piBandLength // Function : piIdealLength // Purpose : Returns ideal length of the band Function piIdealLength Returns Integer Integer iResult iIndex iLength String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.piIdealLength(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.piIdealLength(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_IDEALSIZE To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At REBARBANDINFO.cxIdeal To iLength Function_Return iLength End_Function // piIdealLength // Procedure : Set piIdealLength // Purpose : Sets ideal length of the band Procedure Set piIdealLength Integer iLength Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.piIdealLength To iLength Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_IDEALSIZE To sRebarBandInfo At REBARBANDINFO.fMask Put iLength To sRebarBandInfo At REBARBANDINFO.cxIdeal Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set piIdealLength // Function : piImage // Purpose : Returns zero-based index of imagelist for band Function piImage Returns Integer Integer iResult iIndex iImage String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.piImage(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.piImage(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_IMAGE To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At REBARBANDINFO.iImage To iImage Function_Return iImage End_Function // piImage // Procedure : Set piImage // Purpose : Sets zero-based index of imagelist for band Procedure Set piImage Integer iImage Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.piImage To iImage Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_IMAGE To sRebarBandInfo At REBARBANDINFO.fMask Put iImage To sRebarBandInfo At REBARBANDINFO.iImage Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set piImage // Function : piHeaderLength // Purpose : Returns headerlength of band Function piHeaderLength Returns Integer Integer iResult iIndex iLength String sRebarBandInfo Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.piHeaderLength(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.piHeaderLength(Self)) ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_HEADERSIZE To sRebarBandInfo At REBARBANDINFO.fMask Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult GetBuff From sRebarBandInfo At REBARBANDINFO.cxHeader To iLength Function_Return iLength End_Function // piHeaderLength // Procedure : Set piHeaderLength // Purpose : Sets header length of band Procedure Set piHeaderLength Integer iLength Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.piHeaderLength To iLength Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex=-1) Procedure_Return ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_HEADERSIZE To sRebarBandInfo At REBARBANDINFO.fMask Put iLength To sRebarBandInfo At REBARBANDINFO.cxHeader Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // piHeaderLength // Function : psLabel // Purpose : Returns the band label Function psLabel Returns String Integer iResult iIndex String sRebarBandInfo sLabel Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow = 0) Function_Return (Private.psLabel(Self)) Get Private.IdToIndex Self To iIndex If (iIndex = -1) Function_Return (Private.psLabel(Self)) Move (Repeat(Character(0),256)) To sLabel ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_TEXT To sRebarBandInfo At REBARBANDINFO.fMask Put (AddressOf(sLabel)) To sRebarBandInfo At REBARBANDINFO.lpText Put (Length(sLabel)) To sRebarBandInfo At REBARBANDINFO.cch Move (SendMessage(hWindow,RB_GETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult Function_Return sLabel End_Function // psLabel // Procedure : Set psLabel // Purpose : Sets label of band Procedure Set psLabel String sLabel Integer iResult iIndex String sRebarBandInfo Handle hWindow // Set private property Set Private.psLabel To sLabel Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return Delegate Get Window_Handle To hWindow ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_TEXT To sRebarBandInfo At REBARBANDINFO.fMask Put (AddressOf(sLabel)) To sRebarBandInfo At REBARBANDINFO.lpText Put (Length(sLabel)) To sRebarBandInfo At REBARBANDINFO.cch Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set psLabel // Function : psBitmap // Purpose : Returns bitmap for band Function psBitmap Returns String Function_Return (Private.psBitmap(Self)) End_Function // psBitmap // Procedure : Set psBitmap // Purpose : Sets the bands bitmap Procedure Set psBitmap String sBitmap Integer iResult iIndex String sRebarBandInfo Handle hWindow hBitmap // Set private property Set Private.psBitmap To sBitmap Delegate Get Window_Handle To hWindow If (hWindow = 0) Procedure_Return Get Private.IdToIndex Self To iIndex If (iIndex = -1) Procedure_Return // Handle bitmap Move (LoadImage(0,AddressOf(sBitmap),IMAGE_BITMAP,0,0,LR_LOADFROMFILE)) To hBitmap ZeroType REBARBANDINFO To sRebarBandInfo Put REBARBANDINFO_Size To sRebarBandInfo At REBARBANDINFO.cbSize Put RBBIM_BACKGROUND To sRebarBandInfo At REBARBANDINFO.fMask Put hBitmap To sRebarBandInfo At REBARBANDINFO.hbmBack Move (SendMessage(hWindow,RB_SETBANDINFO,iIndex,AddressOf(sRebarBandInfo))) To iResult End_Procedure // Set psBitmap // Procedure : Set pbBreak // Purpose : Property interface for RBBS_BREAK style Procedure Set pbBreak Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_BREAK,iStyle - (iStyle Iand RBBS_BREAK))) End_Procedure // Set pbBreak // Function : pbBreak // Purpose : Property interface for RBBS_BREAK style Function pbBreak Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_BREAK) End_Function // pbBreak // Procedure : Set pbChildEdge // Purpose : Property interface for RBBS_CHILDEDGE style Procedure Set pbChildEdge Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_CHILDEDGE,iStyle - (iStyle Iand RBBS_CHILDEDGE))) End_Procedure // Set pbChildEdge // Function : pbChildEdge // Purpose : Property interface for RBBS_CHILDEDGE style Function pbChildEdge Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_CHILDEDGE) End_Function // pbChildEdge // Procedure : Set pbFixedBmp // Purpose : Property interface for RBBS_FIXEDBMP style Procedure Set pbFixedBmp Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_FIXEDBMP,iStyle - (iStyle Iand RBBS_FIXEDBMP))) End_Procedure // Set pbFixedBmp // Function : pbFixedBmp // Purpose : Property interface for RBBS_FIXEDBMP style Function pbFixedBmp Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_FIXEDBMP) End_Function // pbFixedBmp // Procedure : Set pbFixedSize // Purpose : Property interface for RBBS_FIXEDSIZE style Procedure Set pbFixedSize Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_FIXEDSIZE,iStyle - (iStyle Iand RBBS_FIXEDSIZE))) End_Procedure // Set pbFixedSize // Function : pbFixedSize // Purpose : Property interface for RBBS_FIXEDSIZE style Function pbFixedSize Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_FIXEDSIZE) End_Function // pbFixedSize // Procedure : Set pbGripperAlways // Purpose : Property interface for RBBS_GRIPPERALWAYS style Procedure Set pbGripperAlways Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_GRIPPERALWAYS,iStyle - (iStyle Iand RBBS_GRIPPERALWAYS))) End_Procedure // Set pbGripperAlways // Function : pbGripperAlways // Purpose : Property interface for RBBS_GRIPPERALWAYS style Function pbGripperAlways Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_GRIPPERALWAYS) End_Function // pbGripperAlways // Procedure : Set pbHidden // Purpose : Property interface for RBBS_HIDDEN style Procedure Set pbHidden Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_HIDDEN,iStyle - (iStyle Iand RBBS_HIDDEN))) End_Procedure // Set pbHidden // Function : pbHidden // Purpose : Property interface for RBBS_HIDDEN style Function pbHidden Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_HIDDEN) End_Function // pbHidden // Procedure : Set pbNoGripper // Purpose : Property interface for RBBS_NOGRIPPER style Procedure Set pbNoGripper Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_NOGRIPPER,iStyle - (iStyle Iand RBBS_NOGRIPPER))) End_Procedure // Set pbNoGripper // Function : Set pbNoGripper // Purpose : Property interface for RBBS_NOGRIPPER style Function pbNoGripper Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_NOGRIPPER) End_Function // pbNoGripper // Procedure : Set pbUseChevron // Purpose : Property interface for RBBS_USECHEVRON style Procedure Set pbUseChevron Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_USECHEVRON,iStyle - (iStyle Iand RBBS_USECHEVRON))) End_Procedure // Set pbUseChevron // Function : pbUseChevron // Purpose : Property interface for RBBS_USECHEVRON style Function pbUseChevron Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_USECHEVRON) End_Function // pbUseChevron // Procedure : Set pbVariableHeight // Purpose : Property interface for RBBS_VARIABLEHEIGHT style Procedure Set pbVariableHeight Boolean iState Integer iStyle Move (pfStyle(Self)) To iStyle Set pfStyle To (If(iState,iStyle Ior RBBS_VARIABLEHEIGHT,iStyle - (iStyle Iand RBBS_VARIABLEHEIGHT))) End_Procedure // Set pbVariableHeight // Function : pbVariableHeight // Purpose : Property interface for RBBS_VARIABLEHEIGHT style Function pbVariableHeight Returns Boolean Function_Return (pfStyle(Self) Iand RBBS_VARIABLEHEIGHT) End_Function // pbVariableHeight // **** Events **** // Procedure : OnBeginDrag // Purpose : Notification message Procedure OnBeginDrag End_Procedure // OnBeginDrag // Procedure : OnEndDrag // Purpose : Notification message Procedure OnEndDrag End_Procedure // OnEndDrag // Procedure : OnChangeSize // Purpose : Notification message Procedure OnChangeSize End_Procedure // OnChangeSize // Procedure : OnChevronPushed // Purpose : Notification message Procedure OnChevronPushed End_Procedure // OnChevronPushed // **** Methods **** // Function : RowHeight // Purpose : Retrieves the height of a specified row in a rebar control. Function RowHeight Returns Integer Integer iIndex Handle hWindow Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Function_Return (SendMessage(hWindow,RB_GETROWHEIGHT,iIndex,0)) End_Function // RowHeight // Procedure : BeginDrag // Purpose : Puts the rebar control in drag-and-drop mode. Procedure BeginDrag Integer iResult iIndex Handle hWindow Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_BEGINDRAG,iIndex,-1)) To iResult End_Procedure // BeginDrag // Procedure : DragMove // Purpose : Updates the drag position in the rebar control after a previous BeginDrag message. Procedure DragMove Integer iResult Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_DRAGMOVE,0,-1)) To iResult End_Procedure // DragMove // Procedure : EndDrag // Purpose : Terminates the rebar control's drag-and-drop operation. Procedure EndDrag Integer iResult Handle hWindow Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_ENDDRAG,0,0)) To iResult End_Procedure // EndDrag // Procedure : DeleteBand // Purpose : Deletes a band from a rebar control. Procedure DeleteBand Integer iResult iIndex Handle hWindow Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_DELETEBAND,iIndex,0)) To iResult End_Procedure // DeleteBand // Procedure : PushChevron // Purpose : Sent to a rebar control to programmatically push a chevron. Procedure PushChevron Integer iValue Integer iResult iIndex Handle hWindow Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_PUSHCHEVRON,iIndex,iValue)) To iResult End_Procedure // PushChevron // Procedure : MoveBand // Purpose : Moves a band from one index to another. Procedure MoveBand Integer iTo Integer iResult iIndex iBands Handle hWindow Get BandCount To iBands If (iTo >= iBands) Procedure_Return Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_MOVEBAND,iIndex,iTo)) To iResult End_Procedure // MoveBand // Procedure : MaximizeBand // Purpose : Resizes a band in a rebar control to either its ideal or largest size. Procedure MaximizeBand Boolean bIdeal Integer iResult iIndex Handle hWindow Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_MAXIMIZEBAND,iIndex,bIdeal)) To iResult End_Procedure // MaximizeBand // Procedure : MinimizeBand // Purpose : Resizes a band in a rebar control to its smallest size. Procedure MinimizeBand Integer iResult iIndex Handle hWindow Get Private.IdToIndex Self To iIndex Delegate Get Window_Handle To hWindow If (hWindow) Move (SendMessage(hWindow,RB_MINIMIZEBAND,iIndex,0)) To iResult End_Procedure // MinimizeBand End_Class // cRebarBand