$PBExportHeader$n_svc_rebar.sru $PBExportComments$MS Rebar service forward global type n_svc_rebar from n_svc_base end type end forward global type n_svc_rebar from n_svc_base end type global n_svc_rebar n_svc_rebar type prototypes FUNCTION long CreateWindowEx( ulong dwExStyle, string lpClassName, string lpWindowName, ulong dwStyle, long xPos, long yPos, long nWidth, long nHeight, long hWndParent, long hMenu, long hInstance, long lpParam ) Library "user32" ALIAS FOR "CreateWindowExA;Ansi" FUNCTION boolean ShowWindow (ulong hWnd, int nCmdShow) Library "USER32.DLL" FUNCTION ulong MoveWindow(ulong hwnd,ulong x,ulong y,ulong nWidth,ulong nHeight,Boolean bRepaint) LIBRARY "user32.dll" FUNCTION boolean DestroyWindow( long hWnd ) Library "user32" FUNCTION long LocalAlloc(long Flags, long Bytes) library "kernel32" FUNCTION long LocalFree(long MemHandle) library "kernel32" FUNCTION long Lstrcpy(long Destination, string Source) library "kernel32.dll" ALIAS FOR "lstrcpyA;Ansi" FUNCTION long lstrcpy(long Destination, ref char Source[]) library "kernel32.dll" alias for "lstrcpy;Ansi" FUNCTION long SendBoolean( long hWnd, long uMsg, long wParam, Boolean lpst ) Library "user32" Alias For "SendMessageA" FUNCTION long SendMessageRECT( long hWnd, long uMsg, long wParam, Ref RECT lpst ) Library "user32" Alias For "SendMessageA;Ansi" FUNCTION long SendMessageBand( long hWnd, long uMsg, long wParam, Ref REBARBANDINFO lpst ) Library "user32" Alias For "SendMessageA;Ansi" FUNCTION boolean GetClientRect (ulong hWnd, ref RECT lpRect) Library "USER32.DLL" alias for "GetClientRect;Ansi" FUNCTION ulong GetWindowRect ( ulong hwnd, ref rect lprect) Library "USER32.DLL" alias for "GetWindowRect;Ansi" end prototypes type variables Protected: CONSTANT long WM_USER = 1024 CONSTANT long CCM_FIRST = 8192 CONSTANT long RBN_FIRST = -831 CONSTANT long CCM_SETCOLORSCHEME = (CCM_FIRST + 2) // lParam is color scheme CONSTANT long CCM_GETCOLORSCHEME = (CCM_FIRST + 3) // fills in COLORSCHEME pointed to by lParam CONSTANT long RBIM_IMAGELIST = 1 //0x00000001 CONSTANT long RBS_TOOLTIPS = 256 //0x0100 CONSTANT long RBS_VARHEIGHT = 512 //0x0200 CONSTANT long RBS_BANDBORDERS = 1024 //0x0400 CONSTANT long RBS_FIXEDORDER = //0x0800 CONSTANT long RBS_REGISTERDROP = //0x1000 CONSTANT long RBS_AUTOSIZE = //0x2000 CONSTANT long RBS_VERTICALGRIPPER = 16384 //0x4000 // this always has the vertical gripper (default for horizontal mode) CONSTANT long RBS_DBLCLKTOGGLE = 32768 //0x8000 CONSTANT long RBBS_BREAK = //0x00000001 // break to new line CONSTANT long RBBS_FIXEDSIZE = //0x00000002 // band can't be sized CONSTANT long RBBS_CHILDEDGE = //0x00000004 // edge around top & bottom of child window CONSTANT long RBBS_HIDDEN = //0x00000008 // don't show CONSTANT long RBBS_NOVERT = //0x00000010 // don't show when vertical CONSTANT long RBBS_FIXEDBMP = //0x00000020 // bitmap doesn't move during band resize CONSTANT long RBBS_VARIABLEHEIGHT = //0x00000040 // allow autosizing of this child vertically CONSTANT long RBBS_GRIPPERALWAYS = //0x00000080 // always show the gripper CONSTANT long RBBS_NOGRIPPER = //0x00000100 // never show the gripper CONSTANT long RBBS_USECHEVRON = 512 CONSTANT long RBBIM_STYLE = //0x00000001 CONSTANT long RBBIM_COLORS = //0x00000002 CONSTANT long RBBIM_TEXT = //0x00000004 CONSTANT long RBBIM_IMAGE = //0x00000008 CONSTANT long RBBIM_CHILD = //0x00000010 CONSTANT long RBBIM_CHILDSIZE = //0x00000020 CONSTANT long RBBIM_SIZE = //0x00000040 CONSTANT long RBBIM_BACKGROUND = //0x00000080 CONSTANT long RBBIM_ID = //0x00000100 CONSTANT long RBBIM_IDEALSIZE = //0x00000200 CONSTANT long RBBIM_LPARAM = //0x00000400 CONSTANT long RBBIM_HEADERSIZE = //0x00000800 // control the size of the header //CONSTANT long REBARBANDINFO = REBARBANDINFOA //CONSTANT long LPREBARBANDINFO = LPREBARBANDINFOA //CONSTANT long LPCREBARBANDINFO = LPCREBARBANDINFOA //CONSTANT long REBARBANDINFO_V3_SIZE REBARBANDINFOA_V3_SIZE CONSTANT long RB_INSERTBANDA = (WM_USER + 1) CONSTANT long RB_DELETEBAND = (WM_USER + 2) CONSTANT long RB_GETBARINFO = (WM_USER + 3) CONSTANT long RB_SETBARINFO = (WM_USER + 4) //CONSTANT long RB_GETBANDINFO = (WM_USER + 5) CONSTANT long RB_SETBANDINFOA = (WM_USER + 6) CONSTANT long RB_SETPARENT = (WM_USER + 7) CONSTANT long RB_HITTEST = (WM_USER + 8) CONSTANT long RB_GETRECT = (WM_USER + 9) CONSTANT long RB_INSERTBANDW = (WM_USER + 10) CONSTANT long RB_SETBANDINFOW = (WM_USER + 11) CONSTANT long RB_GETBANDCOUNT = (WM_USER + 12) CONSTANT long RB_GETROWCOUNT = (WM_USER + 13) CONSTANT long RB_GETROWHEIGHT = (WM_USER + 14) CONSTANT long RB_IDTOINDEX = (WM_USER + 16) // wParam == id CONSTANT long RB_GETTOOLTIPS = (WM_USER + 17) CONSTANT long RB_SETTOOLTIPS = (WM_USER + 18) CONSTANT long RB_SETBKCOLOR = (WM_USER + 19) // sets the default BK color CONSTANT long RB_GETBKCOLOR = (WM_USER + 20) // defaults to CLR_NONE CONSTANT long RB_SETTEXTCOLOR = (WM_USER + 21) CONSTANT long RB_GETTEXTCOLOR = (WM_USER + 22) // defaults to //0x00000000 CONSTANT long RB_SIZETORECT = (WM_USER + 23) // resize the rebar/break bands and such to this rect (lparam) CONSTANT long RB_SETCOLORSCHEME = CCM_SETCOLORSCHEME // lParam is color scheme CONSTANT long RB_GETCOLORSCHEME = CCM_GETCOLORSCHEME // fills in COLORSCHEME pointed to by lParam CONSTANT long RB_INSERTBAND = RB_INSERTBANDA CONSTANT long RB_SETBANDINFO = RB_SETBANDINFOA CONSTANT long RB_BEGINDRAG = (WM_USER + 24) CONSTANT long RB_ENDDRAG = (WM_USER + 25) CONSTANT long RB_DRAGMOVE = (WM_USER + 26) CONSTANT long RB_GETBARHEIGHT = (WM_USER + 27) CONSTANT long RB_GETBANDINFOW = (WM_USER + 28) CONSTANT long RB_GETBANDINFOA = (WM_USER + 29) CONSTANT long RB_GETBANDINFO = RB_GETBANDINFOA CONSTANT long RB_MINIMIZEBAND = (WM_USER + 30) CONSTANT long RB_MAXIMIZEBAND = (WM_USER + 31) //CONSTANT long RB_GETDROPTARGET= (CCM_GETDROPTARGET) CONSTANT long RB_GETBANDBORDERS = (WM_USER + 34) // returns in lparam = lprc the amount of edges added to band wparam CONSTANT long RB_SHOWBAND = (WM_USER + 35) // show/hide band CONSTANT long RB_SETPALETTE = (WM_USER + 37) CONSTANT long RB_GETPALETTE = (WM_USER + 38) CONSTANT long RB_MOVEBAND = (WM_USER + 39) //Notification Messages CONSTANT long RBN_HEIGHTCHANGE = (RBN_FIRST - 0) CONSTANT long RBN_GETOBJECT = (RBN_FIRST - 1) CONSTANT long RBN_LAYOUTCHANGED = (RBN_FIRST - 2) CONSTANT long RBN_AUTOSIZE = (RBN_FIRST - 3) CONSTANT long RBN_BEGINDRAG = (RBN_FIRST - 4) CONSTANT long RBN_ENDDRAG = (RBN_FIRST - 5) CONSTANT long RBN_DELETINGBAND = (RBN_FIRST - 6) // Uses NMREBAR CONSTANT long RBN_DELETEDBAND = (RBN_FIRST - 7) // Uses NMREBAR CONSTANT long RBN_CHILDSIZE = (RBN_FIRST - 8) CONSTANT long RBNM_ID = //0x00000001 CONSTANT long RBNM_STYLE = //0x00000002 CONSTANT long RBNM_LPARAM = //0x00000004 CONSTANT long RBHT_NOWHERE = //0x0001 CONSTANT long RBHT_CAPTION = //0x0002 CONSTANT long RBHT_CLIENT = //0x0003 CONSTANT long RBHT_GRABBER = //0x0004 Private: long il_tmp_pointer end variables forward prototypes public function long of_create (ref n_svc_mgr anv_svc, powerobject apo_parent, integer ai_width, integer ai_height) public function long of_setparent (readonly long al_rebarhwnd, readonly powerobject apo_parent) public subroutine of_insertband (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly long al_childhwnd, readonly string as_bandtext, readonly integer ai_minsize, readonly boolean ab_newline, readonly boolean ab_gripper) public subroutine of_notifyrebar (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly long lparam, readonly long wparam) public function long of_getrebarheight (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly boolean ab_converttounits) public subroutine of_setbandchild (ref n_svc_mgr anv_svc, readonly long al_hwnd, readonly integer ai_index, readonly long al_hwndchild) public subroutine of_setbandminimumsize (ref n_svc_mgr anv_svc, readonly long al_hwnd, readonly integer ai_index, readonly long al_width) public function long of_getbandwidth (readonly long al_rebarhwnd, readonly integer ai_index) public subroutine of_destroy (readonly long al_rebarhwnd) public subroutine of_maximizeband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_maximize) public subroutine of_minimizeband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_minimize) public subroutine of_resize (readonly long al_rebarhwnd, long al_width, readonly long al_height) public subroutine of_showband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_show) end prototypes public function long of_create (ref n_svc_mgr anv_svc, powerobject apo_parent, integer ai_width, integer ai_height);ulong ll_hwnd, ll_style unsignedlong ll_ex_style n_svc_bit lnv_bit TRY anv_svc.of_loadsvc(lnv_bit, CSvc.BIT) ll_style = lnv_bit.of_BitwiseOR({CWin32.WS_CHILD, & CWin32.WS_BORDER, & CWin32.WS_CLIPSIBLINGS, & CWin32.WS_CLIPCHILDREN, & CWin32.CCS_NOPARENTALIGN, & RBS_BANDBORDERS , & /*RBS_AUTOSIZE*/1, & RBS_VARHEIGHT, & CWin32.CCS_NOMOVEY}) ai_width = UnitsToPixels(ai_width, XUnitsToPixels!) ai_height = UnitsToPixels(ai_height, YUnitsToPixels!) ll_hwnd = CreateWindowEx( & 0, & CWin32.REBAR_CLASS, /* Registered Window ClassName */ & "", /* No Window Name */ & ll_style, /* Window Styles. */ & 0, 0, ai_width, ai_height, /* Window position */ & Handle(apo_parent), /* Parent window, can be a window or any other control */ & 200, /* Control ID */ & Handle(GetApplication()), /* Application Handle */ & 0) ShowWindow(ll_hwnd, 1) CATCH (runtimeerror err) MessageBox("n_svc_rebar", err.GetMessage(), StopSign!) END TRY RETURN ll_hwnd end function public function long of_setparent (readonly long al_rebarhwnd, readonly powerobject apo_parent);RETURN Send(al_rebarhwnd, RB_SETPARENT, Handle(apo_parent), 0) end function public subroutine of_insertband (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly long al_childhwnd, readonly string as_bandtext, readonly integer ai_minsize, readonly boolean ab_newline, readonly boolean ab_gripper);n_svc_bit lnv_bit n_svc_sizeof lnv_sizeof REBARBANDINFO rbBand RECT rc long ll_option, ll_option2 anv_svc.of_loadsvc(lnv_bit, CSvc.BIT) anv_svc.of_loadsvc(lnv_sizeof, CSvc.SIZEOF) IF ab_newline THEN ll_option = RBBS_BREAK GetClientRect(al_childhwnd, rc) IF as_bandtext <> CString.EMPTY THEN long ll_len IF il_tmp_pointer <> 0 THEN LocalFree(il_tmp_pointer) END IF ll_option2 = RBBIM_TEXT ll_len = LEN(as_bandtext) + 1 //add byte il_tmp_pointer = LocalAlloc(0, ll_len) rbBand.lpText = il_tmp_pointer //POST LocalFree(rbBand.lpText) lstrCpy(rbBand.lpText, as_bandtext) END IF IF ab_gripper THEN ll_option = lnv_bit.of_BitwiseOR({RBBS_GRIPPERALWAYS, ll_option}) ELSE ll_option = lnv_bit.of_BitwiseOR({RBBS_NOGRIPPER, ll_option}) END IF rbBand.cbSize = lnv_sizeof.SizeOf(rbband) rbBand.fMask = lnv_bit.of_BitwiseOR({ & RBBIM_STYLE, & RBBIM_CHILD , & RBBIM_CHILDSIZE , & RBBIM_SIZE, & ll_option2}) rbBand.fStyle = lnv_bit.of_BitwiseOR({ & RBBS_VARIABLEHEIGHT, & ll_option}) rbBand.hwndChild = al_childhwnd rbBand.cx = rc.right - rc.left rbBand.cyIntegral = 1 rbBand.cxideal = rc.right - rc.left //50 rbBand.cxMinChild = ai_minsize rbBand.cyMinChild = (rc.bottom - rc.top) //+ 3 //add 1 pixel rbBand.cyChild = rc.bottom - rc.top rbBand.cyMaxChild = rc.bottom - rc.top + 2 SendMessageBand(al_rebarhwnd, RB_INSERTBAND, -1, rbBand) end subroutine public subroutine of_notifyrebar (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly long lparam, readonly long wparam);//long ll //NMHDR lstr_ret //n_svc_win32 lnv_win32 // //IF wparam = 200 THEN // anv_svc.of_LoadSvc(lnv_win32, CSvc.WIN32) // // lnv_win32.GetNMHDR(lstr_ret, lparam, NMHDR_SIZE) // CHOOSE CASE lstr_ret.code // CASE /*lnv_rebar.RBN_LAYOUTCHANGED, */RBN_HEIGHTCHANGE // //ll = inv_rebar.of_getheight(RebarHandle, #Vertical) // parent.height = ll // // parent.GetParent().TriggerEvent("resize") //// CASE win32.NM_RELEASEDCAPTURE ////// MessageBox("", "Released") //// //// CASE lnv_Rebar.RBN_ENDDRAG // END CHOOSE //END IF end subroutine public function long of_getrebarheight (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly boolean ab_converttounits);long ll_metrics rect rc n_svc_system lnv_sys ll_metrics = Send(al_rebarhwnd, RB_GETBARHEIGHT, 0, 0) IF ab_converttounits THEN ll_metrics = PixelsToUnits(ll_metrics, YPixelsTounits!) END IF anv_svc.of_LoadSvc(lnv_sys, CSvc.SYS) IF NOT lnv_sys.of_issysthemed() THEN ll_metrics += 12 //pad for PB END IF RETURN ll_metrics end function public subroutine of_setbandchild (ref n_svc_mgr anv_svc, readonly long al_hwnd, readonly integer ai_index, readonly long al_hwndchild);n_svc_bit lnv_bit n_svc_sizeof lnv_sizeof REBARBANDINFO rbBand RECT rc long ll_option, ll_option2 TRY anv_svc.of_loadsvc(lnv_bit, CSvc.BIT) anv_svc.of_loadsvc(lnv_sizeof, CSvc.SIZEOF) GetWindowRect(al_hwndchild, rc) rbBand.cbSize = lnv_sizeof.SizeOf(rbband) rbBand.fMask = lnv_bit.of_BitwiseOR({/*RBBIM_COLORS , RBBIM_TEXT , RBBIM_BACKGROUND,+*/ & RBBIM_STYLE , RBBIM_CHILD , RBBIM_CHILDSIZE , RBBIM_SIZE, ll_option2}) SendMessageBand(al_hwnd, RB_GETBANDINFO, ai_index - 1, rbBand) // rbBand.fStyle = lnv_bit.of_bitor({/*RBBS_CHILDEDGE ,+ RBBS_GRIPPERALWAYS , */RBBS_VARIABLEHEIGHT, ll_option}) rbBand.hwndChild = al_hwndchild // rbBand.cxideal = rc.right - rc.left //50 //// rbBand.cxMinChild = ai_minsize rbBand.cyMinChild = rc.bottom - rc.top rbBand.cyChild = rc.bottom - rc.top rbBand.cyMaxChild = rc.bottom - rc.top + 10 SendMessageBand(al_hwnd, RB_SETBANDINFO, ai_index - 1, rbBand) CATCH (runtimeerror err) //swallow END TRY end subroutine public subroutine of_setbandminimumsize (ref n_svc_mgr anv_svc, readonly long al_hwnd, readonly integer ai_index, readonly long al_width);n_svc_sizeof lnv_size rebarbandinfo lstr anv_svc.of_loadsvc(lnv_size, CSvc.SIZEOF) lstr.cbsize = lnv_size.sizeof(lstr) lstr.fmask = RBBIM_CHILDSIZE sendmessageband(al_hwnd, RB_GETBANDINFO, ai_index - 1, lstr) lstr.cxminchild = al_width //lstr.cxideal = al_width sendmessageband(al_hwnd, RB_SETBANDINFO, ai_index - 1, lstr) //sendboolean(al_hwnd, RB_SHOWBAND, 0, ab_show) end subroutine public function long of_getbandwidth (readonly long al_rebarhwnd, readonly integer ai_index);n_svc_mgr lnv_svc n_svc_sizeof lnv_s rebarbandinfo rb lnv_svc.of_loadsvc(lnv_s, CSvc.SIZEOF) rb.cbsize = lnv_s.sizeof(rb) rb.fMask = RBBIM_SIZE //SendBoolean(al_hwnd, RB_MAXIMIZEBAND, ai_index - 1, ab_maximize) SendMessageBand(al_rebarhwnd, RB_GETBANDINFO, ai_index - 1, rb) RETURN rb.cx end function public subroutine of_destroy (readonly long al_rebarhwnd);DestroyWindow(al_rebarhwnd) end subroutine public subroutine of_maximizeband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_maximize);SendBoolean(al_hwnd, RB_MAXIMIZEBAND, ai_index - 1, ab_maximize) end subroutine public subroutine of_minimizeband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_minimize);SendBoolean(al_hwnd, RB_MINIMIZEBAND, ai_index - 1, FALSE) end subroutine public subroutine of_resize (readonly long al_rebarhwnd, long al_width, readonly long al_height);RECT rc al_width = UnitsToPixels(al_width, XUnitsToPixels!) // al_height = UnitsToPixels(al_height, YUnitsToPixels!) GetWindowRect(al_rebarhwnd, rc) MoveWindow(al_rebarhwnd, 0, 0, al_width, rc.bottom - rc.top, TRUE) end subroutine public subroutine of_showband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_show);SendBoolean(al_hwnd, RB_SHOWBAND, ai_index - 1, ab_show) end subroutine on n_svc_rebar.create call super::create end on on n_svc_rebar.destroy call super::destroy end on
- Sources
- Kodigo
- OpenExplorer
- n_svc_rebar.sru
File: n_svc_rebar.sru
Size: 16628
Date: Mon, 07 Apr 2008 21:32:12 +0200
Size: 16628
Date: Mon, 07 Apr 2008 21:32:12 +0200
- n_svc_base n_svc_rebar(sru)
- of_create (ref n_svc_mgr anv_svc, powerobject apo_parent, integer ai_width, integer ai_height) returns long
- of_destroy (readonly long al_rebarhwnd)
- of_getbandwidth (readonly long al_rebarhwnd, readonly integer ai_index) returns long
- of_getrebarheight (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly boolean ab_converttounits) returns long
- of_insertband (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly long al_childhwnd, readonly string as_bandtext, readonly integer ai_minsize, readonly boolean ab_newline, readonly boolean ab_gripper)
- of_maximizeband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_maximize)
- of_minimizeband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_minimize)
- of_notifyrebar (ref n_svc_mgr anv_svc, readonly long al_rebarhwnd, readonly long lparam, readonly long wparam)
- of_resize (readonly long al_rebarhwnd, long al_width, readonly long al_height)
- of_setbandchild (ref n_svc_mgr anv_svc, readonly long al_hwnd, readonly integer ai_index, readonly long al_hwndchild)
- of_setbandminimumsize (ref n_svc_mgr anv_svc, readonly long al_hwnd, readonly integer ai_index, readonly long al_width)
- of_setparent (readonly long al_rebarhwnd, readonly powerobject apo_parent) returns long
- of_showband (readonly long al_hwnd, readonly integer ai_index, readonly boolean ab_show)