Update of /cvsroot/perl-win32-gui/Win32-GUI
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30502

Modified Files:
        GUI_Options.cpp 
Log Message:
Rework Tooltip Class

Index: GUI_Options.cpp
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Options.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** GUI_Options.cpp     23 Jun 2006 18:35:33 -0000      1.15
--- GUI_Options.cpp     3 Aug 2006 22:20:19 -0000       1.16
***************
*** 740,743 ****
--- 740,745 ----
      char * option;
  
+       ti->uFlags |= TTF_IDISHWND;
+       ti->uFlags |= TTF_SUBCLASS;
      next_i = -1;
      for(i = from_i; i < items; i++) {
***************
*** 746,750 ****
              if(strcmp(option, "-text") == 0) {
                  next_i = i + 1;
!                 ti->lpszText = SvPV_nolen(ST(next_i));
              } else if(strcmp(option, "-needtext") == 0) {
                  next_i = i + 1;
--- 748,755 ----
              if(strcmp(option, "-text") == 0) {
                  next_i = i + 1;
!                 if(SvPOK(ST(next_i))) 
!                     ti->lpszText = SvPV_nolen(ST(next_i));
!                 else if (SvIOK(ST(next_i)))
!                     ti->lpszText = MAKEINTRESOURCE((WORD)SvIV(ST(next_i)));
              } else if(strcmp(option, "-needtext") == 0) {
                  next_i = i + 1;
***************
*** 752,757 ****
              } else if(strcmp(option, "-window") == 0) {
                  next_i = i + 1;
!                 ti->uId = (UINT) handle_From(NOTXSCALL ST(next_i));
!                 ti->uFlags |= TTF_IDISHWND;
              } else if(strcmp(option, "-id") == 0) {
                  next_i = i + 1;
--- 757,761 ----
              } else if(strcmp(option, "-window") == 0) {
                  next_i = i + 1;
!                 ti->hwnd  = (HWND) handle_From(NOTXSCALL ST(next_i));
              } else if(strcmp(option, "-id") == 0) {
                  next_i = i + 1;
***************
*** 782,785 ****
--- 786,790 ----
                  next_i = i + 1;
                  SwitchBit(ti->uFlags, TTF_TRACK , SvIV(ST(next_i)));
+                 ti->uFlags &= ~TTF_SUBCLASS;
              } else if(strcmp(option, "-transparent") == 0) {
                  next_i = i + 1;
***************
*** 803,806 ****
--- 808,834 ----
          }
      }
+ 
+       if( ti->uFlags & TTF_IDISHWND) {
+               ti->uId = (UINT)ti->hwnd;  /* TODO: can hwnd be NULL? */
+       } else {
+               /* if rect not supplied, use hwnd co-ordinates */
+               if(ti->rect.left == 0 && ti->rect.right == 0 && ti->rect.top == 
0 && ti->rect.bottom == 0) {
+                       GetWindowRect(ti->hwnd, &(ti->rect));
+               }
+       }
+ 
+     /* If we're not a top level window, then we
+      * need our container flag set in order to process
+      * WM_NOTIFY messages correctly (see CustomMsgLoop)
+      * Needed for NeedText, Pop and Show events
+      */
+     HWND parent = GetAncestor(ti->hwnd, GA_PARENT);
+     if(parent) {
+         LPPERLWIN32GUI_USERDATA ud;
+         ud = (LPPERLWIN32GUI_USERDATA) GetWindowLong(ti->hwnd, GWL_USERDATA);
+         if( ValidUserData(ud) ) {
+                 ud->dwPlStyle |= PERLWIN32GUI_CONTAINER;
+         }
+     }
  }
  


Reply via email to