$PBExportHeader$n_svc_toolbar.sru $PBExportComments$MS Toolbar service forward global type n_svc_toolbar from n_svc_base end type end forward global type n_svc_toolbar from n_svc_base end type global n_svc_toolbar n_svc_toolbar type prototypes FUNCTION long GetWindowLong(long hwnd,long nIndex) LIBRARY "user32.dll" ALIAS FOR "GetWindowLongA" FUNCTION long SetWindowLong(long hwnd,long nIndex,long dwNewLong) LIBRARY "user32.dll" ALIAS FOR "SetWindowLongA" 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,ulong bRepaint) 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 SendMessageItems( long hWnd, long uMsg, long wParam, Ref tbbutton lpst[] ) Library "user32" Alias For "SendMessageA;Ansi" 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 SendMessageInfo( long hWnd, long uMsg, long wParam, Ref tbbuttoninfo lpst ) Library "user32" Alias For "SendMessageA;Ansi" FUNCTION long SendBoolean( long hWnd, long uMsg, long wParam, Boolean lpst ) Library "user32" Alias For "SendMessageA" SUBROUTINE GetTOOL( ref NMTOOLBAR d, long s, long l ) library 'kernel32.dll' alias for "RtlMoveMemory" SUBROUTINE SetTOOL( long s, ref NMTOOLBAR d, long l ) library 'kernel32.dll' alias for "RtlMoveMemory" FUNCTION long SendMessageRECT( long hWnd, long uMsg, long wParam, Ref RECT lpst ) Library "user32" Alias For "SendMessageA;Ansi" FUNCTION long MapWindowPoints(long hwndFrom,long hwndTo,ref rect lppt,long cPoints) LIBRARY "user32.dll" alias for "MapWindowPoints;Ansi" SUBROUTINE GetDISP( ref NMTTDISPINFO d, long s, long l ) library 'kernel32.dll' alias for "RtlMoveMemory" SUBROUTINE SetDISP( long s, ref NMTTDISPINFO d, long l ) library 'kernel32.dll' alias for "RtlMoveMemory" FUNCTION long SendMessageSize( long hWnd, long uMsg, long wParam, ref tagsize lpst ) Library "user32" Alias For "SendMessageA;Ansi" end prototypes type variables Public: CONSTANT long TBN_FIRST = -700 // toolbar CONSTANT char TBSTATE_CHECKED = "~h01"//0x01 CONSTANT char TBSTATE_PRESSED = "~h02"//0x02 CONSTANT char TBSTATE_ENABLED = "~h04"//0x04 CONSTANT char TBSTATE_HIDDEN = "~h08"//0x08 CONSTANT char TBSTATE_INDETERMINATE = "~h10"//0x10 CONSTANT char TBSTATE_WRAP = "~h20"//0x20 CONSTANT char TBSTATE_ELLIPSES = "~h40"//0x40 CONSTANT char TBSTATE_MARKED = "~h80"//0x80 CONSTANT char TBSTYLE_BUTTON = "~h00"//0x0000 CONSTANT char TBSTYLE_SEP = "~h01"//0x0001 CONSTANT char TBSTYLE_CHECK = "~h02"//0x0002 CONSTANT char TBSTYLE_GROUP = "~h04"//0x0004 CONSTANT char TBSTYLE_DROPDOWN = "~h08 "//0x0008 //CONSTANT char TBSTYLE_CHECKGROUP = (TBSTYLE_GROUP + TBSTYLE_CHECK) CONSTANT char TBSTYLE_AUTOSIZE = "~h10" //0x0010 // automatically calculate the cx of the button CONSTANT long TBSTYLE_NOPREFIX = //0x0020 // if this button should not have accel prefix CONSTANT long TBSTYLE_TOOLTIPS = //0x0100 CONSTANT long TBSTYLE_WRAPABLE = //0x0200 CONSTANT long TBSTYLE_ALTDRAG = //0x0400 CONSTANT long TBSTYLE_FLAT = //0x0800 CONSTANT long TBSTYLE_LIST = //0x1000 CONSTANT long TBSTYLE_CUSTOMERASE = //0x2000 CONSTANT long TBSTYLE_REGISTERDROP = //0x4000 CONSTANT long TBSTYLE_TRANSPARENT = //0x8000 CONSTANT long TBSTYLE_EX_DRAWDDARROWS = //0x00000001 CONSTANT long TBSTYLE_EX_HIDECLIPPEDBUTTONS = 16 CONSTANT long TBSTYLE_EX_DOUBLEBUFFER = 128 CONSTANT long WM_USER = 1024 CONSTANT long TB_ENABLEBUTTON = (WM_USER + 1) CONSTANT long TB_CHECKBUTTON = (WM_USER + 2) CONSTANT long TB_PRESSBUTTON = (WM_USER + 3) CONSTANT long TB_HIDEBUTTON = (WM_USER + 4) CONSTANT long TB_INDETERMINATE = (WM_USER + 5) CONSTANT long TB_MARKBUTTON = (WM_USER + 6) CONSTANT long TB_ISBUTTONENABLED = (WM_USER + 9) CONSTANT long TB_ISBUTTONCHECKED = (WM_USER + 10) CONSTANT long TB_ISBUTTONPRESSED = (WM_USER + 11) CONSTANT long TB_ISBUTTONHIDDEN = (WM_USER + 12) CONSTANT long TB_ISBUTTONINDETERMINATE = (WM_USER + 13) CONSTANT long TB_ISBUTTONHIGHLIGHTED = (WM_USER + 14) CONSTANT long TB_SETSTATE = (WM_USER + 17) CONSTANT long TB_GETSTATE = (WM_USER + 18) CONSTANT long TB_ADDBITMAP = (WM_USER + 19) CONSTANT long IDB_STD_SMALL_COLOR = 0 CONSTANT long IDB_STD_LARGE_COLOR = 1 CONSTANT long IDB_VIEW_SMALL_COLOR = 4 CONSTANT long IDB_VIEW_LARGE_COLOR = 5 CONSTANT long IDB_HIST_SMALL_COLOR = 8 CONSTANT long IDB_HIST_LARGE_COLOR = 9 CONSTANT long STD_CUT = 0 CONSTANT long STD_COPY = 1 CONSTANT long STD_PASTE = 2 CONSTANT long STD_UNDO = 3 CONSTANT long STD_REDOW = 4 CONSTANT long STD_DELETE = 5 CONSTANT long STD_FILENEW = 6 CONSTANT long STD_FILEOPEN = 7 CONSTANT long STD_FILESAVE = 8 CONSTANT long STD_PRINTPRE = 9 CONSTANT long STD_PROPERTIES = 10 CONSTANT long STD_HELP = 11 CONSTANT long STD_FIND = 12 CONSTANT long STD_REPLACE = 13 CONSTANT long STD_PRINT = 14 // icon indexes for standard view bitmap //CONSTANT long VIEW_LARGEICONS = 0 //CONSTANT long VIEW_SMALLICONS = 1 //CONSTANT long VIEW_LIST = 2 //CONSTANT long VIEW_DETAILS = 3 //CONSTANT long VIEW_SORTNAME = 4 //CONSTANT long VIEW_SORTSIZE = 5 //CONSTANT long VIEW_SORTDATE = 6 //CONSTANT long VIEW_SORTTYPE = 7 //CONSTANT long VIEW_PARENTFOLDER = 8 //CONSTANT long VIEW_NETCONNECT = 9 //CONSTANT long VIEW_NETDISCONNECT = 10 //CONSTANT long VIEW_NEWFOLDER = 11 //CONSTANT long VIEW_VIEWMENU = 12 //CONSTANT long HIST_BACK = 0 //CONSTANT long HIST_FORWARD = 1 //CONSTANT long HIST_FAVORITES =2 //CONSTANT long HIST_ADDTOFAVORITES = 3 //CONSTANT long HIST_VIEWTREE = 4 CONSTANT long TB_ADDBUTTONSA = (WM_USER + 20) CONSTANT long TB_INSERTBUTTONA = (WM_USER + 21) CONSTANT long TB_DELETEBUTTON = (WM_USER + 22) CONSTANT long TB_GETBUTTON = (WM_USER + 23) CONSTANT long TB_BUTTONCOUNT = (WM_USER + 24) CONSTANT long TB_COMMANDTOINDEX = (WM_USER + 25) CONSTANT long TB_SAVERESTOREA = (WM_USER + 26) CONSTANT long TB_SAVERESTOREW = (WM_USER + 76) CONSTANT long TB_CUSTOMIZE = (WM_USER + 27) CONSTANT long TB_ADDSTRINGA = (WM_USER + 28) CONSTANT long TB_ADDSTRINGW = (WM_USER + 77) CONSTANT long TB_GETITEMRECT = (WM_USER + 29) CONSTANT long TB_BUTTONSTRUCTSIZE = (WM_USER + 30) CONSTANT long TB_SETBUTTONSIZE = (WM_USER + 31) CONSTANT long TB_SETBITMAPSIZE = (WM_USER + 32) CONSTANT long TB_AUTOSIZE = (WM_USER + 33) CONSTANT long TB_GETTOOLTIPS = (WM_USER + 35) CONSTANT long TB_SETTOOLTIPS = (WM_USER + 36) CONSTANT long TB_SETPARENT = (WM_USER + 37) CONSTANT long TB_SETROWS = (WM_USER + 39) CONSTANT long TB_GETROWS = (WM_USER + 40) CONSTANT long TB_SETCMDID = (WM_USER + 42) CONSTANT long TB_CHANGEBITMAP = (WM_USER + 43) CONSTANT long TB_GETBITMAP = (WM_USER + 44) CONSTANT long TB_GETBUTTONTEXTA = (WM_USER + 45) CONSTANT long TB_GETBUTTONTEXTW = (WM_USER + 75) CONSTANT long TB_REPLACEBITMAP = (WM_USER + 46) CONSTANT long TB_SETINDENT = (WM_USER + 47) CONSTANT long TB_SETIMAGELIST = (WM_USER + 48) CONSTANT long TB_GETIMAGELIST = (WM_USER + 49) CONSTANT long TB_LOADIMAGES = (WM_USER + 50) CONSTANT long TB_GETRECT = (WM_USER + 51) // wParam is the Cmd instead of index CONSTANT long TB_SETHOTIMAGELIST = (WM_USER + 52) CONSTANT long TB_GETHOTIMAGELIST = (WM_USER + 53) CONSTANT long TB_SETDISABLEDIMAGELIST = (WM_USER + 54) CONSTANT long TB_GETDISABLEDIMAGELIST = (WM_USER + 55) CONSTANT long TB_SETSTYLE = (WM_USER + 56) CONSTANT long TB_GETSTYLE = (WM_USER + 57) CONSTANT long TB_GETBUTTONSIZE = (WM_USER + 58) CONSTANT long TB_SETBUTTONWIDTH = (WM_USER + 59) CONSTANT long TB_SETMAXTEXTROWS = (WM_USER + 60) CONSTANT long TB_GETTEXTROWS = (WM_USER + 61) CONSTANT long TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA CONSTANT long TB_SAVERESTORE = TB_SAVERESTOREA CONSTANT long TB_ADDSTRING = TB_ADDSTRINGA CONSTANT long TB_GETOBJECT = (WM_USER + 62) // wParam == IID, lParam void **ppv CONSTANT long TB_GETHOTITEM = (WM_USER + 71) CONSTANT long TB_SETHOTITEM = (WM_USER + 72) // wParam == iHotItem CONSTANT long TB_SETANCHORHIGHLIGHT = (WM_USER + 73) // wParam == TRUE/FALSE CONSTANT long TB_GETANCHORHIGHLIGHT = (WM_USER + 74) CONSTANT long TB_MAPACCELERATORA = (WM_USER + 78) // wParam == ch, lParam int * pidBtn CONSTANT long TBIMHT_AFTER = 1 //0x00000001 // TRUE = insert After iButton, otherwise before CONSTANT long TBIMHT_BACKGROUND = //0x00000002 // TRUE iff missed buttons completely CONSTANT long TB_GETINSERTMARK = (WM_USER + 79) // lParam == LPTBINSERTMARK CONSTANT long TB_SETINSERTMARK = (WM_USER + 80) // lParam == LPTBINSERTMARK CONSTANT long TB_INSERTMARKHITTEST = (WM_USER + 81) // wParam == LPPOINT lParam == LPTBINSERTMARK CONSTANT long TB_MOVEBUTTON = (WM_USER + 82) CONSTANT long TB_GETMAXSIZE = (WM_USER + 83) // lParam == LPSIZE CONSTANT long TB_SETEXTENDEDSTYLE = (WM_USER + 84) // For TBSTYLE_EX_* CONSTANT long TB_GETEXTENDEDSTYLE = (WM_USER + 85) // For TBSTYLE_EX_* CONSTANT long TB_GETPADDING = (WM_USER + 86) CONSTANT long TB_SETPADDING = (WM_USER + 87) CONSTANT long TB_SETINSERTMARKCOLOR = (WM_USER + 88) CONSTANT long TB_GETINSERTMARKCOLOR = (WM_USER + 89) //CONSTANT long TB_SETCOLORSCHEME = CCM_SETCOLORSCHEME // lParam is color scheme //CONSTANT long TB_GETCOLORSCHEME = CCM_GETCOLORSCHEME // fills in COLORSCHEME pointed to by lParam //CONSTANT long TB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT //CONSTANT long TB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT //CONSTANT long TB_MAPACCELERATORW = (WM_USER + 90) // wParam == ch, lParam int * pidBtn //CONSTANT long TB_MAPACCELERATOR = TB_MAPACCELERATORW CONSTANT long TB_MAPACCELERATOR = TB_MAPACCELERATORA CONSTANT long TBBF_LARGE = //0x0001 CONSTANT long TB_GETBITMAPFLAGS = (WM_USER + 41) CONSTANT long TBIF_IMAGE = //0x00000001 CONSTANT long TBIF_TEXT = //0x00000002 CONSTANT long TBIF_STATE = //0x00000004 CONSTANT long TBIF_STYLE = //0x00000008 CONSTANT long TBIF_LPARAM = //0x00000010 CONSTANT long TBIF_COMMAND = //0x00000020 CONSTANT long TBIF_SIZE = //0x00000040 CONSTANT long TB_GETBUTTONINFOW = (WM_USER + 63) CONSTANT long TB_SETBUTTONINFOW = (WM_USER + 64) CONSTANT long TB_GETBUTTONINFOA = (WM_USER + 65) CONSTANT long TB_SETBUTTONINFOA = (WM_USER + 66) CONSTANT long TB_GETBUTTONINFO = TB_GETBUTTONINFOA CONSTANT long TB_SETBUTTONINFO = TB_SETBUTTONINFOA CONSTANT long TB_HITTEST = (WM_USER + 69) // New post Win95/NT4 for InsertButton and AddButton. if iString member // is a pointer to a string, it will be handled as a string like listview // (although LPSTR_TEXTCALLBACK is not supported). CONSTANT long TB_INSERTBUTTON = TB_INSERTBUTTONA CONSTANT long TB_ADDBUTTONS = TB_ADDBUTTONSA CONSTANT long TB_SETDRAWTEXTFLAGS = (WM_USER + 70) // wParam == mask lParam == bit values CONSTANT long TBN_GETBUTTONINFOA = (TBN_FIRST - 0) CONSTANT long TBN_GETBUTTONINFOW = (TBN_FIRST - 20) CONSTANT long TBN_BEGINDRAG = (TBN_FIRST - 1) CONSTANT long TBN_ENDDRAG = (TBN_FIRST - 2) CONSTANT long TBN_BEGINADJUST = (TBN_FIRST - 3) CONSTANT long TBN_ENDADJUST = (TBN_FIRST - 4) CONSTANT long TBN_RESET = (TBN_FIRST - 5) CONSTANT long TBN_QUERYINSERT = (TBN_FIRST - 6) CONSTANT long TBN_QUERYDELETE = (TBN_FIRST - 7) CONSTANT long TBN_TOOLBARCHANGE = (TBN_FIRST - 8) CONSTANT long TBN_CUSTHELP = (TBN_FIRST - 9) CONSTANT long TBN_DROPDOWN = (TBN_FIRST - 10) CONSTANT long TBN_GETOBJECT = (TBN_FIRST - 12) // Hot item change flags CONSTANT long HICF_OTHER = //0x00000000 CONSTANT long HICF_MOUSE = //0x00000001 // Triggered by mouse CONSTANT long HICF_ARROWKEYS = //0x00000002 // Triggered by arrow keys CONSTANT long HICF_ACCELERATOR = //0x00000004 // Triggered by accelerator CONSTANT long HICF_DUPACCEL = //0x00000008 // This accelerator is not unique CONSTANT long HICF_ENTERING = //0x00000010 // idOld is invalid CONSTANT long HICF_LEAVING = //0x00000020 // idNew is invalid CONSTANT long HICF_RESELECT = //0x00000040 // hot item reselected CONSTANT long TBN_HOTITEMCHANGE = (TBN_FIRST - 13) CONSTANT long TBN_DRAGOUT = (TBN_FIRST - 14) // this is sent when the user clicks down on a button then drags off the button CONSTANT long TBN_DELETINGBUTTON = (TBN_FIRST - 15) // uses TBNOTIFY CONSTANT long TBN_GETDISPINFOA = (TBN_FIRST - 16) // This is sent when the toolbar needs some display information CONSTANT long TBN_GETDISPINFOW = (TBN_FIRST - 17) // This is sent when the toolbar needs some display information CONSTANT long TBN_GETINFOTIPA = (TBN_FIRST - 18) CONSTANT long TBN_GETINFOTIP = TBN_GETINFOTIPA //CONSTANT long NMTBGETINFOTIP = NMTBGETINFOTIPA //CONSTANT long LPNMTBGETINFOTIP = LPNMTBGETINFOTIPA CONSTANT long TBNF_IMAGE = //0x00000001 CONSTANT long TBNF_TEXT = //0x00000002 CONSTANT long TBNF_DI_SETITEM = //0x10000000 CONSTANT long TBN_GETDISPINFO = TBN_GETDISPINFOA //CONSTANT long NMTBDISPINFO = NMTBDISPINFOA //CONSTANT long LPNMTBDISPINFO = LPNMTBDISPINFOA CONSTANT long TBDDRET_DEFAULT = 0 CONSTANT long TBDDRET_NODEFAULT = 1 CONSTANT long TBDDRET_TREATPRESSED = 2 // Treat as a standard press button CONSTANT long TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA CONSTANT long TTN_NEEDTEXT = -520 CONSTANT long NM_FIRST = 0 CONSTANT long NM_RCLICK = (NM_FIRST - 5) // uses NMCLICK struct Private: long il_tmp_pointer end variables forward prototypes public function long of_setparent (readonly long al_toolbarhwnd, readonly powerobject apo_parent) public function long of_create (ref n_svc_mgr anv_svc, readonly powerobject apo_parent, readonly long al_styles, readonly long al_extendedstyles, integer ai_width, integer ai_height) public function long of_buildextendedstyles (ref n_svc_mgr anv_svc, readonly boolean ab_doublebuffer, readonly boolean ab_hideclippedbuttons) public function long of_buildstyles (ref n_svc_mgr anv_svc, readonly boolean ab_flat, readonly boolean ab_liststyle, readonly boolean ab_nodivider, readonly boolean ab_tooltips, readonly boolean ab_transparent, readonly boolean ab_wrappable) public subroutine of_setstyle (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly long al_style) public subroutine of_setimagelist (readonly long al_toolbarhwnd, readonly long al_himl) public subroutine of_sethotimagelist (readonly long al_toolbarhwnd, readonly long al_himl) public subroutine of_setdisabledimagelist (readonly long al_toolbarhwnd, readonly long al_himl) public subroutine of_setbuttonheight (readonly long al_toolbarwhnd, readonly integer ai_height) public function boolean of_isbuttonvisible (readonly long al_toolbarhwnd, readonly integer ai_commandid) public function boolean of_isbuttonenabled (readonly long al_toolbarhwnd, readonly integer ai_commandid) public function boolean of_isbuttonchecked (readonly long al_toolbarhwnd, readonly integer ai_commandid) public function long of_getbuttoncount (readonly long al_toolbahwnd) public subroutine of_addbuttons (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, tbbutton astr_buttons[]) public subroutine of_setbuttontext (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly integer ai_commandid, string as_text) public subroutine of_notifytoolbar (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly u_toolbar auo_parent, readonly integer ai_notification, readonly long lparam, readonly string as_text[]) public subroutine of_notifybutton (ref n_svc_mgr anv_svc, readonly integer ai_notification, readonly long lparam, readonly string as_tooltips[]) public function long of_getbuttonheight (readonly long al_toolbarhwnd) public function long of_commandidtoindex (readonly long la_toolbarhwnd, readonly integer ai_commandid) public subroutine of_addbuttons (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly datastore ads, ref string as_buttonid[], ref string as_buttontext[], ref string as_tooltips[], ref string as_buttondata[], ref tbbutton astr_buttons[]) public subroutine of_buttoncheck (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set) public subroutine of_buttonenable (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set) public subroutine of_buttonvisible (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set) public subroutine of_destroy (readonly long al_toolbarhwnd) public function tagsize of_getmaxwidth (readonly long al_toolbarhwnd) public function long of_gettoolbarheight (readonly long al_toolbarhwnd, readonly boolean ab_converttounits) public subroutine of_resize (readonly long al_toolbarhwnd, integer ai_width, integer ai_height) end prototypes public function long of_setparent (readonly long al_toolbarhwnd, readonly powerobject apo_parent);RETURN Send(al_toolbarhwnd, TB_SETPARENT, Handle(apo_parent), 0) end function public function long of_create (ref n_svc_mgr anv_svc, readonly powerobject apo_parent, readonly long al_styles, readonly long al_extendedstyles, 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_CLIPCHILDREN, & CWin32.WS_CLIPSIBLINGS, & CWin32.CCS_NORESIZE, & CWin32.CCS_ADJUSTABLE, & CWin32.CCS_NOPARENTALIGN, & CWin32.CCS_NOMOVEY, & al_styles}) ll_ex_style = lnv_bit.of_BitwiseOR({CWin32.WS_EX_TOOLWINDOW, & TBSTYLE_EX_DRAWDDARROWS, & al_extendedstyles}) ai_width = UnitsToPixels(ai_width, XUnitsToPixels!) ai_height = UnitsToPixels(ai_height, YUnitsToPixels!) ll_hwnd = CreateWindowEx( & ll_ex_style, & CWin32.TOOLBAR_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 */ & 150, /* Control ID */ & Handle(GetApplication()), /* Application Handle */ & 0) //Send(ll_hwnd, TB_SETEXTENDEDSTYLE, 0, al_extendedstyles) //bugfix - remove borders ll_style = GetWindowlong(ll_hwnd, CWin32.GWL_EXSTYLE) ll_style = lnv_bit.of_BitwiseXOR(ll_style, 257)// 256 | 1 SetWindowLong(ll_hwnd, CWin32.GWL_EXSTYLE, ll_style) ShowWindow(ll_hwnd, 1) CATCH (runtimeerror err) MessageBox("n_svc_toolbar", err.GetMessage(), StopSign!) END TRY RETURN ll_hwnd end function public function long of_buildextendedstyles (ref n_svc_mgr anv_svc, readonly boolean ab_doublebuffer, readonly boolean ab_hideclippedbuttons);long ll_style n_svc_bit lnv_bit anv_svc.of_LoadSvc(lnv_bit, CSvc.BIT) IF ab_doublebuffer THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_EX_DOUBLEBUFFER}) END IF IF ab_hideclippedbuttons THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_EX_HIDECLIPPEDBUTTONS}) END IF RETURN ll_style end function public function long of_buildstyles (ref n_svc_mgr anv_svc, readonly boolean ab_flat, readonly boolean ab_liststyle, readonly boolean ab_nodivider, readonly boolean ab_tooltips, readonly boolean ab_transparent, readonly boolean ab_wrappable);long ll_style n_svc_bit lnv_bit anv_svc.of_LoadSvc(lnv_bit, CSvc.BIT) IF ab_flat THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_FLAT}) END IF IF ab_liststyle THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_LIST}) END IF IF ab_nodivider THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, CWin32.CCS_NODIVIDER}) END IF IF ab_tooltips THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_TOOLTIPS}) END IF IF ab_transparent THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_TRANSPARENT}) END IF IF ab_wrappable THEN ll_style = lnv_bit.of_BitwiseOR({ll_style, TBSTYLE_WRAPABLE}) END IF RETURN ll_style end function public subroutine of_setstyle (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly long al_style);n_svc_bit lnv_bit long ll_style anv_svc.of_LoadSvc(lnv_bit, CSvc.BIT) ll_style = GetWindowlong(al_toolbarhwnd, CWin32.GWL_STYLE) ll_style = lnv_bit.of_BitwiseOR({ll_style, al_Style}) Setwindowlong(al_toolbarhwnd, CWin32.GWL_STYLE, ll_style) end subroutine public subroutine of_setimagelist (readonly long al_toolbarhwnd, readonly long al_himl);Send(al_toolbarhwnd, TB_SETIMAGELIST, 0, al_himl) end subroutine public subroutine of_sethotimagelist (readonly long al_toolbarhwnd, readonly long al_himl);Send(al_toolbarhwnd, TB_SETHOTIMAGELIST, 0, al_himl) end subroutine public subroutine of_setdisabledimagelist (readonly long al_toolbarhwnd, readonly long al_himl);Send(al_toolbarhwnd, TB_SETDISABLEDIMAGELIST, 0, al_himl) end subroutine public subroutine of_setbuttonheight (readonly long al_toolbarwhnd, readonly integer ai_height);Send(al_toolbarwhnd, TB_SETBUTTONSIZE, 0, LONG(ai_height, ai_height)) end subroutine public function boolean of_isbuttonvisible (readonly long al_toolbarhwnd, readonly integer ai_commandid);RETURN Send(al_toolbarhwnd, TB_ISBUTTONHIDDEN, ai_commandid, 0) = 0 end function public function boolean of_isbuttonenabled (readonly long al_toolbarhwnd, readonly integer ai_commandid);RETURN Send(al_toolbarhwnd, TB_ISBUTTONENABLED, ai_commandid, 0) <> 0 end function public function boolean of_isbuttonchecked (readonly long al_toolbarhwnd, readonly integer ai_commandid);RETURN Send(al_toolbarhwnd, TB_ISBUTTONCHECKED, ai_commandid, 0) <> 0 end function public function long of_getbuttoncount (readonly long al_toolbahwnd);RETURN Send(al_toolbahwnd, TB_BUTTONCOUNT, 0, 0) end function public subroutine of_addbuttons (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, tbbutton astr_buttons[]);n_svc_sizeof lnv_size long ll_size //load service anv_svc.of_loadsvc(lnv_size, CSvc.SIZEOF) //check bounds IF UPPERBOUND(astr_buttons) <= 0 THEN RETURN ll_size = lnv_size.SizeOf(astr_buttons[1]) Send(al_toolbarhwnd, TB_BUTTONSTRUCTSIZE, ll_size, 0) SendMessageItems(al_toolbarhwnd, TB_ADDBUTTONS, UPPERBOUND(astr_buttons), astr_buttons) end subroutine public subroutine of_setbuttontext (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly integer ai_commandid, string as_text);tbbuttoninfo lstr n_svc_sizeof lnv n_svc_isempty lnv_check long ll_len //load services anv_svc.of_LoadSvc(lnv, CSvc.SIZEOF) anv_svc.of_LoadSvc(lnv_check, CSvc.ISEMPTY) IF NOT lnv_check.of_IsEmpty(as_text) THEN as_text = TRIM(as_text) ll_len = LEN(as_text) + 1 //add byte IF il_tmp_pointer <> 0 THEN LocalFree(il_tmp_pointer) END IF lstr.cbsize = lnv.sizeof(lstr) lstr.dwmask = TBIF_TEXT il_tmp_pointer = LocalAlloc(0, ll_len) lstr.psztext = il_tmp_pointer lstrCpy(lstr.psztext, as_text) lstr.cchText = LEN(as_text) SendMessageInfo(al_toolbarhwnd, TB_SETBUTTONINFO, ai_commandid, lstr) END IF end subroutine public subroutine of_notifytoolbar (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly u_toolbar auo_parent, readonly integer ai_notification, readonly long lparam, readonly string as_text[]);NMTOOLBAR lstr_tool RECT rc, trc, wrc n_svc_sizeof lnv_sizeof anv_svc.of_loadsvc(lnv_sizeof, CSvc.SIZEOF) CHOOSE CASE ai_notification CASE TBN_DROPDOWN //a dropdown button has been clicked //copy the NMTOOLBAR Structure from memory GetTOOL(lstr_tool, lparam, lnv_sizeof.SizeOf(lstr_tool)) //get the button's bounding rectangle SendMessageRect(al_toolbarhwnd, TB_GETRECT, lstr_tool.iitem, rc) //adjust points against parent window MapWindowPoints(lstr_tool.hdr.hwndFrom, Handle(auo_parent.of_GetParentWindow()), rc, 2) rc.left = PixelsToUnits(rc.left, XPixelsToUnits!) rc.bottom = PixelsToUnits(rc.bottom, YPixelsToUnits!) auo_parent.EVENT ke_dropdowncoordinate(lstr_tool.iitem, rc.left, rc.bottom) // auo_parent.Event ke_dropdown(TRIM(as_text[lstr_tool.iitem]), rc.left, rc.bottom) CASE NM_RCLICK //rightclick on toolbar // apo_parent.Event rightclicked() CASE ELSE //refresh // this.of_resize(al_hwnd, 0, 0) //Send(al_hwnd, TB_AUTOSIZE, 0, 0) // UpdateWindow(al_hwnd) END CHOOSE end subroutine public subroutine of_notifybutton (ref n_svc_mgr anv_svc, readonly integer ai_notification, readonly long lparam, readonly string as_tooltips[]);NMTTDISPINFO lstr_disp NMTOOLBAR lstr_tool RECT rc n_svc_sizeof lnv_sizeof long DISP_SIZE anv_svc.of_loadsvc(lnv_sizeof, CSvc.SIZEOF) CHOOSE CASE ai_notification CASE TTN_NEEDTEXT DISP_SIZE = lnv_sizeof.SizeOf(lstr_disp) //copy struc from memory GetDISP(lstr_disp, lparam, DISP_SIZE) lstr_disp.uflags += TBNF_DI_SETITEM lstr_disp.sztext = as_tooltips[lstr_disp.hdr.idfrom] //copy back struc to memory SetDISP(lparam, lstr_disp, DISP_SIZE) END CHOOSE end subroutine public function long of_getbuttonheight (readonly long al_toolbarhwnd);long ll_word ll_word = Send(al_toolbarhwnd, TB_GETBUTTONSIZE, 0, 0) RETURN IntHigh(ll_word) end function public function long of_commandidtoindex (readonly long la_toolbarhwnd, readonly integer ai_commandid);RETURN Send(la_toolbarhwnd, TB_COMMANDTOINDEX, ai_commandid, 0) end function public subroutine of_addbuttons (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly datastore ads, ref string as_buttonid[], ref string as_buttontext[], ref string as_tooltips[], ref string as_buttondata[], ref tbbutton astr_buttons[]);long n, ll_count string ls_bitmap, ls_text[], ls_txt[] n_svc_isempty lnv_check long lpszText, ll_tmp n_svc_resource lnv_res IF NOT ISVALID(ads) THEN RETURN anv_svc.of_LoadSvc(lnv_res, CSvc.RESOURCE) anv_svc.of_loadsvc(lnv_check, CSvc.ISEMPTY) ll_count = ads.RowCount() ads.SetSort("sort_order A") ads.Sort() //reset tooltips as_tooltips = ls_text as_buttontext = ls_text FOR n = 1 to ll_count //command id astr_buttons[n].idcommand = n //image ls_bitmap = ads.GetItemString(n, 'image') IF lnv_check.of_Isempty(ls_bitmap) THEN astr_buttons[n].ibitmap = -2 ELSE IF ISNUMBER(ls_bitmap) THEN astr_buttons[n].ibitmap = INTEGER(ls_bitmap) - 1 ELSE IF LEN(ls_bitmap) > 0 THEN astr_buttons[n].ibitmap = & lnv_res.of_standardimageindexfromstring(ls_bitmap) - 1 ELSE astr_buttons[n].ibitmap = -2 END IF END IF END IF as_buttonid[n] = ads.GetItemString(n, "id") as_tooltips[n] = ads.GetItemString(n, "tooltip") as_buttondata[n] = ads.GetItemString(n, "tagdata") IF lnv_check.of_IsEmpty(as_buttondata[n]) THEN as_buttondata[n] = CString.EMPTY ls_txt[n] = ads.GetItemString(n, "text") IF lnv_check.of_IsEmpty(ls_txt[n]) THEN ls_txt[n] = CString.EMPTY as_buttontext[n] = ls_txt[n] ll_tmp = ads.GetItemNumber(n, 'disabled') IF lnv_check.of_IsEmpty(ll_tmp) THEN ll_tmp = 0 IF NOT ll_tmp > 0 THEN astr_buttons[n].fsState = TBSTATE_ENABLED END IF ll_tmp = ads.GetItemNumber(n, 'divider') IF lnv_check.of_IsEmpty(ll_tmp) THEN ll_tmp = 0 IF ll_tmp > 0 THEN astr_buttons[n].fsStyle = TBSTYLE_SEP //separator width astr_buttons[n].ibitmap = LONG(ls_bitmap) ELSE ll_tmp = ads.GetItemNumber(n, 'dropdown') IF lnv_check.of_IsEmpty(ll_tmp) THEN ll_tmp = 0 IF ll_tmp > 0 THEN //force extended style Send(al_toolbarhwnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS) ll_tmp = ads.GetItemNumber(n, 'dropwhole') IF lnv_check.of_IsEmpty(ll_tmp) THEN ll_tmp = 0 IF ll_tmp > 0 THEN astr_buttons[n].fsStyle = Char(144)// BTNS_WHOLEDROPDOWN + TBSTYLE_AUTOSIZE ELSE astr_buttons[n].fsStyle = Char(24)// TBSTYLE_DROPDOWN + TBSTYLE_AUTOSIZE END IF ELSE astr_buttons[n].fsStyle = TBSTYLE_AUTOSIZE END IF END IF NEXT //add buttons to toolbar this.of_addbuttons(anv_svc, al_toolbarhwnd, astr_buttons) //add button text FOR n = 1 to ll_count IF lnv_check.of_isempty(ls_txt[n]) THEN CONTINUE this.of_setbuttontext(anv_svc, al_toolbarhwnd, n, ls_txt[n]) IF il_tmp_pointer <> 0 THEN LocalFree(il_tmp_pointer) il_tmp_pointer = 0 END IF NEXT Send(al_toolbarhwnd, TB_AUTOSIZE, 0, 0) end subroutine public subroutine of_buttoncheck (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set);SendBoolean(al_toolbarhwnd, TB_CHECKBUTTON, ai_commandid, ab_set) end subroutine public subroutine of_buttonenable (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set);SendBoolean(al_toolbarhwnd, TB_ENABLEBUTTON, ai_commandid, ab_set) end subroutine public subroutine of_buttonvisible (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set);SendBoolean(al_toolbarhwnd, TB_HIDEBUTTON, ai_commandid, NOT ab_set) end subroutine public subroutine of_destroy (readonly long al_toolbarhwnd);DestroyWindow(al_toolbarhwnd) end subroutine public function tagsize of_getmaxwidth (readonly long al_toolbarhwnd);tagSize lstr SendMessagesize(al_toolbarhwnd, TB_GETMAXSIZE, 0, lstr) RETURN lstr end function public function long of_gettoolbarheight (readonly long al_toolbarhwnd, readonly boolean ab_converttounits);long ll_height Send(al_toolbarhwnd, TB_AUTOSIZE, 0, 0) ll_height = of_GetButtonHeight(al_toolbarhwnd) IF ab_converttounits THEN & ll_height = PixelsToUnits(ll_height, YPixelsToUnits!) RETURN ll_height end function public subroutine of_resize (readonly long al_toolbarhwnd, integer ai_width, integer ai_height);RECT rc ai_width = UnitsToPixels(ai_width, XUnitsToPixels!) ai_height = of_GetToolbarHeight( & al_toolbarhwnd, & FALSE)//UnitsToPixels(ai_height, YUnitsToPixels!) MoveWindow(al_toolbarhwnd, 0, 0, ai_width, ai_height, TRUE) end subroutine on n_svc_toolbar.create call super::create end on on n_svc_toolbar.destroy call super::destroy end on
- Sources
- Kodigo
- OpenExplorer
- n_svc_toolbar.sru
File: n_svc_toolbar.sru
Size: 32300
Date: Mon, 07 Apr 2008 21:32:11 +0200
Size: 32300
Date: Mon, 07 Apr 2008 21:32:11 +0200
- n_svc_base n_svc_toolbar(sru)
- of_addbuttons (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly datastore ads, ref string as_buttonid[], ref string as_buttontext[], ref string as_tooltips[], ref string as_buttondata[], ref tbbutton astr_buttons[])
- of_addbuttons (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, tbbutton astr_buttons[])
- of_buildextendedstyles (ref n_svc_mgr anv_svc, readonly boolean ab_doublebuffer, readonly boolean ab_hideclippedbuttons) returns long
- of_buildstyles (ref n_svc_mgr anv_svc, readonly boolean ab_flat, readonly boolean ab_liststyle, readonly boolean ab_nodivider, readonly boolean ab_tooltips, readonly boolean ab_transparent, readonly boolean ab_wrappable) returns long
- of_buttoncheck (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set)
- of_buttonenable (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set)
- of_buttonvisible (readonly long al_toolbarhwnd, readonly integer ai_commandid, readonly boolean ab_set)
- of_commandidtoindex (readonly long la_toolbarhwnd, readonly integer ai_commandid) returns long
- of_create (ref n_svc_mgr anv_svc, readonly powerobject apo_parent, readonly long al_styles, readonly long al_extendedstyles, integer ai_width, integer ai_height) returns long
- of_destroy (readonly long al_toolbarhwnd)
- of_getbuttoncount (readonly long al_toolbahwnd) returns long
- of_getbuttonheight (readonly long al_toolbarhwnd) returns long
- of_getmaxwidth (readonly long al_toolbarhwnd) returns tagsize
- of_gettoolbarheight (readonly long al_toolbarhwnd, readonly boolean ab_converttounits) returns long
- of_isbuttonchecked (readonly long al_toolbarhwnd, readonly integer ai_commandid) returns boolean
- of_isbuttonenabled (readonly long al_toolbarhwnd, readonly integer ai_commandid) returns boolean
- of_isbuttonvisible (readonly long al_toolbarhwnd, readonly integer ai_commandid) returns boolean
- of_notifybutton (ref n_svc_mgr anv_svc, readonly integer ai_notification, readonly long lparam, readonly string as_tooltips[])
- of_notifytoolbar (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly u_toolbar auo_parent, readonly integer ai_notification, readonly long lparam, readonly string as_text[])
- of_resize (readonly long al_toolbarhwnd, integer ai_width, integer ai_height)
- of_setbuttonheight (readonly long al_toolbarwhnd, readonly integer ai_height)
- of_setbuttontext (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly integer ai_commandid, string as_text)
- of_setdisabledimagelist (readonly long al_toolbarhwnd, readonly long al_himl)
- of_sethotimagelist (readonly long al_toolbarhwnd, readonly long al_himl)
- of_setimagelist (readonly long al_toolbarhwnd, readonly long al_himl)
- of_setparent (readonly long al_toolbarhwnd, readonly powerobject apo_parent) returns long
- of_setstyle (ref n_svc_mgr anv_svc, readonly long al_toolbarhwnd, readonly long al_style)