home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / patches / LDropFlag.patch < prev    next >
Encoding:
Text File  |  1998-04-08  |  4.9 KB  |  176 lines

  1. *** Develop:Source331 Build Environment:CW Pro 2:Metrowerks CodeWarrior:MacOS Support:PowerPlant:_In Progress:_Table Classes:LDropFlag.cp    Mon Mar 16 17:12:01 1998
  2. --- Source:LDropFlag.cp    Mon Mar 16 17:12:07 1998
  3. ***************
  4. *** 1,6 ****
  5. --- 1,7 ----
  6.   // ===========================================================================
  7.   //    LDropFlag.cp               ⌐1995-1996 Metrowerks Inc. All rights reserved.
  8.   // ===========================================================================
  9. + //ÑÑÑNETSCAPE - draw over bg colors other than white (ie, preserve bg color)
  10.   //
  11.   //    Draws and tracks clicks for a drop flag.
  12.   
  13. ***************
  14. *** 9,20 ****
  15. --- 10,26 ----
  16.   #endif
  17.   
  18.   #include <LDropFlag.h>
  19. + #include <UGWorld.h>
  20.   
  21.   #ifndef __ICONS__
  22.   #include <Icons.h>
  23.   #endif
  24.   
  25.   
  26. + //ÑÑÑNETSCAPE
  27. + static void PlotIconOffscreen ( const Rect & inRect, ResIDT inIconID ) ;
  28.   //    Icon family resource ID's for the states of the drop flag
  29.   //    The size of the rectangle you pass to Draw and TrackClick determine
  30.   //    which icon size gets used.
  31. ***************
  32. *** 47,53 ****
  33.           iconID = icon_Down;
  34.       }
  35.   
  36. !     ::PlotIconID(&inRect, atNone, ttNone, iconID);
  37.   }
  38.   
  39.   
  40. --- 53,60 ----
  41.           iconID = icon_Down;
  42.       }
  43.   
  44. ! //ÑÑÑNETSCAPE - call PlotIconOffscreen() instead of PlotIconID()
  45. !     PlotIconOffscreen ( inRect, iconID );    
  46.   }
  47.   
  48.   
  49. ***************
  50. *** 64,70 ****
  51.   //    inIsUp specifies if the flag was up or down when the click started
  52.   //
  53.   //    Returns whether the mouse was release inside the DropFlag.
  54.   Boolean
  55.   LDropFlag::TrackClick(
  56.       const Rect    &inRect,
  57. --- 71,78 ----
  58.   //    inIsUp specifies if the flag was up or down when the click started
  59.   //
  60.   //    Returns whether the mouse was release inside the DropFlag.
  61. ! //
  62. ! //ÑÑÑNETSCAPE - call PlotIconOffscreen() instead of PlotIconID()
  63.   Boolean
  64.   LDropFlag::TrackClick(
  65.       const Rect    &inRect,
  66. ***************
  67. *** 87,93 ****
  68.                                       // when it was previously outside
  69.       Boolean        currInside = true;
  70.       Boolean        prevInside = false;
  71. !     ::PlotIconID(&inRect, atNone, ttNone, iconID + 1);
  72.       
  73.                                       // Track the mouse while it is down
  74.       Point    currPt = inMouse;
  75. --- 95,101 ----
  76.                                       // when it was previously outside
  77.       Boolean        currInside = true;
  78.       Boolean        prevInside = false;
  79. !     PlotIconOffscreen(inRect, iconID + 1);
  80.       
  81.                                       // Track the mouse while it is down
  82.       Point    currPt = inMouse;
  83. ***************
  84. *** 101,107 ****
  85.               if (currInside) {
  86.                   trackIconID = iconID + 1;
  87.               }
  88. !             ::PlotIconID(&inRect, atNone, ttNone, trackIconID);
  89.           }
  90.       }
  91.       
  92. --- 109,115 ----
  93.               if (currInside) {
  94.                   trackIconID = iconID + 1;
  95.               }
  96. !             PlotIconOffscreen(inRect, trackIconID);
  97.           }
  98.       }
  99.       
  100. ***************
  101. *** 116,122 ****
  102.       if (goodClick) {
  103.           UInt32    ticks;                // Draw intermediate state
  104.           ::Delay(delay_Animation, &ticks);
  105. !         ::PlotIconID(&inRect, atNone, ttNone, icon_Side);
  106.           ::Delay(delay_Animation, &ticks);
  107.           
  108.                                       // Draw dark end state
  109. --- 124,130 ----
  110.       if (goodClick) {
  111.           UInt32    ticks;                // Draw intermediate state
  112.           ::Delay(delay_Animation, &ticks);
  113. !         PlotIconOffscreen(inRect, icon_Side);
  114.           ::Delay(delay_Animation, &ticks);
  115.           
  116.                                       // Draw dark end state
  117. ***************
  118. *** 124,137 ****
  119.           if (inIsDown) {
  120.               endIconID = icon_Up + 1;
  121.           }
  122. !         ::PlotIconID(&inRect, atNone, ttNone, endIconID);
  123.           ::Delay(delay_Animation, &ticks);
  124.                                       // Draw normal end state
  125. !         ::PlotIconID(&inRect, atNone, ttNone, endIconID - 1);
  126.           
  127.       } else {                        // Draw original state
  128. !         ::PlotIconID(&inRect, atNone, ttNone, iconID);
  129.       }
  130.           
  131.       return goodClick;
  132.   }
  133. --- 132,170 ----
  134.           if (inIsDown) {
  135.               endIconID = icon_Up + 1;
  136.           }
  137. !         PlotIconOffscreen(inRect, endIconID);
  138.           ::Delay(delay_Animation, &ticks);
  139.                                       // Draw normal end state
  140. !         PlotIconOffscreen(inRect, endIconID - 1);
  141.           
  142.       } else {                        // Draw original state
  143. !         PlotIconOffscreen(inRect, iconID);
  144.       }
  145.           
  146.       return goodClick;
  147. + }
  148. + //ÑÑÑ NETSCAPE
  149. + // this code is mainly from LGADisclosureTriangle.cp
  150. + static void PlotIconOffscreen ( const Rect & inRect, ResIDT inIconID )
  151. + {
  152. +     // Ñ In order to make the transitions between the various states
  153. +     // smoother we are going to attempt to figure out what the background
  154. +     // color is behind the triangle, by using the current clipping region
  155. +     // we will subzequently use this color to wipe the background
  156. +     Rect destRect;
  157. +     RgnHandle currClip = ::NewRgn ();
  158. +     ::GetClip ( currClip );
  159. +     Rect clipRect = (**currClip).rgnBBox;
  160. +     ::DisposeRgn ( currClip );
  161. +     ::SectRect ( &inRect, &clipRect, &destRect );
  162. +     RGBColor backColor; 
  163. +     ::GetCPixel ( destRect.right - 1, destRect.top, &backColor );
  164. +     StOffscreenGWorld world(inRect);
  165. +     ::RGBBackColor ( &backColor );
  166. +     ::EraseRect ( &inRect );
  167. +     ::PlotIconID(&inRect, atNone, ttNone, inIconID);
  168.   }
  169.