/[dotgnu-pnet]/pnetlib/System.Windows.Forms/Themes/DefaultThemePainter.cs
ViewVC logotype

Diff of /pnetlib/System.Windows.Forms/Themes/DefaultThemePainter.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by drobosson, Sat Aug 13 03:20:13 2005 UTC revision 1.37 by drobosson, Fri Nov 11 10:24:13 2005 UTC
# Line 1896  public class DefaultThemePainter : IThem Line 1896  public class DefaultThemePainter : IThem
1896                                             state,                                             state,
1897                                             foreColor, backColor,                                             foreColor, backColor,
1898                                             false);                                             false);
1899    #if false
1900                                  // Get the drawing color and adjust for the pressed state.                                  // Get the drawing color and adjust for the pressed state.
1901                                  Color color;                                  Color color;
1902                                  Color inactiveColor = ControlPaint.LightLight(backColor);                                  Color inactiveColor = ControlPaint.LightLight(backColor);
# Line 1926  public class DefaultThemePainter : IThem Line 1926  public class DefaultThemePainter : IThem
1926                                          {                                          {
1927                                                  case ScrollButton.Up:                                                  case ScrollButton.Up:
1928                                                  {                                                  {
                                                         if(width<=20) // if there is not enough space we only draw a point  
                                                         {  
                                                                 DrawGlyph(graphics, x + 1, y + 1, width - 3, height,  
                                                                         Glyphs.up_arrow_bits,  
                                                                         Glyphs.up_arrow_width / 2,  
                                                                         Glyphs.up_arrow_height / 2, inactiveColor);  
                                                   
                                                         }  
   
                                                         else  
                                                         {  
1929                                                                                                    
1930                                                                  DrawGlyph(graphics, x + 1, y + 1, width, height,                                                                  DrawGlyph(graphics, x + 1, y + 1, width, height,
1931                                                                            Glyphs.up_arrow_bits,                                                                            Glyphs.up_arrow_bits,
1932                                                                            Glyphs.up_arrow_width,                                                                            Glyphs.up_arrow_width,
1933                                                                            Glyphs.up_arrow_height, inactiveColor);                                                                            Glyphs.up_arrow_height, inactiveColor);
1934                                                          }  
1935                                                  }                                                  }
1936                                                  break;                                                  break;
1937                    
1938                                                  case ScrollButton.Down:                                                  case ScrollButton.Down:
1939                                                  {                                                  {
                                                         if(width<=20)  // if there is not enough space we only draw a point  
                                                         {  
                                                                 DrawGlyph(graphics, x + 1, y + 1, width - 3, height,  
                                                                           Glyphs.up_arrow_bits,  
                                                                           Glyphs.up_arrow_width / 2,  
                                                                           Glyphs.up_arrow_height / 2, inactiveColor);  
                                                   
                                                         }  
   
                                                         else  
                                                         {  
1940                                                                                                    
1941                                                                  DrawGlyph(graphics, x + 1, y + 1, width, height,                                                                  DrawGlyph(graphics, x + 1, y + 1, width, height,
1942                                                                            Glyphs.down_arrow_bits,                                                                            Glyphs.down_arrow_bits,
# Line 1966  public class DefaultThemePainter : IThem Line 1944  public class DefaultThemePainter : IThem
1944                                                                            Glyphs.down_arrow_height, inactiveColor);                                                                            Glyphs.down_arrow_height, inactiveColor);
1945                                                                                                    
1946                                                          }                                                          }
                                                 }  
1947                                                  break;                                                  break;
1948                                                                                                    
1949                                                  case ScrollButton.Left:                                                  case ScrollButton.Left:
# Line 1994  public class DefaultThemePainter : IThem Line 1971  public class DefaultThemePainter : IThem
1971                                  {                                  {
1972                                          case ScrollButton.Up:                                          case ScrollButton.Up:
1973                                          {                                                {      
                                                 if(width<=20)  // if there is not enough space we draw a point  
                                                 {  
                                                         DrawGlyph(graphics, x, y, width - 3, height,  
                                                                   Glyphs.up_arrow_bits,  
                                                                   Glyphs.up_arrow_width / 2,  
                                                                   Glyphs.up_arrow_height / 2, color);  
1974                                                                                                    
                                                 }  
   
                                                 else  
                                                 {  
1975                                                          DrawGlyph(graphics, x, y, width, height,                                                          DrawGlyph(graphics, x, y, width, height,
1976                                                                    Glyphs.up_arrow_bits,                                                                    Glyphs.up_arrow_bits,
1977                                                                    Glyphs.up_arrow_width,                                                                    Glyphs.up_arrow_width,
1978                                                                    Glyphs.up_arrow_height, color);                                                                    Glyphs.up_arrow_height, color);
                                                 }  
1979                                                                                                    
1980                                          }                                          }
1981                                          break;                                          break;
1982                                                                                    
1983                                          case ScrollButton.Down:                                          case ScrollButton.Down:
1984                                          {                                                {      
                                                 if(width<=20) // if there is not enough space we draw a point  
                                                 {  
                                                         DrawGlyph(graphics, x, y, width - 3, height,  
                                                                   Glyphs.up_arrow_bits,  
                                                                   Glyphs.up_arrow_width / 2,  
                                                                   Glyphs.up_arrow_height / 2, color);  
1985                                                                                                    
                                                 }  
                                                 else  
                                                 {  
1986                                                          DrawGlyph(graphics, x, y, width, height,                                                          DrawGlyph(graphics, x, y, width, height,
1987                                                                    Glyphs.down_arrow_bits,                                                                    Glyphs.down_arrow_bits,
1988                                                                    Glyphs.down_arrow_width,                                                                    Glyphs.down_arrow_width,
1989                                                                    Glyphs.down_arrow_height, color);                                                                    Glyphs.down_arrow_height, color);
1990                                                  }  
1991                                          }                                          }
1992                                          break;                                          break;
1993    
# Line 2056  public class DefaultThemePainter : IThem Line 2013  public class DefaultThemePainter : IThem
2013                                          }                                          }
2014                                          break;                                          break;
2015                                  }                                  }
2016    #endif
2017    
2018  #if false       // May need later for non-standard glyph sizes.                                  // Set non-standard glyph sizes.
2019                                    // The glyphs are resizable using the space left for the increment and decrement buttons.
2020                                  x += 2; // skip border                                  x += 2; // skip border
2021                                  y += 2; // skip border                                  y += 2; // skip border
2022                                  width -= 4; // skip border                                  width -= 4; // skip border
# Line 2077  public class DefaultThemePainter : IThem Line 2036  public class DefaultThemePainter : IThem
2036                                          y -= 1;                                          y -= 1;
2037                                  }                                  }
2038    
2039                                  // setup the glyph shape                                  int glyphWidth = 3; // Glyph width size
2040                                  int glyphWidth = 3;                                  int glyphHeight = 3; // Glyph height size
2041                                  int glyphHeight = 3;                                  switch (button)
2042                                  if (button == ScrollButton.Up || button == ScrollButton.Down)                                  {
2043                                            case ScrollButton.Up:
2044                                  {                                  {
2045                                          glyphWidth *= 2;                                                  if (height<1)  // Same but for height (UP and DOWN buttons)
2046                                                    {
2047                                                            glyphWidth = 0;
2048                                                            glyphHeight = 0;                                    
2049                                  }                                  }
2050                                  else                                                  else if (height<=4) // if the glyph is small we draw a single point
2051                                                    {
2052                                                            glyphWidth = 0;
2053                                                            glyphHeight = 1;
2054                                                    }
2055                                                    else if (height<=12) // We resize the glyph picture using its logical size.
2056                                                    {
2057                                                            glyphWidth = (int)(3.0*((double)height/12.0));
2058                                                            glyphHeight = (int)(3.0*((double)height/12.0));
2059                                                    }
2060                                            }
2061                                            break;  
2062    
2063    
2064                                            case ScrollButton.Down:
2065                                            {
2066                                                    if (height<1)  // Same but for height (UP and DOWN buttons)
2067                                                    {
2068                                                            glyphWidth = 0;
2069                                                            glyphHeight = 0;                                    
2070                                                    }
2071                                                    else if (height<=4) // if the glyph is small we draw a single point
2072                                                    {
2073                                                            glyphWidth = 0;
2074                                                            glyphHeight = 1;
2075                                                    }
2076                                                    else if (height<=12) // We resize the glysh picture using its logical size.
2077                                  {                                  {
2078                                          glyphHeight *= 2;                                                          glyphWidth = (int)(3.0*((double)height/12.0));
2079                                                            glyphHeight = (int)(3.0*((double)height/12.0));
2080                                    }
2081                                            }
2082                                            break;  
2083                                            
2084                                            case ScrollButton.Right:
2085                                            {
2086                                                    if (width<1) // If the glyph width is too small we don't draw it (LEFT and RIGHT buttons)
2087                                                    {
2088                                                            glyphWidth = 0;
2089                                                            glyphHeight = 0;
2090                                                    }
2091                                                    else if (width<=4) // if the glyph is small we draw a single point
2092                                                    {
2093                                                            glyphWidth = 1;
2094                                                            glyphHeight = 0;
2095                                                    }
2096                                                    else if (width<=12) // We resize the glysh picture using its logical size.
2097                                                    {
2098                                                            glyphWidth = (int)(3.0*((double)width/12.0));
2099                                                            glyphHeight = (int)(3.0*((double)width/12.0));
2100                                                    }
2101                                            }
2102                                            break;
2103    
2104    
2105                                            case ScrollButton.Left:
2106                                            {
2107                                                    if (width<1) // If the glyph width is too small we don't draw it (LEFT and RIGHT buttons)
2108                                                    {
2109                                                            glyphWidth = 0;
2110                                                            glyphHeight = 0;
2111                                                    }
2112                                                    else if (width<=4) // if the glyph is small we draw a single point
2113                                                    {
2114                                                            glyphWidth = 1;
2115                                                            glyphHeight = 0;
2116                                                    }
2117                                                    else if (width<=12) // We resize the glyph using its logical size.
2118                                                    {
2119                                                            glyphWidth = (int)(3.0*((double)width/12.0));
2120                                                            glyphHeight = (int)(3.0*((double)width/12.0));
2121                                                    }
2122                                            }
2123                                            break;
2124    
2125                                            default:
2126                                            {
2127                                                    throw new ArgumentException("Invalid scroll button");
2128                                            }
2129                                  }                                  }
2130    
2131    
2132                                    
2133    
2134                                            
2135    
2136                                    
2137                                    // setup the glyph shape
2138    
2139                                  Point[] glyph = new Point[3];                                  Point[] glyph = new Point[3];
2140                                  int offsetX = x+((width-glyphWidth)/2);                                  int offsetX;
2141                                  int offsetY = y+((height-glyphHeight)/2);                                  int offsetY;
2142    
2143                                  switch (button)                                  switch (button)
2144                                  {                                  {
2145                                          case ScrollButton.Up:                                          case ScrollButton.Up:
2146                                          {                                          {
2147                                                  glyph[0] = new Point(offsetX+3,                                                  offsetX = x+width/2-glyphWidth;
2148                                                    offsetY = y+(height+1)/2;
2149    
2150                                                    glyph[0] = new Point(offsetX,
2151                                                                       offsetY);                                                                       offsetY);
2152                                                  glyph[1] = new Point(offsetX+6,                                                  glyph[1] = new Point(offsetX+glyphWidth*2,
2153                                                                       offsetY+3);                                                                       offsetY);
2154                                                  glyph[2] = new Point(offsetX,                                                  glyph[2] = new Point(offsetX+glyphWidth,
2155                                                                       offsetY+3);                                                                       offsetY-glyphHeight);
2156                                          }                                          }
2157                                          break;                                          break;
2158    
2159                                          case ScrollButton.Down:                                          case ScrollButton.Down:
2160                                          {                                          {
2161                                                    offsetX = x+width/2-glyphWidth;
2162                                                    offsetY = y+(height+1)/2-glyphHeight/2;
2163    
2164                                                  glyph[0] = new Point(offsetX,                                                  glyph[0] = new Point(offsetX,
2165                                                                       offsetY);                                                                       offsetY);
2166                                                  glyph[1] = new Point(offsetX+6,                                                  glyph[1] = new Point(offsetX+glyphWidth*2,
2167                                                                       offsetY);                                                                       offsetY);
2168                                                  glyph[2] = new Point(offsetX+3,                                                  glyph[2] = new Point(offsetX+glyphWidth,
2169                                                                       offsetY+3);                                                                       offsetY+glyphHeight);
2170                                          }                                          }
2171                                          break;                                          break;
2172    
2173                                          case ScrollButton.Left:                                          case ScrollButton.Left:
2174                                          {                                          {
2175                                                  glyph[0] = new Point(offsetX,  
2176                                                                       offsetY+3);                                                  offsetX = x+(width+1)/2-glyphWidth/2;
2177                                                  glyph[1] = new Point(offsetX+3,  
2178                                                    offsetY = y+((height-glyphHeight*2)/2);
2179    
2180                                                    glyph[0] = new Point(offsetX+glyphWidth,
2181                                                                       offsetY);                                                                       offsetY);
2182                                                  glyph[2] = new Point(offsetX+3,                                                  glyph[1] = new Point(offsetX+glyphWidth,
2183                                                                       offsetY+6);                                                                       offsetY+glyphHeight*2);
2184                                                    glyph[2] = new Point(offsetX,
2185                                                                         offsetY+glyphHeight);
2186                                          }                                          }
2187                                          break;                                          break;
2188    
2189                                          case ScrollButton.Right:                                          case ScrollButton.Right:
2190                                          {                                          {
2191                                                    offsetX = x+(width+1)/2;
2192                                                    offsetY = y+((height-glyphHeight*2)/2);
2193                                                  glyph[0] = new Point(offsetX,                                                  glyph[0] = new Point(offsetX,
2194                                                                       offsetY);                                                                       offsetY);
2195                                                  glyph[1] = new Point(offsetX,                                                  glyph[1] = new Point(offsetX,
2196                                                                       offsetY+6);                                                                       offsetY+glyphHeight*2);
2197                                                  glyph[2] = new Point(offsetX+3,                                                  glyph[2] = new Point(offsetX+glyphWidth,
2198                                                                       offsetY+3);                                                                       offsetY+glyphHeight);
2199                                          }                                          }
2200                                          break;                                          break;
2201    
2202                                          default:                                          default:
2203                                          {                                          {
2204                                                  throw new ArgumentException("button");                                                  throw new ArgumentException("Invalid scroll button");
2205                                          }                                          }
2206                                  }                                  }
2207                                                                    
# Line 2157  public class DefaultThemePainter : IThem Line 2219  public class DefaultThemePainter : IThem
2219                                  {                                  {
2220                                          graphics.DrawPolygon(pen,glyph);                                          graphics.DrawPolygon(pen,glyph);
2221                                  }                                  }
2222  #endif  
2223    
2224                          }                          }
2225    
2226          // Draw a selection frame.          // Draw a selection frame.

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26