Update of /cvsroot/perl-win32-gui/Win32-GUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7815
Modified Files: Button.xs CHANGELOG GUI.h GUI.pm GUI.rc GUI.xs GUI_Events.cpp GUI_Helpers.cpp GUI_MessageLoops.cpp GUI_Options.cpp Header.xs ImageList.xs ListView.xs MANIFEST Makefile.PL NotifyIcon.xs Readme Readme.html Rebar.xs TYPEMAP Toolbar.xs Tooltip.xs Trackbar.xs TreeView.xs Window.xs Added Files: CustomDraw.pm Log Message: Reini Urban changes Index: GUI.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.xs,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** GUI.xs 11 Jan 2006 21:26:15 -0000 1.48 --- GUI.xs 16 Mar 2006 08:57:45 -0000 1.49 *************** *** 19,22 **** --- 19,24 ---- #include "GUI.h" + START_MY_CXT + /* ########################################################################### *************** *** 57,61 **** OUTPUT: [...1021 lines suppressed...] + # names to the window. + # + # Note: Called implicitly by DragQueryFiles. So don't use DragQueryFiles + # if you need further information from this object. + void + DESTROY(handle) + HDROP handle + CODE: + DragFinish(handle); + + + ########################################################################### BOOT: { + MY_CXT_INIT; + MY_CXT.count = 0; INITCOMMONCONTROLSEX icce; icce.dwSize = sizeof(INITCOMMONCONTROLSEX); Index: Tooltip.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Tooltip.xs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Tooltip.xs 25 Aug 2005 19:30:17 -0000 1.5 --- Tooltip.xs 16 Mar 2006 08:57:48 -0000 1.6 *************** *** 10,14 **** #include "GUI.h" ! void Tooltip_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { --- 10,19 ---- #include "GUI.h" ! typedef struct tagPERLWIN32GUI_NMTTCUSTOMDRAW { ! NMCUSTOMDRAW nmcd; ! UINT uDrawFlags; ! } PERLWIN32GUI_NMTTCUSTOMDRAW, * LPPERLWIN32GUI_NMTTCUSTOMDRAW; ! ! void Tooltip_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { *************** *** 51,54 **** --- 56,60 ---- else if Parse_Event("Pop", PERLWIN32GUI_NEM_CONTROL2) else if Parse_Event("Show", PERLWIN32GUI_NEM_CONTROL3) + else if Parse_Event("CustomDraw", PERLWIN32GUI_NEM_PAINT) else retval = FALSE; *************** *** 99,102 **** --- 105,125 ---- -1); break; + case NM_CUSTOMDRAW: + { + char class_name[] = "Win32::GUI::Tooltip::CustomDraw"; + LPPERLWIN32GUI_NMTTCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMTTCUSTOMDRAW) lParam; + SV *obj = CreateNMCustomDraw(NOTXSCALL class_name, lpCD); + HV *hv = (HV *)SvRV(obj); + hv_store_mg(NOTXSCALL hv, "-drawflags",11,newSViv(lpCD->uDrawFlags), 0); + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", + PERLWIN32GUI_ARGTYPE_SV, obj, + -1); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); + #endif + perlud->forceResult = PerlResult; + PerlResult = 0; /* MsgLoop return ForceResult */ + } + break; } } *************** *** 104,108 **** return PerlResult; } ! MODULE = Win32::GUI::Tooltip PACKAGE = Win32::GUI::Tooltip --- 127,131 ---- return PerlResult; } ! MODULE = Win32::GUI::Tooltip PACKAGE = Win32::GUI::Tooltip Index: Window.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Window.xs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Window.xs 13 Nov 2005 18:57:52 -0000 1.10 --- Window.xs 16 Mar 2006 08:57:48 -0000 1.11 *************** *** 82,85 **** --- 82,89 ---- storing = newSViv((LONG) handle_From(NOTXSCALL value)); stored = hv_store_mg(NOTXSCALL perlcs->hvSelf, "-accel", 6, storing, 0); + } else if(strcmp(option, "-dropfiles") == 0) { + perlcs->iDropFiles = (int) SvIV(value); + storing = newSViv((LONG) SvIV(value)); + stored = hv_store_mg(NOTXSCALL perlcs->hvSelf, "-dropfiles", 10, storing, 0); } else if(strcmp(option, "-hasmaximize") == 0 || strcmp(option, "-maximizebox") == 0) { *************** *** 113,116 **** --- 117,128 ---- void Window_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { + + if (perlcs->iDropFiles) { + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(Window_onPostCreate DragAcceptFiles) (iDropFiles=%d, myhandle=%ud)\n", + perlcs->iDropFiles, myhandle); + #endif + DragAcceptFiles(myhandle, 1); + } } *************** *** 128,131 **** --- 140,144 ---- else if Parse_Event("Scroll", PERLWIN32GUI_NEM_CONTROL7) else if Parse_Event("InitMenu", PERLWIN32GUI_NEM_CONTROL8) + else if Parse_Event("DropFiles", PERLWIN32GUI_NEM_DROPFILE) else if Parse_Event("Paint", PERLWIN32GUI_NEM_PAINT) else retval = FALSE; *************** *** 260,264 **** * Sent when a menu is about to become active. It occurs when the user clicks * an item on the menu bar or presses a menu key. This allows the application ! * to modify the menu before it is displayed. * (@)APPLIES_TO:Window, DialogBox, MDIFrame */ --- 273,277 ---- * Sent when a menu is about to become active. It occurs when the user clicks * an item on the menu bar or presses a menu key. This allows the application ! * to modify the menu before it is displayed. * (@)APPLIES_TO:Window, DialogBox, MDIFrame */ *************** *** 295,301 **** } ! void DialogBox_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! } --- 308,314 ---- } ! void DialogBox_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! } *************** *** 306,310 **** } ! int DialogBox_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) { --- 319,323 ---- } ! int DialogBox_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) { *************** *** 338,344 **** } ! void Graphic_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! } --- 351,357 ---- } ! void Graphic_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! } *************** *** 352,356 **** else if Parse_Event("LButtonUp", PERLWIN32GUI_NEM_CONTROL2) else if Parse_Event("RButtonDown", PERLWIN32GUI_NEM_CONTROL3) ! else if Parse_Event("RButtonUp", PERLWIN32GUI_NEM_CONTROL4) else retval = FALSE; --- 365,369 ---- else if Parse_Event("LButtonUp", PERLWIN32GUI_NEM_CONTROL2) else if Parse_Event("RButtonDown", PERLWIN32GUI_NEM_CONTROL3) ! else if Parse_Event("RButtonUp", PERLWIN32GUI_NEM_CONTROL4) else retval = FALSE; *************** *** 358,362 **** } ! int Graphic_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) { --- 371,375 ---- } ! int Graphic_onEvent (NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM wParam, LPARAM lParam) { *************** *** 453,456 **** --- 466,496 ---- #pragma message( "*** PACKAGE Win32::GUI::Window..." ) + ########################################################################### + # (@)METHOD:DragAcceptFiles(HANDLE, [ fAccept ] ) + # Set or get the status whether a window or dialogbox accepts dropped files. + # Returns 0 or 1 + # + int + DragAcceptFiles(handle,...) + HWND handle; + CODE: + int fAccept; + HV* self; + SV** tmp; + + RETVAL = 0; + self = (HV*) SvRV(ST(0)); + if (self) { + if ( items > 1 ) { + fAccept = SvIV(ST(1)) ? 1 : 0; + DragAcceptFiles(handle, (BOOL)fAccept); + RETVAL = fAccept; + } else { + if (tmp = hv_fetch_mg(NOTXSCALL self, "-dropfiles", 10, 0)) + RETVAL = SvIV(*tmp);; + } + } + OUTPUT: + RETVAL ########################################################################### Index: Readme =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Readme,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Readme 21 Nov 2005 22:33:33 -0000 1.4 --- Readme 16 Mar 2006 08:57:48 -0000 1.5 *************** *** 14,21 **** AVAILABILITY ! This is the README file for Win32::GUI v1.03 built on 21 Nov 2005. Source and ActiveState Perl PPMs are available from ! http://sourceforge.net/project/showfiles.php?group_id=16572. A cygwin distribution (available through cygwin's setup.exe) is --- 14,21 ---- AVAILABILITY ! This is the README file for Win32::GUI v1.03_03 built on 15 Mar 2006. Source and ActiveState Perl PPMs are available from ! <http://sourceforge.net/project/showfiles.php?group_id=16572>. A cygwin distribution (available through cygwin's setup.exe) is *************** *** 157,166 **** nmake ppm ! This procedure will generate a PPM for you current perl environment, including the HTML documentation, ready for installation as above. VERSION ! Documentation for Win32::GUI v1.03 created 21 Nov 2005 This document is autogenerated by the build process. Edits made here --- 157,166 ---- nmake ppm ! This procedure will generate a PPM for your current perl environment, including the HTML documentation, ready for installation as above. VERSION ! Documentation for Win32::GUI v1.03_03 created 15 Mar 2006 This document is autogenerated by the build process. Edits made here *************** *** 169,183 **** SUPPORT ! Homepage: http://perl-win32-gui.sourceforge.net/. For further support join the users mailing list("[EMAIL PROTECTED]") from the website at ! http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users. There ! is a searchable list archive at ! http://sourceforge.net/mail/?group_id=16572. COPYRIGHT and LICENCE ! Copyright (c) 1997..2005 Aldo Calpini. All rights reserved. This program is free software; you can redistribute it and/or modify it --- 169,183 ---- SUPPORT ! Homepage: <http://perl-win32-gui.sourceforge.net/>. For further support join the users mailing list("[EMAIL PROTECTED]") from the website at ! <http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users>. ! There is a searchable list archive at ! <http://sourceforge.net/mail/?group_id=16572>. COPYRIGHT and LICENCE ! Copyright (c) 1997..2006 Aldo Calpini. All rights reserved. This program is free software; you can redistribute it and/or modify it Index: Rebar.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Rebar.xs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Rebar.xs 26 Jun 2005 16:40:59 -0000 1.7 --- Rebar.xs 16 Mar 2006 08:57:48 -0000 1.8 *************** *** 78,81 **** --- 78,82 ---- if Parse_Event("HeightChange", PERLWIN32GUI_NEM_CONTROL1) else if Parse_Event("ChevronPushed", PERLWIN32GUI_NEM_CONTROL2) + else if Parse_Event("CustomDraw", PERLWIN32GUI_NEM_PAINT) else retval = FALSE; *************** *** 118,121 **** --- 119,139 ---- } break; + + case NM_CUSTOMDRAW: + { + char class_name[] = "Win32::GUI::Rebar::CustomDraw"; + LPPERLWIN32GUI_NMCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMCUSTOMDRAW) lParam; + SV *obj = CreateNMCustomDraw(NOTXSCALL class_name, lpCD); + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", + PERLWIN32GUI_ARGTYPE_SV, obj, + -1); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); + #endif + perlud->forceResult = PerlResult; + PerlResult = 0; /* MsgLoop return ForceResult */ + } + break; + } Index: GUI_Events.cpp =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Events.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GUI_Events.cpp 30 Jun 2005 22:36:21 -0000 1.10 --- GUI_Events.cpp 16 Mar 2006 08:57:48 -0000 1.11 *************** *** 19,23 **** BOOL ProcessEventError(NOTXSPROC char *Name, int* PerlResult) { if(SvTRUE(ERRSV)) { ! if(strncmp(Name, "main::", 6) == 0) Name += 6; MessageBeep(MB_ICONASTERISK); *PerlResult = MessageBox(NULL, SvPV_nolen(ERRSV), Name, MB_ICONERROR | MB_OKCANCEL); --- 19,23 ---- BOOL ProcessEventError(NOTXSPROC char *Name, int* PerlResult) { if(SvTRUE(ERRSV)) { ! if(strncmp(Name, "main::", 6) == 0) Name += 6; MessageBeep(MB_ICONASTERISK); *PerlResult = MessageBox(NULL, SvPV_nolen(ERRSV), Name, MB_ICONERROR | MB_OKCANCEL); *************** *** 72,76 **** break; case PERLWIN32GUI_ARGTYPE_LONG: ! XPUSHs(sv_2mortal(newSViv(va_arg( args, long )))); break; case PERLWIN32GUI_ARGTYPE_WORD: --- 72,76 ---- break; case PERLWIN32GUI_ARGTYPE_LONG: ! XPUSHs(sv_2mortal(newSVuv(va_arg( args, long )))); break; case PERLWIN32GUI_ARGTYPE_WORD: *************** *** 81,84 **** --- 81,87 ---- break; case PERLWIN32GUI_ARGTYPE_SV: + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(DoEvent NEM PERLWIN32GUI_ARGTYPE_SV)\n"); + #endif XPUSHs(va_arg( args, SV *)); break; *************** *** 142,145 **** --- 145,154 ---- XPUSHs(sv_2mortal(newSVpv(va_arg( args, char * ), 0))); break; + case PERLWIN32GUI_ARGTYPE_SV: + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(DoEvent OEM PERLWIN32GUI_ARGTYPE_SV)\n"); + #endif + XPUSHs(va_arg( args, SV *)); + break; default: warn("Win32::GUI: WARNING! unknown argument type (%d) to event '%s'", argtype, Name); *************** *** 1039,1047 **** //but this is slightly quicker:) if(SvTRUE(ERRSV)) { ! ProcessEventError(NOTXSCALL "Hook", PerlResult); ! } ! else { ! if(count > 0) { *PerlResult = POPi; } ! } PUTBACK; FREETMPS; --- 1048,1056 ---- //but this is slightly quicker:) if(SvTRUE(ERRSV)) { ! ProcessEventError(NOTXSCALL "Hook", PerlResult); ! } ! else { ! if(count > 0) { *PerlResult = POPi; } ! } PUTBACK; FREETMPS; Index: TYPEMAP =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/TYPEMAP,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TYPEMAP 3 Dec 2005 10:37:03 -0000 1.5 --- TYPEMAP 16 Mar 2006 08:57:48 -0000 1.6 *************** *** 13,16 **** --- 13,17 ---- HPEN T_HANDLE HRGN T_HANDLE + HDROP T_HANDLE HTREEITEM T_IV LONG T_IV *************** *** 56,58 **** T_COLOR sv_setiv($arg, (IV) $var); - --- 57,58 ---- Index: Trackbar.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Trackbar.xs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Trackbar.xs 30 Jun 2005 22:36:21 -0000 1.6 --- Trackbar.xs 16 Mar 2006 08:57:48 -0000 1.7 *************** *** 10,14 **** #include "GUI.h" ! void Trackbar_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { --- 10,14 ---- #include "GUI.h" ! void Trackbar_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { *************** *** 24,28 **** if(strcmp(option, "-tooltip") == 0) { perlcs->hTooltip = (HWND) handle_From(NOTXSCALL value); ! SwitchBit(perlcs->cs.style, TBS_TOOLTIPS , 1); } else if BitmaskOptionValue("-vertical", perlcs->cs.style, TBS_VERT) } else if BitmaskOptionValue("-aligntop", perlcs->cs.style, TBS_TOP) --- 24,28 ---- if(strcmp(option, "-tooltip") == 0) { perlcs->hTooltip = (HWND) handle_From(NOTXSCALL value); ! SwitchBit(perlcs->cs.style, TBS_TOOLTIPS , 1); } else if BitmaskOptionValue("-vertical", perlcs->cs.style, TBS_VERT) } else if BitmaskOptionValue("-aligntop", perlcs->cs.style, TBS_TOP) *************** *** 39,46 **** } ! void Trackbar_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! if (perlcs->hTooltip != NULL) SendMessage(myhandle, TBM_SETTOOLTIPS, (WPARAM) perlcs->hTooltip, 0); } --- 39,46 ---- } ! void Trackbar_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! if (perlcs->hTooltip != NULL) SendMessage(myhandle, TBM_SETTOOLTIPS, (WPARAM) perlcs->hTooltip, 0); } *************** *** 83,86 **** --- 83,102 ---- PERLWIN32GUI_ARGTYPE_INT, (int) HIWORD(wParam), -1 ); break; + + case NM_CUSTOMDRAW: + { + char class_name[] = "Win32::GUI::Trackbar::CustomDraw"; + LPPERLWIN32GUI_NMCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMCUSTOMDRAW) lParam; + SV *obj = CreateNMCustomDraw(NOTXSCALL class_name, lpCD); + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", + PERLWIN32GUI_ARGTYPE_SV, obj, + -1); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); + #endif + perlud->forceResult = PerlResult; + PerlResult = 0; + } + break; } *************** *** 124,128 **** # Retrieves the handle to a trackbar control buddy window at a given location. # ! # The specified location is relative to the control's orientation (horizontal or vertical). # B<LOCATION> = FALSE : Retrieves buddy to the right of the trackbar (or below for vertical trackbar) # B<LOCATION> = TRUE : Retrieves buddy to the left of the trackbar (or above for vertical trackbar) --- 140,144 ---- # Retrieves the handle to a trackbar control buddy window at a given location. # ! # The specified location is relative to the control's orientation (horizontal or vertical). # B<LOCATION> = FALSE : Retrieves buddy to the right of the trackbar (or below for vertical trackbar) # B<LOCATION> = TRUE : Retrieves buddy to the left of the trackbar (or above for vertical trackbar) *************** *** 139,143 **** # (@)METHOD:GetChannelRect() # Retrieves the bounding rectangle for a trackbar's channel. ! # The channel is the area over which the slider moves. It contains the highlight when a range is selected. void --- 155,159 ---- # (@)METHOD:GetChannelRect() # Retrieves the bounding rectangle for a trackbar's channel. ! # The channel is the area over which the slider moves. It contains the highlight when a range is selected. void *************** *** 205,209 **** ########################################################################### # (@)METHOD:GetPics() ! # Retrieves an array of logical positions of the trackbar's tick marks, not including the first and last tick. void --- 221,225 ---- ########################################################################### # (@)METHOD:GetPics() ! # Retrieves an array of logical positions of the trackbar's tick marks, not including the first and last tick. void *************** *** 220,224 **** if (pTics) { EXTEND(SP, nTics); ! for (UINT i = 0; i < nTics; i++) XST_mIV(i, pTics[i]); XSRETURN(nTics); --- 236,240 ---- if (pTics) { EXTEND(SP, nTics); ! for (UINT i = 0; i < nTics; i++) XST_mIV(i, pTics[i]); XSRETURN(nTics); *************** *** 292,296 **** ########################################################################### # (@)METHOD:GetThumbRect() ! # Retrieves the bounding rectangle for the slider in a trackbar. void --- 308,312 ---- ########################################################################### # (@)METHOD:GetThumbRect() ! # Retrieves the bounding rectangle for the slider in a trackbar. void *************** *** 336,340 **** ########################################################################### # (@)METHOD:GetToolTips() ! # Retrieves the handle to the tooltip control assigned to the trackbar, if any. LRESULT --- 352,356 ---- ########################################################################### # (@)METHOD:GetToolTips() ! # Retrieves the handle to the tooltip control assigned to the trackbar, if any. LRESULT *************** *** 348,352 **** ########################################################################### # (@)METHOD:GetUnicodeFormat() ! # Retrieves the UNICODE character format flag for the control. LRESULT --- 364,368 ---- ########################################################################### # (@)METHOD:GetUnicodeFormat() ! # Retrieves the UNICODE character format flag for the control. LRESULT *************** *** 362,366 **** # Assigns a window as the buddy window for a trackbar control # Returns the handle to the window that was previously assigned to the control at that location ! # The specified location is relative to the control's orientation (horizontal or vertical). # LOCATION = FALSE : Retrieves buddy to the right of the trackbar (or below for vertical trackbar) # LOCATION = TRUE : Retrieves buddy to the left of the trackbar (or above for vertical trackbar) --- 378,382 ---- # Assigns a window as the buddy window for a trackbar control # Returns the handle to the window that was previously assigned to the control at that location ! # The specified location is relative to the control's orientation (horizontal or vertical). # LOCATION = FALSE : Retrieves buddy to the right of the trackbar (or below for vertical trackbar) # LOCATION = TRUE : Retrieves buddy to the left of the trackbar (or above for vertical trackbar) *************** *** 390,394 **** ########################################################################### # (@)METHOD:SetPageSize([SIZE=10]) ! # Sets the number of logical positions the trackbar's slider moves in response to keyboard input, such as the PAGE UP or PAGE DOWN keys, or mouse input, such as clicks in the trackbar's channel. LRESULT --- 406,410 ---- ########################################################################### # (@)METHOD:SetPageSize([SIZE=10]) ! # Sets the number of logical positions the trackbar's slider moves in response to keyboard input, such as the PAGE UP or PAGE DOWN keys, or mouse input, such as clicks in the trackbar's channel. LRESULT *************** *** 417,421 **** ########################################################################### # (@)METHOD:SetRange([MIN=0], MAX, [REDRAW=TRUE]) ! # Sets the range of minimum and maximum logical positions for the slider in a trackbar. LRESULT --- 433,437 ---- ########################################################################### # (@)METHOD:SetRange([MIN=0], MAX, [REDRAW=TRUE]) ! # Sets the range of minimum and maximum logical positions for the slider in a trackbar. LRESULT *************** *** 460,464 **** ########################################################################### # (@)METHOD:SetSel([MIN=0], MAX, [REDRAW=TRUE]) ! # Sets the starting and ending logical positions for the current selection range in a trackbar. LRESULT --- 476,480 ---- ########################################################################### # (@)METHOD:SetSel([MIN=0], MAX, [REDRAW=TRUE]) ! # Sets the starting and ending logical positions for the current selection range in a trackbar. LRESULT *************** *** 516,520 **** ########################################################################### # (@)METHOD:SetTic(POSITION) ! # Sets a tick mark in a trackbar at the specified logical position. LRESULT --- 532,536 ---- ########################################################################### # (@)METHOD:SetTic(POSITION) ! # Sets a tick mark in a trackbar at the specified logical position. LRESULT *************** *** 546,552 **** # Positions a tooltip control used by a trackbar control. # TBTS_TOP : The tooltip control will be positioned above the trackbar. This flag is for use with horizontal trackbars. ! # TBTS_LEFT The tooltip control will be positioned to the left of the trackbar. This flag is for use with vertical trackbars. ! # TBTS_BOTTOM The tooltip control will be positioned below the trackbar. This flag is for use with horizontal trackbars. ! # TBTS_RIGHT The tooltip control will be positioned to the right of the trackbar. This flag is for use with vertical trackbars. LRESULT --- 562,568 ---- # Positions a tooltip control used by a trackbar control. # TBTS_TOP : The tooltip control will be positioned above the trackbar. This flag is for use with horizontal trackbars. ! # TBTS_LEFT The tooltip control will be positioned to the left of the trackbar. This flag is for use with vertical trackbars. ! # TBTS_BOTTOM The tooltip control will be positioned below the trackbar. This flag is for use with horizontal trackbars. ! # TBTS_RIGHT The tooltip control will be positioned to the right of the trackbar. This flag is for use with vertical trackbars. LRESULT *************** *** 574,578 **** ########################################################################### # (@)METHOD:SetUnicodeFormat(FLAG) ! # Sets the UNICODE character format flag for the control. LRESULT --- 590,594 ---- ########################################################################### # (@)METHOD:SetUnicodeFormat(FLAG) ! # Sets the UNICODE character format flag for the control. LRESULT *************** *** 597,603 **** HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETRANGEMIN, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETRANGEMIN, 1, (LPARAM) SvIV(ST(1))); --- 613,619 ---- HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETRANGEMIN, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETRANGEMIN, 1, (LPARAM) SvIV(ST(1))); *************** *** 617,623 **** HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETRANGEMAX, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETRANGEMAX, 1, (LPARAM) SvIV(ST(1))); --- 633,639 ---- HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETRANGEMAX, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETRANGEMAX, 1, (LPARAM) SvIV(ST(1))); *************** *** 636,642 **** HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETPOS, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETPOS, 1, (LPARAM) SvIV(ST(1))); --- 652,658 ---- HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETPOS, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETPOS, 1, (LPARAM) SvIV(ST(1))); *************** *** 655,661 **** HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETSELSTART, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETSELSTART, 1, (LPARAM) SvIV(ST(1))); --- 671,677 ---- HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETSELSTART, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETSELSTART, 1, (LPARAM) SvIV(ST(1))); *************** *** 674,680 **** HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETSELEND, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETSELEND, 1, (LPARAM) SvIV(ST(1))); --- 690,696 ---- HWND handle CODE: ! if(items > 1) { if(items > 2) ! RETVAL = SendMessage(handle, TBM_SETSELEND, (WPARAM) SvIV(ST(2)), (LPARAM) SvIV(ST(1))); else RETVAL = SendMessage(handle, TBM_SETSELEND, 1, (LPARAM) SvIV(ST(1))); Index: Toolbar.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Toolbar.xs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Toolbar.xs 26 Jun 2005 16:41:00 -0000 1.5 --- Toolbar.xs 16 Mar 2006 08:57:48 -0000 1.6 *************** *** 10,14 **** #include "GUI.h" ! void Toolbar_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { --- 10,35 ---- #include "GUI.h" ! typedef struct tagPERLWIN32GUI_NMTBCUSTOMDRAW { ! NMCUSTOMDRAW nmcd; [...1062 lines suppressed...] + if ((tempsv = av_fetch(array, 3)) && SvIOK(*tempsv)) + lpCD->rcText.bottom = SvIV(*tempsv); + if (SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-textrect", 9, newRV_inc(SvRV(ST(1))), 0); + } else { + AV* rect = newAV(); + av_push(rect, newSViv(lpCD->rcText.left)); + av_push(rect, newSViv(lpCD->rcText.top)); + av_push(rect, newSViv(lpCD->rcText.right)); + av_push(rect, newSViv(lpCD->rcText.bottom)); + RETVAL = newRV((SV *)rect), 0); + } + #else + MessageBox(NULL, "Unsupported member -textrect. Requires Comctl32.dll version 6.\r\nComctl32.dll version 6 is not redistributable but it is included in Microsoft Windows XP or later", + "Win32::GUI::Toolbar::CustomDraw", + MB_ICONERROR | MB_OKCANCEL); + RETVAL = &PL_sv_undef; + #endif + OUTPUT: + RETVAL Index: TreeView.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/TreeView.xs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TreeView.xs 8 May 2004 17:32:41 -0000 1.5 --- TreeView.xs 16 Mar 2006 08:57:48 -0000 1.6 *************** *** 10,14 **** #include "GUI.h" ! void TreeView_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { --- 10,23 ---- #include "GUI.h" ! typedef struct tagPERLWIN32GUI_NMTVCUSTOMDRAWINFO { ! PERLWIN32GUI_NMCUSTOMDRAW nmcd; ! COLORREF clrText; ! COLORREF clrTextBk; ! #if (_WIN32_IE >= 0x0400) ! int iLevel; ! #endif ! } PERLWIN32GUI_NMTVCUSTOMDRAW, *LPPERLWIN32GUI_NMTVCUSTOMDRAW; ! ! void TreeView_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { *************** *** 22,31 **** BOOL retval = TRUE; ! if(strcmp(option, "-imagelist") == 0) { perlcs->hImageList = (HIMAGELIST) handle_From(NOTXSCALL value); } else if(strcmp(option, "-tooltip") == 0) { perlcs->hTooltip = (HWND) handle_From(NOTXSCALL value); ! SwitchBit(perlcs->cs.style, TVS_NOTOOLTIPS, 0); } else if BitmaskOptionValue("-lines", perlcs->cs.style, TVS_HASLINES) } else if BitmaskOptionValue("-rootlines", perlcs->cs.style, TVS_LINESATROOT) --- 31,40 ---- BOOL retval = TRUE; ! if(strcmp(option, "-imagelist") == 0) { perlcs->hImageList = (HIMAGELIST) handle_From(NOTXSCALL value); } else if(strcmp(option, "-tooltip") == 0) { perlcs->hTooltip = (HWND) handle_From(NOTXSCALL value); ! SwitchBit(perlcs->cs.style, TVS_NOTOOLTIPS, 0); } else if BitmaskOptionValue("-lines", perlcs->cs.style, TVS_HASLINES) } else if BitmaskOptionValue("-rootlines", perlcs->cs.style, TVS_LINESATROOT) *************** *** 52,57 **** if(perlcs->hImageList != NULL) TreeView_SetImageList(myhandle, perlcs->hImageList, TVSIL_NORMAL); ! ! if (perlcs->hTooltip != NULL) TreeView_SetToolTips (myhandle, perlcs->hTooltip); --- 61,66 ---- if(perlcs->hImageList != NULL) TreeView_SetImageList(myhandle, perlcs->hImageList, TVSIL_NORMAL); ! ! if (perlcs->hTooltip != NULL) TreeView_SetToolTips (myhandle, perlcs->hTooltip); *************** *** 80,83 **** --- 89,93 ---- else if Parse_Event("EndLabelEdit", PERLWIN32GUI_NEM_CONTROL7) else if Parse_Event("KeyDown", PERLWIN32GUI_NEM_KEYDOWN) + else if Parse_Event("CustomDraw", PERLWIN32GUI_NEM_PAINT) else retval = FALSE; *************** *** 90,99 **** int PerlResult = 1; TV_ITEM *pItem; ! if ( uMsg == WM_NOTIFY ) { LPNM_TREEVIEW tv_notify = (LPNM_TREEVIEW) lParam; switch(tv_notify->hdr.code) { ! case TVN_BEGINLABELEDIT: /* --- 100,109 ---- int PerlResult = 1; TV_ITEM *pItem; ! if ( uMsg == WM_NOTIFY ) { LPNM_TREEVIEW tv_notify = (LPNM_TREEVIEW) lParam; switch(tv_notify->hdr.code) { ! case TVN_BEGINLABELEDIT: /* *************** *** 104,113 **** * For a treeview to receive this event, -editlabels need to be set to true. * (@)APPLIES_TO:TreeView ! */ pItem = &((TV_DISPINFO*)lParam)->item; PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL6, "BeginLabelEdit", PERLWIN32GUI_ARGTYPE_LONG, (LONG) pItem->hItem, -1); ! // Force result if event is handle if (perlud->dwPlStyle & PERLWIN32GUI_EVENTHANDLING) { --- 114,123 ---- * For a treeview to receive this event, -editlabels need to be set to true. * (@)APPLIES_TO:TreeView ! */ pItem = &((TV_DISPINFO*)lParam)->item; PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL6, "BeginLabelEdit", PERLWIN32GUI_ARGTYPE_LONG, (LONG) pItem->hItem, -1); ! // Force result if event is handle if (perlud->dwPlStyle & PERLWIN32GUI_EVENTHANDLING) { *************** *** 117,125 **** break; ! case TVN_ENDLABELEDIT: /* * (@)EVENT:EndLabelEdit(NODE,TEXT) * Sent when the user has finished editing a label in the TreeView control. ! * You have explicitly set the text of the node to reflect the new changes. * If the user cancels the edit, the text is undef. * (@)APPLIES_TO:TreeView --- 127,135 ---- break; ! case TVN_ENDLABELEDIT: /* * (@)EVENT:EndLabelEdit(NODE,TEXT) * Sent when the user has finished editing a label in the TreeView control. ! * You have explicitly set the text of the node to reflect the new changes. * If the user cancels the edit, the text is undef. * (@)APPLIES_TO:TreeView *************** *** 135,143 **** PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL7, "EndLabelEdit", PERLWIN32GUI_ARGTYPE_LONG, (LONG) pItem->hItem, ! -1); } ! break; ! case TVN_SELCHANGED: /* --- 145,153 ---- PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL7, "EndLabelEdit", PERLWIN32GUI_ARGTYPE_LONG, (LONG) pItem->hItem, ! -1); } ! break; ! case TVN_SELCHANGED: /* *************** *** 204,213 **** if (perlud->dwPlStyle & PERLWIN32GUI_EVENTHANDLING) { perlud->forceResult = (PerlResult == 0 ? TRUE : FALSE); ! PerlResult = 0; // MsgLoop return ForceResult } break; case TVN_KEYDOWN: ! /* * (@)EVENT:KeyDown(KEY) --- 214,223 ---- if (perlud->dwPlStyle & PERLWIN32GUI_EVENTHANDLING) { perlud->forceResult = (PerlResult == 0 ? TRUE : FALSE); ! PerlResult = 0; // MsgLoop return ForceResult } break; case TVN_KEYDOWN: ! { /* * (@)EVENT:KeyDown(KEY) *************** *** 221,227 **** PERLWIN32GUI_ARGTYPE_LONG, (LONG) tv_keydown->wVKey, -1); ! break; ! } } --- 231,258 ---- PERLWIN32GUI_ARGTYPE_LONG, (LONG) tv_keydown->wVKey, -1); + } + break; ! case NM_CUSTOMDRAW: ! { ! LPPERLWIN32GUI_NMTVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMTVCUSTOMDRAW) lParam; ! SV *obj = CreateNMCustomDraw(NOTXSCALL "Win32::GUI::TreeView::CustomDraw", lpCD); ! HV *hv = (HV *)SvRV(obj); ! hv_store_mg(NOTXSCALL hv, "-clrtext", 8, newSVuv((DWORD) lpCD->clrText), 0); ! hv_store_mg(NOTXSCALL hv, "-clrtextbk", 10, newSVuv((DWORD) lpCD->clrTextBk), 0); ! #if (_WIN32_IE >= 0x0400) ! hv_store_mg(NOTXSCALL hv, "-level", 6, newSViv(lpCD->iLevel), 0); ! #endif ! PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", ! PERLWIN32GUI_ARGTYPE_SV, obj, ! -1); ! #ifdef PERLWIN32GUI_STRONGDEBUG ! printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); ! #endif ! perlud->forceResult = PerlResult; ! PerlResult = 0; /* MsgLoop return ForceResult */ ! } ! break; ! } } *************** *** 236,240 **** - ########################################################################### # (@)METHOD:CreateDragImage(NODE) --- 267,270 ---- *************** *** 289,294 **** ########################################################################### # (@)METHOD:EndEditLabelNow([FLAG_CANCEL=TRUE]) ! # Ends the editing of a tree view item's label. ! BOOL EndEditLabelNow(handle,flag=TRUE) HWND handle --- 319,324 ---- ########################################################################### # (@)METHOD:EndEditLabelNow([FLAG_CANCEL=TRUE]) ! # Ends the editing of a tree view item's label. ! BOOL EndEditLabelNow(handle,flag=TRUE) HWND handle *************** *** 385,389 **** ########################################################################### # (@)METHOD:GetFirstVisible() ! # Retrieves the first visible item in a TreeView. HTREEITEM GetFirstVisible(handle) --- 415,419 ---- ########################################################################### # (@)METHOD:GetFirstVisible() ! # Retrieves the first visible item in a TreeView. HTREEITEM GetFirstVisible(handle) *************** *** 397,401 **** # (@)METHOD:GetImageList([TYPE=TVSIL_NORMAL]) # Retrieves the handle to the normal or state image list associated with a TreeView. ! # B<TYPE> = TVSIL_NORMAL | TVSIL_STATE HIMAGELIST GetImageList(handle,type=TVSIL_NORMAL ) --- 427,431 ---- # (@)METHOD:GetImageList([TYPE=TVSIL_NORMAL]) # Retrieves the handle to the normal or state image list associated with a TreeView. ! # B<TYPE> = TVSIL_NORMAL | TVSIL_STATE HIMAGELIST GetImageList(handle,type=TVSIL_NORMAL ) *************** *** 409,413 **** ########################################################################### # (@)METHOD:GetIndent() ! # Retrieves the amount, in pixels, that child items are indented relative to their parent items. UINT GetIndent(handle) --- 439,443 ---- ########################################################################### # (@)METHOD:GetIndent() ! # Retrieves the amount, in pixels, that child items are indented relative to their parent items. UINT GetIndent(handle) *************** *** 501,505 **** # (@)METHOD:GetItemRect(NODE,[FLAG=FALSE]) # Retrieves the bounding rectangle for a tree view item and indicates whether the item is visible. ! # If B<FLAG> is TRUE, the bounding rectangle includes only the text of the item. Otherwise, it includes the entire line that the item occupies in the tree view control. void GetItemRect(handle,item,flag=FALSE) --- 531,535 ---- # (@)METHOD:GetItemRect(NODE,[FLAG=FALSE]) # Retrieves the bounding rectangle for a tree view item and indicates whether the item is visible. ! # If B<FLAG> is TRUE, the bounding rectangle includes only the text of the item. Otherwise, it includes the entire line that the item occupies in the tree view control. void GetItemRect(handle,item,flag=FALSE) *************** *** 523,527 **** ########################################################################### # (@)METHOD:GetLastVisible() ! # Retrieves the last expanded item in a tree view control. HTREEITEM GetLastVisible(handle) --- 553,557 ---- ########################################################################### # (@)METHOD:GetLastVisible() ! # Retrieves the last expanded item in a tree view control. HTREEITEM GetLastVisible(handle) *************** *** 536,548 **** # Retrieves the tree view item that bears the specified relationship to a specified item. # ! # B<FLAG> specifying the item to retrieve : # TVGN_CARET = Retrieves the currently selected item. ! # TVGN_CHILD = Retrieves the first child item of the item specified by the hitem parameter. # TVGN_DROPHILITE = Retrieves the item that is the target of a drag-and-drop operation. ! # TVGN_FIRSTVISIBLE = Retrieves the first visible item. # TVGN_NEXT = Retrieves the next sibling item. # TVGN_NEXTVISIBLE = Retrieves the next visible item that follows the specified item. The specified item must be visible. ! # TVGN_PARENT = Retrieves the parent of the specified item. ! # TVGN_PREVIOUS = Retrieves the previous sibling item. # TVGN_PREVIOUSVISIBLE = Retrieves the first visible item that precedes the specified item. The specified item must be visible. # TVGN_ROOT = Retrieves the topmost or very first item of the tree view control. --- 566,578 ---- # Retrieves the tree view item that bears the specified relationship to a specified item. # ! # B<FLAG> specifying the item to retrieve : # TVGN_CARET = Retrieves the currently selected item. ! # TVGN_CHILD = Retrieves the first child item of the item specified by the hitem parameter. # TVGN_DROPHILITE = Retrieves the item that is the target of a drag-and-drop operation. ! # TVGN_FIRSTVISIBLE = Retrieves the first visible item. # TVGN_NEXT = Retrieves the next sibling item. # TVGN_NEXTVISIBLE = Retrieves the next visible item that follows the specified item. The specified item must be visible. ! # TVGN_PARENT = Retrieves the parent of the specified item. ! # TVGN_PREVIOUS = Retrieves the previous sibling item. # TVGN_PREVIOUSVISIBLE = Retrieves the first visible item that precedes the specified item. The specified item must be visible. # TVGN_ROOT = Retrieves the topmost or very first item of the tree view control. *************** *** 823,832 **** ########################################################################### # (@)METHOD:Select(NODE, [FLAG=TVGN_CARET]) ! # Selects the given B<NODE >in the TreeView. # If B<NODE> is 0 (zero), the selected item, if any, is deselected. # # Optional B<FLAG> parameter ! # TVGN_CARET = Sets the selection to the given item. ! # TVGN_DROPHILITE = Redraws the given item in the style used to indicate the target of a drag-and-drop operation. # TVGN_FIRSTVISIBLE = Ensures that the specified item is visible, and, if possible, displays it at the top of the control's window. BOOL --- 853,862 ---- ########################################################################### # (@)METHOD:Select(NODE, [FLAG=TVGN_CARET]) ! # Selects the given B<NODE >in the TreeView. # If B<NODE> is 0 (zero), the selected item, if any, is deselected. # # Optional B<FLAG> parameter ! # TVGN_CARET = Sets the selection to the given item. ! # TVGN_DROPHILITE = Redraws the given item in the style used to indicate the target of a drag-and-drop operation. # TVGN_FIRSTVISIBLE = Ensures that the specified item is visible, and, if possible, displays it at the top of the control's window. BOOL *************** *** 1020,1024 **** ########################################################################### # (@)METHOD:SetScrollTime(TIME) ! # Sets the maximum scroll time for the tree view control. int SetScrollTime(handle,time) --- 1050,1054 ---- ########################################################################### # (@)METHOD:SetScrollTime(TIME) ! # Sets the maximum scroll time for the tree view control. int SetScrollTime(handle,time) *************** *** 1056,1060 **** ########################################################################### # (@)METHOD:SetUnicodeFormat(FLAG) ! # Sets the UNICODE character format flag for the control. BOOL SetUnicodeFormat(handle,flag) --- 1086,1090 ---- ########################################################################### # (@)METHOD:SetUnicodeFormat(FLAG) ! # Sets the UNICODE character format flag for the control. BOOL SetUnicodeFormat(handle,flag) *************** *** 1210,1211 **** --- 1240,1302 ---- RETVAL + + MODULE = Win32::GUI::TreeView PACKAGE = Win32::GUI::TreeView::CustomDraw + + PROTOTYPES: DISABLE + + ########################################################################### + # (@)PACKAGE:Win32::GUI::TreeView::CustomDraw + + #pragma message( "*** PACKAGE Win32::GUI::TreeView::CustomDraw..." ) + + ########################################################################### + # (@)METHOD:TextColor([COLOR]) + # Set or Get the CustomDraw -clrtext property. + # + # COLOR may be either a numerical value, + # or a color expressed as [RR, GG, BB], + # or a color expressed in HTML notation (#RRGGBB) + SV * + TextColor(handle,color=FALSE) + HWND handle + COLORREF color + PREINIT: + HV* hv = (HV*)SvRV(ST(0)); + CODE: + LPPERLWIN32GUI_NMTVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMTVCUSTOMDRAW) handle; + if (items == 2) { + RETVAL = newSViv(color); + if(SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-clrtext", 8, RETVAL, 0); + lpCD->clrText = color; + } else { + RETVAL = newSViv(lpCD->clrText); + } + OUTPUT: + RETVAL + + ########################################################################### + # (@)METHOD:BackColor([COLOR]) + # Set or Get the CustomDraw -clrtextbk property. + # + # COLOR may be either a numerical value, + # or a color expressed as [RR, GG, BB], + # or a color expressed in HTML notation (#RRGGBB) + SV * + BackColor(handle,color=FALSE) + HWND handle + COLORREF color + PREINIT: + HV* hv = (HV*)SvRV(ST(0)); + CODE: + LPPERLWIN32GUI_NMTVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMTVCUSTOMDRAW) handle; + if (items == 2) { + RETVAL = newSViv(color); + if(SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-clrtextbk", 10, RETVAL, 0); + lpCD->clrTextBk = color; + } else { + RETVAL = newSViv(lpCD->clrTextBk); + } + OUTPUT: + RETVAL Index: GUI_Options.cpp =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Options.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GUI_Options.cpp 11 Jan 2006 21:26:16 -0000 1.10 --- GUI_Options.cpp 16 Mar 2006 08:57:48 -0000 1.11 *************** *** 856,860 **** I32 items, int from_i, ! NOTIFYICONDATA *nid) { int i, next_i; --- 856,861 ---- I32 items, int from_i, ! NOTIFYICONDATA *nid) ! { int i, next_i; *************** *** 928,931 **** --- 929,935 ---- ParseNEMNotifyIconEvent( NOTXSCALL hvEvents, option+3, ST(next_i) ); + } else if(version < 5) { + ; + #if (_WIN32_IE > 0x0501) } else if(strcmp(option, "-behaviour") == 0) { next_i = i + 1; *************** *** 960,963 **** --- 964,968 ---- W32G_WARN("Win32::GUI: Invalid value for -balloon_icon!"); } + #endif } } else { Index: MANIFEST =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/MANIFEST,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MANIFEST 11 Jan 2006 21:26:16 -0000 1.12 --- MANIFEST 16 Mar 2006 08:57:48 -0000 1.13 *************** *** 12,15 **** --- 12,16 ---- Button.xs CHANGELOG + CustomDraw.pm Combobox.xs cygwin.c *************** *** 79,82 **** --- 80,84 ---- samples/Animation.pl samples/BitmapScroll.pl + samples/CustomDraw.pl samples/DateTime.pl samples/Draw.pl *************** *** 85,88 **** --- 87,91 ---- samples/guiperl.ico samples/harrow.cur + samples/Listbox.pl samples/listview_drag_drop.pl samples/MDI.pl *************** *** 90,93 **** --- 93,99 ---- samples/Notepad.pl samples/NotifyIcon.pl + samples/pmx.pl + samples/pride.pl + samples/ProgressBar.pl samples/Region.pl samples/SplashScreen.pl *************** *** 108,111 **** --- 114,118 ---- samples/Tutorial_Part5_twoWindows.pl samples/Tutorial_Part9_noDosWindow.pl + samples/winppm.pl Splitter.xs StatusBar.xs *************** *** 128,131 **** --- 135,139 ---- t/06_Cursor.t t/06_Icon.t + t/07_CustomDraw.t t/50_Font_GetMetrics.t t/50_Richedit_GetCharFormat.t Index: GUI_MessageLoops.cpp =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_MessageLoops.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GUI_MessageLoops.cpp 11 Jan 2006 21:26:16 -0000 1.17 --- GUI_MessageLoops.cpp 16 Mar 2006 08:57:48 -0000 1.18 *************** *** 170,180 **** } } - #ifdef PERLWIN32GUI_STRONGDEBUG - printf("!XS(CommonMsgLoop) returning DefWindowProc\n"); - #endif if (wndprocOriginal != NULL) { return CallWindowProc((WNDPROC_CAST) wndprocOriginal, hwnd, uMsg, wParam, lParam); } else { return DefWindowProc(hwnd, uMsg, wParam, lParam); } --- 170,183 ---- } } if (wndprocOriginal != NULL) { + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("!XS(CommonMsgLoop) returning CallWindowProc 0x%x\n", wndprocOriginal); + #endif return CallWindowProc((WNDPROC_CAST) wndprocOriginal, hwnd, uMsg, wParam, lParam); } else { + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("!XS(CommonMsgLoop) returning DefWindowProc\n"); + #endif return DefWindowProc(hwnd, uMsg, wParam, lParam); } *************** *** 323,328 **** --- 326,340 ---- PerlResult = DoEvent(NOTXSCALL childud, PERLWIN32GUI_NEM_LOSTFOCUS, "LostFocus", -1 ); break; + + /*case NM_CUSTOMDRAW: + PerlResult = DoEvent(NOTXSCALL childud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", -1 ); + childud->forceResult = PerlResult; + break;*/ + default : PerlResult = OnEvent[childud->iClass](NOTXSCALL childud, uMsg, wParam, lParam); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(WindowMsgLoop WM_NOTIFY default) (class=%d) => %d\n", childud->iClass, PerlResult); + #endif break; } *************** *** 627,637 **** case WM_DROPFILES: /* ! * (@)EVENT:DropFiles(DROP_HANDLE) * Sent when the window receives dropped files. ! * (@)APPLIES_TO:* */ ! PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_DROPFILE, "DropFiles", ! PERLWIN32GUI_ARGTYPE_LONG, (LONG) wParam, ! -1); break; } --- 639,658 ---- case WM_DROPFILES: /* ! * (@)EVENT:DropFiles(DRAGDROP) ! * (@)APPLIES_TO:Window, DialogBox ! * * Sent when the window receives dropped files. ! * ! * DRAGDROP - L<DragDrop|Win32::GUI::DragDrop> object. ! * */ ! ! #ifdef PERLWIN32GUI_STRONGDEBUG ! printf("XS(WindowMsgLoop DropFiles) (HDROP=0x%x)\n", wParam); ! #endif ! PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_DROPFILE, "DropFiles", ! PERLWIN32GUI_ARGTYPE_SV, ! CreateObjectWithHandle(NOTXSCALL "Win32::GUI::DragDrop", (HWND) wParam), ! -1 ); break; } *************** *** 966,972 **** break; case WM_DROPFILES: ! PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_DROPFILE, "DropFiles", ! PERLWIN32GUI_ARGTYPE_LONG, (LONG) wParam, ! -1); } --- 987,994 ---- break; case WM_DROPFILES: ! PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_DROPFILE, "DropFiles", ! PERLWIN32GUI_ARGTYPE_SV, ! CreateObjectWithHandle(NOTXSCALL "Win32::GUI::DragDrop", (HWND) wParam), ! -1 ); } Index: CHANGELOG =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/CHANGELOG,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** CHANGELOG 11 Jan 2006 21:26:14 -0000 1.70 --- CHANGELOG 16 Mar 2006 08:57:42 -0000 1.71 *************** *** 6,9 **** --- 6,32 ---- Win32-GUI ChangeLog =================== + + [Reini Urban] : 15 Mar 2006 + - GUI.pm : Change version to 1.04, add -dropfiles to Window + - GUI.h : add CustomDraw and DropFiles support, + start with thread safe static data definitions. + - Button.xs, Header.xs, ListView.xs, Rebar.xs, Toolbar.xs, Tooltip.xs, TreeView.xs: + add CustomDraw EVENT with Win32::GUI::Button::CustomDraw object as param. + abuse the PAINT constant for NEM, which should not conflict. + - CustomDraw.pm : CustomDraw package definition and helpers + - GUI.xs : DoEvents(hwnd=NULL,wMsgFilterMin=0,wMsgFilterMax=0,wRemoveMsg=PM_REMOVE), + Try additional OEM ressource in LoadImage, + Add Win32::GUI::DragDrop object which is passed to the DropFiles event as argument. + - GUI_Helpers.cpp: add SV* CreateNMCustomDraw() + - GUI_MessageLoops.cpp : Change DropFiles EVENT to pass the Win32::GUI::DragDrop object + - ImageList.xs: Add to documention. + - TYPEMAP: Add HDROP as first-class citizen (Win32::GUI::DragDrop) + - Window.xs: support -dropfiles property, store it onPostCreate in perlcs + - SrcParser.pm, Documentation.txt: fix some typos + - t/07_CustomDraw.t: added + - samples/CustomDraw.pl: added + - guard against Win32::GetFileVersion for older perls + - guard against undefined NOTIFYICONDATA for older compilers also (<= MSVC98) + - Upped version to 1.03_03 + + [Robert May] : 11 Jan 2006 - bug fixes and add balloon tips for Notify Icon - Label.xs correct -truncate option processing, as SS_.*ELLIPSIS.* Index: ImageList.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/ImageList.xs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImageList.xs 5 Oct 2005 22:20:49 -0000 1.7 --- ImageList.xs 16 Mar 2006 08:57:48 -0000 1.8 *************** *** 48,52 **** ########################################################################### # (@)METHOD:BeginDrag(INDEX, X, Y) ! # Creates a temporary image list that is used for dragging. BOOL BeginDrag(handle, index, x, y) --- 48,52 ---- ########################################################################### # (@)METHOD:BeginDrag(INDEX, X, Y) ! # Creates a temporary image list that is used for dragging. BOOL BeginDrag(handle, index, x, y) *************** *** 212,216 **** ########################################################################### # (@)METHOD:GetBkColor() ! # Retrieves the current background color for an image list. COLORREF GetBkColor(handle) --- 212,216 ---- ########################################################################### # (@)METHOD:GetBkColor() ! # Retrieves the current background color for an image list. COLORREF GetBkColor(handle) *************** *** 231,235 **** PREINIT: HICON hicon; ! PPCODE: hicon = ImageList_GetIcon(handle, index, flags); if (hicon == NULL) XSRETURN_UNDEF; --- 231,235 ---- PREINIT: HICON hicon; ! PPCODE: hicon = ImageList_GetIcon(handle, index, flags); if (hicon == NULL) XSRETURN_UNDEF; *************** *** 280,284 **** int cx UINT uFlags ! UINT uType COLORREF crMask HINSTANCE hi --- 280,284 ---- int cx UINT uFlags ! UINT uType COLORREF crMask HINSTANCE hi *************** *** 298,305 **** XPUSHs(CreateObjectWithHandle(NOTXSCALL "Win32::GUI::ImageList", (HWND) handle)); XSRETURN(1); ! ########################################################################### # (@)METHOD:Merge(INDEX1,INDEX2, DX,DY,[IMAGELIST=SELF]) ! # Creates a new image by combining two existing images. The function also creates a new image list in which to store the image. # Return a new Win32::GUI::ImageList object. void --- 298,305 ---- XPUSHs(CreateObjectWithHandle(NOTXSCALL "Win32::GUI::ImageList", (HWND) handle)); XSRETURN(1); ! ########################################################################### # (@)METHOD:Merge(INDEX1,INDEX2, DX,DY,[IMAGELIST=SELF]) ! # Creates a new image by combining two existing images. The function also creates a new image list in which to store the image. # Return a new Win32::GUI::ImageList object. void *************** *** 317,321 **** if (hnew == NULL) XSRETURN_UNDEF; XPUSHs(CreateObjectWithHandle(NOTXSCALL "Win32::GUI::ImageList", (HWND) hnew)); ! XSRETURN(1); # TODO : ImageList_Read --- 317,321 ---- if (hnew == NULL) XSRETURN_UNDEF; XPUSHs(CreateObjectWithHandle(NOTXSCALL "Win32::GUI::ImageList", (HWND) hnew)); ! XSRETURN(1); # TODO : ImageList_Read *************** *** 364,368 **** ########################################################################### # (@)METHOD:SetBkColor(COLOR) ! # Sets the background color for an image list. COLORREF SetBkColor(handle, color) --- 364,368 ---- ########################################################################### # (@)METHOD:SetBkColor(COLOR) ! # Sets the background color for an image list. COLORREF SetBkColor(handle, color) *************** *** 378,382 **** # Creates a new drag image by combining the specified image (typically a # mouse cursor image) with the current drag image. ! BOOL SetDragCursorImage(handle, index, x, y) HIMAGELIST handle --- 378,382 ---- # Creates a new drag image by combining the specified image (typically a # mouse cursor image) with the current drag image. ! BOOL SetDragCursorImage(handle, index, x, y) HIMAGELIST handle *************** *** 391,396 **** ########################################################################### # (@)METHOD:SetIconSize(CX, CY) ! # Sets the dimensions of images in an image list and removes all images from the list. ! BOOL SetIconSize(handle, x, y) HIMAGELIST handle --- 391,396 ---- ########################################################################### # (@)METHOD:SetIconSize(CX, CY) ! # Sets the dimensions of images in an image list and removes all images from the list. ! BOOL SetIconSize(handle, x, y) HIMAGELIST handle *************** *** 405,409 **** # (@)METHOD:SetImageCount(COUNT) # Resizes an existing image list. ! BOOL SetImageCount(handle, count) HIMAGELIST handle --- 405,409 ---- # (@)METHOD:SetImageCount(COUNT) # Resizes an existing image list. ! BOOL SetImageCount(handle, count) HIMAGELIST handle *************** *** 417,421 **** # (@)METHOD:SetOverlayImage(INDEX, OVERLAY) # Adds a specified image to the list of images to be used as overlay masks. ! BOOL SetOverlayImage(handle, index, overlay) HIMAGELIST handle --- 417,421 ---- # (@)METHOD:SetOverlayImage(INDEX, OVERLAY) # Adds a specified image to the list of images to be used as overlay masks. ! BOOL SetOverlayImage(handle, index, overlay) HIMAGELIST handle *************** *** 428,432 **** # TODO : ImageList_Write ! ########################################################################### # (@)METHOD:AddIcon(ICON) --- 428,432 ---- # TODO : ImageList_Write ! ########################################################################### # (@)METHOD:AddIcon(ICON) *************** *** 480,483 **** --- 480,484 ---- # if no parameter is given, returns a 2 element array (X, Y), # otherwise sets the size to the given parameters. + # If X and Y is given, also removes all images from the list. void Size(handle,...) *************** *** 521,526 **** # (@)METHOD:DragEnter(WINDOW, X, Y) # Locks updates to the specified window during a drag operation and displays ! # the drag image at the specified position within the window. ! # # Class method : Win32::GUI::ImageList::DragEnter($window, $x, $y) BOOL --- 522,527 ---- # (@)METHOD:DragEnter(WINDOW, X, Y) # Locks updates to the specified window during a drag operation and displays ! # the drag image at the specified position within the window. ! # # Class method : Win32::GUI::ImageList::DragEnter($window, $x, $y) BOOL *************** *** 537,542 **** # (@)METHOD:DragLeave(WINDOW) # Unlocks the specified window and hides the drag image, allowing the window ! # to be updated. ! # # Class method : Win32::GUI::ImageList::DragLeave($window) BOOL --- 538,543 ---- # (@)METHOD:DragLeave(WINDOW) # Unlocks the specified window and hides the drag image, allowing the window ! # to be updated. ! # # Class method : Win32::GUI::ImageList::DragLeave($window) BOOL *************** *** 551,555 **** # (@)METHOD:DragMove(X, Y) # Locks updates to the specified window during a drag operation and displays ! # the drag image at the specified position within the window. # # Class method : Win32::GUI::ImageList::DragMove($x, $y) --- 552,556 ---- # (@)METHOD:DragMove(X, Y) # Locks updates to the specified window during a drag operation and displays ! # the drag image at the specified position within the window. # # Class method : Win32::GUI::ImageList::DragMove($x, $y) Index: GUI_Helpers.cpp =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Helpers.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GUI_Helpers.cpp 11 Jan 2006 21:26:15 -0000 1.15 --- GUI_Helpers.cpp 16 Mar 2006 08:57:48 -0000 1.16 *************** *** 419,422 **** --- 419,470 ---- /* ########################################################################## + # (@)INTERNAL:CreateNMCustomDraw(char* class_name, HWND handle) + # Create a (tied ?) object in specified CustomDraw class and initialize the base struct. + # Tie would help in FETCH from property, but the methods via AUTOLOAD are enough. + */ + SV* CreateNMCustomDraw(NOTXSPROC char* class_name, void * lParam) { + LPPERLWIN32GUI_NMCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMCUSTOMDRAW) lParam; + HV *hv = newHV(); + hv_store_mg(NOTXSCALL hv, "-handle", 7, newSVuv((DWORD)lParam), 0); + hv_store_mg(NOTXSCALL hv, "-windowfrom",11, newSViv((DWORD)lpCD->hdr.hwndFrom), 0); + hv_store_mg(NOTXSCALL hv, "-idfrom", 7, newSViv((ULONG)lpCD->hdr.idFrom), 0); + hv_store_mg(NOTXSCALL hv, "-code", 5, newSViv((ULONG)lpCD->hdr.code), 0); + hv_store_mg(NOTXSCALL hv, "-drawstage", 10, newSViv((DWORD)lpCD->dwDrawStage), 0); + hv_store_mg(NOTXSCALL hv, "-hdc", 4, newSVuv((ULONG)lpCD->hdc), 0); + AV *rect = newAV(); + av_push(rect, newSViv(lpCD->rc.left)); + av_push(rect, newSViv(lpCD->rc.top)); + av_push(rect, newSViv(lpCD->rc.right)); + av_push(rect, newSViv(lpCD->rc.bottom)); + hv_store_mg(NOTXSCALL hv, "-rect", 5, newRV_inc((SV *)rect), 0); + hv_store_mg(NOTXSCALL hv, "-item", 5, newSViv((DWORD)lpCD->dwItemSpec), 0); + hv_store_mg(NOTXSCALL hv, "-itemstate", 10, newSVuv((ULONG)lpCD->uItemState), 0); + hv_store_mg(NOTXSCALL hv, "-itemlparam",11, newSVuv((ULONG)lpCD->lItemlParam), 0); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s)", class_name); + printf(" (-handle=0x%x, -item=%d, -drawstage=%d, -itemstage=%d, -hdc=0x%x) \n", + lParam, lpCD->dwItemSpec, lpCD->dwDrawStage, lpCD->uItemState, lpCD->hdc); + #endif + + #ifdef ENABLE_TIE_CUSTOMDRAW + /* + From perlguts - Understanding the Magic of Tied Hashes and Arrays: + First create a new hash, then create a second + hash which it blesses into the class which will + implement the tie methods. Lastly tie the two hashes + together, and return a reference to the new tied hash. + */ + SV *tie = sv_2mortal(newRV((SV*)newHV())); + sv_bless(tie, gv_stashpv(class_name, 0)); + hv_magic(hv, (GV*)tie, PERL_MAGIC_tied); + #endif + + SV* cv = sv_2mortal(newRV((SV*)hv)); + sv_bless(cv, gv_stashpv(class_name, TRUE)); + return cv; + } + + /* + ########################################################################## # (@)INTERNAL:GetMenuFromID(ID, *name) # Gets the menu handle (HMENU) from the ID, searching in Perl's global *************** *** 481,485 **** itoa(nID, temp, 10); name = hv_fetch_mg(NOTXSCALL hash, temp, strlen(temp), FALSE); ! if(name == NULL) return FALSE; strcpy(Name, (char *) SvPV_nolen(*name)); return TRUE; --- 529,538 ---- itoa(nID, temp, 10); name = hv_fetch_mg(NOTXSCALL hash, temp, strlen(temp), FALSE); ! if(name == NULL) { ! #ifdef PERLWIN32GUI_STRONGDEBUG ! printf("XS(GetAcceleratorName) no name found\n"); ! #endif ! return FALSE; ! } strcpy(Name, (char *) SvPV_nolen(*name)); return TRUE; Index: Readme.html =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Readme.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Readme.html 3 Dec 2005 01:56:31 -0000 1.5 --- Readme.html 16 Mar 2006 08:57:48 -0000 1.6 *************** *** 62,67 **** <hr /> <h1><a name="availability">AVAILABILITY</a></h1> ! <p>This is the README file for Win32::GUI v1.03 ! built on 22 Nov 2005.</p> <p>Source and ActiveState Perl PPMs are available from <a href="http://sourceforge.net/project/showfiles.php?group_id=16572">http://sourceforge.net/project/showfiles.php</a>.</p> --- 62,67 ---- <hr /> <h1><a name="availability">AVAILABILITY</a></h1> ! <p>This is the README file for Win32::GUI v1.03_03 ! built on 15 Mar 2006.</p> <p>Source and ActiveState Perl PPMs are available from <a href="http://sourceforge.net/project/showfiles.php?group_id=16572">http://sourceforge.net/project/showfiles.php</a>.</p> *************** *** 195,199 **** nmake test nmake ppm</pre> ! <p>This procedure will generate a PPM for you current perl environment, including the HTML documentation, ready for installation as above.</p> <p> --- 195,199 ---- nmake test nmake ppm</pre> ! <p>This procedure will generate a PPM for your current perl environment, including the HTML documentation, ready for installation as above.</p> <p> *************** *** 201,205 **** <hr /> <h1><a name="version">VERSION</a></h1> ! <p>Documentation for Win32::GUI v1.03 created 22 Nov 2005</p> <p>This document is autogenerated by the build process. Edits made here will be lost. Edit <em>docs/GUI/UserGuide/Readme.pod</em> instead.</p> --- 201,205 ---- <hr /> <h1><a name="version">VERSION</a></h1> ! <p>Documentation for Win32::GUI v1.03_03 created 15 Mar 2006</p> <p>This document is autogenerated by the build process. Edits made here will be lost. Edit <em>docs/GUI/UserGuide/Readme.pod</em> instead.</p> *************** *** 215,219 **** <hr /> <h1><a name="copyright_and_licence">COPYRIGHT and LICENCE</a></h1> ! <p>Copyright (c) 1997..2005 Aldo Calpini. All rights reserved.</p> <p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> --- 215,219 ---- <hr /> <h1><a name="copyright_and_licence">COPYRIGHT and LICENCE</a></h1> ! <p>Copyright (c) 1997..2006 Aldo Calpini. All rights reserved.</p> <p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> Index: Button.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Button.xs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Button.xs 3 Aug 2005 21:45:55 -0000 1.6 --- Button.xs 16 Mar 2006 08:57:42 -0000 1.7 *************** *** 99,102 **** --- 99,103 ---- else if Parse_Event("Disable", PERLWIN32GUI_NEM_CONTROL2) else if Parse_Event("Push", PERLWIN32GUI_NEM_CONTROL3) + else if Parse_Event("CustomDraw", PERLWIN32GUI_NEM_PAINT) else retval = FALSE; *************** *** 165,168 **** --- 166,217 ---- break; + case NM_CUSTOMDRAW: + { + /* + * (@)EVENT:CustomDraw(CUSTOMDRAW) + * Sent by a Button control to notify its parent windows about + * drawing operations. + * + * CUSTOMDRAW - L<Win32::GUI::Button::CustomDraw> object holding + * the NMCUSTOMDRAW structure. + * + * Return Value: + * The value your application must return depends on + * L<-drawstate|Win32::GUI::CustomDraw/DrawState>. + * + * CDRF_NOTIFYPOSTERASE (-drawstage == CDDS_PREERASE) + * The control will notify the parent after erasing an item. + * + * CDRF_NOTIFYPOSTPAINT (-drawstage == CDDS_PREPAINT) + * The control will notify the parent after painting an item. + * + * CDRF_SKIPDEFAULT (-drawstage == CDDS_PREERASE or CDDS_PREPAINT) + * The application drew the item manually. The control will not draw + * the item. + * + * Remarks: + * + * If the button control is marked ownerdraw (BS_OWNERDRAW), the custom draw + * notification is not sent. + * + * Note: To use this API, you must provide a manifest specifying Comclt32.dll + * version 6.0. + * + * (@)APPLIES_TO:Button + */ + char class_name[] = "Win32::GUI::Button::CustomDraw"; + LPPERLWIN32GUI_NMCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMCUSTOMDRAW) lParam; + SV *obj = CreateNMCustomDraw(NOTXSCALL class_name, lpCD); + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", + PERLWIN32GUI_ARGTYPE_SV, obj, + -1); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); + #endif + perlud->forceResult = PerlResult; + PerlResult = 0; /* MsgLoop return ForceResult */ + } + break; + default: PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL1, "Anonymous", --- NEW FILE: CustomDraw.pm --- package Win32::GUI::CustomDraw; # By Reini Urban ########################################################################### # (@)PACKAGE:Win32::GUI::CustomDraw # Object passed to the CustomDraw event handler - the NMCUSTOMDRAW struct. # Created by the L<CustomDraw|Win32::GUI::Header/CustomDraw (Win32::GUI::CustomDraw)> event. # # Defines the following general methods and properties: # # Handle() -handle (read-only) # WindowFrom() -windowfrom # IdFrom() -idfrom # Code() -code # DrawStage() -drawstage # HDC() -hdc (read-only) # Rect() -rect # Item() -item # ItemState() -itemstate # ItemLParam() -itemlparam # # Derived classes define extended properties and methods. # See L<Win32::GUI::TreeView::CustomDraw>, # L<Win32::GUI::ListView::CustomDraw>, # L<Win32::GUI::Toolbar::CustomDraw>, # L<Win32::GUI::Header::CustomDraw>, # L<Win32::GUI::Button::CustomDraw>, # L<Win32::GUI::Rebar::CustomDraw>, # L<Win32::GUI::Tooltip::CustomDraw>, # L<Win32::GUI::TrackBar::CustomDraw>, ########################################################################### # (@)EVENT:CustomDraw(CUSTOMDRAW) # (@)APPLIES_TO:Header,ListView,Rebar,Trackbar,TreeView,Tooltip # Sent by the control to notify its parent windows about # drawing operations. # # CUSTOMDRAW - Specialized L<CustomDraw|Win32::GUI::CustomDraw> object holding the # NMCUSTOMDRAW structure. # # Return Value: # The value your application must return depends on # L<-drawstate|Win32::GUI::CustomDraw/DrawState>. # # CDRF_DODEFAULT (-drawstage == CDDS_PREPAINT) # The control will draw itself. It will not send any additional # NM_CUSTOMDRAW messages for this paint cycle. # # CDRF_NOTIFYITEMDRAW (-drawstage == CDDS_PREPAINT) # The control will notify the parent of any item-related # drawing operations. It will send NM_CUSTOMDRAW notification messages # before and after drawing items. # # CDRF_NOTIFYITEMERASE (-drawstage == CDDS_PREPAINT) # The control will notify the parent when an # item will be erased. It will send NM_CUSTOMDRAW notification messages # before and after erasing items. # # CDRF_NOTIFYPOSTERASE (-drawstage == CDDS_PREPAINT) # The control will notify the parent after erasing an item. # # CDRF_NOTIFYPOSTPAINT (-drawstage == CDDS_PREPAINT) # The control will notify the parent after painting an item. # # CDRF_NEWFONT (-drawstage == CDDS_ITEMPREPAINT) # The application specified a new font for the # item; the control will use the new font. # # CDRF_NOTIFYSUBITEMDRAW (-drawstage == CDDS_ITEMPREPAINT) # Version 4.71. Your application will receive an NM_CUSTOMDRAW # message with -drawstage set to CDDS_ITEMPREPAINT | CDDS_SUBITEM before # each subitem is drawn. You can then specify font and color for each # subitem separately or return CDRF_DODEFAULT for default # processing. # # CDRF_SKIPDEFAULT (-drawstage == CDDS_ITEMPREPAINT) # The application drew the item manually. The control will not draw # the item. # require Exporter; # require Tie::Hash; # our @ISA = qw(Exporter Tie::StdHash); our @ISA = qw(Exporter); our $VERSI0N = '0.41'; # Return values: use constant CDRF_DODEFAULT => 0; #The control will draw itself. It will not send #additional notifications for this paint cycle. #This flag cannot be used with any other flag. use constant CDRF_NEWFONT => 0x02; #Flag to notify that you changed the font or color. use constant CDRF_SKIPDEFAULT => 0x04; #The control will not perform any painting at all. use constant CDRF_NOTIFYPOSTPAINT => 0x10; #The control will send an notification when the painting cycle for the #entire control is complete. use constant CDRF_NOTIFYITEMDRAW => 0x20; #The control will notify the parent of any item-specific drawing operations. #It will send notification messages before and after it draws items. use constant CDRF_NOTIFYSUBITEMDRAW => 0x20; # use constant CDRF_NOTIFYPOSTERASE => 0x40; # use constant CDRF_NOTIFYITEMERASE => 0x80; # # DrawState states: use constant CDDS_PREPAINT => 1; #Before the paint cycle begins use constant CDDS_POSTPAINT => 2; #After the paint cycle is complete. use constant CDDS_PREERASE => 3; #Before the erase cycle begins. use constant CDDS_POSTERASE => 4; #After the erase cycle is complete. use constant CDDS_ITEMPREPAINT => 65537; #Before an item is drawn. use constant CDDS_ITEMPOSTPAINT => 65538; #After an item has been drawn. use constant CDDS_ITEMPREERASE => 65539; #Before an item is erased. use constant CDDS_ITEMPOSTERASE => 65540; #After an item has been erased. use constant CDDS_SUBITEM => 0x20000; #Shell and Common Controls Versions 4.71. # Flag combined with CDDS_ITEMPREPAINT or CDDS_ITEMPOSTPAINT if a subitem is being drawn. # This will only be set if CDRF_NOTIFYITEMDRAW is returned from CDDS_PREPAINT. # ItemState flags: use constant CDIS_CHECKED => 8; #The item is checked. use constant CDIS_DEFAULT => 32; #The item is in its default state. use constant CDIS_DISABLED => 4; #The item is disabled. use constant CDIS_FOCUS => 16; #The item is in focus. use constant CDIS_GRAYED => 2; #The item is grayed. use constant CDIS_HOT => 64; #The item is currently under the pointer ("hot"). use constant CDIS_INDETERMINATE => 256; #The item is in an indeterminate state. use constant CDIS_MARKED => 128; #The item is marked. The meaning of this is up to the implementation. use constant CDIS_SELECTED => 1; #The item is selected. use constant CDIS_SHOWKEYBOARDCUES => 512; #Version 6.0.The item is a keyboard cue. our @EXPORT = qw (CDRF_DODEFAULT CDRF_NEWFONT CDRF_SKIPDEFAULT CDRF_NOTIFYPOSTPAINT CDRF_NOTIFYITEMDRAW CDRF_NOTIFYSUBITEMDRAW CDRF_NOTIFYPOSTERASE CDRF_NOTIFYITEMERASE CDDS_PREPAINT CDDS_POSTPAINT CDDS_PREERASE CDDS_POSTERASE CDDS_ITEMPREPAINT CDDS_ITEMPOSTPAINT CDDS_ITEMPREERASE CDDS_ITEMPOSTERASE CDDS_SUBITEM CDIS_CHECKED CDIS_DEFAULT CDIS_DISABLED CDIS_FOCUS CDIS_GRAYED CDIS_HOT CDIS_SELECTED CDIS_MARKED CDIS_INDETERMINATE CDIS_SHOWKEYBOARDCUES ); sub croak {require Carp; goto &Carp::croak} # The struct is filled by the XS event and set by perl STORE via AUTOLOAD with # the methodname. Setting a property directly is disabled until tie will work. # Conventions: # - empty pack and/or size disables the setter method # - pos may be empty, will be calculated on-the-fly by _structpos() then our %Struct = (# property => methodname,size,pack,pos -windowfrom => ["WindowFrom",4,'L',0], -idfrom => ["IdFrom", 4,'L',4], -code => ["Code", 4,'L',8], -drawstage => ["DrawStage", 4,'L',12], -hdc => ["HDC", 4,undef,16], # read-only -rect => ["Rect", 4*4,undef,20],# read-only(?) -item => ["Item", 4,'L',36], # pointer -itemstate => ["ItemState", 4,'I',40], -itemlparam => ["ItemLParam",4,'L',44], -handle => ["Handle", 0,undef], # cannot store ); # NOTE: Still needed? Only if dwItemSpec is a pointer. When? # Holding the location for the item passed around. our $Item; ########################################################################### # (@)METHOD:WindowFrom( [DWORD] ) # Get or set the CustomDraw -windowfrom property. ########################################################################### # (@)METHOD:IdFrom( [DWORD] ) # Get or set the CustomDraw -idfrom property. ########################################################################### # (@)METHOD:Code( [DWORD] ) # Get or set the CustomDraw -code property. ########################################################################### # (@)METHOD:DrawStage( [INT] ) # Get or set the CustomDraw -DrawStage property. ########################################################################### # (@)METHOD:ItemLParam( [DWORD] ) # Get or set the CustomDraw -itemlparam property. ########################################################################### # (@)METHOD:ItemState( [INT] ) # Get or set(?) the CustomDraw -itemstate property. # Current item state. This value is a combination of the following: # # CDIS_CHECKED - The item is checked. # CDIS_DEFAULT - The item is in its default state. # CDIS_DISABLED - The item is disabled. # CDIS_FOCUS - The item is in focus. # CDIS_GRAYED - The item is grayed. # CDIS_HOT - The item is currently under the pointer ("hot"). # CDIS_INDETERMINATE - The item is in an indeterminate state. # CDIS_MARKED - The item is marked. The meaning of this is up to the implementation. # CDIS_SELECTED - The item is selected. # CDIS_SHOWKEYBOARDCUES - Version 6.0.The item is a keyboard cue. ########################################################################### # (@)INTERNAL:_structpos(SELF, STRUCTREF, KEY) # Helper to fill the pos pointer in the struct. sub _structpos { my $self = shift; my $h = shift; my $key = shift; return $h->{$key}->[3] if @{$h->{$key}} > 3; # TODO: warn on unsorted hashes (for now every member already has the pos) my $i = 0; for my $k (keys %$h) { # assumes sorted keys! my $size = $h->{$k}->[1]; if ($size) { $h->{$k}->[3] = $i; # store pos in 3 $i += $size; # advance by size } } return $h->{$key}->[3]; } ########################################################################### # (@)INTERNAL:AUTOLOAD(HANDLE, METHOD) sub AUTOLOAD { my $sub = $AUTOLOAD; my ($pkg,$name) = $sub =~ /(.*)::(.*?)$/; my $found; # Abort from recursion. -property must be defined in the XS event. # Here we only call the MethodName() croak "Undefined property $name" if substr($name,0,1) eq '-'; my $h = eval "*".$pkg."::Struct"."{HASH}"; for my $key (keys %$h) { if ($h->{$key}->[0] eq $name) { # found in Struct # put into the callers class, not into Win32::GUI::CustomDraw eval "sub $sub { [EMAIL PROTECTED]>1 ? \$_[0]->STORE(\"$key\",\$_[1]) : \$_[0]->{\"$key\"} }"; $found++; last; } } croak "Undefined method $sub" unless $found; goto &$sub; } ########################################################################### # (@)INTERNAL:STORE(SELF,KEY,VALUE) # Store the value in the external NMCUSTOMDRAW struct by pack. # Only called by MethodName via AUTOLOAD, KEY must be a valid -property. # # Setting a property directly is disabled until tie will work. Ex: $ctrl->{-clrtext} = 0xffffff; sub STORE { my($self, $key, $value) = @_; # Abort from recursion. MethodName must be resolved by AUTOLOAD to -property. # $key must be a valid -property croak "Undefined property $key" unless substr($key,0,1) eq '-'; my $h = eval "*".ref($self)."::Struct"."{HASH}"; if (exists $h->{$key}) { if (my $method = $self->can($h->{$key})) { # override by special method return &{$method}($self, $value); } elsif (!exists $self->{$key}) { Win32::GUI::MessageBox(NULL, "undefined XS member $key", ref $self, MB_ICONERROR | MB_OKCANCEL); } else { # Store it back to the struct my $size = $h->{$key}->[1]; my $pack = $h->{$key}->[2]; if (!$size or !$pack) { Win32::GUI::MessageBox(NULL, "Attempt to write to read-only property $key", ref $self, MB_ICONERROR | MB_OKCANCEL); return; } my $pos = $self->_structpos($h,$key); substr($self->{-handle},$pos,$size,pack($pack,$value)); # And store the perl value also. return $self->{$key} = $value; } } else { Win32::GUI::MessageBox(NULL, "undefined member $key", ref $self, MB_ICONERROR | MB_OKCANCEL); } } sub DESTROY {}; ########################################################################### ########################################################################### ########################################################################### # (@)INTERNAL:FETCH # Get the value from the hash. The struct is already unpacked by XS. # Not used and not needed since we store the value in the perl hash also. We don't tie yet. sub FETCH { my($self, $key) = @_; croak "Undefined property $key" unless substr($key,0,1) eq '-'; # abort from recursion my $h = eval "*".ref($self)."::Struct"."{HASH}"; if (exists $h->{$key}) { if (my $method = $self->can($h->{$key})) { # override by special method return &{$method}($self); } elsif (!exists $self->{$key}) { Win32::GUI::MessageBox(NULL, "undefined XS member $key", ref $self, MB_ICONERROR | MB_OKCANCEL); } else { return $self->{$key}; } } else { Win32::GUI::MessageBox(NULL, "undefined member $key", ref $self, MB_ICONERROR | MB_OKCANCEL); } } sub EXISTS { my $self = shift; return undef unless substr($_[0],0,1) eq '-'; my $h = eval "*".ref($self)."::Struct"."{HASH}"; return 1 if exists $h->{$_[0]}; return undef; } sub FIRSTKEY { my $h = eval "*".ref($self)."::Struct"."{HASH}"; my $a = scalar keys %$h; return $_[0]->{each %$h }; } sub NEXTKEY { my $h = eval "*".ref($self)."::Struct"."{HASH}"; return $_[0]->{each %$h }; } ########################################################################### ########################################################################### ########################################################################### # (@)METHOD:Item( [INT] ) # Get or set the CustomDraw -item property. # # Item number. What is contained in this member will depend on the type of # control that is sending the notification. See the L<CustomDraw|Win32::GUI::CustomDraw> # event reference for the specific control to determine what, if anything, is # contained in this member. sub Item { my($self, $value) = @_; my $key = '-item'; if (@_ > 1) { # Store the perl value. $self->{$key} = $value; # And store the pointer to the IV value back to the struct. #$Win32::GUI::CustomDraw::Item = $value; #substr($self->{-handle},36,4,Win32::GUI::SvPtr(\$Item)); substr($self->{-handle},36,4,pack("I",$value)); return $value; } else { return $self->{$key}; } } ########################################################################### # (@)METHOD:Rect( [ARRAYREF] ) # Get or set the CustomDraw -rect property. [left,right,top,bottom] # # RECT structure that describes the bounding rectangle # of the area being drawn. This member is initialized # only by the CDDS_ITEMPREPAINT notification. Version # 5.80. This member is also initialized by the # CDDS_PREPAINT notification. sub Rect { my($self, $value) = @_; my $key = '-rect'; if (@_ > 1) { croak "->Rect() requires arrayref" unless ref($value) eq 'ARRAY'; my $h = eval "*".ref($self)."::Struct"."{HASH}"; my $size = $h->{$key}->[1]; my $pack = $h->{$key}->[2]; my $pos = $self->_structpos($h,$key); substr($self->{-handle},$pos,$size,pack($pack,@$value)); # And store the perl value also. return $self->{$key} = $value; } else { return $self->{-rect}; } } ########################################################################### # (@)METHOD:HDC() # Get the CustomDraw -hdc property. # #sub HDC { # my($self, $value) = @_; # my $key = '-hdc'; # if (@_ > 1) { # Win32::GUI::MessageBox(NULL, "undefined setter for property -hdc", # ref $self, MB_ICONERROR | MB_OKCANCEL); # return; # } else { # return $self->{$key}; # } #} package Win32::GUI::ListView::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); ########################################################################### # (@)PACKAGE:Win32::GUI::ListView::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::ListView/CustomDraw (Win32::GUI::CustomDraw)> event. # # NMLVCUSTOMDRAW structure holding the ListView CustomDraw information. # # L<-item|Win32::GUI::CustomDraw/Item> contains the identifier of the item being drawn and # the L<-itemlparam|Win32::GUI::CustomDraw/ItemLParam> contains its application-defined data. # # Additional to the L<CustomDraw|Win32::GUI::CustomDraw> object it defines # the following methods (get and set) and associated properties: # # TextColor() -clrtext # BackgroundColor() -clrtextbk # SubItem() -subitem # ItemType() -itemtype #Item Custom Draw: # FaceColor() -clrface # IconEffect() -iconeffect # IconPhase() -iconphase # PartId() -partid # StateId() -stateid #Group Custom Draw: # TextRect -rctext # Align -align # # You may read from the method or property, and you may write to most methods. our %Struct = %Win32::GUI::CustomDraw::Struct; $Struct{-clrtext} = ["TextColor", 4,'L',48]; # described in ListView.xs $Struct{-clrtextbk} = ["BackgroundColor", 4,'L',52]; # described in ListView.xs ########################################################################### # (@)METHOD:SubItem( [SUBITEM] ) # Set or Get the CustomDraw -subitem property. # Index of the subitem that is being drawn. If the main item is # being drawn, this member will be zero. # # Comctl32.dll Version 4.71. $Struct{-subitem} = ["SubItem", 4,'i',56]; ########################################################################### # (@)METHOD:ItemType( [DWORD] ) # Set or Get the CustomDraw -itemtype property. # DWORD - contains the type of the item to draw. # # This member can be one of the following values: # LVCDI_ITEM - An item is to be drawn. # LVCDI_GROUP - A group is to be drawn. # # Comctl32.dll Version 6.0. use constant LVCDI_ITEM => 1; # Version 6.0 use constant LVCDI_GROUP => 2; # Version 6.0 $Struct{-itemtype} = ["ItemType", 4,'L',60]; $Struct{-clrface} = ["FaceColor", 4,'L',64]; # described in ListView.xs ########################################################################### # (@)METHOD:IconEffect( [INT] ) # Set or Get the CustomDraw -iconeffect property. # # INT - Specifies the effect that is applied to an icon, such as Glow, Shadow, or Pulse. # # Comctl32.dll Version 6.0. $Struct{-iconeffect}= ["IconEffect", 4,'i',68]; ########################################################################### # (@)METHOD:IconPhase( [INT] ) # Set or Get the CustomDraw -iconphase property. # # INT - specifies the phase of an icon. # # Comctl32.dll Version 6.0. $Struct{-iconphase} = ["IconPhase", 4,'i',72]; ########################################################################### # (@)METHOD:PartId( [INT] ) # Set or Get the CustomDraw -partid property. # # INT - Specifies the ID of the part of an item to draw. # # Comctl32.dll Version 6.0. $Struct{-partid} = ["PartId", 4,'i',76]; ########################################################################### # (@)METHOD:StateId( [INT] ) # Set or Get the CustomDraw -stateid property. # # INT - Specifies the ID of the state of an item to draw. # # Comctl32.dll Version 6.0. $Struct{-stateid} = ["StateId", 4,'i',80]; $Struct{-textrect} = ["TextRect", 16,'LLLL',84]; # described in ListView.xs ########################################################################### # (@)METHOD:Align( [INT] ) # Set or Get the CustomDraw -align property. # INT that specifies how a group should be aligned. This member can be one of the following values. # # LVGA_HEADER_CENTER - Center the group. # LVGA_HEADER_LEFT - Align the group on the left. # LVGA_HEADER_RIGHT - Align the group on the right. # # Comctl32.dll Version 6.0. $Struct{-align} = ["Align", 4,'I',100]; package Win32::GUI::Toolbar::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); ########################################################################### # (@)PACKAGE:Win32::GUI::Toolbar::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::Toolbar/CustomDraw> event. # # NMTBCUSTOMDRAW structure holding the Toolbar CustomDraw information. # # L<-item|Win32::GUI::CustomDraw/Item> contains the command identifier of the item # being drawn. # L<-itemlparam|Win32::GUI::CustomDraw/ItemLParam> contains the dwData value # for the item being drawn. # # Additional to the L<CustomDraw|Win32::GUI::CustomDraw> object it defines # the following methods (get and set) and associated properties: # # hbrMonoDither() -hbrmonodither # hbrLines() -hbrlines # hpenLines() -hpenlines # TextColor() -clrtext # MarkColor() -clrmark (if TBSTATE_MARKED) # TextHighlightColor() -clrtexthighlight # ButtonFaceColor() -clrbtnface # ButtonHighlightColor() -clrbtnhighlight # TextRect() -textrect # nStringBkMode() -nstringbkmode # nHLStringBkMode() -nhlstringbkmode # ListGap() -ilistgap # # You may read from the method or property, and you may write to most methods. our %Struct = %Win32::GUI::CustomDraw::Struct; ########################################################################### # (@)METHOD:hbrMonoDither( ) # Get the CustomDraw -hbrmonodither HBRUSH. # # Returns HBRUSH handle that the control will use when drawing the background of marked # or dithered items. This member is ignored if TBCDRF_NOMARK is returned from # the NM_CUSTOMDRAW notification. # # Comctl32.dll Version 4.70 $Struct{-hbrmonodither} = ["hbrMonoDither", 4,'L',48]; ########################################################################### # (@)METHOD:hbrLines( ) # Get the CustomDraw -hbrlines HBRUSH. # # Returns HBRUSH handle that the control will use when drawing lines on the buttons. # # Comctl32.dll Version 4.70 $Struct{-hbrlines} = ["hbrLines", 4,'L',52]; ########################################################################### # (@)METHOD:hpenLines( ) # Get the CustomDraw -hpenlines HPEN. # # Returns the HPEN handle that the control will use when drawing lines on the buttons. # # Comctl32.dll Version 4.70 $Struct{-hpenlines} = ["hpenLines", 4,'L',56]; $Struct{-clrtext} = ["TextColor", 4,'L',60]; # doc in XS. $Struct{-clrmark} = ["MarkColor", 4,'L',64]; # doc in XS. Color of text bk when marked. # (only if TBSTATE_MARKED) $Struct{-clrtexthighlight}= ["TextHighlightColor", 4,'L',68]; # doc in XS. Color of text when highlighted $Struct{-clrbtnface} = ["ButtonFaceColor", 4,'L',72]; # doc in XS. Background of the button $Struct{-clrbtnhighlight} = ["ButtonHighlightColor", 4,'L',76]; # doc in XS. 3D highlight $Struct{-clrhighlighthottrack}=["HighlightHotTrackColor", 4,'L',80]; # doc in XS. In conjunction with # fHighlightHotTrack will cause button to highlight like a menu $Struct{-textrect} = ["TextRect", 16,'LLLL',84]; # doc in XS ########################################################################### # (@)METHOD:nStringBkMode( [INT] ) # Get or set the CustomDraw -nstringbkmode. # # Background mode that the control will use when drawing the text of # a nonhighlighted item. This can be either the TRANSPARENT or OPAQUE value. # # Comctl32.dll Version 4.70 $Struct{-nstringbkmode} = ["nStringBkMode", 4,'i',100]; ########################################################################### # (@)METHOD:nHLStringBkMode( [INT] ) # Get or set the CustomDraw nhlstringbkmode property. # # Background mode that the control will use when drawing the text of # a nonhighlighted item. This can be either the TRANSPARENT or OPAQUE value. # # Comctl32.dll Version 4.70 $Struct{-nhlstringbkmode} = ["nHLStringBkMode",4,'i',104]; ########################################################################### # (@)METHOD:ListGap( [INT] ) # Get or set the CustomDraw -ilistgap property. # # Specifies the distance between the toolbar button image and the text, in # logical pixels, for toolbars that have TBSTYLE_LIST style set. # # Comctl32.dll Version 6.0 $Struct{-ilistgap} = ["ListGap", 4,'i',108]; use constant TBCDRF_BLENDICON => 0; #Version 5.00. Blend the button 50 percent with # the background. This occurs when -drawstate equals CDDS_ITEMPREPAINT. use constant TBCDRF_NOBACKGROUND => 0; #Version 5.00. Don't draw button background. # This occurs when -drawstate equals CDDS_ITEMPREPAINT. use constant TBCDRF_NOEDGES => 0x10000; #Version 4.71. Don't draw button edges. This # occurs when -drawstate equals CDDS_ITEMPREPAINT. use constant TBCDRF_HILITEHOTTRACK => 0x20000;#Version 4.71. Use the clrHighlightHotTrack member # of the NMTBCUSTOMDRAW structure to draw the background of hot-tracked items. This occurs when # -drawstate equals CDDS_ITEMPREPAINT. use constant TBCDRF_NOOFFSET => 0x40000; #Version 4.71. Don't offset button when pressed. # This occurs when -drawstate equals CDDS_ITEMPREPAINT. use constant TBCDRF_NOMARK => 0x80000; #Don't draw default highlight of items that # have the TBSTATE_MARKED. This occurs when -drawstate equals CDDS_ITEMPREPAINT. use constant TBCDRF_NOETCHEDEFFECT => 0x100000; #Version 4.71. Don't draw etched effect # for disabled items. This occurs when -drawstate equals CDDS_ITEMPREPAINT. package Win32::GUI::Header::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); our %Struct = %Win32::GUI::CustomDraw::Struct; ########################################################################### # (@)PACKAGE:Win32::GUI::Header::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::Header/CustomDraw (Win32::GUI::CustomDraw)> event handler. # # NMCUSTOMDRAW structure holding the CustomDraw information. # # L<-item|Win32::GUI::CustomDraw/Item> contains the index of the item being drawn. # L<-itemlparam|Win32::GUI::CustomDraw/ItemLParam> contains the item's lParam. # # See L<Win32::GUI::CustomDraw>. # # You may read from any method or property, and you may write to most methods. package Win32::GUI::Button::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); our %Struct = %Win32::GUI::CustomDraw::Struct; ########################################################################### # (@)PACKAGE:Win32::GUI::Button::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::Button/CustomDraw> event handler. # # NMCUSTOMDRAW structure holding the CustomDraw information. # # -itemspec contains the index of the item being drawn. # L<-itemlparam|Win32::GUI::CustomDraw/ItemLParam> contains the item's lParam.. # # See L<Win32::GUI::CustomDraw>. # # You may read from the method or property, and you may write to most methods. package Win32::GUI::Rebar::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); our %Struct = %Win32::GUI::CustomDraw::Struct; ########################################################################### # (@)PACKAGE:Win32::GUI::Rebar::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::Rebar/CustomDraw (Win32::GUI::CustomDraw)> event. # # NMCUSTOMDRAW structure holding the CustomDraw information. # # L<-item|Win32::GUI::CustomDraw/Item> contains the identifier of the band being drawn. # L<-itemlparam|Win32::GUI::CustomDraw/ItemLParam> contains the lParam of the band being drawn. # # See L<Win32::GUI::CustomDraw>. # # You may read from the method or property, and you may write to most methods. package Win32::GUI::Tooltip::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); our %Struct = %Win32::GUI::CustomDraw::Struct; ########################################################################### # (@)PACKAGE:Win32::GUI::Tooltip::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::Tooltip/CustomDraw (Win32::GUI::CustomDraw)> event handler. # # NMCUSTOMDRAW structure holding the CustomDraw information. # # See L<Win32::GUI::CustomDraw>. # # You may read from the method or property, and you may write to most methods. ########################################################################### # (@)METHOD:DrawFlags( [INT] ) # Get or set the CustomDraw -drawflags property. # # INT value specifying how ToolTip text will be # formatted when it is displayed. An application may # change this field to alter the way text is drawn. This # value is passed to the L<DrawText|Win32::GUI::DrawText> function # internally. All values for the uFormat parameter of # DrawText are valid. # # Comctl32.dll Version 4.70 $Struct{-drawflags} = ["DrawFlags", 4,'I',48]; package Win32::GUI::TrackBar::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); our %Struct = %Win32::GUI::CustomDraw::Struct; ########################################################################### # (@)PACKAGE:Win32::GUI::TrackBar::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::TrackBar/CustomDraw (Win32::GUI::CustomDraw)> event handler. # # NMCUSTOMDRAW structure holding the Trackbar CustomDraw information. # Trackbar controls insert the following values into the -itemspec member of # this structure to identify the portion of the control being drawn: # # TBCD_CHANNEL # Identifies the channel that the trackbar control's thumb marker slides along. # TBCD_THUMB # Identifies the trackbar control's thumb marker. This is the portion of the # control that the user moves. # TBCD_TICS # Identifies the increment tick marks that appear along the edge of the trackbar control. # # See L<Win32::GUI::CustomDraw>. # # You may read from the method or property, and you may write to most methods. use constant TBCD_TICS => 1; use constant TBCD_THUMB => 2; use constant TBCD_CHANNEL => 3; package Win32::GUI::TreeView::CustomDraw; our @ISA = qw(Win32::GUI::CustomDraw); ########################################################################### # (@)PACKAGE:Win32::GUI::TreeView::CustomDraw # Object passed to the L<CustomDraw|Win32::GUI::TreeView/CustomDraw (Win32::GUI::CustomDraw)> event handler. # # NMTVCUSTOMDRAW structure holding the TreeView CustomDraw information. # L<-item|Win32::GUI::CustomDraw/Item> contains the handle of the item being drawn. # L<-itemlparam|Win32::GUI::CustomDraw/ItemLParam> contains the lParam of the item being drawn. # # You may read from the method or property, and you may write to most methods. # # Remark: Version 5.80. If you change the font by # returning CDRF_NEWFONT, the tree-view control might # display clipped text. This behavior is necessary for # backward compatibility with earlier versions of the # common controls. If you want to change the font of a # tree-view control, you will get better results if you # send a CCM_SETVERSION message with the wParam value # set to 5 before adding any items to the control. # # See L<Win32::GUI::CustomDraw>. our %Struct = %Win32::GUI::CustomDraw::Struct; $Struct{-clrtext} = ["TextColor", 4,'L',48]; # described in TreeView.xs $Struct{-clrtextbk} = ["BackgroundColor", 4,'L',52]; # described in TreeView.xs ########################################################################### # (@)METHOD:Level( [INT] ) # Set or Get the CustomDraw -level property. # # INT - Zero-based level of the item being drawn. The root item is at level # zero, a child of the root item is at level one, and so on. # # Comctl32.dll Version 4.71. $Struct{-level} = ["Level", 4,'i',56]; Index: GUI.rc =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.rc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GUI.rc 21 Nov 2005 22:33:33 -0000 1.6 --- GUI.rc 16 Mar 2006 08:57:45 -0000 1.7 *************** *** 8,13 **** 1 VERSIONINFO ! FILEVERSION 1,03,00,00 ! PRODUCTVERSION 1,03,00,00 FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL --- 8,13 ---- 1 VERSIONINFO ! FILEVERSION 1,03,03,00 ! PRODUCTVERSION 1,03,03,00 FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL *************** *** 17,30 **** BLOCK "040904E4" { ! VALUE "Comments" , "Win32::GUI Perl module v1.03" VALUE "CompanyName" , "Open Source" VALUE "FileDescription" , "perl-win32-gui Perl extension" ! VALUE "FileVersion" , "1.03" VALUE "InternalName" , "GUI.dll" ! VALUE "LegalCopyright" , "Copyright © Aldo Caplini 1997..2005" VALUE "LegalTrademarks" , "GNU and Artistic licences" VALUE "OriginalFilename" , "GUI.dll" VALUE "ProductName" , "Win32::GUI" ! VALUE "ProductVersion" , "1.03" } } --- 17,30 ---- BLOCK "040904E4" { ! VALUE "Comments" , "Win32::GUI Perl module v1.03_03" VALUE "CompanyName" , "Open Source" VALUE "FileDescription" , "perl-win32-gui Perl extension" ! VALUE "FileVersion" , "1.03_03" VALUE "InternalName" , "GUI.dll" ! VALUE "LegalCopyright" , "Copyright © Aldo Caplini 1997..2006" VALUE "LegalTrademarks" , "GNU and Artistic licences" VALUE "OriginalFilename" , "GUI.dll" VALUE "ProductName" , "Win32::GUI" ! VALUE "ProductVersion" , "1.03_03" } } Index: Makefile.PL =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Makefile.PL,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Makefile.PL 21 Nov 2005 22:33:33 -0000 1.15 --- Makefile.PL 16 Mar 2006 08:57:48 -0000 1.16 *************** *** 209,212 **** --- 209,213 ---- 'GUI.pm' => '$(INST_LIBDIR)/GUI.pm', 'BitmapInline.pm' => '$(INST_LIBDIR)/GUI/BitmapInline.pm', + 'CustomDraw.pm' => '$(INST_LIBDIR)/GUI/CustomDraw.pm', 'GridLayout.pm' => '$(INST_LIBDIR)/GUI/GridLayout.pm', }, Index: GUI.pm =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GUI.pm 11 Jan 2006 21:26:14 -0000 1.37 --- GUI.pm 16 Mar 2006 08:57:42 -0000 1.38 *************** *** 25,29 **** # STATIC OBJECT PROPERTIES # ! $VERSION = "1.03_02"; # For MakeMaker $XS_VERSION = $VERSION; # For dynaloader $VERSION = eval $VERSION; # For Perl (see perldoc perlmodstyle) --- 25,29 ---- # STATIC OBJECT PROPERTIES # ! $VERSION = "1.03_03"; # For MakeMaker $XS_VERSION = $VERSION; # For dynaloader $VERSION = eval $VERSION; # For Perl (see perldoc perlmodstyle) *************** *** 837,841 **** # # Class specific B<%OPTIONS> are: ! # -accel => Win32::GUI::Accelerator # -accelerators => Win32::GUI::Accelerator # -acceleratortable => Win32::GUI::Accelerator --- 837,841 ---- # # Class specific B<%OPTIONS> are: ! # -accel => L<Win32::GUI::Accelerator> # -accelerators => Win32::GUI::Accelerator # -acceleratortable => Win32::GUI::Accelerator *************** *** 885,888 **** --- 885,891 ---- # -dialogui => 0/1 # Act as a dialog box. + # -dropfiles => 0/1 (default 0) + # Accept L<DragAcceptFiles|Win32::GUI::DragDrop::DragAcceptFiles>. + # Reacts on a L<DropFiles|Win32::GUI::Window::DropFiles> event. sub new { my $self = Win32::GUI->_new(Win32::GUI::constant("WIN32__GUI__WINDOW", 0), @_); *************** *** 2766,2773 **** # has been loaded. package Win32::GUI::NotifyIcon; ! use Win32(); our $SHELLDLL_VERSION; BEGIN { $SHELLDLL_VERSION = (Win32::GetFileVersion('shell32'))[0]; } --- 2769,2781 ---- # has been loaded. package Win32::GUI::NotifyIcon; ! use Win32; our $SHELLDLL_VERSION; BEGIN { + if (Win32->can('GetFileVersion')) { + # added to perl 12 May 2005 $SHELLDLL_VERSION = (Win32::GetFileVersion('shell32'))[0]; + } else { + $SHELLDLL_VERSION = 0; + } } Index: NotifyIcon.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/NotifyIcon.xs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NotifyIcon.xs 11 Jan 2006 21:26:16 -0000 1.4 --- NotifyIcon.xs 16 Mar 2006 08:57:48 -0000 1.5 *************** *** 29,34 **** --- 29,36 ---- nid.uCallbackMessage = WM_NOTIFYICON; SwitchBit(nid.uFlags, NIF_MESSAGE, 1); + #if (_WIN32_IE > 0x0501) SwitchBit(nid.uFlags, NIF_INFO, 1); nid.uTimeout = 10000; + #endif ParseNotifyIconOptions(NOTXSCALL sp, mark, ax, items, 1, &nid); *************** *** 50,54 **** --- 52,58 ---- nid.cbSize = NOTIFYICONDATA_V1_SIZE; nid.hWnd = parent; + #if (_WIN32_IE > 0x0501) nid.uTimeout = 10000; + #endif ParseNotifyIconOptions(NOTXSCALL sp, mark, ax, items, 1, &nid); *************** *** 85,88 **** --- 89,93 ---- NOTIFYICONDATA nid; CODE: + #if (_WIN32_IE > 0x0501) ZeroMemory(&nid, sizeof(NOTIFYICONDATA)); nid.cbSize = NOTIFYICONDATA_V1_SIZE; *************** *** 92,95 **** --- 97,103 ---- RETVAL = Shell_NotifyIcon(NIM_SETFOCUS, &nid); + #else + RETVAL = 0; + #endif OUTPUT: RETVAL *************** *** 103,106 **** --- 111,115 ---- NOTIFYICONDATA nid; CODE: + #if (_WIN32_IE > 0x0501) ZeroMemory(&nid, sizeof(NOTIFYICONDATA)); nid.cbSize = NOTIFYICONDATA_V1_SIZE; *************** *** 110,113 **** --- 119,125 ---- RETVAL = Shell_NotifyIcon(NIM_SETVERSION, &nid); + #else + RETVAL = 0; + #endif OUTPUT: RETVAL Index: Header.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Header.xs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Header.xs 17 Apr 2004 08:34:10 -0000 1.3 --- Header.xs 16 Mar 2006 08:57:48 -0000 1.4 *************** *** 54,57 **** --- 54,58 ---- else if Parse_Event("ItemClick", PERLWIN32GUI_NEM_CONTROL5) else if Parse_Event("ItemDblClick", PERLWIN32GUI_NEM_CONTROL6) + else if Parse_Event("CustomDraw", PERLWIN32GUI_NEM_PAINT) else retval = FALSE; *************** *** 173,176 **** --- 174,193 ---- -1); break; + + case NM_CUSTOMDRAW: + { + char class_name[] = "Win32::GUI::Header::CustomDraw"; + LPPERLWIN32GUI_NMCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMCUSTOMDRAW) lParam; + SV *obj = CreateNMCustomDraw(NOTXSCALL class_name, lpCD); + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", + PERLWIN32GUI_ARGTYPE_SV, obj, + -1); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); + #endif + perlud->forceResult = PerlResult; + PerlResult = 0; /* MsgLoop return ForceResult */ + } + break; } } Index: GUI.h =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GUI.h 12 Jan 2006 22:23:27 -0000 1.25 --- GUI.h 16 Mar 2006 08:57:42 -0000 1.26 *************** *** 185,188 **** --- 185,189 ---- #define PERLWIN32GUI_NEM_CONTROL6 0x04000000 #define PERLWIN32GUI_NEM_CONTROL7 0x02000000 + // BeginDrag in ListView, InitMenu in Window #define PERLWIN32GUI_NEM_CONTROL8 0x01000000 *************** *** 271,274 **** --- 272,276 ---- DWORD dwFlags; DWORD dwFlagsMask; + int iDropFiles; } PERLWIN32GUI_CREATESTRUCT, *LPPERLWIN32GUI_CREATESTRUCT; *************** *** 307,310 **** --- 309,330 ---- } PERLWIN32GUI_MENUITEMDATA, *LPPERLWIN32GUI_MENUITEMDATA; + typedef struct tagPERLWIN32GUI_NMCUSTOMDRAWINFO { + NMHDR hdr; + DWORD dwDrawStage; + HDC hdc; + RECT rc; + DWORD* dwItemSpec; + UINT uItemState; + LPARAM lItemlParam; + } PERLWIN32GUI_NMCUSTOMDRAW, *LPPERLWIN32GUI_NMCUSTOMDRAW; + + /* Experimental: thread safe static data */ + #define MY_CXT_KEY "Win32::GUI::_guts" XS_VERSION + typedef struct { + int count; + PERLWIN32GUI_USERDATA perlud; + PERLWIN32GUI_CREATESTRUCT perlcs; + PERLWIN32GUI_NMCUSTOMDRAW perlcd; + } my_cxt_t; #define ValidUserData(ptr) (ptr != NULL && ptr->dwSize == sizeof(PERLWIN32GUI_USERDATA)) *************** *** 412,415 **** --- 432,436 ---- //BOOL GetObjectNameAndClass(NOTXSPROC HWND hwnd, char *Name, int *obj_class); SV* CreateObjectWithHandle(NOTXSPROC char* class_name, HWND handle); + SV* CreateNMCustomDraw(NOTXSPROC char* class_name, void* lParam); HMENU GetMenuFromID(NOTXSPROC int nID); BOOL GetMenuName(NOTXSPROC HWND hwnd, int nID, char *Name); *************** *** 781,788 **** #endif - #ifndef NOTIFYICONDATA_V1_SIZE - # define NOTIFYICONDATA_V1_SIZE CCSIZEOF_STRUCT(NOTIFYICONDATA, szTip[63]) - #endif - #else #define WNDPROC_CAST FARPROC --- 802,805 ---- *************** *** 790,793 **** --- 807,814 ---- #endif + // MINGW, cygwin and MSVC <= 98 + #ifndef NOTIFYICONDATA_V1_SIZE + # define NOTIFYICONDATA_V1_SIZE CCSIZEOF_STRUCT(NOTIFYICONDATA, szTip[63]) + #endif // MSVC6 patches *************** *** 862,863 **** --- 883,887 ---- #endif /* defined(_MSC_VER) && (_MSC_VER <= 1200) && (WINVER < 0x0500) */ + + /* Tie the CustomDraw object or not? Currently not working, STORE is done via AUTOLOAD. */ + #undef ENABLE_TIE_CUSTOMDRAW Index: ListView.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/ListView.xs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ListView.xs 3 Dec 2005 01:56:31 -0000 1.10 --- ListView.xs 16 Mar 2006 08:57:48 -0000 1.11 *************** *** 10,14 **** #include "GUI.h" ! void ListView_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { --- 10,35 ---- #include "GUI.h" ! typedef struct tagPERLWIN32GUI_NMLVCUSTOMDRAWINFO { ! PERLWIN32GUI_NMCUSTOMDRAW nmcd; ! COLORREF clrText; ! COLORREF clrTextBk; ! #if (_WIN32_IE >= 0x0400) ! int iSubItem; ! #endif ! #if (_WIN32_IE >= 0x560) ! DWORD dwItemType; ! // Item Custom Draw ! COLORREF clrFace; ! int iIconEffect; ! int iIconPhase; ! int iPartId; ! int iStateId: ! // Group Custom Draw ! RECT rcText; ! UINT uAlign; ! #endif ! } PERLWIN32GUI_NMLVCUSTOMDRAW, *LPPERLWIN32GUI_NMLVCUSTOMDRAW; ! ! void ListView_onPreCreate(NOTXSPROC LPPERLWIN32GUI_CREATESTRUCT perlcs) { *************** *** 35,42 **** } else if(strcmp(option, "-imagelist") == 0) { perlcs->hImageList = (HIMAGELIST) handle_From(NOTXSCALL value); ! } else if BitmaskOptionValue("-report", perlcs->cs.style, LVS_REPORT) } else if BitmaskOptionValue("-list", perlcs->cs.style, LVS_LIST) ! } else if BitmaskOptionValue("-singlesel", perlcs->cs.style, LVS_SINGLESEL) } else if BitmaskOptionValue("-showselalways", perlcs->cs.style, LVS_SHOWSELALWAYS) } else if BitmaskOptionValue("-sortascending", perlcs->cs.style, LVS_SORTASCENDING) --- 56,63 ---- } else if(strcmp(option, "-imagelist") == 0) { perlcs->hImageList = (HIMAGELIST) handle_From(NOTXSCALL value); ! } else if BitmaskOptionValue("-report", perlcs->cs.style, LVS_REPORT) } else if BitmaskOptionValue("-list", perlcs->cs.style, LVS_LIST) ! } else if BitmaskOptionValue("-singlesel", perlcs->cs.style, LVS_SINGLESEL) } else if BitmaskOptionValue("-showselalways", perlcs->cs.style, LVS_SHOWSELALWAYS) } else if BitmaskOptionValue("-sortascending", perlcs->cs.style, LVS_SORTASCENDING) *************** *** 73,77 **** ListView_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! if (perlcs->dwFlagsMask != 0) ListView_SetExtendedListViewStyleEx(myhandle, perlcs->dwFlagsMask, perlcs->dwFlags); --- 94,99 ---- ListView_onPostCreate(NOTXSPROC HWND myhandle, LPPERLWIN32GUI_CREATESTRUCT perlcs) { ! // NOTE: Currently nobody sets this dwFlagsMask ! if (perlcs->dwFlags != 0) //dwFlagsMask ListView_SetExtendedListViewStyleEx(myhandle, perlcs->dwFlagsMask, perlcs->dwFlags); *************** *** 82,86 **** if(perlcs->clrBackground != CLR_INVALID) { SendMessage((HWND)myhandle, LVM_SETBKCOLOR, (WPARAM) 0, (LPARAM) perlcs->clrBackground); ! perlcs->clrBackground = CLR_INVALID; // Don't store } } --- 104,108 ---- if(perlcs->clrBackground != CLR_INVALID) { SendMessage((HWND)myhandle, LVM_SETBKCOLOR, (WPARAM) 0, (LPARAM) perlcs->clrBackground); ! perlcs->clrBackground = CLR_INVALID; // Don't store } } *************** *** 99,105 **** --- 121,134 ---- else if Parse_Event("EndLabelEdit", PERLWIN32GUI_NEM_CONTROL7) else if Parse_Event("BeginDrag", PERLWIN32GUI_NEM_CONTROL8) + else if Parse_Event("CustomDraw", PERLWIN32GUI_NEM_PAINT) else if Parse_Event("KeyDown", PERLWIN32GUI_NEM_KEYDOWN) else retval = FALSE; + // TODO: + // InsertItem + // ItemActivate + // HotTrack + // DeleteItem + // CustomDraw - should we use the event name Paint here? return retval; *************** *** 122,129 **** /* * (@)EVENT:BeginDrag(ITEM) ! * Notifies a list-view control that a drag-and-drop operation involving the left mouse * button is being initiated. Passes the item being dragged. * (@)APPLIES_TO:ListView ! */ PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL8, "BeginDrag", PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_notify->iItem,-1); --- 151,158 ---- /* * (@)EVENT:BeginDrag(ITEM) ! * Notifies a list-view control that a drag-and-drop operation involving the left mouse * button is being initiated. Passes the item being dragged. * (@)APPLIES_TO:ListView ! */ PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL8, "BeginDrag", PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_notify->iItem,-1); *************** *** 138,142 **** * CHANGED specifies the item attributes that have changed (LVIF_). * (@)APPLIES_TO:ListView ! */ case LVN_ITEMCHANGING: --- 167,171 ---- * CHANGED specifies the item attributes that have changed (LVIF_). * (@)APPLIES_TO:ListView ! */ case LVN_ITEMCHANGING: *************** *** 156,160 **** break; ! /* * (@)EVENT:ItemChanged(ITEM, NEWSTATE, OLDSTATE, CHANGED) --- 185,189 ---- break; ! /* * (@)EVENT:ItemChanged(ITEM, NEWSTATE, OLDSTATE, CHANGED) *************** *** 205,209 **** // TODO : LVN_DELETEITEM : // TODO : LVN_ITEMACTIVATE ! case LVN_COLUMNCLICK: /* --- 234,238 ---- // TODO : LVN_DELETEITEM : // TODO : LVN_ITEMACTIVATE ! case LVN_COLUMNCLICK: /* *************** *** 227,231 **** * For a ListView to receive this event, -editlabels need to be set to true. * (@)APPLIES_TO:ListView ! */ case LVN_BEGINLABELEDIT: --- 256,260 ---- * For a ListView to receive this event, -editlabels need to be set to true. * (@)APPLIES_TO:ListView ! */ case LVN_BEGINLABELEDIT: *************** *** 241,254 **** break; ! /* * (@)EVENT:EndLabelEdit(ITEM,TEXT) * Sent when the user has finished editing a label in the ListView control. ! * You have explicitly set the text of the item to reflect the new changes. * If the user cancels the edit, the text is undef. * (@)APPLIES_TO:ListView */ ! case LVN_ENDLABELEDIT: pItem = &((LV_DISPINFO*)lParam)->item; --- 270,283 ---- break; ! /* * (@)EVENT:EndLabelEdit(ITEM,TEXT) * Sent when the user has finished editing a label in the ListView control. ! * You have explicitly set the text of the item to reflect the new changes. * If the user cancels the edit, the text is undef. * (@)APPLIES_TO:ListView */ ! case LVN_ENDLABELEDIT: pItem = &((LV_DISPINFO*)lParam)->item; *************** *** 263,276 **** PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL7, "EndLabelEdit", PERLWIN32GUI_ARGTYPE_LONG, (LONG) pItem->iItem, ! -1); } ! break; case LVN_KEYDOWN: { - LV_KEYDOWN FAR * lv_keydown = (LV_KEYDOWN FAR *) lParam; /* ! * (@)EVENT:KeyDown(KEY) * Sent when the user presses a key while the ListView * control has focus; KEY is the ASCII code of the --- 292,304 ---- PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_CONTROL7, "EndLabelEdit", PERLWIN32GUI_ARGTYPE_LONG, (LONG) pItem->iItem, ! -1); } ! break; case LVN_KEYDOWN: { /* ! * (@)EVENT:KeyDown(KEY, hwndFrom, idFrom, CODE) * Sent when the user presses a key while the ListView * control has focus; KEY is the ASCII code of the *************** *** 278,288 **** --- 306,385 ---- * (@)APPLIES_TO:ListView */ + //FIXME: on ctrl-keys there is a additional param on the stack + LV_KEYDOWN FAR * lv_keydown = (LV_KEYDOWN FAR *) lParam; + NMHDR lv_NMHDR = lv_keydown->hdr; + if (0 && ((LONG) lv_NMHDR.hwndFrom == 16)) { + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_KEYDOWN, "KeyDown", + PERLWIN32GUI_ARGTYPE_LONG, (HWND) lv_NMHDR.hwndFrom, + PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_NMHDR.idFrom, + PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_NMHDR.code, + -1); + } else { PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_KEYDOWN, "KeyDown", PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_keydown->wVKey, + PERLWIN32GUI_ARGTYPE_LONG, (HWND) lv_NMHDR.hwndFrom, + PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_NMHDR.idFrom, + PERLWIN32GUI_ARGTYPE_LONG, (LONG) lv_NMHDR.code, -1); + } } break; // TODO : LVN_HOTTRACK + + case NM_CUSTOMDRAW: + { + SV* obj; + HV* hv; + char class_name[] = "Win32::GUI::ListView::CustomDraw"; + LPPERLWIN32GUI_NMLVCUSTOMDRAW lpLvCD = (LPPERLWIN32GUI_NMLVCUSTOMDRAW) lParam; + obj = CreateNMCustomDraw(NOTXSCALL class_name, lpLvCD); + hv = (HV *)SvRV(obj); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw hv) hv=0x%x, type=%d, flags=%d, magic=%d\n", + hv, SvTYPE(hv), SvFLAGS(hv), SvMAGICAL(hv)); + #endif + hv_store_mg(NOTXSCALL hv, "-clrtext", 8, newSViv(lpLvCD->clrText), 0); + hv_store_mg(NOTXSCALL hv, "-clrtextbk", 10, newSViv(lpLvCD->clrTextBk), 0); + #if (_WIN32_IE >= 0x0400) + hv_store_mg(NOTXSCALL hv, "-subitem", 8, newSViv(lpLvCD->iSubItem), 0); + #endif + #if (_WIN32_IE >= 0x560) + AV* rect = newAV(); + av_push(rect, newSViv(lpLvCD->rcText.left)); + av_push(rect, newSViv(lpLvCD->rcText.top)); + av_push(rect, newSViv(lpLvCD->rcText.right)); + av_push(rect, newSViv(lpLvCD->rcText.bottom)); + hv_store_mg(NOTXSCALL hv, "-itemtype", 9, newSViv(lpLvCD->dwItemType), 0); + hv_store_mg(NOTXSCALL hv, "-clrface", 8, newSViv(lpLvCD->clrFace), 0); + hv_store_mg(NOTXSCALL hv, "-iconeffect",11, newSViv(lpLvCD->iIconEffect), 0); + hv_store_mg(NOTXSCALL hv, "-iconphase", 10, newSViv(lpLvCD->iIconPhase), 0); + hv_store_mg(NOTXSCALL hv, "-partid", 7, newSViv(lpLvCD->iPartId), 0); + hv_store_mg(NOTXSCALL hv, "-stateid", 8, newSViv(lpLvCD->iStateId), 0); + hv_store_mg(NOTXSCALL hv, "-textrect", 9, newRV_inc((SV *)rect), 0); + hv_store_mg(NOTXSCALL hv, "-align", 6, newSVuv(lpLvCD->uAlign), 0); + #endif + #ifdef ENABLE_TIE_CUSTOMDRAW + /* + From perlguts - Understanding the Magic of Tied Hashes and Arrays: + First create a new hash, then create a second + hash which it blesses into the class which will + implement the tie methods. Lastly tie the two hashes + together, and return a reference to the new tied hash. + */ + SV *tie = newRV_noinc((SV*)newHV()); + sv_bless(tie, gv_stashpv(class_name, 0)); + hv_magic(hv, (GV*)tie, PERL_MAGIC_tied); + #endif + PerlResult = DoEvent(NOTXSCALL perlud, PERLWIN32GUI_NEM_PAINT, "CustomDraw", + PERLWIN32GUI_ARGTYPE_SV, obj, + -1); + #ifdef PERLWIN32GUI_STRONGDEBUG + printf("XS(CreateNMCustomDraw %s) => %d\n", class_name, PerlResult); + #endif + perlud->forceResult = PerlResult; + PerlResult = 0; /* MsgLoop return ForceResult */ + } + break; } } *************** *** 297,301 **** #pragma message( "*** PACKAGE Win32::GUI::ListView..." ) - ########################################################################### # (@)METHOD:ApproximateViewRect(cx,cy,icount=-1) --- 394,397 ---- *************** *** 315,322 **** # (@)METHOD:Arrange([FLAG]) # ! # LVA_ALIGNLEFT = Aligns items along the left edge of the window. ! # LVA_ALIGNTOP = Aligns items along the top edge of the window. ! # LVA_DEFAULT = Aligns items according to the ListView's current alignment styles (the default value). ! # LVA_SNAPTOGRID = Snaps all icons to the nearest grid position. int --- 411,418 ---- # (@)METHOD:Arrange([FLAG]) # ! # LVA_ALIGNLEFT = Aligns items along the left edge of the window. ! # LVA_ALIGNTOP = Aligns items along the top edge of the window. ! # LVA_DEFAULT = Aligns items according to the ListView's current alignment styles (the default value). ! # LVA_SNAPTOGRID = Snaps all icons to the nearest grid position. int *************** *** 331,335 **** ########################################################################### # (@)METHOD:CreateDragImage(index, xcor, ycor) ! # Creates a transparent version of an item image. The xcor and yxcor are the # initial location of the upper-left corner of the image. HIMAGELIST --- 427,431 ---- ########################################################################### # (@)METHOD:CreateDragImage(index, xcor, ycor) ! # Creates a transparent version of an item image. The xcor and yxcor are the # initial location of the upper-left corner of the image. HIMAGELIST *************** *** 347,351 **** OUTPUT: RETVAL ! ########################################################################### # (@)METHOD:DeleteAllItems() --- 443,447 ---- OUTPUT: RETVAL ! ########################################################################### # (@)METHOD:DeleteAllItems() *************** *** 410,414 **** OUTPUT: RETVAL ! ########################################################################### # (@)METHOD:FindItem(FROM, %OPTIONS) --- 506,510 ---- OUTPUT: RETVAL ! ########################################################################### # (@)METHOD:FindItem(FROM, %OPTIONS) *************** *** 510,514 **** ########################################################################### # (@)METHOD:GetCheckState(INDEX) ! # Determines if an item in a ListView is selected. BOOL GetCheckState(handle,index) --- 606,610 ---- ########################################################################### # (@)METHOD:GetCheckState(INDEX) ! # Determines if an item in a ListView is selected. BOOL GetCheckState(handle,index) *************** *** 603,607 **** # (@)METHOD:VisibleCount() # (@)METHOD:GetCountPerPage() ! # Calculates the number of items that can fit vertically in the visible area of a ListView when in list or report view. int GetCountPerPage(handle) --- 699,703 ---- # (@)METHOD:VisibleCount() # (@)METHOD:GetCountPerPage() ! # Calculates the number of items that can fit vertically in the visible area of a ListView when in list or report view. int GetCountPerPage(handle) *************** *** 616,620 **** ########################################################################### # (@)METHOD:GetEditControl() ! # Retrieves the handle to the edit control being used to edit a list view item's text. HWND GetEditControl(handle) --- 712,716 ---- ########################################################################### # (@)METHOD:GetEditControl() ! # Retrieves the handle to the edit control being used to edit a list view item's text. HWND GetEditControl(handle) *************** *** 660,664 **** ########################################################################### # (@)METHOD:GetHotItem() ! # Retrieves the index of the hot item. int GetHotItem(handle) --- 756,760 ---- ########################################################################### # (@)METHOD:GetHotItem() ! # Retrieves the index of the hot item. int GetHotItem(handle) *************** *** 683,690 **** # (@)METHOD:GetImageList([TYPE=LVSIL_NORMAL]) # Retrieves the handle to an image list used for drawing list view items. ! # Type : ! # LVSIL_NORMAL Image list with large icons. ! # LVSIL_SMALL Image list with small icons. ! # LVSIL_STATE Image list with state images. HIMAGELIST GetImageList(handle,type=LVSIL_NORMAL) --- 779,786 ---- # (@)METHOD:GetImageList([TYPE=LVSIL_NORMAL]) # Retrieves the handle to an image list used for drawing list view items. ! # Type : ! # LVSIL_NORMAL Image list with large icons. ! # LVSIL_SMALL Image list with small icons. ! # LVSIL_STATE Image list with state images. HIMAGELIST GetImageList(handle,type=LVSIL_NORMAL) *************** *** 698,703 **** ########################################################################### # (@)METHOD:GetISearchString(STRING) ! # Retrieves the incremental search string of a ListView. ! BOOL GetISearchString(handle,lpsz) HWND handle --- 794,799 ---- ########################################################################### # (@)METHOD:GetISearchString(STRING) ! # Retrieves the incremental search string of a ListView. ! BOOL GetISearchString(handle,lpsz) HWND handle *************** *** 866,870 **** ########################################################################### # (@)METHOD:GetNextItem(index,[mask=LVNI_ALL]) ! # Searches for a list view item that has the specified properties and bears the specified relationship to a specified item. UINT GetNextItem(handle,index,mask=LVNI_ALL) --- 962,967 ---- ########################################################################### # (@)METHOD:GetNextItem(index,[mask=LVNI_ALL]) ! # Searches for a list view item that has the specified properties and bears ! # the specified relationship to a specified item. UINT GetNextItem(handle,index,mask=LVNI_ALL) *************** *** 879,883 **** ########################################################################### # (@)METHOD:GetNumberOfWorkAreas() ! # Retrieves the number of working areas in a ListView. UINT GetNumberOfWorkAreas(handle,index,mask=LVNI_ALL) --- 976,980 ---- ########################################################################### # (@)METHOD:GetNumberOfWorkAreas() ! # Retrieves the number of working areas in a ListView. UINT GetNumberOfWorkAreas(handle,index,mask=LVNI_ALL) *************** *** 938,942 **** ########################################################################### # (@)METHOD:GetStringWidth(STRING) ! # Determines the width of a specified string using the specified ListView's current font. int GetStringWidth(handle,string) --- 1035,1040 ---- ########################################################################### # (@)METHOD:GetStringWidth(STRING) ! # Determines the width of a specified string using the specified ListView's ! # current font. int GetStringWidth(handle,string) *************** *** 996,1000 **** ########################################################################### # (@)METHOD:GetToolTips() ! # Retrieves the tooltip control that the ListView uses to display tooltips. HWND GetToolTips(handle) --- 1094,1098 ---- ########################################################################### # (@)METHOD:GetToolTips() ! # Retrieves the tooltip control that the ListView uses to display tooltips. HWND GetToolTips(handle) *************** *** 1012,1016 **** HWND handle ALIAS: ! Win32::GUI::ListView::GetFirstVisible = 1 CODE: RETVAL = ListView_GetTopIndex(handle); --- 1110,1114 ---- HWND handle ALIAS: ! Win32::GUI::ListView::GetFirstVisible = 1 CODE: RETVAL = ListView_GetTopIndex(handle); *************** *** 1020,1024 **** ########################################################################### # (@)METHOD:GetUnicodeFormat() ! # Retrieves the UNICODE character format flag for the control. BOOL GetUnicodeFormat(handle) --- 1118,1122 ---- ########################################################################### # (@)METHOD:GetUnicodeFormat() ! # Retrieves the UNICODE character format flag for the control. BOOL GetUnicodeFormat(handle) *************** *** 1247,1251 **** # B<%OPTIONS> : # -url => STRING ! # URL of the background image. # -tiled => 0/1 # The background image will be tiled to fill the entire background. --- 1345,1349 ---- # B<%OPTIONS> : # -url => STRING ! # URL of the background image. # -tiled => 0/1 # The background image will be tiled to fill the entire background. *************** *** 1290,1294 **** OUTPUT: RETVAL ! ########################################################################### # (@)METHOD:SetCallbackMask(MASK) --- 1388,1392 ---- OUTPUT: RETVAL ! ########################################################################### # (@)METHOD:SetCallbackMask(MASK) *************** *** 1306,1310 **** # (@)METHOD:SetColumn(COLUMN, %OPTIONS) # Change column option in a ListView. ! # # B<%OPTIONS> : See InsertColumn() int --- 1404,1408 ---- # (@)METHOD:SetColumn(COLUMN, %OPTIONS) # Change column option in a ListView. ! # # B<%OPTIONS> : See InsertColumn() int *************** *** 1356,1360 **** ########################################################################### # (@)METHOD:SetExtendedListViewStyle(EXSTYLE) ! # Sets extended styles for ListViews. void SetExtendedListViewStyle(handle,exstyle) --- 1454,1458 ---- ########################################################################### # (@)METHOD:SetExtendedListViewStyle(EXSTYLE) ! # Sets extended styles for ListViews. void SetExtendedListViewStyle(handle,exstyle) *************** *** 1413,1417 **** ########################################################################### # (@)METHOD:SetIconSpacing(X,Y) ! # Sets the spacing between icons in ListView set to the LVS_ICON style. DWORD SetIconSpacing(handle,x,y) --- 1511,1515 ---- ########################################################################### # (@)METHOD:SetIconSpacing(X,Y) ! # Sets the spacing between icons in ListView set to the LVS_ICON style. DWORD SetIconSpacing(handle,x,y) *************** *** 1428,1432 **** # Assigns an image list to a ListView. # ! #Type of image list. This parameter can be one of the following values: # # LVSIL_NORMAL (0) Image list with large icons. --- 1526,1530 ---- # Assigns an image list to a ListView. # ! #Type of image list. This parameter can be one of the following values: # # LVSIL_NORMAL (0) Image list with large icons. *************** *** 1515,1519 **** # (@)METHOD:SetItemPosition(INDEX, X, Y) # (@)METHOD:MoveItem(INDEX, X, Y) ! # Moves an item to a specified position in a ListView (in icon or small icon view). # X,Y are in listview co-ordinates. void --- 1613,1617 ---- # (@)METHOD:SetItemPosition(INDEX, X, Y) # (@)METHOD:MoveItem(INDEX, X, Y) ! # Moves an item to a specified position in a ListView (in icon or small icon view). # X,Y are in listview co-ordinates. void *************** *** 1536,1540 **** UINT index UINT state ! UINT mask CODE: ListView_SetItemState(handle, index, state, mask); --- 1634,1638 ---- UINT index UINT state ! UINT mask CODE: ListView_SetItemState(handle, index, state, mask); *************** *** 1548,1552 **** UINT index LPTSTR texte ! UINT subitem CODE: ListView_SetItemText(handle, index, subitem, texte); --- 1646,1650 ---- UINT index LPTSTR texte ! UINT subitem CODE: ListView_SetItemText(handle, index, subitem, texte); *************** *** 1554,1558 **** ########################################################################### # (@)METHOD:SetSelectionMark(index) ! # Sets the selection mark in a ListView. int SetSelectionMark(handle,index) --- 1652,1656 ---- ########################################################################### # (@)METHOD:SetSelectionMark(index) ! # Sets the selection mark in a ListView. int SetSelectionMark(handle,index) *************** *** 1566,1570 **** ########################################################################### # (@)METHOD:SetTextBkColor(COLOR) ! # Sets the background color of text in a ListView. BOOL SetTextBkColor(handle,color) --- 1664,1668 ---- ########################################################################### # (@)METHOD:SetTextBkColor(COLOR) ! # Sets the background color of text in a ListView. BOOL SetTextBkColor(handle,color) *************** *** 1578,1582 **** ########################################################################### # (@)METHOD:SetTextColor(COLOR) ! # Sets the text color of a ListView. BOOL SetTextColor(handle,color) --- 1676,1680 ---- ########################################################################### # (@)METHOD:SetTextColor(COLOR) ! # Sets the text color of a ListView. BOOL SetTextColor(handle,color) *************** *** 1590,1594 **** ########################################################################### # (@)METHOD:SetToolTips(TOOLTIP) ! # Sets the tooltip control that the ListView will use to display tooltips. HWND SetToolTips(handle,tooltip) --- 1688,1692 ---- ########################################################################### # (@)METHOD:SetToolTips(TOOLTIP) ! # Sets the tooltip control that the ListView will use to display tooltips. HWND SetToolTips(handle,tooltip) *************** *** 1606,1610 **** ########################################################################### # (@)METHOD:SetUnicodeFormat(FLAG) ! # Sets the UNICODE character format flag for the control. BOOL SetUnicodeFormat(handle,flag) --- 1704,1708 ---- ########################################################################### # (@)METHOD:SetUnicodeFormat(FLAG) ! # Sets the UNICODE character format flag for the control. BOOL SetUnicodeFormat(handle,flag) *************** *** 1645,1649 **** ht.pt.x = x; ht.pt.y = y; ! if (ListView_SubItemHitTest(handle, &ht) != -1) { EXTEND(SP, 3); XST_mIV(0, (long) ht.iItem); --- 1743,1747 ---- ht.pt.x = x; ht.pt.y = y; ! if (ListView_SubItemHitTest(handle, &ht) != -1) { EXTEND(SP, 3); XST_mIV(0, (long) ht.iItem); *************** *** 1651,1656 **** XST_mIV(2, ht.flags); XSRETURN(3); ! } ! else XSRETURN_UNDEF; --- 1749,1754 ---- XST_mIV(2, ht.flags); XSRETURN(3); ! } ! else XSRETURN_UNDEF; *************** *** 1997,1998 **** --- 2095,2236 ---- } + + MODULE = Win32::GUI::ListView PACKAGE = Win32::GUI::ListView::CustomDraw + + PROTOTYPES: DISABLE + + ########################################################################### + # (@)PACKAGE:Win32::GUI::ListView::CustomDraw + + #pragma message( "*** PACKAGE Win32::GUI::ListView::CustomDraw..." ) + + ########################################################################### + # (@)METHOD:TextColor([COLOR]) + # Set or Get the CustomDraw -clrtext property. + # COLOR may be either a numerical value, + # or a color expressed as [RR, GG, BB], + # or a color expressed in HTML notation (#RRGGBB) + SV * + TextColor(handle,color=FALSE) + HWND handle + COLORREF color + PREINIT: + HV* hv = (HV*)SvRV(ST(0)); + CODE: + LPPERLWIN32GUI_NMLVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMLVCUSTOMDRAW) handle; + if (items == 2) { + RETVAL = newSViv(color); + if(SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-clrtext", 8, RETVAL, 0); + lpCD->clrText = color; + } else { + RETVAL = newSViv(lpCD->clrText); + } + OUTPUT: + RETVAL + + ########################################################################### + # (@)METHOD:BackColor([COLOR]) + # Set or Get the CustomDraw -clrtextbk property. + # COLOR may be either a numerical value, + # or a color expressed as [RR, GG, BB], + # or a color expressed in HTML notation (#RRGGBB) + SV * + BackColor(handle,color=FALSE) + HWND handle + COLORREF color + PREINIT: + HV* hv = (HV*)SvRV(ST(0)); + CODE: + LPPERLWIN32GUI_NMLVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMLVCUSTOMDRAW) handle; + if (items == 2) { + RETVAL = newSViv(color); + if(SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-clrtextbk", 10, RETVAL, 0); + lpCD->clrTextBk = color; + } else { + RETVAL = newSViv(lpCD->clrTextBk); + } + OUTPUT: + RETVAL + + ########################################################################### + # (@)METHOD:FaceColor( [COLOR] ) + # Set or Get the CustomDraw -clrface property. + # COLOR may be either a numerical value, + # or a color expressed as [RR, GG, BB], + # or a color expressed in HTML notation (#RRGGBB) + SV * + FaceColor(handle,color=FALSE) + HWND handle + COLORREF color + PREINIT: + HV* hv = (HV*)SvRV(ST(0)); + CODE: + #if (_WIN32_IE >= 0x560) + LPPERLWIN32GUI_NMLVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMLVCUSTOMDRAW) handle; + if (items == 2) { + RETVAL = newSViv(color); + if(SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-clrface", 8, RETVAL, 0); + lpCD->clrFace = color; + } else { + RETVAL = newSViv(lpCD->clrFace); + } + #else + MessageBox(NULL, "Unsupported member -clrface. Requires Comctl32.dll version 6.\r\nComctl32.dll version 6 is not redistributable but it is included in Microsoft Windows XP or later", + "Win32::GUI::ListView::CustomDraw", + MB_ICONERROR | MB_OKCANCEL); + RETVAL = &PL_sv_undef; + #endif + OUTPUT: + RETVAL + + ########################################################################### + # (@)METHOD:TextRect( [LEFT,TOP,RIGHT,BOTTOM] ) => [ LEFT,TOP,RIGHT,BOTTOM ] + # Get or set the CustomDraw -textrect property. + # Comctl32.dll Version 6.0. + SV * + TextRect(handle,rect=FALSE) + HWND handle + SV *rect + PREINIT: + #if (_WIN32_IE >= 0x560) + SV **tempsv; + HV* hv = (HV*)SvRV(ST(0)); + #endif + CODE: + #if (_WIN32_IE >= 0x560) + LPPERLWIN32GUI_NMLVCUSTOMDRAW lpCD = (LPPERLWIN32GUI_NMLVCUSTOMDRAW) handle; + if (items > 1) { + if (SvROK(ST(1))) + AV *array = SvRV(ST(1)); + else + XSRETURN_UNDEF; + + if ((tempsv = av_fetch(array, 0)) && SvIOK(*tempsv)) + lpCD->rcText.left = SvIV(*tempsv); + if ((tempsv = av_fetch(array, 1)) && SvIOK(*tempsv)) + lpCD->rcText.top = SvIV(*tempsv); + if ((tempsv = av_fetch(array, 2)) && SvIOK(*tempsv)) + lpCD->rcText.right = SvIV(*tempsv); + if ((tempsv = av_fetch(array, 3)) && SvIOK(*tempsv)) + lpCD->rcText.bottom = SvIV(*tempsv); + if (SvROK(ST(0))) + hv_store_mg(NOTXSCALL hv, "-textrect", 9, newRV_inc(SvRV(ST(1))), 0); + } else { + AV* rect = newAV(); + av_push(rect, newSViv(lpCD->rcText.left)); + av_push(rect, newSViv(lpCD->rcText.top)); + av_push(rect, newSViv(lpCD->rcText.right)); + av_push(rect, newSViv(lpCD->rcText.bottom)); + RETVAL = newRV((SV *)rect), 0); + } + #else + MessageBox(NULL, "Unsupported member -textrect. Requires Comctl32.dll version 6.\r\nComctl32.dll version 6 is not redistributable but it is included in Microsoft Windows XP or later", + "Win32::GUI::ListView::CustomDraw", + MB_ICONERROR | MB_OKCANCEL); + RETVAL = &PL_sv_undef; + #endif + OUTPUT: + RETVAL